Commit 843866e7 authored by Michael Natterer's avatar Michael Natterer 😴

app: make things behave more reasonable with multiple monitors

There is now a preference option that determines whether windows
should be opened on the same monitor as before. It should be disabled
when the machine gets monitors plugged/unplugged dynamically ("laptop")
and enabled when there is a static multi-monitor setup ("wokstation").
This is merely the current simplistic policy on top of the newly added
underlying infrastructure:

- pass integer monitor numbers around in all places where we already
  pass around a GdkScreen. Pass the "current" monitor to these changed
  APIs, where "current" is either the monitor where the action-triggering
  widget is, or if that is unavailable the monitor where the mouse is.

- add gimp_widget_get_monitor() in order to easily get to the monitor,
  just like gtk_widget_get_screen().

- add screen and monitor parameters in some places that were missed
  before.

- in sessionrc, save all window positions relative to the window's
  monitor, and save the monitor separately, if it's not the screen's
  primary monitor.

- when restoring window positions, use the stored monitor when the new
  prefs options says so (use the screen's primary monitor if there is
  no stored monitor), otherwise use current monitor that is now passed
  around.
parent 16819917
......@@ -40,6 +40,7 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimpwindowstrategy.h"
#include "dialogs/data-delete-dialog.h"
......@@ -255,7 +256,8 @@ data_edit_cmd_callback (GtkAction *action,
if (data && gimp_data_factory_view_have (view,
GIMP_OBJECT (data)))
{
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (view));
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (view));
gint monitor = gimp_widget_get_monitor (GTK_WIDGET (view));
GtkWidget *dockable;
dockable =
......@@ -263,6 +265,7 @@ data_edit_cmd_callback (GtkAction *action,
context->gimp,
gimp_dialog_factory_get_singleton (),
screen,
monitor,
value);
gimp_data_editor_set_data (GIMP_DATA_EDITOR (gtk_bin_get_child (GTK_BIN (dockable))),
......
......@@ -27,6 +27,7 @@
#include "core/gimp.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimpwindowstrategy.h"
#include "actions.h"
......@@ -46,6 +47,7 @@ dialogs_create_toplevel_cmd_callback (GtkAction *action,
if (value)
gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
NULL /*ui_manager*/,
value, -1, TRUE);
}
......@@ -65,5 +67,6 @@ dialogs_create_dockable_cmd_callback (GtkAction *action,
gimp,
gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
value);
}
......@@ -44,6 +44,7 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimpwindowstrategy.h"
#include "display/gimpdisplay.h"
......@@ -468,6 +469,7 @@ edit_named_paste_cmd_callback (GtkAction *action,
gimp,
gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-buffer-list|gimp-buffer-grid");
}
......
......@@ -48,6 +48,7 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
......@@ -150,6 +151,7 @@ file_open_location_cmd_callback (GtkAction *action,
gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
NULL /*ui_manager*/,
"gimp-file-open-location-dialog", -1, TRUE);
}
......@@ -473,6 +475,7 @@ file_close_all_cmd_callback (GtkAction *action,
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-close-all-dialog", -1);
}
}
......@@ -512,6 +515,7 @@ file_open_dialog_show (Gimp *gimp,
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (parent),
gimp_widget_get_monitor (parent),
NULL /*ui_manager*/,
"gimp-file-open-dialog", -1, FALSE);
......@@ -556,6 +560,7 @@ file_save_dialog_show (Gimp *gimp,
{
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (parent),
gimp_widget_get_monitor (parent),
NULL /*ui_manager*/,
"gimp-file-save-dialog",
-1, FALSE);
......@@ -644,6 +649,7 @@ file_export_dialog_show (Gimp *gimp,
{
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (parent),
gimp_widget_get_monitor (parent),
NULL /*ui_manager*/,
"gimp-file-export-dialog",
-1, FALSE);
......
......@@ -50,6 +50,7 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpdock.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
......@@ -140,6 +141,7 @@ image_new_cmd_callback (GtkAction *action,
dialog = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
NULL /*ui_manager*/,
"gimp-image-new-dialog", -1, FALSE);
......
......@@ -34,6 +34,7 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpview.h"
#include "widgets/gimpwidgets-utils.h"
#include "actions.h"
#include "palettes-commands.h"
......@@ -59,6 +60,7 @@ palettes_import_cmd_callback (GtkAction *action,
gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
NULL /*ui_manager*/,
"gimp-palette-import-dialog", -1, TRUE);
}
......
......@@ -33,6 +33,7 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimpwindowstrategy.h"
#include "display/gimpdisplay.h"
......@@ -322,6 +323,7 @@ select_save_cmd_callback (GtkAction *action,
image->gimp,
gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-channel-list");
}
......
......@@ -42,6 +42,7 @@
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimptooloptionseditor.h"
#include "widgets/gimpuimanager.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimpwindowstrategy.h"
#include "dialogs/data-delete-dialog.h"
......@@ -243,6 +244,7 @@ tool_options_show_preset_editor (Gimp *gimp,
gimp,
gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (GTK_WIDGET (editor)),
gimp_widget_get_monitor (GTK_WIDGET (editor)),
"gimp-tool-preset-editor");
gimp_data_editor_set_data (GIMP_DATA_EDITOR (gtk_bin_get_child (GTK_BIN (dockable))),
......
......@@ -38,6 +38,7 @@
#include "widgets/gimpdock.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpuimanager.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimpwindowstrategy.h"
#include "display/gimpdisplay.h"
......@@ -392,6 +393,7 @@ view_navigation_window_cmd_callback (GtkAction *action,
gimp,
gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (GTK_WIDGET (shell)),
gimp_widget_get_monitor (GTK_WIDGET (shell)),
"gimp-navigation-view");
}
......
......@@ -167,7 +167,9 @@ windows_open_recent_cmd_callback (GtkAction *action,
GimpSessionInfo *info;
GimpDialogFactoryEntry *entry;
Gimp *gimp;
GtkWidget *widget;
return_if_no_gimp (gimp, data);
return_if_no_widget (widget, data);
info = g_object_get_data (G_OBJECT (action), "info");
entry = gimp_session_info_get_factory_entry (info);
......@@ -190,7 +192,9 @@ windows_open_recent_cmd_callback (GtkAction *action,
gimp_dialog_factory_add_session_info (gimp_dialog_factory_get_singleton (),
info);
gimp_session_info_restore (info, gimp_dialog_factory_get_singleton ());
gimp_session_info_restore (info, gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget));
g_object_unref (info);
}
......@@ -49,6 +49,7 @@ enum
PROP_SAVE_DEVICE_STATUS,
PROP_SAVE_SESSION_INFO,
PROP_RESTORE_SESSION,
PROP_RESTORE_MONITOR,
PROP_SAVE_TOOL_OPTIONS,
PROP_SHOW_TOOLTIPS,
PROP_TEAROFF_MENUS,
......@@ -146,6 +147,10 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
"restore-session", RESTORE_SESSION_BLURB,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RESTORE_MONITOR,
"restore-monitor", RESTORE_MONITOR_BLURB,
FALSE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAVE_TOOL_OPTIONS,
"save-tool-options",
SAVE_TOOL_OPTIONS_BLURB,
......@@ -386,6 +391,9 @@ gimp_gui_config_set_property (GObject *object,
case PROP_RESTORE_SESSION:
gui_config->restore_session = g_value_get_boolean (value);
break;
case PROP_RESTORE_MONITOR:
gui_config->restore_monitor = g_value_get_boolean (value);
break;
case PROP_SAVE_TOOL_OPTIONS:
gui_config->save_tool_options = g_value_get_boolean (value);
break;
......@@ -521,6 +529,9 @@ gimp_gui_config_get_property (GObject *object,
case PROP_RESTORE_SESSION:
g_value_set_boolean (value, gui_config->restore_session);
break;
case PROP_RESTORE_MONITOR:
g_value_set_boolean (value, gui_config->restore_monitor);
break;
case PROP_SAVE_TOOL_OPTIONS:
g_value_set_boolean (value, gui_config->save_tool_options);
break;
......
......@@ -43,6 +43,7 @@ struct _GimpGuiConfig
gboolean save_device_status;
gboolean save_session_info;
gboolean restore_session;
gboolean restore_monitor;
gboolean save_tool_options;
gboolean show_tooltips;
gboolean tearoff_menus;
......
......@@ -294,6 +294,11 @@ N_("When enabled, the image window will automatically resize itself " \
#define RESTORE_SESSION_BLURB \
N_("Let GIMP try to restore your last saved session on each startup.")
#define RESTORE_MONITOR_BLURB \
N_("When enabled, GIMP will try to restore windows on the monitor they " \
"were open before. When disabled, windows will appear on the currently " \
"used monitor.")
#define SAVE_DEVICE_STATUS_BLURB \
N_("Remember the current tool, pattern, color, and brush across GIMP " \
"sessions.")
......
......@@ -212,9 +212,11 @@ GimpContainer *global_recent_docks = NULL;
static GtkWidget * dialogs_restore_dialog (GimpDialogFactory *factory,
GdkScreen *screen,
gint monitor,
GimpSessionInfo *info);
static GtkWidget * dialogs_restore_window (GimpDialogFactory *factory,
GdkScreen *screen,
gint monitor,
GimpSessionInfo *info);
......@@ -422,6 +424,7 @@ static const GimpDialogFactoryEntry entries[] =
* dialogs_restore_dialog:
* @factory:
* @screen:
* @monitor:
* @info:
*
* Creates a top level widget based on the given session info object
......@@ -433,6 +436,7 @@ static const GimpDialogFactoryEntry entries[] =
static GtkWidget *
dialogs_restore_dialog (GimpDialogFactory *factory,
GdkScreen *screen,
gint monitor,
GimpSessionInfo *info)
{
GtkWidget *dialog;
......@@ -443,7 +447,7 @@ dialogs_restore_dialog (GimpDialogFactory *factory,
info);
dialog =
gimp_dialog_factory_dialog_new (factory, screen,
gimp_dialog_factory_dialog_new (factory, screen, monitor,
NULL /*ui_manager*/,
gimp_session_info_get_factory_entry (info)->identifier,
gimp_session_info_get_factory_entry (info)->view_size,
......@@ -461,17 +465,19 @@ dialogs_restore_dialog (GimpDialogFactory *factory,
* dialogs_restore_window:
* @factory:
* @screen:
* @monitor:
* @info:
*
* "restores" the image window. We don't really restore anything since
* the image window is created earlier, so we just look for and return
* the already-created image window.
*
* Returns:
* Returns:
**/
static GtkWidget *
dialogs_restore_window (GimpDialogFactory *factory,
GdkScreen *screen,
gint monitor,
GimpSessionInfo *info)
{
Gimp *gimp = gimp_dialog_factory_get_context (factory)->gimp;
......
......@@ -492,6 +492,7 @@ prefs_input_devices_dialog (GtkWidget *widget,
{
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-input-devices-dialog", 0);
}
......@@ -501,6 +502,7 @@ prefs_keyboard_shortcuts_dialog (GtkWidget *widget,
{
gimp_dialog_factory_dialog_raise (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (widget),
gimp_widget_get_monitor (widget),
"gimp-keyboard-shortcuts-dialog", 0);
}
......@@ -2509,6 +2511,9 @@ prefs_dialog_new (Gimp *gimp,
prefs_check_button_add (object, "save-session-info",
_("_Save window positions on exit"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "restore-monitor",
_("Open windows on the same _monitor they were open before"),
GTK_BOX (vbox2));
button = prefs_button_add (GTK_STOCK_SAVE,
_("Save Window Positions _Now"),
......
......@@ -49,6 +49,7 @@
#include "widgets/gimptoolbox.h"
#include "widgets/gimpuimanager.h"
#include "widgets/gimpview.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpdisplay.h"
#include "gimpdisplay-foreach.h"
......@@ -178,10 +179,14 @@ static void gimp_image_window_config_notify (GimpImageWindow *win
GimpGuiConfig *config);
static void gimp_image_window_session_clear (GimpImageWindow *window);
static void gimp_image_window_session_apply (GimpImageWindow *window,
const gchar *entry_id);
const gchar *entry_id,
GdkScreen *screen,
gint monitor);
static void gimp_image_window_session_update (GimpImageWindow *window,
GimpDisplay *new_display,
const gchar *new_entry_id);
const gchar *new_entry_id,
GdkScreen *screen,
gint monitor);
static const gchar *
gimp_image_window_config_to_entry_id (GimpGuiConfig *config);
static void gimp_image_window_show_tooltip (GimpUIManager *manager,
......@@ -454,7 +459,9 @@ gimp_image_window_constructed (GObject *object)
gimp_image_window_session_update (window,
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 */
0 /* FIXME monitor */);
}
static void
......@@ -1645,7 +1652,9 @@ gimp_image_window_config_notify (GimpImageWindow *window,
{
gimp_image_window_session_update (window,
NULL /*new_display*/,
gimp_image_window_config_to_entry_id (config));
gimp_image_window_config_to_entry_id (config),
gtk_widget_get_screen (GTK_WIDGET (window)),
gimp_widget_get_monitor (GTK_WIDGET (window)));
}
}
......@@ -1765,7 +1774,9 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
gimp_image_window_session_update (window,
active_display,
NULL /*new_entry_id*/);
NULL /*new_entry_id*/,
gtk_widget_get_screen (GTK_WIDGET (window)),
gimp_widget_get_monitor (GTK_WIDGET (window)));
gimp_context_set_display (gimp_get_user_context (private->gimp),
active_display);
......@@ -1861,7 +1872,9 @@ gimp_image_window_image_notify (GimpDisplay *display,
gimp_image_window_session_update (window,
display,
NULL /*new_entry_id*/);
NULL /*new_entry_id*/,
gtk_widget_get_screen (GTK_WIDGET (window)),
gimp_widget_get_monitor (GTK_WIDGET (window)));
tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (private->notebook),
GTK_WIDGET (gimp_display_get_shell (display)));
......@@ -1888,7 +1901,9 @@ gimp_image_window_session_clear (GimpImageWindow *window)
static void
gimp_image_window_session_apply (GimpImageWindow *window,
const gchar *entry_id)
const gchar *entry_id,
GdkScreen *screen,
gint monitor)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
GimpSessionInfo *session_info = NULL;
......@@ -1921,7 +1936,9 @@ gimp_image_window_session_apply (GimpImageWindow *window,
gimp_dialog_factory_add_foreign (private->dialog_factory,
entry_id,
GTK_WIDGET (window));
GTK_WIDGET (window),
screen,
monitor);
gtk_window_unmaximize (GTK_WINDOW (window));
gtk_window_resize (GTK_WINDOW (window), width, height);
......@@ -1930,7 +1947,9 @@ gimp_image_window_session_apply (GimpImageWindow *window,
static void
gimp_image_window_session_update (GimpImageWindow *window,
GimpDisplay *new_display,
const gchar *new_entry_id)
const gchar *new_entry_id,
GdkScreen *screen,
gint monitor)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
......@@ -1946,7 +1965,8 @@ gimp_image_window_session_update (GimpImageWindow *window,
*/
if (strcmp (new_entry_id, GIMP_SINGLE_IMAGE_WINDOW_ENTRY_ID) == 0)
{
gimp_image_window_session_apply (window, new_entry_id);
gimp_image_window_session_apply (window, new_entry_id,
screen, monitor);
}
}
else if (strcmp (private->entry_id, new_entry_id) != 0)
......@@ -1966,7 +1986,8 @@ gimp_image_window_session_update (GimpImageWindow *window,
! gimp_display_get_image (private->active_shell->display) &&
g_list_length (private->shells) <= 1)
{
gimp_image_window_session_apply (window, new_entry_id);
gimp_image_window_session_apply (window, new_entry_id,
screen, monitor);
}
}
else if (strcmp (new_entry_id, GIMP_SINGLE_IMAGE_WINDOW_ENTRY_ID) == 0)
......@@ -1975,7 +1996,8 @@ gimp_image_window_session_update (GimpImageWindow *window,
* shall session manage ourself until single-window mode
* is exited
*/
gimp_image_window_session_apply (window, new_entry_id);
gimp_image_window_session_apply (window, new_entry_id,
screen, monitor);
}
}
......@@ -2002,7 +2024,8 @@ gimp_image_window_session_update (GimpImageWindow *window,
/* As soon as we have no image (and no other shells that may
* contain images) we should become the empty image window
*/
gimp_image_window_session_apply (window, private->entry_id);
gimp_image_window_session_apply (window, private->entry_id,
screen, monitor);
}
}
}
......
......@@ -38,6 +38,7 @@ static GtkWidget * gimp_multi_window_strategy_show_dockable_dialog (GimpWi
Gimp *gimp,
GimpDialogFactory *factory,
GdkScreen *screen,
gint monitor,
const gchar *identifiers);
......@@ -69,9 +70,11 @@ gimp_multi_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
Gimp *gimp,
GimpDialogFactory *factory,
GdkScreen *screen,
gint monitor,
const gchar *identifiers)
{
return gimp_dialog_factory_dialog_raise (factory, screen, identifiers, -1);
return gimp_dialog_factory_dialog_raise (factory, screen, monitor,
identifiers, -1);
}
GimpObject *
......
......@@ -44,6 +44,7 @@ static GtkWidget * gimp_single_window_strategy_show_dockable_dialog (GimpW
Gimp *gimp,
GimpDialogFactory *factory,
GdkScreen *screen,
gint monitor,
const gchar *identifiers);
......@@ -75,6 +76,7 @@ gimp_single_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
Gimp *gimp,
GimpDialogFactory *factory,
GdkScreen *screen,
gint monitor,
const gchar *identifiers)
{
GList *windows = gimp_get_image_windows (gimp);
......@@ -96,6 +98,7 @@ gimp_single_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
widget = gimp_dialog_factory_dialog_new (factory,
screen,
monitor,
ui_manager,
"gimp-toolbox",
-1 /*view_size*/,
......@@ -111,7 +114,8 @@ gimp_single_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
else if (gimp_dialog_factory_find_widget (factory, identifiers))
{
/* if the dialog is already open, simply raise it */
return gimp_dialog_factory_dialog_raise (factory, screen, identifiers, -1);
return gimp_dialog_factory_dialog_raise (factory, screen, monitor,
identifiers, -1);
}
else
{
......@@ -131,8 +135,8 @@ gimp_single_window_strategy_show_dockable_dialog (GimpWindowStrategy *strategy,
}
widget = gimp_dockbook_add_from_dialog_factory (GIMP_DOCKBOOK (dockbook),
identifiers,
-1 /*index*/);
identifiers,
-1 /*index*/);
}
......
......@@ -103,6 +103,8 @@ gimp_tool_dialog_dispose (GObject *object)
**/
GtkWidget *
gimp_tool_dialog_new (GimpToolInfo *tool_info,
GdkScreen *screen,
gint monitor,
const gchar *desc,
...)
{
......@@ -132,7 +134,9 @@ gimp_tool_dialog_new (GimpToolInfo *tool_info,
gimp_dialog_factory_add_foreign (gimp_dialog_factory_get_singleton (),
identifier,
dialog);
dialog,
screen,
monitor);
g_free (identifier);
......
......@@ -43,6 +43,8 @@ struct _GimpToolDialog
GType gimp_tool_dialog_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_tool_dialog_new (GimpToolInfo *tool_info,
GdkScreen *screen,
gint monitor,
const gchar *desc,
...) G_GNUC_NULL_TERMINATED;
......
......@@ -84,7 +84,9 @@ struct _GimpToolGuiPrivate
static void gimp_tool_gui_dispose (GObject *object);
static void gimp_tool_gui_finalize (GObject *object);
static void gimp_tool_gui_create_dialog (GimpToolGui *gui);
static void gimp_tool_gui_create_dialog (GimpToolGui *gui,
GdkScreen *screen,
gint monitor);
static void gimp_tool_gui_update_buttons (GimpToolGui *gui);
static void gimp_tool_gui_update_shell (GimpToolGui *gui);
static void gimp_tool_gui_update_viewable (GimpToolGui *gui);
......@@ -211,6 +213,8 @@ gimp_tool_gui_finalize (GObject *object)
GimpToolGui *
gimp_tool_gui_new (GimpToolInfo *tool_info,
const gchar *description,
GdkScreen *screen,
gint monitor,
gboolean overlay,
...)
{
......@@ -244,7 +248,7 @@ gimp_tool_gui_new (GimpToolInfo *tool_info,
va_end (args);
gimp_tool_gui_create_dialog (gui);
gimp_tool_gui_create_dialog (gui, screen, monitor);
return gui;
}
......@@ -394,6 +398,8 @@ gimp_tool_gui_hide (GimpToolGui *gui)
void
gimp_tool_gui_set_overlay (GimpToolGui *gui,
GdkScreen *screen,
gint monitor,
gboolean overlay)
{
GimpToolGuiPrivate *private;
......@@ -421,7 +427,7 @@ gimp_tool_gui_set_overlay (GimpToolGui *gui,
private->overlay = overlay ? TRUE : FALSE;
gimp_tool_gui_create_dialog (gui);
gimp_tool_gui_create_dialog (gui, screen, monitor);
if (visible)
gimp_tool_gui_show (gui);
......@@ -557,7 +563,9 @@ gimp_tool_gui_set_alternative_button_order (GimpToolGui *gui,
/* private functions */
static void
gimp_tool_gui_create_dialog (GimpToolGui *gui)
gimp_tool_gui_create_dialog (GimpToolGui *gui,
GdkScreen *screen,
gint monitor)
{
GimpToolGuiPrivate *private = GET_PRIVATE (gui);
GList *list;
......@@ -596,6 +604,7 @@ gimp_tool_gui_create_dialog (GimpToolGui *gui)
else
{
private->dialog = gimp_tool_dialog_new (private->tool_info,
screen, monitor,
private->description,
NULL);
......
......@@ -54,6 +54,8 @@ GType gimp_tool_gui_get_type (void) G_GNUC_CONST;
GimpToolGui * gimp_tool_gui_new (GimpToolInfo *tool_info,
const gchar *description,
GdkScreen *screen,
gint monitor,
gboolean overlay,
...) G_GNUC_NULL_TERMINATED;
......@@ -72,6 +74,8 @@ void gimp_tool_gui_show (GimpToolGui *gui);
void gimp_tool_gui_hide (GimpToolGui *gui);
void gimp_tool_gui_set_overlay (GimpToolGui *gui,
GdkScreen *screen,
gint monitor,
gboolean overlay);
gboolean gimp_tool_gui_get_overlay (GimpToolGui *gui);
......
......@@ -34,6 +34,7 @@
#include "widgets/gimpdockcontainer.h"
#include "widgets/gimpdockwindow.h"
#include "widgets/gimptoolbox.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
......@@ -332,6 +333,7 @@ gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
GimpAlignmentType screen_side_destination)
{
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (dock_columns));
gint monitor = gimp_widget_get_monitor (GTK_WIDGET (dock_columns));
GList *docks = g_list_copy (gimp_dock_columns_get_docks (dock_columns));
GList *iter = NULL;
gboolean contains_toolbox = FALSE;
......@@ -367,6 +369,7 @@ gimp_ui_configurer_move_docks_to_window (GimpUIConfigurer *ui_configurer,
dock_window =
gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
screen,
monitor,
NULL /*ui_manager*/,
(contains_toolbox ?
"gimp-toolbox-window" :
......
......@@ -110,12 +110,22 @@ gui_message_error_console (Gimp *gimp,
}
if (! dockable)
dockable =
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
gimp,
gimp_dialog_factory_get_singleton (),
gdk_screen_get_default (),
"gimp-error-console");
{
GdkScreen *screen;
gint x, y;
gint monitor;
gdk_display_get_pointer (gdk_display_get_default (),
&screen, &x, &y, NULL);
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
dockable =
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
gimp,
gimp_dialog_factory_get_singleton (),
screen, monitor,
"gimp-error-console");
}
if (dockable)
{
......@@ -178,8 +188,16 @@ progress_error_dialog (GimpProgress *progress)
static GtkWidget *
global_error_dialog (void)
{
GdkScreen *screen;
gint x, y;
gint monitor;
gdk_display_get_pointer (gdk_display_get_default (),
&screen, &x, &y, NULL);
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
return gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),