mirror of
https://github.com/glfw/glfw.git
synced 2025-07-29 11:00:04 +00:00
x11_window: use XTranslateCoordiantes to get correct coordiantes
for XdndPosition
This commit is contained in:
parent
af115856d4
commit
cc9730d8a6
@ -740,12 +740,14 @@ static void processEvent(XEvent *event)
|
|||||||
// and update the mouse position
|
// and update the mouse position
|
||||||
int absX = (event->xclient.data.l[2]>>16) & 0xFFFF;
|
int absX = (event->xclient.data.l[2]>>16) & 0xFFFF;
|
||||||
int absY = (event->xclient.data.l[2]) & 0xFFFF;
|
int absY = (event->xclient.data.l[2]) & 0xFFFF;
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
|
|
||||||
_glfwPlatformGetWindowPos(window,&x,&y);
|
Window child;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
_glfwInputCursorMotion(window,absX-x,absY-y);
|
XTranslateCoordinates(_glfw.x11.display, _glfw.x11.root, window->x11.handle,
|
||||||
|
absX, absY, &x, &y, &child);
|
||||||
|
|
||||||
|
_glfwInputCursorMotion(window,x,y);
|
||||||
|
|
||||||
// Xdnd: reply with an XDND status message
|
// Xdnd: reply with an XDND status message
|
||||||
XClientMessageEvent m;
|
XClientMessageEvent m;
|
||||||
@ -1093,14 +1095,21 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
|||||||
{
|
{
|
||||||
Window child;
|
Window child;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
int left;
|
||||||
|
int top;
|
||||||
|
|
||||||
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root,
|
|
||||||
|
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root,
|
||||||
0, 0, &x, &y, &child);
|
0, 0, &x, &y, &child);
|
||||||
|
|
||||||
|
XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child,
|
||||||
|
0, 0, &left, &top, &child);
|
||||||
|
|
||||||
|
|
||||||
if (xpos)
|
if (xpos)
|
||||||
*xpos = x;
|
*xpos = x;
|
||||||
if (ypos)
|
if (ypos)
|
||||||
*ypos = y;
|
*ypos = y-top;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
||||||
|
Loading…
Reference in New Issue
Block a user