X11: Fix no window position events during resize
A window resize action that also resulting in the window being moved did
not emit any window positions events, as the position of real
ConfigureNotify events was ignored. The real events use parent
coordinates instead of root coordinates so this adds parent tracking and
conditional translation.
Fixes #1613.
(cherry picked from commit fe57e3c292
)
This commit is contained in:
parent
359f0e103c
commit
ecda86fa4f
@ -146,6 +146,7 @@ information on what to include when reporting a bug.
|
|||||||
- [X11] Bugfix: Changing `GLFW_FLOATING` on a hidden window could silently fail
|
- [X11] Bugfix: Changing `GLFW_FLOATING` on a hidden window could silently fail
|
||||||
- [X11] Bugfix: Disabled cursor mode was interrupted by indicator windows
|
- [X11] Bugfix: Disabled cursor mode was interrupted by indicator windows
|
||||||
- [X11] Bugfix: Monitor physical dimensions could be reported as zero mm
|
- [X11] Bugfix: Monitor physical dimensions could be reported as zero mm
|
||||||
|
- [X11] Bugfix: Window position events were not emitted during resizing (#1613)
|
||||||
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
||||||
- [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer
|
- [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer
|
||||||
macOS versions (#1442)
|
macOS versions (#1442)
|
||||||
|
@ -180,6 +180,7 @@ typedef struct _GLFWwindowX11
|
|||||||
{
|
{
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
Window handle;
|
Window handle;
|
||||||
|
Window parent;
|
||||||
XIC ic;
|
XIC ic;
|
||||||
|
|
||||||
GLFWbool overrideRedirect;
|
GLFWbool overrideRedirect;
|
||||||
|
@ -1258,6 +1258,18 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
|
case CreateNotify:
|
||||||
|
{
|
||||||
|
window->x11.parent = event->xcreatewindow.parent;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case ReparentNotify:
|
||||||
|
{
|
||||||
|
window->x11.parent = event->xreparent.parent;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
{
|
{
|
||||||
const int key = translateKey(keycode);
|
const int key = translateKey(keycode);
|
||||||
@ -1542,18 +1554,28 @@ static void processEvent(XEvent *event)
|
|||||||
window->x11.height = event->xconfigure.height;
|
window->x11.height = event->xconfigure.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->xconfigure.x != window->x11.xpos ||
|
int xpos = event->xconfigure.x;
|
||||||
event->xconfigure.y != window->x11.ypos)
|
int ypos = event->xconfigure.y;
|
||||||
{
|
|
||||||
if (window->x11.overrideRedirect || event->xany.send_event)
|
|
||||||
{
|
|
||||||
_glfwInputWindowPos(window,
|
|
||||||
event->xconfigure.x,
|
|
||||||
event->xconfigure.y);
|
|
||||||
|
|
||||||
window->x11.xpos = event->xconfigure.x;
|
// NOTE: ConfigureNotify events from the server are in local
|
||||||
window->x11.ypos = event->xconfigure.y;
|
// coordinates, so if we are reparented we need to translate
|
||||||
}
|
// the position into root (screen) coordinates
|
||||||
|
if (!event->xany.send_event && window->x11.parent != _glfw.x11.root)
|
||||||
|
{
|
||||||
|
Window dummy;
|
||||||
|
XTranslateCoordinates(_glfw.x11.display,
|
||||||
|
window->x11.parent,
|
||||||
|
_glfw.x11.root,
|
||||||
|
xpos, ypos,
|
||||||
|
&xpos, &ypos,
|
||||||
|
&dummy);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xpos != window->x11.xpos || ypos != window->x11.ypos)
|
||||||
|
{
|
||||||
|
_glfwInputWindowPos(window, xpos, ypos);
|
||||||
|
window->x11.xpos = xpos;
|
||||||
|
window->x11.ypos = ypos;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user