gdk: event freeing, child shapes, root coordinates of destroyed windows and implicit grabs fixed as in GTK+ 3, and windows that do not accept focus no longer offer WM_TAKE_FOCUS

This commit is contained in:
Daemonratte 2026-10-18 10:18:40 +02:00
commit 094b95e9d9
No known key found for this signature in database
3 changed files with 43 additions and 10 deletions

View file

@ -517,6 +517,8 @@ gdk_event_copy (const GdkEvent *event)
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (event->button.axes)
new_event->button.axes = _gdk_memdup2 (event->button.axes,
@ -576,10 +578,13 @@ gdk_event_free (GdkEvent *event)
case GDK_DRAG_STATUS:
case GDK_DROP_START:
case GDK_DROP_FINISHED:
g_object_unref (event->dnd.context);
if (event->dnd.context != NULL)
g_object_unref (event->dnd.context);
break;
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
g_free (event->button.axes);
break;
@ -731,8 +736,6 @@ gdk_event_get_state (const GdkEvent *event,
*state = event->crossing.state;
return TRUE;
case GDK_PROPERTY_NOTIFY:
*state = event->property.state;
return TRUE;
case GDK_VISIBILITY_NOTIFY:
case GDK_CLIENT_EVENT:
case GDK_NO_EXPOSE:

View file

@ -1244,6 +1244,9 @@ find_native_sibling_above (GdkWindowObject *parent,
{
GdkWindowObject *w;
if (!parent)
return NULL;
w = find_native_sibling_above_helper (parent, child);
if (w)
return w;
@ -8707,10 +8710,10 @@ gdk_window_get_root_coords (GdkWindow *window,
if (GDK_WINDOW_DESTROYED (window))
{
if (x)
*root_x = x;
if (y)
*root_y = y;
if (root_x)
*root_x = 0;
if (root_y)
*root_y = 0;
return;
}
@ -9054,6 +9057,15 @@ do_child_shapes (GdkWindow *window,
if (merge && private->shape)
gdk_region_subtract (region, private->shape);
/* what is left is where neither the children nor the shape are; the
* shape is the rest */
{
GdkRegion *full = gdk_region_rectangle (&r);
gdk_region_xor (region, full);
gdk_region_destroy (full);
}
gdk_window_shape_combine_region (window, region, 0, 0);
gdk_region_destroy (region);
@ -9232,7 +9244,18 @@ do_child_input_shapes (GdkWindow *window,
if (merge && private->input_shape)
gdk_region_subtract (region, private->input_shape);
/* what is left is where neither the children nor the shape are; the
* shape is the rest */
{
GdkRegion *full = gdk_region_rectangle (&r);
gdk_region_xor (region, full);
gdk_region_destroy (full);
}
gdk_window_input_shape_combine_region (window, region, 0, 0);
gdk_region_destroy (region);
}
@ -10584,7 +10607,8 @@ get_pointer_window (GdkDisplay *display,
grab = _gdk_display_has_pointer_grab (display, serial);
if (grab != NULL &&
!grab->owner_events &&
pointer_window != grab->window)
pointer_window != grab->window &&
!gdk_window_is_ancestor (pointer_window, grab->window))
pointer_window = NULL;
return pointer_window;

View file

@ -476,9 +476,12 @@ set_wm_protocols (GdkWindow *window)
int n = 0;
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "WM_DELETE_WINDOW");
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "WM_TAKE_FOCUS");
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PING");
/* without input focus, "No Input" rather than "Globally Active" */
if (((GdkWindowObject *) window)->accept_focus)
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "WM_TAKE_FOCUS");
#ifdef HAVE_XSYNC
if (GDK_DISPLAY_X11 (display)->use_sync)
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_SYNC_REQUEST");
@ -4118,7 +4121,10 @@ gdk_window_set_accept_focus (GdkWindow *window,
if (!GDK_WINDOW_DESTROYED (window) &&
WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
update_wm_hints (window, FALSE);
{
update_wm_hints (window, FALSE);
set_wm_protocols (window);
}
}
}