mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-05 21:02:42 +02:00
app: improve clipboard shutdown on Windows
On Windows gtk_clipboard_store ignores the number of items we have set to be stored, instead storing all. Since this can be a long list, shutting down GIMP on Windows can take considerable time when you have a larger selection on the clipboard. So we manually stop handling every target larger than 1 (png) and even stop handling png after the first time, since it often gets called multiple times for png.
This commit is contained in:
@@ -64,6 +64,9 @@ struct _GimpClipboard
|
||||
GimpBuffer *buffer;
|
||||
gchar *svg;
|
||||
GimpCurve *curve;
|
||||
|
||||
gboolean storing;
|
||||
guint max_info;
|
||||
};
|
||||
|
||||
|
||||
@@ -113,6 +116,8 @@ gimp_clipboard_init (Gimp *gimp)
|
||||
g_return_if_fail (gimp_clip == NULL);
|
||||
|
||||
gimp_clip = gimp_clipboard_new (gimp->be_verbose);
|
||||
gimp_clip->storing = FALSE;
|
||||
gimp_clip->max_info = 1;
|
||||
|
||||
g_object_set_data_full (G_OBJECT (gimp), GIMP_CLIPBOARD_KEY,
|
||||
gimp_clip, (GDestroyNotify) gimp_clipboard_free);
|
||||
@@ -131,6 +136,9 @@ gimp_clipboard_exit (Gimp *gimp)
|
||||
if (clipboard &&
|
||||
gtk_clipboard_get_owner (clipboard) == G_OBJECT (gimp))
|
||||
{
|
||||
GimpClipboard *gimp_clip = gimp_clipboard_get (gimp);
|
||||
|
||||
gimp_clip->storing = TRUE;
|
||||
gtk_clipboard_store (clipboard);
|
||||
}
|
||||
|
||||
@@ -1166,6 +1174,27 @@ gimp_clipboard_send_image (GtkClipboard *clipboard,
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* On Windows gtk_clipboard_store ignores the number of items we have
|
||||
* set to be stored, instead storing all. Since this can be a long list,
|
||||
* shutting down GIMP on Windows can take considerable time when you
|
||||
* have a larger selection on the clipboard. So we manually stop
|
||||
* handling every target larger than 1 (png) and even stop handling
|
||||
* png after the first time, since it often gets called multiple times
|
||||
* for png.
|
||||
*/
|
||||
if (gimp_clip->storing)
|
||||
{
|
||||
if (info > gimp_clip->max_info)
|
||||
{
|
||||
gimp_unset_busy (gimp);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_clip->max_info = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gimp_pickable_flush (GIMP_PICKABLE (gimp_clip->image));
|
||||
|
||||
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (gimp_clip->image),
|
||||
|
Reference in New Issue
Block a user