[gtk/present-toplevel-2: 29/83] x11: Set type hints based on surface type
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/present-toplevel-2: 29/83] x11: Set type hints based on surface type
- Date: Thu, 12 Mar 2020 00:45:26 +0000 (UTC)
commit eefedccaee167552a8678384328245143fafbc5f
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 7 09:07:53 2020 -0800
x11: Set type hints based on surface type
Set the ewmh type hints based on the surface type and
transient parent, instead of taking it from the type hint.
gdk/x11/gdksurface-x11.c | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 53a91af8a0..e3d39a3df3 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -792,6 +792,11 @@ disconnect_frame_clock (GdkSurface *surface)
}
}
+static void gdk_x11_surface_set_title (GdkSurface *surface,
+ const char *title);
+static void gdk_x11_surface_set_type_hint (GdkSurface *surface,
+ GdkSurfaceTypeHint hint);
+
GdkSurface *
_gdk_x11_display_create_surface (GdkDisplay *display,
GdkSurfaceType surface_type,
@@ -909,7 +914,11 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
g_object_ref (surface);
_gdk_x11_display_add_window (x11_screen->display, &impl->xid, surface);
- gdk_surface_set_title (surface, get_default_title ());
+ gdk_x11_surface_set_title (surface, get_default_title ());
+ if (surface->surface_type == GDK_SURFACE_TOPLEVEL)
+ gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_NORMAL);
+ else if (surface->surface_type == GDK_SURFACE_POPUP)
+ gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_MENU);
class_hint = XAllocClassHint ();
class_hint->res_name = (char *) g_get_prgname ();
@@ -2348,13 +2357,19 @@ gdk_x11_surface_set_transient_for (GdkSurface *surface,
/* XSetTransientForHint() doesn't allow unsetting, so do it manually */
if (parent && !GDK_SURFACE_DESTROYED (parent))
- XSetTransientForHint (GDK_SURFACE_XDISPLAY (surface),
- GDK_SURFACE_XID (surface),
- GDK_SURFACE_XID (parent));
+ {
+ XSetTransientForHint (GDK_SURFACE_XDISPLAY (surface),
+ GDK_SURFACE_XID (surface),
+ GDK_SURFACE_XID (parent));
+ gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DIALOG);
+ }
else
- XDeleteProperty (GDK_SURFACE_XDISPLAY (surface),
- GDK_SURFACE_XID (surface),
- gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface),
"WM_TRANSIENT_FOR"));
+ {
+ XDeleteProperty (GDK_SURFACE_XDISPLAY (surface),
+ GDK_SURFACE_XID (surface),
+ gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface),
"WM_TRANSIENT_FOR"));
+ gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_NORMAL);
+ }
}
GdkCursor *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]