Switch from using XWarpPointer with relative child coords, to XWarpPointer with absolute coords on linux.

This commit is contained in:
UnknownShadow200 2018-01-15 07:34:07 +11:00
parent f1e697898e
commit 88fc277ab1
7 changed files with 44 additions and 10 deletions

View File

@ -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
}
}

View File

@ -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,

View File

@ -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);

View File

@ -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_ {

View File

@ -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.

View File

@ -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;
}
}
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);

View File

@ -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