[gnome-flashback] screenshot: avoid deprecated GdkDeviceManager
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] screenshot: avoid deprecated GdkDeviceManager
- Date: Sat, 19 Dec 2015 20:59:05 +0000 (UTC)
commit e2e26f4cac594f96ea0f3c762510b7659d936be4
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Dec 19 22:46:39 2015 +0200
screenshot: avoid deprecated GdkDeviceManager
gnome-flashback/libscreenshot/gf-screenshot.c | 12 ++++----
gnome-flashback/libscreenshot/gf-select-area.c | 33 ++++++------------------
2 files changed, 14 insertions(+), 31 deletions(-)
---
diff --git a/gnome-flashback/libscreenshot/gf-screenshot.c b/gnome-flashback/libscreenshot/gf-screenshot.c
index 230ae67..d215a45 100644
--- a/gnome-flashback/libscreenshot/gf-screenshot.c
+++ b/gnome-flashback/libscreenshot/gf-screenshot.c
@@ -424,11 +424,11 @@ find_current_window (GdkDisplay *display)
if (window == NULL)
{
- GdkDeviceManager *manager;
+ GdkSeat *seat;
GdkDevice *device;
- manager = gdk_display_get_device_manager (display);
- device = gdk_device_manager_get_client_pointer (manager);
+ seat = gdk_display_get_default_seat (display);
+ device = gdk_seat_get_pointer (seat);
window = gdk_device_get_window_at_position (device, NULL, NULL);
@@ -634,7 +634,7 @@ take_screenshot_real (GfScreenshot *screenshot,
if (cursor_pixbuf != NULL)
{
- GdkDeviceManager *manager;
+ GdkSeat *seat;
GdkDevice *device;
GdkRectangle rect;
gint cx;
@@ -642,8 +642,8 @@ take_screenshot_real (GfScreenshot *screenshot,
gint xhot;
gint yhot;
- manager = gdk_display_get_device_manager (display);
- device = gdk_device_manager_get_client_pointer (manager);
+ seat = gdk_display_get_default_seat (display);
+ device = gdk_seat_get_pointer (seat);
if (wm_window != NULL)
gdk_window_get_device_position (wm_window, device, &cx, &cy, NULL);
diff --git a/gnome-flashback/libscreenshot/gf-select-area.c b/gnome-flashback/libscreenshot/gf-select-area.c
index c3152ca..f477f30 100644
--- a/gnome-flashback/libscreenshot/gf-select-area.c
+++ b/gnome-flashback/libscreenshot/gf-select-area.c
@@ -282,10 +282,9 @@ gf_select_area_select (GfSelectArea *select_area,
{
GdkDisplay *display;
GdkCursor *cursor;
- GdkDeviceManager *manager;
- GdkDevice *pointer;
- GdkDevice *keyboard;
+ GdkSeat *seat;
GdkWindow *window;
+ GdkSeatCapabilities capabilities;
GdkGrabStatus status;
*x = *y = *width = *height = 0;
@@ -294,40 +293,24 @@ gf_select_area_select (GfSelectArea *select_area,
display = gdk_display_get_default ();
cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
- manager = gdk_display_get_device_manager (display);
- pointer = gdk_device_manager_get_client_pointer (manager);
- keyboard = gdk_device_get_associated_device (pointer);
+ seat = gdk_display_get_default_seat (display);
window = gtk_widget_get_window (select_area->window);
- status = gdk_device_grab (pointer, window, GDK_OWNERSHIP_NONE, FALSE,
- GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK,
- cursor, GDK_CURRENT_TIME);
+ capabilities = GDK_SEAT_CAPABILITY_POINTER |
+ GDK_SEAT_CAPABILITY_KEYBOARD;
- if (status != GDK_GRAB_SUCCESS)
- {
- g_object_unref (cursor);
- return FALSE;
- }
-
- if (gdk_display_device_is_grabbed (display, keyboard))
- gdk_device_ungrab (keyboard, GDK_CURRENT_TIME);
-
- status = gdk_device_grab (keyboard, window, GDK_OWNERSHIP_NONE, FALSE,
- GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
- NULL, GDK_CURRENT_TIME);
+ status = gdk_seat_grab (seat, window, capabilities, FALSE, cursor,
+ NULL, NULL, NULL);
if (status != GDK_GRAB_SUCCESS)
{
- gdk_device_ungrab (pointer, GDK_CURRENT_TIME);
g_object_unref (cursor);
return FALSE;
}
gtk_main ();
- gdk_device_ungrab (pointer, GDK_CURRENT_TIME);
- gdk_device_ungrab (keyboard, GDK_CURRENT_TIME);
+ gdk_seat_ungrab (seat);
if (select_area->selected == FALSE)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]