summaryrefslogtreecommitdiff
path: root/services
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-01-30 22:28:42 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-01-30 22:28:42 +0100
commit43c3c9de4596ecab76be42172b47ddee93f5900a (patch)
tree7b7a970e0fc840f5361e1385cf62cdd0ed5c1c54 /services
parentb13ed8c19b71086091f2269cdb73f5f695738946 (diff)
parent931f9c294065ee267ff2f1219222b6205bc70537 (diff)
Merging with upstream
(bzr r1858.9.27)
Diffstat (limited to 'services')
-rw-r--r--services/CMakeLists.txt2
-rw-r--r--services/panel-service.c46
2 files changed, 44 insertions, 4 deletions
diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt
index 095784536..a1dc073f8 100644
--- a/services/CMakeLists.txt
+++ b/services/CMakeLists.txt
@@ -2,7 +2,7 @@
# Panel Service
#
find_package(PkgConfig)
-pkg_check_modules(SERVICE_DEPS REQUIRED gtk+-3.0 gobject-2.0 gio-2.0 gthread-2.0 indicator3-0.4=>0.4.90 x11 gconf-2.0)
+pkg_check_modules(SERVICE_DEPS REQUIRED gtk+-3.0>=3.3 gobject-2.0 gio-2.0 gthread-2.0 indicator3-0.4=>0.4.90 x11 gconf-2.0)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable indicatordir OUTPUT_VARIABLE _indicatordir OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable iconsdir OUTPUT_VARIABLE _iconsdir OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/services/panel-service.c b/services/panel-service.c
index c2ce7e3db..cbd8368ad 100644
--- a/services/panel-service.c
+++ b/services/panel-service.c
@@ -32,6 +32,7 @@
#include <gdk/gdkx.h>
#include <X11/extensions/XInput2.h>
+#include <X11/XKBlib.h>
#include "panel-marshal.h"
@@ -55,6 +56,8 @@ struct _PanelServicePrivate
gint32 timeouts[N_TIMEOUT_SLOTS];
IndicatorObjectEntry *last_entry;
+ GtkWidget *menubar;
+ GtkWidget *offscreen_window;
GtkMenu *last_menu;
guint32 last_menu_id;
guint32 last_menu_move_id;
@@ -138,6 +141,24 @@ panel_service_class_dispose (GObject *object)
gdk_window_remove_filter (NULL, (GdkFilterFunc)event_filter, object);
+ if (G_IS_OBJECT (priv->menubar))
+ {
+ g_object_unref (priv->menubar);
+ priv->menubar = NULL;
+ }
+
+ if (G_IS_OBJECT (priv->offscreen_window))
+ {
+ g_object_unref (priv->offscreen_window);
+ priv->offscreen_window = NULL;
+ }
+
+ if (G_IS_OBJECT (priv->last_menu))
+ {
+ g_object_unref (priv->last_menu);
+ priv->last_menu = NULL;
+ }
+
if (priv->initial_sync_id)
{
g_source_remove (priv->initial_sync_id);
@@ -249,9 +270,9 @@ event_filter (GdkXEvent *ev, GdkEvent *gev, PanelService *self)
if (event->evtype == XI_KeyRelease)
{
- if (XKeycodeToKeysym(event->display, event->detail, 0) == GDK_KEY_F10)
+ if (XkbKeycodeToKeysym(event->display, event->detail, 0, 0) == GDK_KEY_F10)
{
- if (GTK_MENU (priv->last_menu))
+ if (GTK_IS_MENU (priv->last_menu))
gtk_menu_popdown (GTK_MENU (priv->last_menu));
}
}
@@ -443,6 +464,10 @@ panel_service_init (PanelService *self)
PanelServicePrivate *priv;
priv = self->priv = GET_PRIVATE (self);
+ priv->offscreen_window = gtk_offscreen_window_new ();
+ priv->menubar = gtk_menu_bar_new ();
+ gtk_container_add (GTK_CONTAINER (priv->offscreen_window), priv->menubar);
+
gdk_window_add_filter (NULL, (GdkFilterFunc)event_filter, self);
priv->panel2entries_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -1121,6 +1146,11 @@ on_active_menu_hidden (GtkMenu *menu, PanelService *self)
g_signal_handler_disconnect (priv->last_menu, priv->last_menu_id);
g_signal_handler_disconnect (priv->last_menu, priv->last_menu_move_id);
+
+ GtkWidget *top_win = gtk_widget_get_toplevel (GTK_WIDGET (priv->last_menu));
+ if (GTK_IS_WINDOW (top_win))
+ gtk_window_set_attached_to (GTK_WINDOW (top_win), NULL);
+
priv->last_menu = NULL;
priv->last_menu_id = 0;
priv->last_menu_move_id = 0;
@@ -1521,6 +1551,16 @@ panel_service_actually_show_entry (PanelService *self,
G_CALLBACK (gtk_widget_destroyed), &priv->last_menu);
}
+ GtkWidget *top_widget = gtk_widget_get_toplevel (GTK_WIDGET (priv->last_menu));
+
+ if (GTK_IS_WINDOW (top_widget))
+ {
+ GtkWindow *top_win = GTK_WINDOW (top_widget);
+
+ if (gtk_window_get_attached_to (top_win) != priv->menubar)
+ gtk_window_set_attached_to (top_win, priv->menubar);
+ }
+
priv->last_entry = entry;
priv->last_x = x;
priv->last_y = y;
@@ -1557,7 +1597,7 @@ panel_service_actually_show_entry (PanelService *self,
* active application (which will make it change colour (as state changes), which
* then looks like flickering to the user.
*/
- if (GTK_MENU (last_menu))
+ if (GTK_IS_MENU (last_menu))
gtk_menu_popdown (GTK_MENU (last_menu));
}