diff --git a/app/actions/buffers-commands.c b/app/actions/buffers-commands.c index f288adb8b4..030020e6a0 100644 --- a/app/actions/buffers-commands.c +++ b/app/actions/buffers-commands.c @@ -32,6 +32,7 @@ #include "widgets/gimpbufferview.h" #include "widgets/gimpcontainerview.h" #include "widgets/gimpcontainerview-utils.h" +#include "widgets/gimpwidgets-utils.h" #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" @@ -84,11 +85,14 @@ buffers_paste_as_new_cmd_callback (GtkAction *action, if (image) { + GtkWidget *widget = GTK_WIDGET (editor); GimpImage *new_image; new_image = gimp_image_new_from_buffer (image->gimp, image, buffer); gimp_create_display (image->gimp, new_image, - GIMP_UNIT_PIXEL, 1.0); + GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (new_image); } } diff --git a/app/actions/data-commands.c b/app/actions/data-commands.c index badb0f0833..7479d4b486 100644 --- a/app/actions/data-commands.c +++ b/app/actions/data-commands.c @@ -42,6 +42,7 @@ #include "widgets/gimpmessagedialog.h" #include "widgets/gimpwidgets-utils.h" #include "widgets/gimpwindowstrategy.h" +#include "widgets/gimpwidgets-utils.h" #include "dialogs/data-delete-dialog.h" @@ -74,12 +75,15 @@ data_open_as_image_cmd_callback (GtkAction *action, if (uri) { + GtkWidget *widget = GTK_WIDGET (view); GimpImage *image; GimpPDBStatusType status; GError *error = NULL; image = file_open_with_display (context->gimp, context, NULL, uri, FALSE, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget), &status, &error); if (! image && status != GIMP_PDB_CANCEL) diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c index 15817846ac..474b543eb4 100644 --- a/app/actions/debug-commands.c +++ b/app/actions/debug-commands.c @@ -37,14 +37,14 @@ #include "gegl/gimp-gegl-utils.h" -#include "display/gimpdisplay.h" -#include "display/gimpdisplayshell.h" -#include "display/gimpimagewindow.h" - #include "widgets/gimpaction.h" #include "widgets/gimpmenufactory.h" #include "widgets/gimpuimanager.h" +#include "display/gimpdisplay.h" +#include "display/gimpdisplayshell.h" +#include "display/gimpimagewindow.h" + #include "menus/menus.h" #include "actions.h" @@ -314,7 +314,7 @@ debug_show_image_graph (GimpImage *source_image) 1.0, GIMP_NORMAL_MODE); gimp_image_add_layer (new_image, layer, NULL, 0, FALSE); - gimp_create_display (gimp, new_image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (gimp, new_image, GIMP_UNIT_PIXEL, 1.0, NULL, 0); /* Cleanup */ g_object_unref (new_image); diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c index b1896046e3..3b7a5f2d8d 100644 --- a/app/actions/documents-commands.c +++ b/app/actions/documents-commands.c @@ -43,6 +43,7 @@ #include "widgets/gimpdocumentview.h" #include "widgets/gimpmessagebox.h" #include "widgets/gimpmessagedialog.h" +#include "widgets/gimpwidgets-utils.h" #include "display/gimpdisplay.h" #include "display/gimpdisplay-foreach.h" @@ -343,6 +344,8 @@ documents_open_image (GtkWidget *editor, uri = gimp_object_get_name (imagefile); image = file_open_with_display (context->gimp, context, NULL, uri, FALSE, + G_OBJECT (gtk_widget_get_screen (editor)), + gimp_widget_get_monitor (editor), &status, &error); if (! image && status != GIMP_PDB_CANCEL) diff --git a/app/actions/edit-commands.c b/app/actions/edit-commands.c index 53a7a0f974..a24ef602a0 100644 --- a/app/actions/edit-commands.c +++ b/app/actions/edit-commands.c @@ -317,7 +317,9 @@ edit_paste_as_new_cmd_callback (GtkAction *action, { Gimp *gimp; GimpBuffer *buffer; + GtkWidget *widget; return_if_no_gimp (gimp, data); + return_if_no_widget (widget, data); buffer = gimp_clipboard_get_buffer (gimp); @@ -329,7 +331,9 @@ edit_paste_as_new_cmd_callback (GtkAction *action, buffer); g_object_unref (buffer); - gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (image); } else diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c index 1ea4cd5460..738cb22e8c 100644 --- a/app/actions/file-commands.c +++ b/app/actions/file-commands.c @@ -177,11 +177,13 @@ file_open_recent_cmd_callback (GtkAction *action, if (imagefile) { GimpDisplay *display; + GtkWidget *widget; GimpProgress *progress; GimpImage *image; GimpPDBStatusType status; GError *error = NULL; return_if_no_display (display, data); + return_if_no_widget (widget, data); g_object_ref (display); g_object_ref (imagefile); @@ -192,6 +194,8 @@ file_open_recent_cmd_callback (GtkAction *action, image = file_open_with_display (gimp, action_data_get_context (data), progress, gimp_object_get_name (imagefile), FALSE, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget), &status, &error); if (! image && status != GIMP_PDB_CANCEL) diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index 28c36e8ab3..1fbd692247 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -551,10 +551,10 @@ image_duplicate_cmd_callback (GtkAction *action, new_image = gimp_image_duplicate (image); - gimp_create_display (new_image->gimp, - new_image, - shell->unit, - gimp_zoom_model_get_factor (shell->zoom)); + gimp_create_display (new_image->gimp, new_image, shell->unit, + gimp_zoom_model_get_factor (shell->zoom), + G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (shell))), + gimp_widget_get_monitor (GTK_WIDGET (shell))); g_object_unref (new_image); } diff --git a/app/actions/images-commands.c b/app/actions/images-commands.c index d314a19563..f607e0efb8 100644 --- a/app/actions/images-commands.c +++ b/app/actions/images-commands.c @@ -29,6 +29,7 @@ #include "widgets/gimpcontainerview.h" #include "widgets/gimpimageview.h" +#include "widgets/gimpwidgets-utils.h" #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" @@ -84,7 +85,9 @@ images_new_view_cmd_callback (GtkAction *action, if (image && gimp_container_have (container, GIMP_OBJECT (image))) { - gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (editor))), + gimp_widget_get_monitor (GTK_WIDGET (editor))); } } diff --git a/app/actions/templates-commands.c b/app/actions/templates-commands.c index a74fb600e5..7ea6550b96 100644 --- a/app/actions/templates-commands.c +++ b/app/actions/templates-commands.c @@ -40,6 +40,7 @@ #include "widgets/gimpmessagedialog.h" #include "widgets/gimptemplateeditor.h" #include "widgets/gimptemplateview.h" +#include "widgets/gimpwidgets-utils.h" #include "dialogs/template-options-dialog.h" @@ -82,7 +83,7 @@ templates_create_image_cmd_callback (GtkAction *action, GimpContainer *container; GimpContext *context; GimpTemplate *template; - return_if_no_gimp(gimp,data); + return_if_no_gimp (gimp, data); container = gimp_container_view_get_container (editor->view); context = gimp_container_view_get_context (editor->view); @@ -91,10 +92,13 @@ templates_create_image_cmd_callback (GtkAction *action, if (template && gimp_container_have (container, GIMP_OBJECT (template))) { + GtkWidget *widget = GTK_WIDGET (editor); GimpImage *image; image = gimp_image_new_from_template (gimp, template, context); - gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0); + gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (image); gimp_image_new_set_last_template (gimp, template); diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c index 7bed4a683b..918a9df2a1 100644 --- a/app/actions/view-commands.c +++ b/app/actions/view-commands.c @@ -92,7 +92,9 @@ view_new_cmd_callback (GtkAction *action, gimp_create_display (display->gimp, gimp_display_get_image (display), - shell->unit, gimp_zoom_model_get_factor (shell->zoom)); + shell->unit, gimp_zoom_model_get_factor (shell->zoom), + G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (shell))), + gimp_widget_get_monitor (GTK_WIDGET (shell))); } void diff --git a/app/app.c b/app/app.c index 11551ee888..7c621cd281 100644 --- a/app/app.c +++ b/app/app.c @@ -261,7 +261,9 @@ app_run (const gchar *full_prog_name, for (i = 0; filenames[i] != NULL; i++) { if (run_loop) - file_open_from_command_line (gimp, filenames[i], as_new); + file_open_from_command_line (gimp, filenames[i], as_new, + NULL, /* FIXME monitor */ + 0 /* FIXME monitor */); } } diff --git a/app/core/gimp-gui.c b/app/core/gimp-gui.c index eb1e5b1908..27e1c050ec 100644 --- a/app/core/gimp-gui.c +++ b/app/core/gimp-gui.c @@ -325,13 +325,16 @@ GimpObject * gimp_create_display (Gimp *gimp, GimpImage *image, GimpUnit unit, - gdouble scale) + gdouble scale, + GObject *screen, + gint monitor) { g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL); + g_return_val_if_fail (screen == NULL || G_IS_OBJECT (screen), NULL); if (gimp->gui.display_create) - return gimp->gui.display_create (gimp, image, unit, scale); + return gimp->gui.display_create (gimp, image, unit, scale, screen, monitor); return NULL; } diff --git a/app/core/gimp-gui.h b/app/core/gimp-gui.h index 582bf19d01..be6225c1f2 100644 --- a/app/core/gimp-gui.h +++ b/app/core/gimp-gui.h @@ -58,7 +58,9 @@ struct _GimpGui GimpObject * (* display_create) (Gimp *gimp, GimpImage *image, GimpUnit unit, - gdouble scale); + gdouble scale, + GObject *screen, + gint monitor); void (* display_delete) (GimpObject *display); void (* displays_reconnect) (Gimp *gimp, GimpImage *old_image, @@ -111,7 +113,9 @@ guint32 gimp_get_display_window_id (Gimp *gimp, GimpObject * gimp_create_display (Gimp *gimp, GimpImage *image, GimpUnit unit, - gdouble scale); + gdouble scale, + GObject *screen, + gint monitor); void gimp_delete_display (Gimp *gimp, GimpObject *display); void gimp_reconnect_displays (Gimp *gimp, diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c index 5a958a6600..43f7334d38 100644 --- a/app/core/gimp-utils.c +++ b/app/core/gimp-utils.c @@ -865,6 +865,7 @@ void gimp_create_image_from_buffer (Gimp *gimp, GeglBuffer *buffer) { +#if 0 GimpImage *image; GimpLayer *layer; const Babl *format; @@ -888,4 +889,5 @@ gimp_create_image_from_buffer (Gimp *gimp, gimp_image_add_layer (image, layer, NULL, -1, FALSE); gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0); +#endif } diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c index 674ccb2b9f..08550acaa6 100644 --- a/app/dialogs/file-open-dialog.c +++ b/app/dialogs/file-open-dialog.c @@ -39,6 +39,7 @@ #include "widgets/gimpfiledialog.h" #include "widgets/gimphelp-ids.h" +#include "widgets/gimpwidgets-utils.h" #include "file-open-dialog.h" @@ -216,6 +217,8 @@ file_open_dialog_open_image (GtkWidget *open_dialog, GIMP_PROGRESS (open_dialog), uri, uri, FALSE, load_proc, + G_OBJECT (gtk_widget_get_screen (open_dialog)), + gimp_widget_get_monitor (open_dialog), &status, &error); if (! image && status != GIMP_PDB_CANCEL) diff --git a/app/dialogs/file-open-location-dialog.c b/app/dialogs/file-open-location-dialog.c index b1f4a7834f..9bbc30b88f 100644 --- a/app/dialogs/file-open-location-dialog.c +++ b/app/dialogs/file-open-location-dialog.c @@ -37,6 +37,7 @@ #include "widgets/gimpcontainerentry.h" #include "widgets/gimphelp-ids.h" #include "widgets/gimpprogressbox.h" +#include "widgets/gimpwidgets-utils.h" #include "file-open-location-dialog.h" @@ -204,6 +205,8 @@ file_open_location_response (GtkDialog *dialog, gimp_get_user_context (gimp), GIMP_PROGRESS (box), uri, text, FALSE, NULL, + G_OBJECT (gtk_widget_get_screen (entry)), + gimp_widget_get_monitor (entry), &status, &error); if (image == NULL && status != GIMP_PDB_CANCEL) diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c index 2772ec3953..0ea833df5f 100644 --- a/app/dialogs/image-new-dialog.c +++ b/app/dialogs/image-new-dialog.c @@ -41,6 +41,7 @@ #include "widgets/gimpmessagebox.h" #include "widgets/gimpmessagedialog.h" #include "widgets/gimptemplateeditor.h" +#include "widgets/gimpwidgets-utils.h" #include "image-new-dialog.h" @@ -360,13 +361,17 @@ image_new_create_image (ImageNewDialog *dialog) Gimp *gimp = dialog->context->gimp; GimpImage *image; - gtk_widget_destroy (dialog->dialog); + gtk_widget_hide (dialog->dialog); image = gimp_image_new_from_template (gimp, template, gimp_get_user_context (gimp)); - gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0); + gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0, + G_OBJECT (gtk_widget_get_screen (dialog->dialog)), + gimp_widget_get_monitor (dialog->dialog)); g_object_unref (image); + gtk_widget_destroy (dialog->dialog); + gimp_image_new_set_last_template (gimp, template); g_object_unref (template); diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index 3e0b746ea1..c94b8ab5c1 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -393,7 +393,9 @@ gimp_display_new (Gimp *gimp, gdouble scale, GimpMenuFactory *menu_factory, GimpUIManager *popup_manager, - GimpDialogFactory *dialog_factory) + GimpDialogFactory *dialog_factory, + GdkScreen *screen, + gint monitor) { GimpDisplay *display; GimpDisplayPrivate *private; @@ -402,6 +404,7 @@ gimp_display_new (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL); + g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); /* If there isn't an interface, never create a display */ if (gimp->no_interface) @@ -443,7 +446,9 @@ gimp_display_new (Gimp *gimp, window = gimp_image_window_new (gimp, private->image, menu_factory, - dialog_factory); + dialog_factory, + screen, + monitor); } /* create the shell for the image */ diff --git a/app/display/gimpdisplay.h b/app/display/gimpdisplay.h index 7296867078..21652a0f6d 100644 --- a/app/display/gimpdisplay.h +++ b/app/display/gimpdisplay.h @@ -55,7 +55,9 @@ GimpDisplay * gimp_display_new (Gimp *gimp, gdouble scale, GimpMenuFactory *menu_factory, GimpUIManager *popup_manager, - GimpDialogFactory *dialog_factory); + GimpDialogFactory *dialog_factory, + GdkScreen *screen, + gint monitor); void gimp_display_delete (GimpDisplay *display); void gimp_display_close (GimpDisplay *display); diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c index dff32e3ffd..ae2ea731cc 100644 --- a/app/display/gimpdisplayshell-dnd.c +++ b/app/display/gimpdisplayshell-dnd.c @@ -50,6 +50,7 @@ #include "vectors/gimpvectors-import.h" #include "widgets/gimpdnd.h" +#include "widgets/gimpwidgets-utils.h" #include "gimpdisplay.h" #include "gimpdisplayshell.h" @@ -224,7 +225,9 @@ gimp_display_shell_drop_drawable (GtkWidget *widget, { image = gimp_image_new_from_drawable (shell->display->gimp, GIMP_DRAWABLE (viewable)); - gimp_create_display (shell->display->gimp, image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (shell->display->gimp, image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (image); return; @@ -439,7 +442,9 @@ gimp_display_shell_drop_buffer (GtkWidget *widget, { image = gimp_image_new_from_buffer (shell->display->gimp, NULL, GIMP_BUFFER (viewable)); - gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (image); return; @@ -556,6 +561,8 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget, new_image = file_open_with_display (shell->display->gimp, context, NULL, uri, FALSE, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget), &status, &error); if (! new_image && status != GIMP_PDB_CANCEL) @@ -567,6 +574,8 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget, image = file_open_with_display (shell->display->gimp, context, GIMP_PROGRESS (shell->display), uri, FALSE, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget), &status, &error); if (! image && status != GIMP_PDB_CANCEL) @@ -617,7 +626,9 @@ gimp_display_shell_drop_component (GtkWidget *widget, { dest_image = gimp_image_new_from_component (image->gimp, image, component); - gimp_create_display (dest_image->gimp, dest_image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (dest_image->gimp, dest_image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (dest_image); return; @@ -673,7 +684,9 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget, { image = gimp_image_new_from_pixbuf (shell->display->gimp, pixbuf, _("Dropped Buffer")); - gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (image); return; diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c index 5634a87ec2..c99e4a97ec 100644 --- a/app/display/gimpimagewindow.c +++ b/app/display/gimpimagewindow.c @@ -86,6 +86,8 @@ enum PROP_GIMP, PROP_MENU_FACTORY, PROP_DIALOG_FACTORY, + PROP_INITIAL_SCREEN, + PROP_INITIAL_MONITOR }; @@ -112,6 +114,9 @@ struct _GimpImageWindowPrivate GdkWindowState window_state; const gchar *entry_id; + + GdkScreen *initial_screen; + gint initial_monitor; }; typedef struct @@ -293,6 +298,19 @@ gimp_image_window_class_init (GimpImageWindowClass *klass) GIMP_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_INITIAL_SCREEN, + g_param_spec_object ("initial-screen", + NULL, NULL, + GDK_TYPE_SCREEN, + GIMP_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_INITIAL_MONITOR, + g_param_spec_int ("initial-monitor", + NULL, NULL, + 0, 16, 0, + GIMP_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + g_type_class_add_private (klass, sizeof (GimpImageWindowPrivate)); gtk_rc_parse_string (image_window_rc_style); @@ -460,8 +478,8 @@ gimp_image_window_constructed (GObject *object) gimp_image_window_session_update (window, NULL /*new_display*/, gimp_image_window_config_to_entry_id (config), - gdk_screen_get_default (), /* FIXME monitor */ - 0 /* FIXME monitor */); + private->initial_screen, + private->initial_monitor); } static void @@ -527,6 +545,12 @@ gimp_image_window_set_property (GObject *object, case PROP_DIALOG_FACTORY: private->dialog_factory = g_value_get_object (value); break; + case PROP_INITIAL_SCREEN: + private->initial_screen = g_value_get_object (value); + break; + case PROP_INITIAL_MONITOR: + private->initial_monitor = g_value_get_int (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -551,6 +575,12 @@ gimp_image_window_get_property (GObject *object, case PROP_DIALOG_FACTORY: g_value_set_object (value, private->dialog_factory); break; + case PROP_INITIAL_SCREEN: + g_value_set_object (value, private->initial_screen); + break; + case PROP_INITIAL_MONITOR: + g_value_set_int (value, private->initial_monitor); + break; case PROP_MENU_FACTORY: default: @@ -1002,7 +1032,9 @@ GimpImageWindow * gimp_image_window_new (Gimp *gimp, GimpImage *image, GimpMenuFactory *menu_factory, - GimpDialogFactory *dialog_factory) + GimpDialogFactory *dialog_factory, + GdkScreen *screen, + gint monitor) { GimpImageWindow *window; @@ -1010,11 +1042,14 @@ gimp_image_window_new (Gimp *gimp, g_return_val_if_fail (GIMP_IS_IMAGE (image) || image == NULL, NULL); g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL); g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL); + g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); window = g_object_new (GIMP_TYPE_IMAGE_WINDOW, "gimp", gimp, "menu-factory", menu_factory, "dialog-factory", dialog_factory, + "initial-screen", screen, + "initial-monitor", monitor, /* The window position will be overridden by the * dialog factory, it is only really used on first * startup. diff --git a/app/display/gimpimagewindow.h b/app/display/gimpimagewindow.h index 14fb14ef00..ca326f990d 100644 --- a/app/display/gimpimagewindow.h +++ b/app/display/gimpimagewindow.h @@ -48,7 +48,9 @@ GType gimp_image_window_get_type (void) G_GNUC_CONST; GimpImageWindow * gimp_image_window_new (Gimp *gimp, GimpImage *image, GimpMenuFactory *menu_factory, - GimpDialogFactory *dialog_factory); + GimpDialogFactory *dialog_factory, + GdkScreen *screen, + gint monitor); void gimp_image_window_destroy (GimpImageWindow *window); GimpUIManager * gimp_image_window_get_ui_manager (GimpImageWindow *window); diff --git a/app/file/file-open.c b/app/file/file-open.c index 621e46aebf..5634b62d92 100644 --- a/app/file/file-open.c +++ b/app/file/file-open.c @@ -416,11 +416,14 @@ file_open_with_display (Gimp *gimp, GimpProgress *progress, const gchar *uri, gboolean as_new, + GObject *screen, + gint monitor, GimpPDBStatusType *status, GError **error) { return file_open_with_proc_and_display (gimp, context, progress, uri, uri, as_new, NULL, + screen, monitor, status, error); } @@ -432,6 +435,8 @@ file_open_with_proc_and_display (Gimp *gimp, const gchar *entered_filename, gboolean as_new, GimpPlugInProcedure *file_proc, + GObject *screen, + gint monitor, GimpPDBStatusType *status, GError **error) { @@ -441,6 +446,7 @@ file_open_with_proc_and_display (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); + g_return_val_if_fail (screen == NULL || G_IS_OBJECT (screen), NULL); g_return_val_if_fail (status != NULL, NULL); image = file_open_image (gimp, context, progress, @@ -479,7 +485,8 @@ file_open_with_proc_and_display (Gimp *gimp, g_free (basename); } - if (gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0)) + if (gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0, + screen, monitor)) { /* the display owns the image now */ g_object_unref (image); @@ -598,7 +605,10 @@ file_open_layers (Gimp *gimp, gboolean file_open_from_command_line (Gimp *gimp, const gchar *filename, - gboolean as_new) + gboolean as_new, + GObject *screen, + gint monitor) + { GError *error = NULL; gchar *uri; @@ -606,6 +616,7 @@ file_open_from_command_line (Gimp *gimp, g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); g_return_val_if_fail (filename != NULL, FALSE); + g_return_val_if_fail (screen == NULL || G_IS_OBJECT (screen), FALSE); /* we accept URI or filename */ uri = file_utils_any_to_uri (gimp, filename, &error); @@ -627,6 +638,7 @@ file_open_from_command_line (Gimp *gimp, gimp_get_user_context (gimp), GIMP_PROGRESS (display), uri, as_new, + screen, monitor, &status, &error); if (image) diff --git a/app/file/file-open.h b/app/file/file-open.h index d6651ba728..523a62d206 100644 --- a/app/file/file-open.h +++ b/app/file/file-open.h @@ -49,6 +49,8 @@ GimpImage * file_open_with_display (Gimp *gimp, GimpProgress *progress, const gchar *uri, gboolean as_new, + GObject *screen, + gint monitor, GimpPDBStatusType *status, GError **error); @@ -59,6 +61,8 @@ GimpImage * file_open_with_proc_and_display (Gimp *gimp, const gchar *entered_filename, gboolean as_new, GimpPlugInProcedure *file_proc, + GObject *screen, + gint monitor, GimpPDBStatusType *status, GError **error); @@ -75,7 +79,9 @@ GList * file_open_layers (Gimp *gimp, gboolean file_open_from_command_line (Gimp *gimp, const gchar *filename, - gboolean as_new); + gboolean as_new, + GObject *screen, + gint monitor); #endif /* __FILE_OPEN_H__ */ diff --git a/app/gui/gimpdbusservice.c b/app/gui/gimpdbusservice.c index 9e90c46fab..f9d00eb0aa 100644 --- a/app/gui/gimpdbusservice.c +++ b/app/gui/gimpdbusservice.c @@ -265,7 +265,9 @@ gimp_dbus_service_open_idle (GimpDBusService *service) if (data) { - file_open_from_command_line (service->gimp, data->uri, data->as_new); + file_open_from_command_line (service->gimp, data->uri, data->as_new, + NULL, /* FIXME monitor */ + 0 /* FIXME monitor */); gimp_dbus_service_open_data_free (data); diff --git a/app/gui/gimpuiconfigurer.c b/app/gui/gimpuiconfigurer.c index d53f450da5..4d051df758 100644 --- a/app/gui/gimpuiconfigurer.c +++ b/app/gui/gimpuiconfigurer.c @@ -431,7 +431,9 @@ gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer, new_image_window = gimp_image_window_new (ui_configurer->p->gimp, NULL, global_menu_factory, - gimp_dialog_factory_get_singleton ()); + gimp_dialog_factory_get_singleton (), + gtk_widget_get_screen (GTK_WIDGET (source_image_window)), + gimp_widget_get_monitor (GTK_WIDGET (source_image_window))); /* Move the shell there */ shell = gimp_image_window_get_shell (source_image_window, 1); diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c index be513d24e2..b9648764a8 100644 --- a/app/gui/gui-vtable.c +++ b/app/gui/gui-vtable.c @@ -104,7 +104,9 @@ static guint32 gui_display_get_window_id (GimpObject *display); static GimpObject * gui_display_create (Gimp *gimp, GimpImage *image, GimpUnit unit, - gdouble scale); + gdouble scale, + GObject *screen, + gint monitor); static void gui_display_delete (GimpObject *display); static void gui_displays_reconnect (Gimp *gimp, GimpImage *old_image, @@ -340,11 +342,16 @@ static GimpObject * gui_display_create (Gimp *gimp, GimpImage *image, GimpUnit unit, - gdouble scale) + gdouble scale, + GObject *screen, + gint monitor) { GimpContext *context = gimp_get_user_context (gimp); GimpDisplay *display = GIMP_DISPLAY (gui_get_empty_display (gimp)); + if (! screen) + monitor = gimp_get_monitor_at_pointer ((GdkScreen **) &screen); + if (display) { gimp_display_fill (display, image, unit, scale); @@ -358,7 +365,9 @@ gui_display_create (Gimp *gimp, display = gimp_display_new (gimp, image, unit, scale, global_menu_factory, image_managers->data, - gimp_dialog_factory_get_singleton ()); + gimp_dialog_factory_get_singleton (), + GDK_SCREEN (screen), + monitor); } if (gimp_context_get_display (context) == display) diff --git a/app/gui/gui.c b/app/gui/gui.c index 83bfd87cdc..576209e495 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -572,10 +572,10 @@ gui_restore_after_callback (Gimp *gimp, GimpDisplayShell *shell; /* create the empty display */ - display = GIMP_DISPLAY (gimp_create_display (gimp, - NULL, - GIMP_UNIT_PIXEL, - 1.0)); + display = GIMP_DISPLAY (gimp_create_display (gimp, NULL, + GIMP_UNIT_PIXEL, 1.0, + NULL, /* FIXME monitor */ + 0 /* FIXME monitor */)); shell = gimp_display_get_shell (display); diff --git a/app/pdb/display-cmds.c b/app/pdb/display-cmds.c index c2651ae5e5..89a5e1a0cd 100644 --- a/app/pdb/display-cmds.c +++ b/app/pdb/display-cmds.c @@ -78,7 +78,7 @@ display_new_invoker (GimpProcedure *procedure, { gimp_image_flush (image); - display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0); + display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL, 0); if (display) { diff --git a/app/tests/gimp-app-test-utils.c b/app/tests/gimp-app-test-utils.c index 844d0b98df..395d5a481a 100644 --- a/app/tests/gimp-app-test-utils.c +++ b/app/tests/gimp-app-test-utils.c @@ -138,7 +138,8 @@ gimp_test_utils_create_image (Gimp *gimp, gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, - 1.0 /*scale*/); + 1.0 /*scale*/, + NULL, 0); } /** diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c index 0538790970..805fe36d0c 100644 --- a/app/widgets/gimpsessioninfo.c +++ b/app/widgets/gimpsessioninfo.c @@ -582,6 +582,8 @@ gimp_session_info_restore (GimpSessionInfo *info, monitor, info); } + else + g_printerr ("EEEEK\n"); if (GIMP_IS_SESSION_MANAGED (dialog) && info->p->aux_info) gimp_session_managed_set_aux_info (GIMP_SESSION_MANAGED (dialog), diff --git a/app/widgets/gimptoolbox-dnd.c b/app/widgets/gimptoolbox-dnd.c index 449294f408..6d0d6ffa67 100644 --- a/app/widgets/gimptoolbox-dnd.c +++ b/app/widgets/gimptoolbox-dnd.c @@ -42,6 +42,7 @@ #include "gimpdnd.h" #include "gimptoolbox.h" #include "gimptoolbox-dnd.h" +#include "gimpwidgets-utils.h" #include "gimp-intl.h" @@ -158,7 +159,10 @@ gimp_toolbox_drop_uri_list (GtkWidget *widget, GError *error = NULL; image = file_open_with_display (context->gimp, context, NULL, - uri, FALSE, &status, &error); + uri, FALSE, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget), + &status, &error); if (! image && status != GIMP_PDB_CANCEL) { @@ -189,7 +193,9 @@ gimp_toolbox_drop_drawable (GtkWidget *widget, new_image = gimp_image_new_from_drawable (context->gimp, GIMP_DRAWABLE (viewable)); - gimp_create_display (context->gimp, new_image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (context->gimp, new_image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (new_image); } @@ -223,7 +229,9 @@ gimp_toolbox_drop_buffer (GtkWidget *widget, image = gimp_image_new_from_buffer (context->gimp, NULL, GIMP_BUFFER (viewable)); - gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (image); } @@ -243,7 +251,9 @@ gimp_toolbox_drop_component (GtkWidget *widget, new_image = gimp_image_new_from_component (context->gimp, image, component); - gimp_create_display (new_image->gimp, new_image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (new_image->gimp, new_image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (new_image); } @@ -262,6 +272,8 @@ gimp_toolbox_drop_pixbuf (GtkWidget *widget, new_image = gimp_image_new_from_pixbuf (context->gimp, pixbuf, _("Dropped Buffer")); - gimp_create_display (new_image->gimp, new_image, GIMP_UNIT_PIXEL, 1.0); + gimp_create_display (new_image->gimp, new_image, GIMP_UNIT_PIXEL, 1.0, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget)); g_object_unref (new_image); } diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index fe31a8e4ee..4f87b31aa4 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -445,7 +445,7 @@ gimp_toolbox_button_press_event (GtkWidget *widget, clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY); gtk_clipboard_request_text (clipboard, toolbox_paste_received, - g_object_ref (toolbox->p->context)); + g_object_ref (toolbox)); return TRUE; } @@ -771,7 +771,8 @@ toolbox_paste_received (GtkClipboard *clipboard, const gchar *text, gpointer data) { - GimpContext *context = GIMP_CONTEXT (data); + GimpToolbox *toolbox = GIMP_TOOLBOX (data); + GimpContext *context = toolbox->p->context; if (text) { @@ -787,12 +788,16 @@ toolbox_paste_received (GtkClipboard *clipboard, if (strlen (copy)) { + GtkWidget *widget = GTK_WIDGET (toolbox); GimpImage *image; GimpPDBStatusType status; GError *error = NULL; image = file_open_with_display (context->gimp, context, NULL, - copy, FALSE, &status, &error); + copy, FALSE, + G_OBJECT (gtk_widget_get_screen (widget)), + gimp_widget_get_monitor (widget), + &status, &error); if (! image && status != GIMP_PDB_CANCEL) { diff --git a/tools/pdbgen/pdb/display.pdb b/tools/pdbgen/pdb/display.pdb index ca0fa6b027..96061914bc 100644 --- a/tools/pdbgen/pdb/display.pdb +++ b/tools/pdbgen/pdb/display.pdb @@ -73,7 +73,7 @@ HELP { gimp_image_flush (image); - display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0); + display = gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0, NULL, 0); if (display) {