diff options
author | William Wold <[email protected]> | 2019-02-11 16:12:23 -0500 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-03-10 15:11:45 +0100 |
commit | 8ae4ece9753c583c65503ac32ce4314cdc7d9029 (patch) | |
tree | 13f3029fbc07432854e20621cbe3bce93348fb86 | |
parent | 9e85956188204eafff6c0c27ece1812bf3d57108 (diff) | |
download | mate-panel-8ae4ece9753c583c65503ac32ce4314cdc7d9029.tar.bz2 mate-panel-8ae4ece9753c583c65503ac32ce4314cdc7d9029.tar.xz |
Wayland support for panel-menu-button.c
-rw-r--r-- | mate-panel/panel-menu-button.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c index 3e72972f..00607bbd 100644 --- a/mate-panel/panel-menu-button.c +++ b/mate-panel/panel-menu-button.c @@ -95,7 +95,9 @@ struct _PanelMenuButtonPrivate { char *custom_icon; char *tooltip; - Window interrupted_window; +#ifdef HAVE_X11 + Window interrupted_x11_window; +#endif MenuPathRoot path_root; guint use_menu_path : 1; @@ -445,8 +447,13 @@ panel_menu_button_recreate_menu (PanelMenuButton *button) static gboolean panel_menu_button_menu_deactivate (GtkWidget* widget, PanelMenuButton* button) { GtkWidget *toplevel = gtk_widget_get_toplevel(widget); - panel_util_set_current_active_window(toplevel, button->priv->interrupted_window); - button->priv->interrupted_window = None; + +#ifdef HAVE_X11 + if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (widget))) { + panel_util_set_current_active_x11_window(toplevel, button->priv->interrupted_x11_window); + button->priv->interrupted_x11_window = None; + } +#endif return FALSE; } @@ -471,6 +478,9 @@ panel_menu_button_popup_menu (PanelMenuButton *button, screen = gtk_window_get_screen (GTK_WINDOW (button->priv->toplevel)); gtk_menu_set_screen (GTK_MENU (button->priv->menu), screen); + gtk_window_set_attached_to (GTK_WINDOW (gtk_widget_get_toplevel (button->priv->menu)), + GTK_WIDGET (button)); + /*using these same anchor points lets default "anchor-hints" properly position the menu *so that on a vertical panel the menu aligns with the outside edge of a menu button *placed at the top or bottom of a left or a right panel @@ -484,9 +494,13 @@ panel_menu_button_popup_menu (PanelMenuButton *button, g_signal_connect(GTK_MENU_SHELL (button->priv->menu), "deactivate", G_CALLBACK (panel_menu_button_menu_deactivate), button); toplevel = gtk_widget_get_toplevel(GTK_WIDGET(button->priv->toplevel)); - button->priv->interrupted_window = panel_util_get_current_active_window (toplevel); window = gtk_widget_get_window (toplevel); - panel_util_set_current_active_window (toplevel, GDK_WINDOW_XID(window)); +#ifdef HAVE_X11 + if (GDK_IS_X11_DISPLAY (gdk_window_get_display (window))) { + button->priv->interrupted_x11_window = panel_util_get_current_active_x11_window (toplevel); + panel_util_set_current_active_x11_window (toplevel, GDK_WINDOW_XID(window)); + } +#endif } static void |