forked from AuroraMiddleware/gtk
Free button_state.mask after XIQueryPointer()
This function allocates the button mask, so free it after use, or right before the next XIQueryPointer() call, as done in gdk_x11_device_xi2_window_at_position().
This commit is contained in:
parent
b2b73a349e
commit
0cc2f93d5c
@ -362,6 +362,8 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
|
|||||||
if (mask)
|
if (mask)
|
||||||
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state);
|
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state);
|
||||||
|
|
||||||
|
g_free (button_state.mask);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +451,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
|||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
Window xwindow, root, child, last = None;
|
Window xwindow, root, child, last = None;
|
||||||
gdouble xroot_x, xroot_y, xwin_x, xwin_y;
|
gdouble xroot_x, xroot_y, xwin_x, xwin_y;
|
||||||
XIButtonState button_state;
|
XIButtonState button_state = { 0 };
|
||||||
XIModifierState mod_state;
|
XIModifierState mod_state;
|
||||||
XIGroupState group_state;
|
XIGroupState group_state;
|
||||||
|
|
||||||
@ -501,6 +503,10 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
|||||||
{
|
{
|
||||||
window = GDK_WINDOW (list->data);
|
window = GDK_WINDOW (list->data);
|
||||||
xwindow = GDK_WINDOW_XID (window);
|
xwindow = GDK_WINDOW_XID (window);
|
||||||
|
|
||||||
|
/* Free previous button mask, if any */
|
||||||
|
g_free (button_state.mask);
|
||||||
|
|
||||||
gdk_x11_display_error_trap_push (display);
|
gdk_x11_display_error_trap_push (display);
|
||||||
XIQueryPointer (xdisplay,
|
XIQueryPointer (xdisplay,
|
||||||
device_xi2->device_id,
|
device_xi2->device_id,
|
||||||
@ -525,6 +531,8 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
|||||||
XSetWindowAttributes attributes;
|
XSetWindowAttributes attributes;
|
||||||
Window w;
|
Window w;
|
||||||
|
|
||||||
|
g_free (button_state.mask);
|
||||||
|
|
||||||
w = XCreateWindow (xdisplay, xwindow, (int)xwin_x, (int)xwin_y, 1, 1, 0,
|
w = XCreateWindow (xdisplay, xwindow, (int)xwin_x, (int)xwin_y, 1, 1, 0,
|
||||||
CopyFromParent, InputOnly, CopyFromParent,
|
CopyFromParent, InputOnly, CopyFromParent,
|
||||||
0, &attributes);
|
0, &attributes);
|
||||||
@ -558,6 +566,8 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
|||||||
while (xwindow)
|
while (xwindow)
|
||||||
{
|
{
|
||||||
last = xwindow;
|
last = xwindow;
|
||||||
|
g_free (button_state.mask);
|
||||||
|
|
||||||
gdk_x11_display_error_trap_push (display);
|
gdk_x11_display_error_trap_push (display);
|
||||||
XIQueryPointer (xdisplay,
|
XIQueryPointer (xdisplay,
|
||||||
device_xi2->device_id,
|
device_xi2->device_id,
|
||||||
@ -593,6 +603,8 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
|
|||||||
if (mask)
|
if (mask)
|
||||||
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state);
|
*mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state);
|
||||||
|
|
||||||
|
g_free (button_state.mask);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user