diff options
author | infirit <[email protected]> | 2014-11-22 14:39:13 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-11-22 15:13:50 +0100 |
commit | 54bb9d708c43ae6fbeb25888fe39d0b7f14a7631 (patch) | |
tree | 247864a2c367fdf7bbe418f5dbe350de38d0978a | |
parent | eddf9c62d300df3e3be0444c060dd3fe75b97643 (diff) | |
download | mate-panel-54bb9d708c43ae6fbeb25888fe39d0b7f14a7631.tar.bz2 mate-panel-54bb9d708c43ae6fbeb25888fe39d0b7f14a7631.tar.xz |
Gtk3: Fix use of deprecated gdk_pointer_grab()/_ungrab()
Replaced gdk_pointer_grab() and gdk_pointer_ungrab()
by gdk_device_grab() and gdk_device_ungrab(), respectively.
Taken from gnome-panel commit: 98da5c1953ab90cc5581c1858d7a9c3d3cf796eb
From: Germán Póo-Caamaño <[email protected]>
-rw-r--r-- | mate-panel/mate-panel-applet-frame.c | 11 | ||||
-rw-r--r-- | mate-panel/panel-force-quit.c | 36 | ||||
-rw-r--r-- | mate-panel/panel-toplevel.c | 34 | ||||
-rw-r--r-- | mate-panel/panel-widget.c | 34 |
4 files changed, 105 insertions, 10 deletions
diff --git a/mate-panel/mate-panel-applet-frame.c b/mate-panel/mate-panel-applet-frame.c index 1ccba946..ac4205f5 100644 --- a/mate-panel/mate-panel-applet-frame.c +++ b/mate-panel/mate-panel-applet-frame.c @@ -476,6 +476,11 @@ mate_panel_applet_frame_button_changed (GtkWidget *widget, { MatePanelAppletFrame *frame; gboolean handled = FALSE; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDisplay *display; + GdkDevice *pointer; + GdkDeviceManager *device_manager; +#endif frame = MATE_PANEL_APPLET_FRAME (widget); @@ -504,6 +509,12 @@ mate_panel_applet_frame_button_changed (GtkWidget *widget, case 3: if (event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS) { +#if GTK_CHECK_VERSION (3, 0, 0) + display = gtk_widget_get_display (widget); + device_manager = gdk_display_get_device_manager (display); + pointer = gdk_device_manager_get_client_pointer (device_manager); + gdk_device_ungrab (pointer, GDK_CURRENT_TIME); +#endif gdk_pointer_ungrab (GDK_CURRENT_TIME); MATE_PANEL_APPLET_FRAME_GET_CLASS (frame)->popup_menu (frame, diff --git a/mate-panel/panel-force-quit.c b/mate-panel/panel-force-quit.c index 9d70b590..bc3e6dda 100644 --- a/mate-panel/panel-force-quit.c +++ b/mate-panel/panel-force-quit.c @@ -100,14 +100,28 @@ display_popup_window (GdkScreen *screen) static void remove_popup (GtkWidget *popup) { - GdkWindow *root; + GdkWindow *root; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDisplay *display; + GdkDevice *pointer; + GdkDeviceManager *device_manager; +#endif root = gdk_screen_get_root_window ( gtk_window_get_screen (GTK_WINDOW (popup))); gdk_window_remove_filter (root, (GdkFilterFunc) popup_filter, popup); gtk_widget_destroy (popup); + +#if GTK_CHECK_VERSION (3, 0, 0) + display = gdk_window_get_display (root); + device_manager = gdk_display_get_device_manager (display); + pointer = gdk_device_manager_get_client_pointer (device_manager); + + gdk_device_ungrab (pointer, GDK_CURRENT_TIME); +#else gdk_pointer_ungrab (GDK_CURRENT_TIME); +#endif gdk_keyboard_ungrab (GDK_CURRENT_TIME); } @@ -292,6 +306,11 @@ panel_force_quit (GdkScreen *screen, GdkCursor *cross; GtkWidget *popup; GdkWindow *root; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDisplay *display; + GdkDevice *pointer; + GdkDeviceManager *device_manager; +#endif popup = display_popup_window (screen); @@ -300,13 +319,24 @@ panel_force_quit (GdkScreen *screen, gdk_window_add_filter (root, (GdkFilterFunc) popup_filter, popup); cross = gdk_cursor_new (GDK_CROSS); - status = gdk_pointer_grab (root, FALSE, GDK_BUTTON_PRESS_MASK, - NULL, cross, time); #if GTK_CHECK_VERSION (3, 0, 0) + display = gdk_window_get_display (root); + device_manager = gdk_display_get_device_manager (display); + pointer = gdk_device_manager_get_client_pointer (device_manager); + + status = gdk_device_grab (pointer, root, + GDK_OWNERSHIP_NONE, FALSE, + GDK_BUTTON_PRESS_MASK, + cross, time); + g_object_unref (cross); #else + status = gdk_pointer_grab (root, FALSE, GDK_BUTTON_PRESS_MASK, + NULL, cross, time); + gdk_cursor_unref (cross); #endif + if (status != GDK_GRAB_SUCCESS) { g_warning ("Pointer grab failed\n"); remove_popup (popup); diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index 76b816a8..1e0ab359 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -441,6 +441,11 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp GdkWindow *window; GdkCursorType cursor_type; GdkCursor *cursor; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDisplay *display; + GdkDevice *pointer; + GdkDeviceManager *device_manager; +#endif if (toplevel->priv->state != PANEL_STATE_NORMAL || toplevel->priv->grab_op != PANEL_GRAB_OP_NONE) @@ -494,12 +499,22 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp toplevel, toplevel->priv->grab_op); cursor = gdk_cursor_new (cursor_type); - gdk_pointer_grab (window, FALSE, - GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - NULL, cursor, time_); #if GTK_CHECK_VERSION (3, 0, 0) + display = gdk_window_get_display (window); + device_manager = gdk_display_get_device_manager (display); + pointer = gdk_device_manager_get_client_pointer (device_manager); + + gdk_device_grab (pointer, window, + GDK_OWNERSHIP_NONE, FALSE, + GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, + cursor, time_); + g_object_unref (cursor); #else + gdk_pointer_grab (window, FALSE, + GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, + NULL, cursor, time_); + gdk_cursor_unref (cursor); #endif @@ -510,6 +525,11 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) { GtkWidget *widget; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDisplay *display; + GdkDevice *pointer; + GdkDeviceManager *device_manager; +#endif g_return_if_fail (toplevel->priv->grab_op != PANEL_GRAB_OP_NONE); @@ -520,7 +540,15 @@ static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) gtk_grab_remove (widget); +#if GTK_CHECK_VERSION (3, 0, 0) + display = gtk_widget_get_display (widget); + device_manager = gdk_display_get_device_manager (display); + pointer = gdk_device_manager_get_client_pointer (device_manager); + + gdk_device_ungrab (pointer, time_); +#else gdk_pointer_ungrab (time_); +#endif gdk_keyboard_ungrab (time_); } diff --git a/mate-panel/panel-widget.c b/mate-panel/panel-widget.c index 5dd4bb43..86382746 100644 --- a/mate-panel/panel-widget.c +++ b/mate-panel/panel-widget.c @@ -2025,16 +2025,28 @@ panel_widget_applet_drag_start (PanelWidget *panel, if (window) { GdkGrabStatus status; GdkCursor *fleur_cursor; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDisplay *display; + GdkDevice *pointer; + GdkDeviceManager *device_manager; fleur_cursor = gdk_cursor_new (GDK_FLEUR); - status = gdk_pointer_grab (window, FALSE, - APPLET_EVENT_MASK, NULL, - fleur_cursor, time_); + display = gdk_window_get_display (window); + device_manager = gdk_display_get_device_manager (display); + pointer = gdk_device_manager_get_client_pointer (device_manager); + status = gdk_device_grab (pointer, window, + GDK_OWNERSHIP_NONE, FALSE, + APPLET_EVENT_MASK, + fleur_cursor, time_); -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (fleur_cursor); #else + fleur_cursor = gdk_cursor_new (GDK_FLEUR); + + status = gdk_pointer_grab (window, FALSE, + APPLET_EVENT_MASK, NULL, + fleur_cursor, time_); gdk_cursor_unref (fleur_cursor); #endif gdk_flush (); @@ -2050,11 +2062,25 @@ panel_widget_applet_drag_start (PanelWidget *panel, void panel_widget_applet_drag_end (PanelWidget *panel) { +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDisplay *display; + GdkDevice *pointer; + GdkDeviceManager *device_manager; +#endif + g_return_if_fail (PANEL_IS_WIDGET (panel)); if (panel->currently_dragged_applet == NULL) return; +#if GTK_CHECK_VERSION (3, 0, 0) + display = gtk_widget_get_display (GTK_WIDGET (panel)); + device_manager = gdk_display_get_device_manager (display); + pointer = gdk_device_manager_get_client_pointer (device_manager); + + gdk_device_ungrab (pointer, GDK_CURRENT_TIME); +#else gdk_pointer_ungrab (GDK_CURRENT_TIME); +#endif gtk_grab_remove (panel->currently_dragged_applet->applet); panel_widget_applet_drag_end_no_grab (panel); panel_toplevel_pop_autohide_disabler (panel->toplevel); |