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.
This commit is contained in:
Michael Natterer
2014-05-02 03:01:23 +02:00
parent 16819917f5
commit 843866e7e7
57 changed files with 456 additions and 167 deletions

View File

@ -114,6 +114,7 @@ tool_options_editor_updates (gconstpointer data)
GimpUIManager *ui_manager = gimp_image_window_get_ui_manager (image_window);
GtkWidget *dockable = gimp_dialog_factory_dialog_new (gimp_dialog_factory_get_singleton (),
gtk_widget_get_screen (toplevel),
gimp_widget_get_monitor (toplevel),
NULL /*ui_manager*/,
"gimp-tool-options",
-1 /*view_size*/,
@ -127,8 +128,7 @@ tool_options_editor_updates (gconstpointer data)
g_assert_cmpstr (GIMP_HELP_TOOL_RECT_SELECT,
==,
gimp_tool_options_editor_get_tool_options (editor)->
tool_info->
help_id);
tool_info->help_id);
/* Change tool and make sure the change is taken into account by the
* tool options editor
@ -139,8 +139,7 @@ tool_options_editor_updates (gconstpointer data)
g_assert_cmpstr (GIMP_HELP_TOOL_ELLIPSE_SELECT,
==,
gimp_tool_options_editor_get_tool_options (editor)->
tool_info->
help_id);
tool_info->help_id);
}
static GtkWidget *
@ -764,9 +763,11 @@ window_roles (gconstpointer data)
dock = gimp_dock_with_window_new (gimp_dialog_factory_get_singleton (),
gdk_screen_get_default (),
0,
FALSE /*toolbox*/);
toolbox = gimp_dock_with_window_new (gimp_dialog_factory_get_singleton (),
gdk_screen_get_default (),
0,
TRUE /*toolbox*/);
dock_window = gimp_dock_window_from_dock (GIMP_DOCK (dock));
toolbox_window = gimp_dock_window_from_dock (GIMP_DOCK (toolbox));