diff options
author | Alexander Larsson <alexl@redhat.com> | 2002-11-21 15:55:08 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2002-11-21 15:55:08 +0000 |
commit | 16ed971719c16afcdb634c11304e1f66643fa9af (patch) | |
tree | 3485a8c29efc5338b2900f47296b8a400fad7535 | |
parent | 3a120e41f61e61f615be901f0fd90d2b385d0606 (diff) | |
download | nautilus-16ed971719c16afcdb634c11304e1f66643fa9af.tar.gz |
Only set image of required size, when now pixmap needed, kill old pixmap
2002-11-21 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-directory-background.c:
(image_loading_done_callback): Only set image of required size,
when now pixmap needed, kill old pixmap and set color.
(free_root_pixmap): New function to free root background image
Patch from Brian.Cameron@sun.com
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | libnautilus-private/nautilus-directory-background.c | 98 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 19 |
3 files changed, 103 insertions, 23 deletions
@@ -1,3 +1,12 @@ +2002-11-21 Alexander Larsson <alexl@redhat.com> + + * libnautilus-private/nautilus-directory-background.c: + (image_loading_done_callback): Only set image of required size, + when now pixmap needed, kill old pixmap and set color. + (free_root_pixmap): New function to free root background image + + Patch from Brian.Cameron@sun.com + 2002-11-20 Anders Carlsson <andersca@gnu.org> * components/Makefile.am: diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c index 7eefbe553..378410268 100644 --- a/libnautilus-private/nautilus-directory-background.c +++ b/libnautilus-private/nautilus-directory-background.c @@ -494,16 +494,64 @@ set_root_pixmap (GdkPixmap *pixmap, GdkScreen *screen) XFlush (display); } + +/* Free the root pixmap */ +static void +free_root_pixmap (GdkScreen *screen) +{ + gulong nitems; + Atom type; + gint format; + int result; + int screen_num; + guchar *data_esetroot; + gulong bytes_after; + Display *display; + + screen_num = gdk_screen_get_number (screen); + display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); + data_esetroot = NULL; + + XGrabServer (display); + + result = XGetWindowProperty (display, RootWindow (display, screen_num), + gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"), + 0L, 1L, False, XA_PIXMAP, + &type, &format, &nitems, &bytes_after, + &data_esetroot); + + if (data_esetroot != NULL) { + if (result == Success && type == XA_PIXMAP && format == 32 && nitems == 1) { + gdk_error_trap_push (); + XKillClient (display, *(Pixmap *)data_esetroot); + gdk_flush (); + gdk_error_trap_pop (); + } + XFree (data_esetroot); + } + + XDeleteProperty (display, RootWindow (display, screen_num), + gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID")); + XDeleteProperty (display, RootWindow (display, screen_num), + gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID")); + + XUngrabServer (display); + XFlush (display); +} static void image_loading_done_callback (EelBackground *background, gboolean successful_load, void *disconnect_signal) { - int width; - int height; + int entire_width; + int entire_height; + int pixmap_width; + int pixmap_height; GdkGC *gc; GdkPixmap *pixmap; GdkWindow *background_window; GdkScreen *screen; + GdkColor parsed_color; + char * color_string; if (GPOINTER_TO_INT (disconnect_signal)) { g_signal_handlers_disconnect_by_func @@ -515,26 +563,34 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load screen = g_object_get_data (G_OBJECT (background), "screen"); if (screen == NULL) return; - width = gdk_screen_get_width (screen); - height = gdk_screen_get_height (screen); - - pixmap = make_root_pixmap (screen, width, height); - if (pixmap == NULL) { - return; - } + entire_width = gdk_screen_get_width (screen); + entire_height = gdk_screen_get_height (screen); + + if (eel_background_get_suggested_pixmap_size (background, entire_width, entire_height, + &pixmap_width, &pixmap_height)) { + pixmap = make_root_pixmap (screen, pixmap_width, pixmap_height); + if (pixmap == NULL) { + return; + } - gc = gdk_gc_new (pixmap); - eel_background_draw_to_drawable (background, pixmap, gc, 0, 0, width, height, width, height); - g_object_unref (gc); - - set_root_pixmap (pixmap, screen); - - background_window = background_get_desktop_background_window (background); - if (background_window != NULL && - gdk_drawable_get_depth (background_window) == gdk_drawable_get_depth (pixmap)) - gdk_window_set_back_pixmap (background_window, pixmap, FALSE); - - g_object_unref (pixmap); + gc = gdk_gc_new (pixmap); + eel_background_draw_to_drawable (background, pixmap, gc, 0, 0, pixmap_width, pixmap_height, + entire_width, entire_height); + g_object_unref (gc); + set_root_pixmap (pixmap, screen); + g_object_unref (pixmap); + + } else { + free_root_pixmap (screen); + background_window = background_get_desktop_background_window (background); + color_string = eel_background_get_color (background); + + if (background_window != NULL && color_string != NULL) { + if (eel_gdk_color_parse (color_string, &parsed_color)) { + gdk_window_set_background (background_window, &parsed_color); + } + } + } } static void diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index 234832d87..931f459f2 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -1695,6 +1695,8 @@ nautilus_file_operations_copy_move (const GList *item_uris, gboolean target_is_trash; gboolean is_desktop_trash_link; gboolean duplicate; + gboolean target_is_mapping; + gboolean have_nonlocal_source; IconPositionIterator *icon_position_iterator; @@ -1705,12 +1707,17 @@ nautilus_file_operations_copy_move (const GList *item_uris, result = GNOME_VFS_OK; target_is_trash = FALSE; + target_is_mapping = FALSE; if (target_dir != NULL) { if (eel_uri_is_trash (target_dir)) { target_is_trash = TRUE; } else { target_dir_uri = gnome_vfs_uri_new (target_dir); } + if (strncmp (target_dir, "burn:", 5) == 0) { + target_is_mapping = TRUE; + } + } /* Build the source and target URI lists and figure out if all @@ -1718,6 +1725,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, */ source_uri_list = NULL; target_uri_list = NULL; + have_nonlocal_source = FALSE; duplicate = copy_action != GDK_ACTION_MOVE; for (p = item_uris; p != NULL; p = p->next) { /* Filter out special Nautilus link files */ @@ -1734,6 +1742,11 @@ nautilus_file_operations_copy_move (const GList *item_uris, if (source_uri == NULL) { continue; } + + if (strcmp (source_uri->method_string, "file") != 0) { + have_nonlocal_source = TRUE; + } + source_dir_uri = gnome_vfs_uri_get_parent (source_uri); target_uri = NULL; if (target_dir != NULL) { @@ -1794,8 +1807,10 @@ nautilus_file_operations_copy_move (const GList *item_uris, source_uri_list = g_list_reverse (source_uri_list); target_uri_list = g_list_reverse (target_uri_list); - - if (copy_action == GDK_ACTION_MOVE) { + if (target_is_mapping && !have_nonlocal_source && (copy_action == GDK_ACTION_COPY || copy_action == GDK_ACTION_MOVE)) { + copy_action = GDK_ACTION_LINK; + } + if (copy_action == GDK_ACTION_MOVE && !target_is_mapping) { move_options |= GNOME_VFS_XFER_REMOVESOURCE; } else if (copy_action == GDK_ACTION_LINK) { move_options |= GNOME_VFS_XFER_LINK_ITEMS; |