From 5e22453ed90c748b2e0bbab0889af2f78b8aa61f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 7 Jan 2011 16:43:58 -0500 Subject: [PATCH] Add upstream patches for deprecated gdk apis --- nautilus-gdk-deprecated1.patch | 122 +++++++++++++++++ nautilus-gdk-deprecated2.patch | 230 +++++++++++++++++++++++++++++++++ nautilus-gdk-deprecated3.patch | 60 +++++++++ nautilus.spec | 8 ++ 4 files changed, 420 insertions(+) create mode 100644 nautilus-gdk-deprecated1.patch create mode 100644 nautilus-gdk-deprecated2.patch create mode 100644 nautilus-gdk-deprecated3.patch diff --git a/nautilus-gdk-deprecated1.patch b/nautilus-gdk-deprecated1.patch new file mode 100644 index 0000000..13b0306 --- /dev/null +++ b/nautilus-gdk-deprecated1.patch @@ -0,0 +1,122 @@ +From 2ff006dd583f58ff2dd687f538e59757a8bd70c4 Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +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 diff --git a/nautilus-gdk-deprecated2.patch b/nautilus-gdk-deprecated2.patch new file mode 100644 index 0000000..46c1195 --- /dev/null +++ b/nautilus-gdk-deprecated2.patch @@ -0,0 +1,230 @@ +From bd151c8174796c1c5b0b6466ef8a0e3a0e214054 Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Sun, 26 Dec 2010 15:20:00 +0000 +Subject: general: don't use deprecated gdk_app_launch_context_new() + +--- +diff --git a/eel/eel-gnome-extensions.c b/eel/eel-gnome-extensions.c +index fbe7437..73e9378 100644 +--- a/eel/eel-gnome-extensions.c ++++ b/eel/eel-gnome-extensions.c +@@ -144,7 +144,7 @@ get_terminal_command_prefix (gboolean for_command) + return command; + } + +-char * ++static char * + eel_gnome_make_terminal_command (const char *command) + { + char *prefix, *quoted, *terminal_command; +@@ -168,6 +168,7 @@ eel_gnome_open_terminal_on_screen (const char *command, + GAppInfo *app; + GdkAppLaunchContext *ctx; + GError *error = NULL; ++ GdkDisplay *display; + + command_line = eel_gnome_make_terminal_command (command); + if (command_line == NULL) { +@@ -178,7 +179,8 @@ eel_gnome_open_terminal_on_screen (const char *command, + app = g_app_info_create_from_commandline (command_line, NULL, 0, &error); + + if (app != NULL && screen != NULL) { +- ctx = gdk_app_launch_context_new (); ++ display = gdk_screen_get_display (screen); ++ ctx = gdk_display_get_app_launch_context (display); + gdk_app_launch_context_set_screen (ctx, screen); + + g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), &error); +@@ -195,9 +197,3 @@ eel_gnome_open_terminal_on_screen (const char *command, + + g_free (command_line); + } +- +-void +-eel_gnome_open_terminal (const char *command) +-{ +- eel_gnome_open_terminal_on_screen (command, NULL); +-} +diff --git a/eel/eel-gnome-extensions.h b/eel/eel-gnome-extensions.h +index 82c1374..8a00d5e 100644 +--- a/eel/eel-gnome-extensions.h ++++ b/eel/eel-gnome-extensions.h +@@ -29,11 +29,7 @@ + + #include + +-/* Return a command string containing the path to a terminal on this system. */ +-char * eel_gnome_make_terminal_command (const char *command); +- + /* Open up a new terminal, optionally passing in a command to execute */ +-void eel_gnome_open_terminal (const char *command); + void eel_gnome_open_terminal_on_screen (const char *command, + GdkScreen *screen); + +diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c +index a003b84..e2e791e 100644 +--- a/libnautilus-private/nautilus-program-choosing.c ++++ b/libnautilus-private/nautilus-program-choosing.c +@@ -95,12 +95,13 @@ nautilus_launch_application_by_uri (GAppInfo *application, + GList *uris, + GtkWindow *parent_window) + { +- char *uri; +- GList *locations, *l; ++ char *uri; ++ GList *locations, *l; + GFile *location; +- NautilusFile *file; +- gboolean result; ++ NautilusFile *file; ++ gboolean result; + GError *error; ++ GdkDisplay *display; + GdkAppLaunchContext *launch_context; + NautilusIconInfo *icon; + int count, total; +@@ -122,10 +123,18 @@ nautilus_launch_application_by_uri (GAppInfo *application, + } + locations = g_list_reverse (locations); + +- launch_context = gdk_app_launch_context_new (); +- if (parent_window) ++ if (parent_window != NULL) { ++ display = gtk_widget_get_display (GTK_WIDGET (parent_window)); ++ } else { ++ display = gdk_display_get_default (); ++ } ++ ++ launch_context = gdk_display_get_app_launch_context (display); ++ ++ if (parent_window != NULL) { + gdk_app_launch_context_set_screen (launch_context, + gtk_window_get_screen (parent_window)); ++ } + + file = nautilus_file_get_by_uri (uris->data); + icon = nautilus_file_get_icon (file, 48, 0); +@@ -168,6 +177,33 @@ nautilus_launch_application_by_uri (GAppInfo *application, + g_list_free_full (locations, g_object_unref); + } + ++static void ++launch_application_from_command_internal (const gchar *full_command, ++ GdkScreen *screen, ++ gboolean use_terminal) ++{ ++ GAppInfo *app; ++ GdkAppLaunchContext *ctx; ++ GdkDisplay *display; ++ ++ if (use_terminal) { ++ eel_gnome_open_terminal_on_screen (full_command, screen); ++ } else { ++ app = g_app_info_create_from_commandline (full_command, NULL, 0, NULL); ++ ++ if (app != NULL) { ++ display = gdk_screen_get_display (screen); ++ ctx = gdk_display_get_app_launch_context (display); ++ gdk_app_launch_context_set_screen (ctx, screen); ++ ++ g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), NULL); ++ ++ g_object_unref (app); ++ g_object_unref (ctx); ++ } ++ } ++} ++ + /** + * nautilus_launch_application_from_command: + * +@@ -188,8 +224,6 @@ nautilus_launch_application_from_command (GdkScreen *screen, + char *quoted_parameter; + char *parameter; + va_list ap; +- GAppInfo *app; +- GdkAppLaunchContext *ctx; + + full_command = g_strdup (command_string); + +@@ -207,22 +241,8 @@ nautilus_launch_application_from_command (GdkScreen *screen, + + va_end (ap); + +- if (use_terminal) { +- eel_gnome_open_terminal_on_screen (full_command, screen); +- } else { +- app = g_app_info_create_from_commandline (full_command, NULL, 0, NULL); +- +- if (app != NULL) { +- ctx = gdk_app_launch_context_new (); +- gdk_app_launch_context_set_screen (ctx, screen); +- +- g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), NULL); +- +- g_object_unref (app); +- g_object_unref (ctx); +- } +- } +- ++ launch_application_from_command_internal (full_command, screen, use_terminal); ++ + g_free (full_command); + } + +@@ -245,8 +265,6 @@ nautilus_launch_application_from_command_array (GdkScreen *screen, + char *full_command, *tmp; + char *quoted_parameter; + const char * const *p; +- GAppInfo *app; +- GdkAppLaunchContext *ctx; + + full_command = g_strdup (command_string); + +@@ -261,21 +279,7 @@ nautilus_launch_application_from_command_array (GdkScreen *screen, + } + } + +- if (use_terminal) { +- eel_gnome_open_terminal_on_screen (full_command, screen); +- } else { +- app = g_app_info_create_from_commandline (full_command, NULL, 0, NULL); +- +- if (app != NULL) { +- ctx = gdk_app_launch_context_new (); +- gdk_app_launch_context_set_screen (ctx, screen); +- +- g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), NULL); +- +- g_object_unref (app); +- g_object_unref (ctx); +- } +- } ++ launch_application_from_command_internal (full_command, screen, use_terminal); + + g_free (full_command); + } +@@ -362,7 +366,7 @@ nautilus_launch_desktop_file (GdkScreen *screen, + } + + error = NULL; +- context = gdk_app_launch_context_new (); ++ context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (parent_window))); + /* TODO: Ideally we should accept a timestamp here instead of using GDK_CURRENT_TIME */ + gdk_app_launch_context_set_timestamp (context, GDK_CURRENT_TIME); + gdk_app_launch_context_set_screen (context, +diff --git a/src/nautilus-connect-server-dialog-main.c b/src/nautilus-connect-server-dialog-main.c +index d25eaf3..8b518fe 100644 +--- a/src/nautilus-connect-server-dialog-main.c ++++ b/src/nautilus-connect-server-dialog-main.c +@@ -88,7 +88,7 @@ nautilus_connect_server_dialog_display_location_async (NautilusConnectServerDial + g_print ("%s\n", uri); + } + else { +- launch_context = gdk_app_launch_context_new (); ++ launch_context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (self))); + gdk_app_launch_context_set_screen (launch_context, + gtk_widget_get_screen (GTK_WIDGET (self))); + +-- +cgit v0.8.3.1 diff --git a/nautilus-gdk-deprecated3.patch b/nautilus-gdk-deprecated3.patch new file mode 100644 index 0000000..7962a01 --- /dev/null +++ b/nautilus-gdk-deprecated3.patch @@ -0,0 +1,60 @@ +From 70df8fad8b1ddf470e8600f6e8e9bc953853b419 Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Sun, 26 Dec 2010 15:20:23 +0000 +Subject: desktop-icon-view: don't use deprecated GDK grab API + +--- +diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c +index 20e9750..8d96f3a 100644 +--- a/src/file-manager/fm-desktop-icon-view.c ++++ b/src/file-manager/fm-desktop-icon-view.c +@@ -332,13 +332,44 @@ fm_desktop_icon_view_handle_middle_click (NautilusIconContainer *icon_container, + FMDesktopIconView *desktop_icon_view) + { + XButtonEvent x_event; +- ++ GdkDevice *keyboard = NULL, *pointer = NULL, *cur; ++ GdkDeviceManager *manager; ++ GList *list, *l; ++ ++ manager = gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (icon_container))); ++ list = gdk_device_manager_list_devices (manager, GDK_DEVICE_TYPE_MASTER); ++ ++ for (l = list; l != NULL; l = l->next) { ++ cur = l->data; ++ ++ if (pointer == NULL && (gdk_device_get_source (cur) == GDK_SOURCE_MOUSE)) { ++ pointer = cur; ++ } ++ ++ if (keyboard == NULL && (gdk_device_get_source (cur) == GDK_SOURCE_KEYBOARD)) { ++ keyboard = cur; ++ } ++ ++ if (pointer != NULL && keyboard != NULL) { ++ break; ++ } ++ } ++ ++ g_list_free (list); ++ + /* During a mouse click we have the pointer and keyboard grab. + * We will send a fake event to the root window which will cause it + * to try to get the grab so we need to let go ourselves. + */ +- gdk_pointer_ungrab (GDK_CURRENT_TIME); +- gdk_keyboard_ungrab (GDK_CURRENT_TIME); ++ ++ if (pointer != NULL) { ++ gdk_device_ungrab (pointer, GDK_CURRENT_TIME); ++ } ++ ++ ++ if (keyboard != NULL) { ++ gdk_device_ungrab (keyboard, GDK_CURRENT_TIME); ++ } + + /* Stop the event because we don't want anyone else dealing with it. */ + gdk_flush (); +-- +cgit v0.8.3.1 diff --git a/nautilus.spec b/nautilus.spec index 7744563..a71e7e0 100644 --- a/nautilus.spec +++ b/nautilus.spec @@ -77,6 +77,10 @@ Patch7: rtl-fix.patch # https://bugzilla.redhat.com/show_bug.cgi?id=583559 Patch23: nautilus-578086-po.patch +Patch31: nautilus-gdk-deprecated1.patch +Patch32: nautilus-gdk-deprecated2.patch +Patch33: nautilus-gdk-deprecated3.patch + %description Nautilus is the file manager and graphical shell for the GNOME desktop that makes it easy to manage your files and the rest of your system. @@ -113,6 +117,10 @@ for developing nautilus extensions. # %patch8 -p1 -b .hide-white-screen %patch23 -p1 -b .gu_IN-crash +%patch31 -p1 -b .deprecated-gdk1 +%patch32 -p1 -b .deprecated-gdk2 +%patch33 -p1 -b .deprecated-gdk3 + %build gtkdocize