summaryrefslogtreecommitdiff
path: root/libmate-panel-applet/mate-panel-applet.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-02-08 17:24:55 +0100
committerStefano Karapetsas <[email protected]>2014-02-08 17:24:55 +0100
commit41b192b6d139fa0426022ac98675eaa66cb303c1 (patch)
tree3499dfce74893b5234b86512f58747ed3ae60866 /libmate-panel-applet/mate-panel-applet.c
parent1d0d0843a3a3cd16c47ebc3361973ca6d02bd066 (diff)
downloadmate-panel-41b192b6d139fa0426022ac98675eaa66cb303c1.tar.bz2
mate-panel-41b192b6d139fa0426022ac98675eaa66cb303c1.tar.xz
libmate-panel-applet: GTK3 improvements
Diffstat (limited to 'libmate-panel-applet/mate-panel-applet.c')
-rw-r--r--libmate-panel-applet/mate-panel-applet.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c
index f0a9a5c2..7ec9bfb9 100644
--- a/libmate-panel-applet/mate-panel-applet.c
+++ b/libmate-panel-applet/mate-panel-applet.c
@@ -801,6 +801,9 @@ mate_panel_applet_position_menu (GtkMenu *menu,
MatePanelApplet *applet;
GtkAllocation allocation;
GtkRequisition requisition;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkDevice *device;
+#endif
GdkScreen *screen;
int menu_x = 0;
int menu_y = 0;
@@ -811,7 +814,12 @@ mate_panel_applet_position_menu (GtkMenu *menu,
applet = MATE_PANEL_APPLET (widget);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ screen = gtk_widget_get_screen (widget);
+ gtk_menu_set_screen (menu, screen);
+#else
screen = gtk_window_get_screen (GTK_WINDOW (applet->priv->plug));
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL);
@@ -820,8 +828,12 @@ mate_panel_applet_position_menu (GtkMenu *menu,
#endif
gdk_window_get_origin (gtk_widget_get_window (widget),
&menu_x, &menu_y);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (widget)));
+ gdk_window_get_device_position(gtk_widget_get_window (widget), device, &pointer_x, &pointer_y, NULL);
+#else
gtk_widget_get_pointer (widget, &pointer_x, &pointer_y);
-
+#endif
gtk_widget_get_allocation (widget, &allocation);
menu_x += allocation.x;
@@ -863,7 +875,11 @@ mate_panel_applet_position_menu (GtkMenu *menu,
*x = menu_x;
*y = menu_y;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ *push_in = FALSE;
+#else
*push_in = TRUE;
+#endif
}
static void
@@ -921,9 +937,13 @@ mate_panel_applet_button_event (GtkWidget *widget,
* selected.
* We don't want to hog the pointer on our parent.
*/
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gdk_device_ungrab (event->device, GDK_CURRENT_TIME);
+#else
gdk_display_pointer_ungrab
(gtk_widget_get_display (widget),
GDK_CURRENT_TIME);
+#endif
} else {
xevent.xbutton.type = ButtonRelease;
}