diff options
author | raveit65 <[email protected]> | 2019-06-03 19:56:29 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-06-07 15:27:21 +0200 |
commit | 894645c7bce5a4f554976ab48f66293bf9fd70cc (patch) | |
tree | 3cbb8d1e4d915f3cc1d1acec75da608aa905605d | |
parent | a9e608411f519b5cb1bc268f7384dc8449221d4f (diff) | |
download | mate-panel-894645c7bce5a4f554976ab48f66293bf9fd70cc.tar.bz2 mate-panel-894645c7bce5a4f554976ab48f66293bf9fd70cc.tar.xz |
revert menu-bar: transfer focus correctly on alt-F1
This revert
https://github.com/mate-desktop/mate-panel/commit/f0f4c5e
and fixes hopefully https://github.com/mate-desktop/marco/issues/209
-rw-r--r-- | mate-panel/panel-menu-bar.c | 36 | ||||
-rw-r--r-- | mate-panel/panel-menu-button.c | 33 | ||||
-rw-r--r-- | mate-panel/panel-util.c | 96 | ||||
-rw-r--r-- | mate-panel/panel-util.h | 11 |
4 files changed, 0 insertions, 176 deletions
diff --git a/mate-panel/panel-menu-bar.c b/mate-panel/panel-menu-bar.c index b88c6ffb..ae429ba8 100644 --- a/mate-panel/panel-menu-bar.c +++ b/mate-panel/panel-menu-bar.c @@ -28,11 +28,6 @@ #include "panel-menu-bar.h" -#ifdef HAVE_X11 -#include <X11/Xlib.h> -#include <gdk/gdkx.h> -#endif - #include <string.h> #include <glib/gi18n.h> @@ -66,10 +61,6 @@ struct _PanelMenuBarPrivate { GSettings* settings; PanelOrientation orientation; - -#ifdef HAVE_X11 - Window interrupted_x11_window; -#endif }; enum { @@ -90,21 +81,6 @@ static gboolean panel_menu_bar_reinit_tooltip(GtkWidget* widget, PanelMenuBar* m return FALSE; } -static gboolean panel_menu_bar_deactivate (GtkWidget* widget, PanelMenuBar* menubar) -{ - GtkWidget *toplevel = gtk_widget_get_toplevel (widget); - -#ifdef HAVE_X11 - if (GDK_IS_X11_DISPLAY (gtk_widget_get_display (widget))) - { - panel_util_set_current_active_x11_window (toplevel, menubar->priv->interrupted_x11_window); - menubar->priv->interrupted_x11_window = None; - } -#endif - - return FALSE; -} - static gboolean panel_menu_bar_hide_tooltip_and_focus(GtkWidget* widget, PanelMenuBar* menubar) { /* remove focus that would be drawn on the currently focused child of @@ -130,7 +106,6 @@ static void panel_menu_bar_setup_tooltip(PanelMenuBar* menubar) /* Reset tooltip when the menu bar is not used */ g_signal_connect(GTK_MENU_SHELL (menubar), "deactivate", G_CALLBACK (panel_menu_bar_reinit_tooltip), menubar); - g_signal_connect(GTK_MENU_SHELL (menubar), "deactivate", G_CALLBACK (panel_menu_bar_deactivate), menubar); } static void panel_menu_bar_update_visibility (GSettings* settings, gchar* key, PanelMenuBar* menubar) @@ -432,22 +407,11 @@ void panel_menu_bar_popup_menu(PanelMenuBar* menubar, guint32 activate_time) { GtkMenu* menu; GtkMenuShell* menu_shell; - GtkWidget* toplevel; - GdkWindow* window; g_return_if_fail(PANEL_IS_MENU_BAR(menubar)); menu = GTK_MENU(menubar->priv->applications_menu); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar)); - window = gtk_widget_get_window (toplevel); -#ifdef HAVE_X11 - if (GDK_IS_X11_DISPLAY (gdk_window_get_display (window))) { - menubar->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 - /* * We need to call _gtk_menu_shell_activate() here as is done in * window_key_press_handler in gtkmenubar.c which pops up menu diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c index 9b44d795..001ed50a 100644 --- a/mate-panel/panel-menu-button.c +++ b/mate-panel/panel-menu-button.c @@ -26,12 +26,9 @@ #include "panel-menu-button.h" -#include <X11/Xlib.h> - #include <string.h> #include <glib/gi18n.h> #include <gio/gio.h> -#include <gdk/gdkx.h> #include <matemenu-tree.h> @@ -91,10 +88,6 @@ struct _PanelMenuButtonPrivate { char *custom_icon; char *tooltip; -#ifdef HAVE_X11 - Window interrupted_x11_window; -#endif - MenuPathRoot path_root; guint use_menu_path : 1; guint use_custom_icon : 1; @@ -442,28 +435,12 @@ panel_menu_button_recreate_menu (PanelMenuButton *button) button->priv->menu = NULL; } -static gboolean panel_menu_button_menu_deactivate (GtkWidget* widget, PanelMenuButton* button) -{ - GtkWidget *toplevel = gtk_widget_get_toplevel(widget); - -#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; -} - void panel_menu_button_popup_menu (PanelMenuButton *button, guint n_button, guint32 activate_time) { GdkScreen *screen; - GtkWidget *toplevel; - GdkWindow *window; g_return_if_fail (PANEL_IS_MENU_BUTTON (button)); @@ -489,16 +466,6 @@ panel_menu_button_popup_menu (PanelMenuButton *button, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL); - - 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)); - window = gtk_widget_get_window (toplevel); -#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 diff --git a/mate-panel/panel-util.c b/mate-panel/panel-util.c index e6bdd653..7389b321 100644 --- a/mate-panel/panel-util.c +++ b/mate-panel/panel-util.c @@ -47,13 +47,6 @@ #include "panel-icon-names.h" #include "panel-lockdown.h" -#ifdef HAVE_X11 -#include <X11/Xlib.h> -#include <X11/Xatom.h> -#include <gdk/gdkx.h> -static Atom _net_active_window = None; -#endif - char * panel_util_make_exec_uri_for_desktop (const char *exec) { @@ -1249,92 +1242,3 @@ panel_util_get_file_optional_homedir (const char *location) return file; } -#ifdef HAVE_X11 - -static void panel_menu_bar_get_net_active_x11_window(Display *xdisplay) -{ - if (_net_active_window == None) - _net_active_window = XInternAtom (xdisplay, - "_NET_ACTIVE_WINDOW", - False); -} - -Window panel_util_get_current_active_x11_window (GtkWidget *toplevel) -{ - GdkScreen *screen; - GdkDisplay *display; - GdkWindow *root; - Display *xdisplay; - Window xroot; - - Window res = None; - - Atom return_type; - int return_format; - unsigned long n; - unsigned long bytes; - unsigned char *prop = NULL; - - screen = gtk_window_get_screen (GTK_WINDOW(toplevel)); - display = gdk_screen_get_display (screen); - root = gdk_screen_get_root_window (screen); - - xdisplay = GDK_DISPLAY_XDISPLAY (display); - xroot = GDK_WINDOW_XID (root); - - panel_menu_bar_get_net_active_x11_window (xdisplay); - if (_net_active_window != None - && XGetWindowProperty (xdisplay, xroot, _net_active_window, 0, 1, - False, XA_WINDOW, &return_type, &return_format, - &n, &bytes, &prop) == Success) - { - if ((return_type == XA_WINDOW) && (return_format == 32) && - (n == 1) && (prop)) { - res = *(Window *)prop; - } - - if (prop) - XFree (prop); - - } - return res; -} - -void panel_util_set_current_active_x11_window (GtkWidget *toplevel, Window window) -{ - GdkScreen *screen; - GdkDisplay *display; - GdkWindow *root; - Display *xdisplay; - Window xroot; - XEvent xev; - - screen = gtk_window_get_screen (GTK_WINDOW(toplevel)); - display = gdk_screen_get_display (screen); - root = gdk_screen_get_root_window (screen); - - xdisplay = GDK_DISPLAY_XDISPLAY (display); - xroot = GDK_WINDOW_XID (root); - - panel_menu_bar_get_net_active_x11_window (xdisplay); - if (_net_active_window == None) - return; - - xev.xclient.type = ClientMessage; - xev.xclient.serial = 0; - xev.xclient.send_event = True; - xev.xclient.window = window; - xev.xclient.message_type = _net_active_window; - xev.xclient.format = 32; - xev.xclient.data.l[0] = 2; /* requestor type; we're not an app */ - xev.xclient.data.l[1] = CurrentTime; - xev.xclient.data.l[2] = None; /* our currently active window */ - xev.xclient.data.l[3] = 0; - xev.xclient.data.l[4] = 0; - - XSendEvent (xdisplay, xroot, False, - SubstructureRedirectMask | SubstructureNotifyMask, - &xev); -} - -#endif diff --git a/mate-panel/panel-util.h b/mate-panel/panel-util.h index b80740f8..8d9fb2ef 100644 --- a/mate-panel/panel-util.h +++ b/mate-panel/panel-util.h @@ -4,10 +4,6 @@ #include <gio/gio.h> #include <gtk/gtk.h> -#ifdef HAVE_X11 -#include <X11/Xlib.h> -#endif - #ifdef __cplusplus extern "C" { #endif @@ -70,13 +66,6 @@ void panel_util_set_tooltip_text (GtkWidget *widget, GFile *panel_util_get_file_optional_homedir (const char *location); -#ifdef HAVE_X11 -Window panel_util_get_current_active_x11_window (GtkWidget *toplevel); - -void panel_util_set_current_active_x11_window (GtkWidget *toplevel, - Window window); -#endif - #ifdef __cplusplus } #endif |