diff options
author | Pablo Barciela <[email protected]> | 2018-05-14 01:25:55 +0200 |
---|---|---|
committer | Pablo Barciela <[email protected]> | 2018-05-14 01:25:55 +0200 |
commit | d6d1cdb0e241ee3a07200ad0561a8105b6243c2b (patch) | |
tree | d2f1c89b88098313cee862e503f80706cd8ff666 | |
parent | 7b7cd3f48b52cbfb3591a61e43c40492c2ac3a72 (diff) | |
download | pluma-d6d1cdb0e241ee3a07200ad0561a8105b6243c2b.tar.bz2 pluma-d6d1cdb0e241ee3a07200ad0561a8105b6243c2b.tar.xz |
pluma-notebook.c: avoid deprecated 'gdk_pointer_ ...' functions
avoid deprecated:
gdk_pointer_is_grabbed
gdk_pointer_grab
gdk_pointer_ungrab
-rw-r--r-- | pluma/pluma-notebook.c | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c index acecc0f4..5b8f388d 100644 --- a/pluma/pluma-notebook.c +++ b/pluma/pluma-notebook.c @@ -396,6 +396,14 @@ static void drag_start (PlumaNotebook *notebook, guint32 time) { + GdkSeat *seat; + GdkDevice *device; + GdkDisplay *display; + + display = gtk_widget_get_display (GTK_WIDGET (notebook)); + seat = gdk_display_get_default_seat (display); + device = gdk_seat_get_pointer (seat); + if (!leftdown) return; notebook->priv->drag_in_progress = TRUE; @@ -403,24 +411,22 @@ drag_start (PlumaNotebook *notebook, /* get a new cursor, if necessary */ /* FIXME multi-head */ if (cursor == NULL) - { - GdkDisplay *display; - display = gtk_widget_get_display (GTK_WIDGET (notebook)); cursor = gdk_cursor_new_for_display (display, GDK_FLEUR); - } /* grab the pointer */ gtk_grab_add (GTK_WIDGET (notebook)); /* FIXME multi-head */ - if (!gdk_pointer_is_grabbed ()) + if (!gdk_display_device_is_grabbed (display, device)) { - gdk_pointer_grab (gtk_widget_get_window (GTK_WIDGET (notebook)), - FALSE, - GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - NULL, - cursor, - time); + gdk_seat_grab (seat, + gtk_widget_get_window (GTK_WIDGET (notebook)), + GDK_SEAT_CAPABILITY_POINTER, + FALSE, + cursor, + NULL, + NULL, + NULL); } } @@ -524,8 +530,15 @@ move_current_tab_to_another_notebook (PlumaNotebook *src, GdkEventMotion *event, gint dest_position) { - PlumaTab *tab; - gint cur_page; + PlumaTab *tab; + gint cur_page; + GdkSeat *seat; + GdkDevice *device; + GdkDisplay *display; + + display = gtk_widget_get_display (GTK_WIDGET (GTK_NOTEBOOK (src))); + seat = gdk_display_get_default_seat (display); + device = gdk_seat_get_pointer (seat); /* This is getting tricky, the tab was dragged in a notebook * in another window of the same app, we move the tab @@ -542,9 +555,9 @@ move_current_tab_to_another_notebook (PlumaNotebook *src, /* stop drag in origin window */ /* ungrab the pointer if it's grabbed */ drag_stop (src); - if (gdk_pointer_is_grabbed ()) + if (gdk_display_device_is_grabbed (display, device)) { - gdk_pointer_ungrab (event->time); + gdk_seat_ungrab (seat); } gtk_grab_remove (GTK_WIDGET (src)); @@ -565,6 +578,14 @@ button_release_cb (PlumaNotebook *notebook, GdkEventButton *event, gpointer data) { + GdkSeat *seat; + GdkDevice *device; + GdkDisplay *display; + + display = gtk_widget_get_display (GTK_WIDGET (GTK_NOTEBOOK (notebook))); + seat = gdk_display_get_default_seat (display); + device = gdk_seat_get_pointer (seat); + if (event->button == 1) leftdown = FALSE; if (notebook->priv->drag_in_progress) @@ -588,9 +609,9 @@ button_release_cb (PlumaNotebook *notebook, } /* ungrab the pointer if it's grabbed */ - if (gdk_pointer_is_grabbed ()) + if (gdk_display_device_is_grabbed (display, device)) { - gdk_pointer_ungrab (event->time); + gdk_seat_ungrab (seat); } gtk_grab_remove (GTK_WIDGET (notebook)); } |