app: add screen and monitor to all display and image window constructors

so they appear on the proper monitor as well.
This commit is contained in:
Michael Natterer 2014-05-02 20:20:46 +02:00
parent a2f6d60a42
commit 7f23fbec34
34 changed files with 214 additions and 56 deletions

View File

@ -32,6 +32,7 @@
#include "widgets/gimpbufferview.h" #include "widgets/gimpbufferview.h"
#include "widgets/gimpcontainerview.h" #include "widgets/gimpcontainerview.h"
#include "widgets/gimpcontainerview-utils.h" #include "widgets/gimpcontainerview-utils.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h" #include "display/gimpdisplayshell.h"
@ -84,11 +85,14 @@ buffers_paste_as_new_cmd_callback (GtkAction *action,
if (image) if (image)
{ {
GtkWidget *widget = GTK_WIDGET (editor);
GimpImage *new_image; GimpImage *new_image;
new_image = gimp_image_new_from_buffer (image->gimp, image, buffer); new_image = gimp_image_new_from_buffer (image->gimp, image, buffer);
gimp_create_display (image->gimp, new_image, 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); g_object_unref (new_image);
} }
} }

View File

@ -42,6 +42,7 @@
#include "widgets/gimpmessagedialog.h" #include "widgets/gimpmessagedialog.h"
#include "widgets/gimpwidgets-utils.h" #include "widgets/gimpwidgets-utils.h"
#include "widgets/gimpwindowstrategy.h" #include "widgets/gimpwindowstrategy.h"
#include "widgets/gimpwidgets-utils.h"
#include "dialogs/data-delete-dialog.h" #include "dialogs/data-delete-dialog.h"
@ -74,12 +75,15 @@ data_open_as_image_cmd_callback (GtkAction *action,
if (uri) if (uri)
{ {
GtkWidget *widget = GTK_WIDGET (view);
GimpImage *image; GimpImage *image;
GimpPDBStatusType status; GimpPDBStatusType status;
GError *error = NULL; GError *error = NULL;
image = file_open_with_display (context->gimp, context, NULL, image = file_open_with_display (context->gimp, context, NULL,
uri, FALSE, uri, FALSE,
G_OBJECT (gtk_widget_get_screen (widget)),
gimp_widget_get_monitor (widget),
&status, &error); &status, &error);
if (! image && status != GIMP_PDB_CANCEL) if (! image && status != GIMP_PDB_CANCEL)

View File

@ -37,14 +37,14 @@
#include "gegl/gimp-gegl-utils.h" #include "gegl/gimp-gegl-utils.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpimagewindow.h"
#include "widgets/gimpaction.h" #include "widgets/gimpaction.h"
#include "widgets/gimpmenufactory.h" #include "widgets/gimpmenufactory.h"
#include "widgets/gimpuimanager.h" #include "widgets/gimpuimanager.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpimagewindow.h"
#include "menus/menus.h" #include "menus/menus.h"
#include "actions.h" #include "actions.h"
@ -314,7 +314,7 @@ debug_show_image_graph (GimpImage *source_image)
1.0, 1.0,
GIMP_NORMAL_MODE); GIMP_NORMAL_MODE);
gimp_image_add_layer (new_image, layer, NULL, 0, FALSE); 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 */ /* Cleanup */
g_object_unref (new_image); g_object_unref (new_image);

View File

@ -43,6 +43,7 @@
#include "widgets/gimpdocumentview.h" #include "widgets/gimpdocumentview.h"
#include "widgets/gimpmessagebox.h" #include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h" #include "widgets/gimpmessagedialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h" #include "display/gimpdisplay-foreach.h"
@ -343,6 +344,8 @@ documents_open_image (GtkWidget *editor,
uri = gimp_object_get_name (imagefile); uri = gimp_object_get_name (imagefile);
image = file_open_with_display (context->gimp, context, NULL, uri, FALSE, 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); &status, &error);
if (! image && status != GIMP_PDB_CANCEL) if (! image && status != GIMP_PDB_CANCEL)

View File

@ -317,7 +317,9 @@ edit_paste_as_new_cmd_callback (GtkAction *action,
{ {
Gimp *gimp; Gimp *gimp;
GimpBuffer *buffer; GimpBuffer *buffer;
GtkWidget *widget;
return_if_no_gimp (gimp, data); return_if_no_gimp (gimp, data);
return_if_no_widget (widget, data);
buffer = gimp_clipboard_get_buffer (gimp); buffer = gimp_clipboard_get_buffer (gimp);
@ -329,7 +331,9 @@ edit_paste_as_new_cmd_callback (GtkAction *action,
buffer); buffer);
g_object_unref (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); g_object_unref (image);
} }
else else

View File

@ -177,11 +177,13 @@ file_open_recent_cmd_callback (GtkAction *action,
if (imagefile) if (imagefile)
{ {
GimpDisplay *display; GimpDisplay *display;
GtkWidget *widget;
GimpProgress *progress; GimpProgress *progress;
GimpImage *image; GimpImage *image;
GimpPDBStatusType status; GimpPDBStatusType status;
GError *error = NULL; GError *error = NULL;
return_if_no_display (display, data); return_if_no_display (display, data);
return_if_no_widget (widget, data);
g_object_ref (display); g_object_ref (display);
g_object_ref (imagefile); 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), image = file_open_with_display (gimp, action_data_get_context (data),
progress, progress,
gimp_object_get_name (imagefile), FALSE, gimp_object_get_name (imagefile), FALSE,
G_OBJECT (gtk_widget_get_screen (widget)),
gimp_widget_get_monitor (widget),
&status, &error); &status, &error);
if (! image && status != GIMP_PDB_CANCEL) if (! image && status != GIMP_PDB_CANCEL)

View File

@ -551,10 +551,10 @@ image_duplicate_cmd_callback (GtkAction *action,
new_image = gimp_image_duplicate (image); new_image = gimp_image_duplicate (image);
gimp_create_display (new_image->gimp, gimp_create_display (new_image->gimp, new_image, shell->unit,
new_image, gimp_zoom_model_get_factor (shell->zoom),
shell->unit, G_OBJECT (gtk_widget_get_screen (GTK_WIDGET (shell))),
gimp_zoom_model_get_factor (shell->zoom)); gimp_widget_get_monitor (GTK_WIDGET (shell)));
g_object_unref (new_image); g_object_unref (new_image);
} }

View File

@ -29,6 +29,7 @@
#include "widgets/gimpcontainerview.h" #include "widgets/gimpcontainerview.h"
#include "widgets/gimpimageview.h" #include "widgets/gimpimageview.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h" #include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.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))) 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)));
} }
} }

View File

@ -40,6 +40,7 @@
#include "widgets/gimpmessagedialog.h" #include "widgets/gimpmessagedialog.h"
#include "widgets/gimptemplateeditor.h" #include "widgets/gimptemplateeditor.h"
#include "widgets/gimptemplateview.h" #include "widgets/gimptemplateview.h"
#include "widgets/gimpwidgets-utils.h"
#include "dialogs/template-options-dialog.h" #include "dialogs/template-options-dialog.h"
@ -82,7 +83,7 @@ templates_create_image_cmd_callback (GtkAction *action,
GimpContainer *container; GimpContainer *container;
GimpContext *context; GimpContext *context;
GimpTemplate *template; GimpTemplate *template;
return_if_no_gimp(gimp,data); return_if_no_gimp (gimp, data);
container = gimp_container_view_get_container (editor->view); container = gimp_container_view_get_container (editor->view);
context = gimp_container_view_get_context (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))) if (template && gimp_container_have (container, GIMP_OBJECT (template)))
{ {
GtkWidget *widget = GTK_WIDGET (editor);
GimpImage *image; GimpImage *image;
image = gimp_image_new_from_template (gimp, template, context); 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); g_object_unref (image);
gimp_image_new_set_last_template (gimp, template); gimp_image_new_set_last_template (gimp, template);

View File

@ -92,7 +92,9 @@ view_new_cmd_callback (GtkAction *action,
gimp_create_display (display->gimp, gimp_create_display (display->gimp,
gimp_display_get_image (display), 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 void

View File

@ -261,7 +261,9 @@ app_run (const gchar *full_prog_name,
for (i = 0; filenames[i] != NULL; i++) for (i = 0; filenames[i] != NULL; i++)
{ {
if (run_loop) 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 */);
} }
} }

View File

@ -325,13 +325,16 @@ GimpObject *
gimp_create_display (Gimp *gimp, gimp_create_display (Gimp *gimp,
GimpImage *image, GimpImage *image,
GimpUnit unit, 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 (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), 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) 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; return NULL;
} }

View File

@ -58,7 +58,9 @@ struct _GimpGui
GimpObject * (* display_create) (Gimp *gimp, GimpObject * (* display_create) (Gimp *gimp,
GimpImage *image, GimpImage *image,
GimpUnit unit, GimpUnit unit,
gdouble scale); gdouble scale,
GObject *screen,
gint monitor);
void (* display_delete) (GimpObject *display); void (* display_delete) (GimpObject *display);
void (* displays_reconnect) (Gimp *gimp, void (* displays_reconnect) (Gimp *gimp,
GimpImage *old_image, GimpImage *old_image,
@ -111,7 +113,9 @@ guint32 gimp_get_display_window_id (Gimp *gimp,
GimpObject * gimp_create_display (Gimp *gimp, GimpObject * gimp_create_display (Gimp *gimp,
GimpImage *image, GimpImage *image,
GimpUnit unit, GimpUnit unit,
gdouble scale); gdouble scale,
GObject *screen,
gint monitor);
void gimp_delete_display (Gimp *gimp, void gimp_delete_display (Gimp *gimp,
GimpObject *display); GimpObject *display);
void gimp_reconnect_displays (Gimp *gimp, void gimp_reconnect_displays (Gimp *gimp,

View File

@ -865,6 +865,7 @@ void
gimp_create_image_from_buffer (Gimp *gimp, gimp_create_image_from_buffer (Gimp *gimp,
GeglBuffer *buffer) GeglBuffer *buffer)
{ {
#if 0
GimpImage *image; GimpImage *image;
GimpLayer *layer; GimpLayer *layer;
const Babl *format; const Babl *format;
@ -888,4 +889,5 @@ gimp_create_image_from_buffer (Gimp *gimp,
gimp_image_add_layer (image, layer, NULL, -1, FALSE); gimp_image_add_layer (image, layer, NULL, -1, FALSE);
gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0); gimp_create_display (gimp, image, GIMP_UNIT_PIXEL, 1.0);
#endif
} }

View File

@ -39,6 +39,7 @@
#include "widgets/gimpfiledialog.h" #include "widgets/gimpfiledialog.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
#include "file-open-dialog.h" #include "file-open-dialog.h"
@ -216,6 +217,8 @@ file_open_dialog_open_image (GtkWidget *open_dialog,
GIMP_PROGRESS (open_dialog), GIMP_PROGRESS (open_dialog),
uri, uri, FALSE, uri, uri, FALSE,
load_proc, load_proc,
G_OBJECT (gtk_widget_get_screen (open_dialog)),
gimp_widget_get_monitor (open_dialog),
&status, &error); &status, &error);
if (! image && status != GIMP_PDB_CANCEL) if (! image && status != GIMP_PDB_CANCEL)

View File

@ -37,6 +37,7 @@
#include "widgets/gimpcontainerentry.h" #include "widgets/gimpcontainerentry.h"
#include "widgets/gimphelp-ids.h" #include "widgets/gimphelp-ids.h"
#include "widgets/gimpprogressbox.h" #include "widgets/gimpprogressbox.h"
#include "widgets/gimpwidgets-utils.h"
#include "file-open-location-dialog.h" #include "file-open-location-dialog.h"
@ -204,6 +205,8 @@ file_open_location_response (GtkDialog *dialog,
gimp_get_user_context (gimp), gimp_get_user_context (gimp),
GIMP_PROGRESS (box), GIMP_PROGRESS (box),
uri, text, FALSE, NULL, uri, text, FALSE, NULL,
G_OBJECT (gtk_widget_get_screen (entry)),
gimp_widget_get_monitor (entry),
&status, &error); &status, &error);
if (image == NULL && status != GIMP_PDB_CANCEL) if (image == NULL && status != GIMP_PDB_CANCEL)

View File

@ -41,6 +41,7 @@
#include "widgets/gimpmessagebox.h" #include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h" #include "widgets/gimpmessagedialog.h"
#include "widgets/gimptemplateeditor.h" #include "widgets/gimptemplateeditor.h"
#include "widgets/gimpwidgets-utils.h"
#include "image-new-dialog.h" #include "image-new-dialog.h"
@ -360,13 +361,17 @@ image_new_create_image (ImageNewDialog *dialog)
Gimp *gimp = dialog->context->gimp; Gimp *gimp = dialog->context->gimp;
GimpImage *image; GimpImage *image;
gtk_widget_destroy (dialog->dialog); gtk_widget_hide (dialog->dialog);
image = gimp_image_new_from_template (gimp, template, image = gimp_image_new_from_template (gimp, template,
gimp_get_user_context (gimp)); 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); g_object_unref (image);
gtk_widget_destroy (dialog->dialog);
gimp_image_new_set_last_template (gimp, template); gimp_image_new_set_last_template (gimp, template);
g_object_unref (template); g_object_unref (template);

View File

@ -393,7 +393,9 @@ gimp_display_new (Gimp *gimp,
gdouble scale, gdouble scale,
GimpMenuFactory *menu_factory, GimpMenuFactory *menu_factory,
GimpUIManager *popup_manager, GimpUIManager *popup_manager,
GimpDialogFactory *dialog_factory) GimpDialogFactory *dialog_factory,
GdkScreen *screen,
gint monitor)
{ {
GimpDisplay *display; GimpDisplay *display;
GimpDisplayPrivate *private; 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 (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), 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 there isn't an interface, never create a display */
if (gimp->no_interface) if (gimp->no_interface)
@ -443,7 +446,9 @@ gimp_display_new (Gimp *gimp,
window = gimp_image_window_new (gimp, window = gimp_image_window_new (gimp,
private->image, private->image,
menu_factory, menu_factory,
dialog_factory); dialog_factory,
screen,
monitor);
} }
/* create the shell for the image */ /* create the shell for the image */

View File

@ -55,7 +55,9 @@ GimpDisplay * gimp_display_new (Gimp *gimp,
gdouble scale, gdouble scale,
GimpMenuFactory *menu_factory, GimpMenuFactory *menu_factory,
GimpUIManager *popup_manager, GimpUIManager *popup_manager,
GimpDialogFactory *dialog_factory); GimpDialogFactory *dialog_factory,
GdkScreen *screen,
gint monitor);
void gimp_display_delete (GimpDisplay *display); void gimp_display_delete (GimpDisplay *display);
void gimp_display_close (GimpDisplay *display); void gimp_display_close (GimpDisplay *display);

View File

@ -50,6 +50,7 @@
#include "vectors/gimpvectors-import.h" #include "vectors/gimpvectors-import.h"
#include "widgets/gimpdnd.h" #include "widgets/gimpdnd.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpdisplay.h" #include "gimpdisplay.h"
#include "gimpdisplayshell.h" #include "gimpdisplayshell.h"
@ -224,7 +225,9 @@ gimp_display_shell_drop_drawable (GtkWidget *widget,
{ {
image = gimp_image_new_from_drawable (shell->display->gimp, image = gimp_image_new_from_drawable (shell->display->gimp,
GIMP_DRAWABLE (viewable)); 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); g_object_unref (image);
return; return;
@ -439,7 +442,9 @@ gimp_display_shell_drop_buffer (GtkWidget *widget,
{ {
image = gimp_image_new_from_buffer (shell->display->gimp, NULL, image = gimp_image_new_from_buffer (shell->display->gimp, NULL,
GIMP_BUFFER (viewable)); 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); g_object_unref (image);
return; return;
@ -556,6 +561,8 @@ gimp_display_shell_drop_uri_list (GtkWidget *widget,
new_image = file_open_with_display (shell->display->gimp, context, new_image = file_open_with_display (shell->display->gimp, context,
NULL, NULL,
uri, FALSE, uri, FALSE,
G_OBJECT (gtk_widget_get_screen (widget)),
gimp_widget_get_monitor (widget),
&status, &error); &status, &error);
if (! new_image && status != GIMP_PDB_CANCEL) 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, image = file_open_with_display (shell->display->gimp, context,
GIMP_PROGRESS (shell->display), GIMP_PROGRESS (shell->display),
uri, FALSE, uri, FALSE,
G_OBJECT (gtk_widget_get_screen (widget)),
gimp_widget_get_monitor (widget),
&status, &error); &status, &error);
if (! image && status != GIMP_PDB_CANCEL) 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, dest_image = gimp_image_new_from_component (image->gimp,
image, component); 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); g_object_unref (dest_image);
return; return;
@ -673,7 +684,9 @@ gimp_display_shell_drop_pixbuf (GtkWidget *widget,
{ {
image = gimp_image_new_from_pixbuf (shell->display->gimp, pixbuf, image = gimp_image_new_from_pixbuf (shell->display->gimp, pixbuf,
_("Dropped Buffer")); _("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); g_object_unref (image);
return; return;

View File

@ -86,6 +86,8 @@ enum
PROP_GIMP, PROP_GIMP,
PROP_MENU_FACTORY, PROP_MENU_FACTORY,
PROP_DIALOG_FACTORY, PROP_DIALOG_FACTORY,
PROP_INITIAL_SCREEN,
PROP_INITIAL_MONITOR
}; };
@ -112,6 +114,9 @@ struct _GimpImageWindowPrivate
GdkWindowState window_state; GdkWindowState window_state;
const gchar *entry_id; const gchar *entry_id;
GdkScreen *initial_screen;
gint initial_monitor;
}; };
typedef struct typedef struct
@ -293,6 +298,19 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
GIMP_PARAM_READWRITE | GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY)); 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)); g_type_class_add_private (klass, sizeof (GimpImageWindowPrivate));
gtk_rc_parse_string (image_window_rc_style); gtk_rc_parse_string (image_window_rc_style);
@ -460,8 +478,8 @@ gimp_image_window_constructed (GObject *object)
gimp_image_window_session_update (window, gimp_image_window_session_update (window,
NULL /*new_display*/, NULL /*new_display*/,
gimp_image_window_config_to_entry_id (config), gimp_image_window_config_to_entry_id (config),
gdk_screen_get_default (), /* FIXME monitor */ private->initial_screen,
0 /* FIXME monitor */); private->initial_monitor);
} }
static void static void
@ -527,6 +545,12 @@ gimp_image_window_set_property (GObject *object,
case PROP_DIALOG_FACTORY: case PROP_DIALOG_FACTORY:
private->dialog_factory = g_value_get_object (value); private->dialog_factory = g_value_get_object (value);
break; 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: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); 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: case PROP_DIALOG_FACTORY:
g_value_set_object (value, private->dialog_factory); g_value_set_object (value, private->dialog_factory);
break; 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: case PROP_MENU_FACTORY:
default: default:
@ -1002,7 +1032,9 @@ GimpImageWindow *
gimp_image_window_new (Gimp *gimp, gimp_image_window_new (Gimp *gimp,
GimpImage *image, GimpImage *image,
GimpMenuFactory *menu_factory, GimpMenuFactory *menu_factory,
GimpDialogFactory *dialog_factory) GimpDialogFactory *dialog_factory,
GdkScreen *screen,
gint monitor)
{ {
GimpImageWindow *window; 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_IMAGE (image) || image == NULL, NULL);
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), 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 (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, window = g_object_new (GIMP_TYPE_IMAGE_WINDOW,
"gimp", gimp, "gimp", gimp,
"menu-factory", menu_factory, "menu-factory", menu_factory,
"dialog-factory", dialog_factory, "dialog-factory", dialog_factory,
"initial-screen", screen,
"initial-monitor", monitor,
/* The window position will be overridden by the /* The window position will be overridden by the
* dialog factory, it is only really used on first * dialog factory, it is only really used on first
* startup. * startup.

View File

@ -48,7 +48,9 @@ GType gimp_image_window_get_type (void) G_GNUC_CONST;
GimpImageWindow * gimp_image_window_new (Gimp *gimp, GimpImageWindow * gimp_image_window_new (Gimp *gimp,
GimpImage *image, GimpImage *image,
GimpMenuFactory *menu_factory, GimpMenuFactory *menu_factory,
GimpDialogFactory *dialog_factory); GimpDialogFactory *dialog_factory,
GdkScreen *screen,
gint monitor);
void gimp_image_window_destroy (GimpImageWindow *window); void gimp_image_window_destroy (GimpImageWindow *window);
GimpUIManager * gimp_image_window_get_ui_manager (GimpImageWindow *window); GimpUIManager * gimp_image_window_get_ui_manager (GimpImageWindow *window);

View File

@ -416,11 +416,14 @@ file_open_with_display (Gimp *gimp,
GimpProgress *progress, GimpProgress *progress,
const gchar *uri, const gchar *uri,
gboolean as_new, gboolean as_new,
GObject *screen,
gint monitor,
GimpPDBStatusType *status, GimpPDBStatusType *status,
GError **error) GError **error)
{ {
return file_open_with_proc_and_display (gimp, context, progress, return file_open_with_proc_and_display (gimp, context, progress,
uri, uri, as_new, NULL, uri, uri, as_new, NULL,
screen, monitor,
status, error); status, error);
} }
@ -432,6 +435,8 @@ file_open_with_proc_and_display (Gimp *gimp,
const gchar *entered_filename, const gchar *entered_filename,
gboolean as_new, gboolean as_new,
GimpPlugInProcedure *file_proc, GimpPlugInProcedure *file_proc,
GObject *screen,
gint monitor,
GimpPDBStatusType *status, GimpPDBStatusType *status,
GError **error) 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_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), 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 (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); g_return_val_if_fail (status != NULL, NULL);
image = file_open_image (gimp, context, progress, image = file_open_image (gimp, context, progress,
@ -479,7 +485,8 @@ file_open_with_proc_and_display (Gimp *gimp,
g_free (basename); 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 */ /* the display owns the image now */
g_object_unref (image); g_object_unref (image);
@ -598,7 +605,10 @@ file_open_layers (Gimp *gimp,
gboolean gboolean
file_open_from_command_line (Gimp *gimp, file_open_from_command_line (Gimp *gimp,
const gchar *filename, const gchar *filename,
gboolean as_new) gboolean as_new,
GObject *screen,
gint monitor)
{ {
GError *error = NULL; GError *error = NULL;
gchar *uri; 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 (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (filename != NULL, 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 */ /* we accept URI or filename */
uri = file_utils_any_to_uri (gimp, filename, &error); 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_get_user_context (gimp),
GIMP_PROGRESS (display), GIMP_PROGRESS (display),
uri, as_new, uri, as_new,
screen, monitor,
&status, &error); &status, &error);
if (image) if (image)

View File

@ -49,6 +49,8 @@ GimpImage * file_open_with_display (Gimp *gimp,
GimpProgress *progress, GimpProgress *progress,
const gchar *uri, const gchar *uri,
gboolean as_new, gboolean as_new,
GObject *screen,
gint monitor,
GimpPDBStatusType *status, GimpPDBStatusType *status,
GError **error); GError **error);
@ -59,6 +61,8 @@ GimpImage * file_open_with_proc_and_display (Gimp *gimp,
const gchar *entered_filename, const gchar *entered_filename,
gboolean as_new, gboolean as_new,
GimpPlugInProcedure *file_proc, GimpPlugInProcedure *file_proc,
GObject *screen,
gint monitor,
GimpPDBStatusType *status, GimpPDBStatusType *status,
GError **error); GError **error);
@ -75,7 +79,9 @@ GList * file_open_layers (Gimp *gimp,
gboolean file_open_from_command_line (Gimp *gimp, gboolean file_open_from_command_line (Gimp *gimp,
const gchar *filename, const gchar *filename,
gboolean as_new); gboolean as_new,
GObject *screen,
gint monitor);
#endif /* __FILE_OPEN_H__ */ #endif /* __FILE_OPEN_H__ */

View File

@ -265,7 +265,9 @@ gimp_dbus_service_open_idle (GimpDBusService *service)
if (data) 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); gimp_dbus_service_open_data_free (data);

View File

@ -431,7 +431,9 @@ gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer,
new_image_window = gimp_image_window_new (ui_configurer->p->gimp, new_image_window = gimp_image_window_new (ui_configurer->p->gimp,
NULL, NULL,
global_menu_factory, 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 */ /* Move the shell there */
shell = gimp_image_window_get_shell (source_image_window, 1); shell = gimp_image_window_get_shell (source_image_window, 1);

View File

@ -104,7 +104,9 @@ static guint32 gui_display_get_window_id (GimpObject *display);
static GimpObject * gui_display_create (Gimp *gimp, static GimpObject * gui_display_create (Gimp *gimp,
GimpImage *image, GimpImage *image,
GimpUnit unit, GimpUnit unit,
gdouble scale); gdouble scale,
GObject *screen,
gint monitor);
static void gui_display_delete (GimpObject *display); static void gui_display_delete (GimpObject *display);
static void gui_displays_reconnect (Gimp *gimp, static void gui_displays_reconnect (Gimp *gimp,
GimpImage *old_image, GimpImage *old_image,
@ -340,11 +342,16 @@ static GimpObject *
gui_display_create (Gimp *gimp, gui_display_create (Gimp *gimp,
GimpImage *image, GimpImage *image,
GimpUnit unit, GimpUnit unit,
gdouble scale) gdouble scale,
GObject *screen,
gint monitor)
{ {
GimpContext *context = gimp_get_user_context (gimp); GimpContext *context = gimp_get_user_context (gimp);
GimpDisplay *display = GIMP_DISPLAY (gui_get_empty_display (gimp)); GimpDisplay *display = GIMP_DISPLAY (gui_get_empty_display (gimp));
if (! screen)
monitor = gimp_get_monitor_at_pointer ((GdkScreen **) &screen);
if (display) if (display)
{ {
gimp_display_fill (display, image, unit, scale); gimp_display_fill (display, image, unit, scale);
@ -358,7 +365,9 @@ gui_display_create (Gimp *gimp,
display = gimp_display_new (gimp, image, unit, scale, display = gimp_display_new (gimp, image, unit, scale,
global_menu_factory, global_menu_factory,
image_managers->data, image_managers->data,
gimp_dialog_factory_get_singleton ()); gimp_dialog_factory_get_singleton (),
GDK_SCREEN (screen),
monitor);
} }
if (gimp_context_get_display (context) == display) if (gimp_context_get_display (context) == display)

View File

@ -572,10 +572,10 @@ gui_restore_after_callback (Gimp *gimp,
GimpDisplayShell *shell; GimpDisplayShell *shell;
/* create the empty display */ /* create the empty display */
display = GIMP_DISPLAY (gimp_create_display (gimp, display = GIMP_DISPLAY (gimp_create_display (gimp, NULL,
NULL, GIMP_UNIT_PIXEL, 1.0,
GIMP_UNIT_PIXEL, NULL, /* FIXME monitor */
1.0)); 0 /* FIXME monitor */));
shell = gimp_display_get_shell (display); shell = gimp_display_get_shell (display);

View File

@ -78,7 +78,7 @@ display_new_invoker (GimpProcedure *procedure,
{ {
gimp_image_flush (image); 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) if (display)
{ {

View File

@ -138,7 +138,8 @@ gimp_test_utils_create_image (Gimp *gimp,
gimp_create_display (gimp, gimp_create_display (gimp,
image, image,
GIMP_UNIT_PIXEL, GIMP_UNIT_PIXEL,
1.0 /*scale*/); 1.0 /*scale*/,
NULL, 0);
} }
/** /**

View File

@ -582,6 +582,8 @@ gimp_session_info_restore (GimpSessionInfo *info,
monitor, monitor,
info); info);
} }
else
g_printerr ("EEEEK\n");
if (GIMP_IS_SESSION_MANAGED (dialog) && info->p->aux_info) if (GIMP_IS_SESSION_MANAGED (dialog) && info->p->aux_info)
gimp_session_managed_set_aux_info (GIMP_SESSION_MANAGED (dialog), gimp_session_managed_set_aux_info (GIMP_SESSION_MANAGED (dialog),

View File

@ -42,6 +42,7 @@
#include "gimpdnd.h" #include "gimpdnd.h"
#include "gimptoolbox.h" #include "gimptoolbox.h"
#include "gimptoolbox-dnd.h" #include "gimptoolbox-dnd.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -158,7 +159,10 @@ gimp_toolbox_drop_uri_list (GtkWidget *widget,
GError *error = NULL; GError *error = NULL;
image = file_open_with_display (context->gimp, context, 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) 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, new_image = gimp_image_new_from_drawable (context->gimp,
GIMP_DRAWABLE (viewable)); 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); g_object_unref (new_image);
} }
@ -223,7 +229,9 @@ gimp_toolbox_drop_buffer (GtkWidget *widget,
image = gimp_image_new_from_buffer (context->gimp, NULL, image = gimp_image_new_from_buffer (context->gimp, NULL,
GIMP_BUFFER (viewable)); 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); g_object_unref (image);
} }
@ -243,7 +251,9 @@ gimp_toolbox_drop_component (GtkWidget *widget,
new_image = gimp_image_new_from_component (context->gimp, new_image = gimp_image_new_from_component (context->gimp,
image, component); 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); 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, new_image = gimp_image_new_from_pixbuf (context->gimp, pixbuf,
_("Dropped Buffer")); _("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); g_object_unref (new_image);
} }

View File

@ -445,7 +445,7 @@ gimp_toolbox_button_press_event (GtkWidget *widget,
clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY); clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY);
gtk_clipboard_request_text (clipboard, gtk_clipboard_request_text (clipboard,
toolbox_paste_received, toolbox_paste_received,
g_object_ref (toolbox->p->context)); g_object_ref (toolbox));
return TRUE; return TRUE;
} }
@ -771,7 +771,8 @@ toolbox_paste_received (GtkClipboard *clipboard,
const gchar *text, const gchar *text,
gpointer data) gpointer data)
{ {
GimpContext *context = GIMP_CONTEXT (data); GimpToolbox *toolbox = GIMP_TOOLBOX (data);
GimpContext *context = toolbox->p->context;
if (text) if (text)
{ {
@ -787,12 +788,16 @@ toolbox_paste_received (GtkClipboard *clipboard,
if (strlen (copy)) if (strlen (copy))
{ {
GtkWidget *widget = GTK_WIDGET (toolbox);
GimpImage *image; GimpImage *image;
GimpPDBStatusType status; GimpPDBStatusType status;
GError *error = NULL; GError *error = NULL;
image = file_open_with_display (context->gimp, context, 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) if (! image && status != GIMP_PDB_CANCEL)
{ {

View File

@ -73,7 +73,7 @@ HELP
{ {
gimp_image_flush (image); 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) if (display)
{ {