summaryrefslogtreecommitdiff
path: root/mate-dictionary/src/gdict-applet.c
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2023-08-12 18:52:14 -0400
committerraveit65 <[email protected]>2023-08-14 11:11:39 +0200
commit3b8ad0b9cd1addb41d938785faa3247b1cf4a9db (patch)
tree28a429d6236baf691ee87a86cd8fb842cdc0f9a1 /mate-dictionary/src/gdict-applet.c
parentf5ba27007c359c933631d30dac4593c147c5e01e (diff)
downloadmate-utils-3b8ad0b9cd1addb41d938785faa3247b1cf4a9db.tar.bz2
mate-utils-3b8ad0b9cd1addb41d938785faa3247b1cf4a9db.tar.xz
Wayland: Fix position and behavior of dictionary applet popup window
*Use gtk layer shell to duplicate the x11 behavior of the dictionary applet's popup dialog window
Diffstat (limited to 'mate-dictionary/src/gdict-applet.c')
-rw-r--r--mate-dictionary/src/gdict-applet.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/mate-dictionary/src/gdict-applet.c b/mate-dictionary/src/gdict-applet.c
index b8c1b4eb..bc4b7593 100644
--- a/mate-dictionary/src/gdict-applet.c
+++ b/mate-dictionary/src/gdict-applet.c
@@ -38,6 +38,11 @@
#include "gdict-common.h"
#include "gdict-aligned-window.h"
+#if defined (ENABLE_WAYLAND) && defined (GDK_WINDOWING_WAYLAND)
+#include <gdk/gdkwayland.h>
+#include <gtk-layer-shell/gtk-layer-shell.h>
+#endif
+
#define GDICT_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_APPLET, GdictAppletClass))
#define GDICT_APPLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_APPLET, GdictAppletClass))
@@ -314,6 +319,16 @@ gdict_applet_build_window (GdictApplet *applet)
G_CALLBACK (window_show_cb),
applet);
+ GdkDisplay *display = gdk_screen_get_display (gdk_screen_get_default());
+
+#if defined (ENABLE_WAYLAND) && defined (GDK_WINDOWING_WAYLAND)
+ if ((GDK_IS_WAYLAND_DISPLAY (display)) && (!gtk_layer_is_layer_window (GTK_WINDOW (window))))
+ {
+ gtk_layer_init_for_window (GTK_WINDOW (window));
+ gtk_layer_set_layer (GTK_WINDOW (window), GTK_LAYER_SHELL_LAYER_TOP);
+ gtk_layer_set_keyboard_mode (GTK_WINDOW (window), GTK_LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND);
+ }
+#endif
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (window), frame);