nautilus/nautilus-gdk-deprecated1.patch
2011-01-07 16:43:58 -05:00

123 lines
3.9 KiB
Diff

From 2ff006dd583f58ff2dd687f538e59757a8bd70c4 Mon Sep 17 00:00:00 2001
From: Cosimo Cecchi <cosimoc@gnome.org>
Date: Sun, 26 Dec 2010 15:18:53 +0000
Subject: canvas: don't use deprecated GDK grab API
---
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index ba53db5..4e869d7 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -315,11 +315,7 @@ eel_canvas_item_dispose (GObject *object)
item->canvas->need_repick = TRUE;
}
- if (item == item->canvas->grabbed_item) {
- GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
- item->canvas->grabbed_item = NULL;
- gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
- }
+ eel_canvas_item_ungrab (item, GDK_CURRENT_TIME);
if (item == item->canvas->focused_item)
item->canvas->focused_item = NULL;
@@ -840,10 +836,16 @@ eel_canvas_item_hide (EelCanvasItem *item)
* returns %GDK_GRAB_NOT_VIEWABLE. Else, it returns the result of calling
* gdk_pointer_grab().
**/
-int
-eel_canvas_item_grab (EelCanvasItem *item, guint event_mask, GdkCursor *cursor, guint32 etime)
+GdkGrabStatus
+eel_canvas_item_grab (EelCanvasItem *item,
+ GdkEventMask event_mask,
+ GdkCursor *cursor,
+ guint32 timestamp)
{
- int retval;
+ GdkGrabStatus retval;
+ GdkDisplay *display;
+ GdkDeviceManager *manager;
+ GdkDevice *device;
g_return_val_if_fail (EEL_IS_CANVAS_ITEM (item), GDK_GRAB_NOT_VIEWABLE);
g_return_val_if_fail (gtk_widget_get_mapped (GTK_WIDGET (item->canvas)),
@@ -855,12 +857,17 @@ eel_canvas_item_grab (EelCanvasItem *item, guint event_mask, GdkCursor *cursor,
if (!(item->flags & EEL_CANVAS_ITEM_MAPPED))
return GDK_GRAB_NOT_VIEWABLE;
- retval = gdk_pointer_grab (gtk_layout_get_bin_window (&item->canvas->layout),
- FALSE,
- event_mask,
- NULL,
- cursor,
- etime);
+ display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
+ manager = gdk_display_get_device_manager (display);
+ device = gdk_device_manager_get_client_pointer (manager);
+
+ retval = gdk_device_grab (device,
+ gtk_layout_get_bin_window (GTK_LAYOUT (item->canvas)),
+ GDK_OWNERSHIP_NONE,
+ FALSE,
+ event_mask,
+ cursor,
+ timestamp);
if (retval != GDK_GRAB_SUCCESS)
return retval;
@@ -885,6 +892,8 @@ void
eel_canvas_item_ungrab (EelCanvasItem *item, guint32 etime)
{
GdkDisplay *display;
+ GdkDeviceManager *manager;
+ GdkDevice *device;
g_return_if_fail (EEL_IS_CANVAS_ITEM (item));
@@ -892,11 +901,13 @@ eel_canvas_item_ungrab (EelCanvasItem *item, guint32 etime)
return;
display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
+ manager = gdk_display_get_device_manager (display);
+ device = gdk_device_manager_get_client_pointer (manager);
+
item->canvas->grabbed_item = NULL;
- gdk_display_pointer_ungrab (display, etime);
+ gdk_device_ungrab (device, etime);
}
-
/**
* eel_canvas_item_w2i:
* @item: A canvas item.
@@ -2129,9 +2140,7 @@ shutdown_transients (EelCanvas *canvas)
}
if (canvas->grabbed_item) {
- GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (canvas));
- canvas->grabbed_item = NULL;
- gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
+ eel_canvas_item_ungrab (canvas->grabbed_item, GDK_CURRENT_TIME);
}
remove_idle (canvas);
diff --git a/eel/eel-canvas.h b/eel/eel-canvas.h
index 02b3b4d..bcdae80 100644
--- a/eel/eel-canvas.h
+++ b/eel/eel-canvas.h
@@ -245,8 +245,10 @@ void eel_canvas_item_hide (EelCanvasItem *item);
* grab. Time is a proper X event time parameter. Returns the same values as
* XGrabPointer().
*/
-int eel_canvas_item_grab (EelCanvasItem *item, unsigned int event_mask,
- GdkCursor *cursor, guint32 etime);
+GdkGrabStatus eel_canvas_item_grab (EelCanvasItem *item,
+ GdkEventMask event_mask,
+ GdkCursor *cursor,
+ guint32 etime);
/* Ungrabs the mouse -- the specified item must be the same that was passed to
* eel_canvas_item_grab(). Time is a proper X event time parameter.
--
cgit v0.8.3.1