From 88fc277ab15cec86fd9a0fab7390219810e8e855 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 15 Jan 2018 07:34:07 +1100 Subject: [PATCH] Switch from using XWarpPointer with relative child coords, to XWarpPointer with absolute coords on linux. --- OpenTK/Platform/X11/X11GLNative.cs | 5 +---- src/Client/Block.c | 1 + src/Client/Block.h | 5 +---- src/Client/Physics.c | 1 + src/Client/String.h | 1 - src/Client/Widgets.c | 26 +++++++++++++++++++++++++- src/Client/Widgets.h | 15 +++++++++++++++ 7 files changed, 44 insertions(+), 10 deletions(-) diff --git a/OpenTK/Platform/X11/X11GLNative.cs b/OpenTK/Platform/X11/X11GLNative.cs index 49a0d4be5..e6c9f781a 100644 --- a/OpenTK/Platform/X11/X11GLNative.cs +++ b/OpenTK/Platform/X11/X11GLNative.cs @@ -657,10 +657,7 @@ namespace OpenTK.Platform.X11 { return new Point( rootX, rootY ); } set { - IntPtr root, child; - int rootX, rootY, childX, childY, mask; - API.XQueryPointer( window.Display, window.RootWindow, out root, out child, out rootX, out rootY, out childX, out childY, out mask ); - API.XWarpPointer( window.Display, IntPtr.Zero, IntPtr.Zero, 0, 0, 0, 0, value.X - rootX, value.Y - rootY ); + API.XWarpPointer( window.Display, IntPtr.Zero, window.RootWindow, 0, 0, 0, 0, value.X, value.Y ); API.XFlush( window.Display ); // TODO: not sure if XFlush call is necessary } } diff --git a/src/Client/Block.c b/src/Client/Block.c index 20932761f..b6643dded 100644 --- a/src/Client/Block.c +++ b/src/Client/Block.c @@ -3,6 +3,7 @@ #include "ExtMath.h" #include "TerrainAtlas.h" #include "Player.h" +#include "Game.h" TextureLoc Block_TopTex[BLOCK_CPE_COUNT] = { 0, 1, 0, 2, 16, 4, 15, 17, 14, 14, 30, 30, 18, 19, 32, 33, 34, 21, 22, 48, 49, 64, 65, 66, 67, 68, 69, 70, 71, diff --git a/src/Client/Block.h b/src/Client/Block.h index 40c6cf875..c480d59e2 100644 --- a/src/Client/Block.h +++ b/src/Client/Block.h @@ -4,11 +4,8 @@ #include "BlockID.h" #include "String.h" #include "PackedCol.h" -#include "Game.h" #include "Vectors.h" -#include "Bitmap.h" #include "Constants.h" -#include "Compiler.h" /* Stores properties and data for blocks. Also performs automatic rotation of directional blocks. Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3 @@ -105,7 +102,7 @@ void Block_RecalculateBB(BlockID block); void Block_SetSide(TextureLoc texLoc, BlockID blockId); void Block_SetTex(TextureLoc texLoc, Face face, BlockID blockId); -#define Block_GetTexLoc(block, face) Block_Textures[(block) * FACE_COUNT + face] +#define Block_GetTexLoc(block, face) Block_Textures[(block) * FACE_COUNT + (face)] void Block_UpdateCullingAll(void); void Block_UpdateCulling(BlockID block); diff --git a/src/Client/Physics.c b/src/Client/Physics.c index 715b83f3b..6ee13e5de 100644 --- a/src/Client/Physics.c +++ b/src/Client/Physics.c @@ -10,6 +10,7 @@ #include "Options.h" #include "TreeGen.h" #include "Platform.h" +#include "Game.h" /* Data for a resizable queue, used for liquid physic tick entries. */ typedef struct TickQueue_ { diff --git a/src/Client/String.h b/src/Client/String.h index 8f27d5c2f..39ab3ab3b 100644 --- a/src/Client/String.h +++ b/src/Client/String.h @@ -1,7 +1,6 @@ #ifndef CC_STRING_H #define CC_STRING_H #include "Typedefs.h" -#include "Compiler.h" /* Implements operations for a string. Also implements conversions betweens strings and numbers. Also implements converting code page 437 indices to/from unicode. diff --git a/src/Client/Widgets.c b/src/Client/Widgets.c index f0d4c9eaf..845c82b7f 100644 --- a/src/Client/Widgets.c +++ b/src/Client/Widgets.c @@ -1533,4 +1533,28 @@ void InputWidget_Create(InputWidget* widget, FontDesc* font, STRING_REF String* Size2D size = Drawer2D_MeasureText(&args); widget->PrefixWidth = (UInt16)size.Width; widget->Base.Width = size.Width; widget->PrefixHeight = (UInt16)size.Height; widget->Base.Height = size.Height; -} \ No newline at end of file +} + + +void PlayerListWidget_Init(void); +void PlayerListWidget_Render(Real64 delta); +void PlayerListWidget_Dispose(void); +String* PlayerListWidget_GetNameUnder(Int32 mouseX, Int32 mouseY); +void PlayerListWidget_RepositionColumns(void); +void PlayerListWidget_UpdateTableDimensions(void); +Int32 PlayerListWidget_GetColumnWidth(Int32 column); +Int32 PlayerListWidget_GetColumnHeight(Int32 column); +void PlayerListWidget_SetColumnPos(Int32 column, Int32 x, Int32 y); +void PlayerListWidget_RecalcYOffset(void); +void PlayerListWidget_Reposition(void); +void PlayerListWidget_AddName(UInt8 id, Int32 index); +void PlayerListWidget_TabEntryAdded(Object* sender, IdEventArgs* e); +void PlayerListWidget_TabEntryChanged(Object* sender, IdEventArgs* e); +void PlayerListWidget_TabEntryRemoved(Object* sender, IdEventArgs* e); +void PlayerListWidget_DeleteAt(Int32 i); +void PlayerListWidget_SortAndReposition(void); +Texture* PlayerListWidget_DrawName(String* name); +void PlayerListWidget_SortEntries(void); +void PlayerListWidget_DeleteGroup(Int32&* i); +void PlayerListWidget_AddGroup(UInt16 id, Int32&* index); +Int32 PlayerListWidget_GetGroupCount(UInt16 id, Int32 idx); \ No newline at end of file diff --git a/src/Client/Widgets.h b/src/Client/Widgets.h index 9908c7078..07a7fd019 100644 --- a/src/Client/Widgets.h +++ b/src/Client/Widgets.h @@ -6,6 +6,7 @@ #include "String.h" #include "BlockID.h" #include "Constants.h" +#include "Entity.h" /* Contains all 2D widget implementations. Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3 */ @@ -191,4 +192,18 @@ void TextGroupWidget_PushUpAndReplaceLast(TextGroupWidget* widget, STRING_PURE S Int32 TextGroupWidget_GetUsedHeight(TextGroupWidget* widget); void TextGroupWidget_GetSelected(TextGroupWidget* widget, STRING_TRANSIENT String* text, Int32 mouseX, Int32 mouseY); void TextGroupWidget_SetText(TextGroupWidget* widget, Int32 index, STRING_PURE String* text); + + +typedef struct PlayerListWidget_ { + Widget Base; + FontDesc Font; + UInt16 NamesCount, ElementOffset; + Int32 XMin, XMax, YHeight; + bool Classic; + UInt16 IDs[TABLIST_MAX_NAMES * 2]; + Texture Textures[TABLIST_MAX_NAMES * 2]; +} PlayerListWidget; +void PlayerListWidget_Create(PlayerListWidget* widget, FontDesc* font, bool classic); +String* PlayerListWidget_GetNameUnder(Int32 mouseX, Int32 mouseY); +void PlayerListWidget_RecalcYOffset(void); #endif \ No newline at end of file