Commit Graph

95 Commits

Author SHA1 Message Date
Hartmut Kuhse ef66ea296d app: don't assign variable before checking the validity 2015-03-09 08:28:33 +01:00
Michael Natterer bbf01ebabf libgimpwidgets, app: add gdk_screen_get_monitor_workarea()
to the gimp3migration hack and use it where appropriate, so in the
gtk3-port branch windows will not overlap with docks, panels etc.
2014-05-19 14:37:32 +02:00
Michael Natterer a1a70a4d1f app: don't session-restore windows partially offscreen or on 2 monitors 2014-05-03 23:59:15 +02:00
Michael Natterer 7f23fbec34 app: add screen and monitor to all display and image window constructors
so they appear on the proper monitor as well.
2014-05-02 20:21:41 +02:00
Michael Natterer 843866e7e7 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.
2014-05-02 03:01:23 +02:00
Michael Natterer 2fc0c768f1 app: don't leak references in gimp_session_info_restore_docks()
This should fix quite a bunch of memory leaks.
2013-01-14 01:36:08 +01:00
Michael Natterer 867da8f293 app: add gimp_context_get_foreground,background_pixel()
which takes a Babl format to convert from/to.
Include <gegl.h> in a million places.
2012-05-02 17:50:41 +02:00
Michael Natterer 7cbd1c5739 app: don't dereference a NULL session_info->p->factory_entry 2012-03-30 09:55:45 +02:00
Martin Nordholts e74d220930 app: Restore docks in an idle handler
In single-window mode, gimp_session_managed_set_aux_info() will set
the size of the dock areas at the sides. If we don't wait for those
areas to get their size-allocation, we can't properly restore the
docks inside them, so do that in an idle callback.

Also add a required call to gimp_test_run_mainloop_until_idle()
because of this in the 'automatic_tab_style' test.
2011-06-14 23:34:12 +02:00
Martin Nordholts 00d6f8e655 Move gimp_session_info_clear_info() into gimp_session_info_restore()
All callers of gimp_session_info_restore() call
gimp_session_info_clear_info() afterwards, so move that into the
function instead.
2011-06-14 23:34:12 +02:00
Martin Nordholts bed298be13 app: Remember column width in multi-column dock windows 2011-05-31 23:15:39 +02:00
Martin Nordholts b4ed281f9a app: Call gimp_session_info_aux_set_list() generically
gimp_session_info_aux_set_list() is not a per-GimpDialogRestoreFunc
thing.
2011-05-31 23:15:38 +02:00
Martin Nordholts 6fc587c643 app: Add GimpSessionManaged
Add a GimpSessionManaged interface to generalize
gimp_session_info_aux_get_list() and gimp_session_info_aux_set_list().
2011-05-31 23:15:14 +02:00
Michael Natterer edad544e73 app: don't redundantly check for (foo && GIMP_IS_FOO (foo)) in GimpSessionInfo 2011-05-30 23:39:39 +02:00
Martin Nordholts 10aa3921a0 app: Rememeber if image windows are opened
Rememeber if image windows are opened because we want the
gimp_session_info_restore() code to run for the single-image window
once that code is in place.
2011-05-28 16:18:34 +02:00
Martin Nordholts 93fd257c52 app: Give configure event info to gimp_session_info_read_geometry()
When we get to gimp_dialog_factory_dialog_configure() and do
gimp_session_info_read_geometry(), the window geometry has not yet
been updated, i.e. gimp_session_info_read_geometry() gives the session
info the size of the *previous* configure event.

Solve this by giving gimp_session_info_read_geometry() the configure
event so it can use that size when availble.

If we don't do this change, then we get bogus values of the size of
image window when repeatedly switching between single- and
multi-window mode.
2011-05-27 22:33:55 +02:00
Martin Nordholts 396d5fd5e8 app: Add a 'restore_func' to GimpDialogFactoryEntry
In gimp_session_info_restore() there is code to create a dialog from a
session info. GimpSessionInfo lives in the widgets module. Thus we
can't add restoration code that depends on a higher level module. In
particular, we can't add code to restore docks in an GimpImageWindow
since GimpImageWindow lives in the display module. And we need such
code to be able to restore a single-window mode session.

Since dialogs are defined in the dialogs module, it makes sense to
also have the code that restores a dialog in that module.

So, add a 'restore_func' member to GimpRestoreDialogFunc of type
GimpRestoreDialogFunc and move the code there.
2011-05-27 21:55:41 +02:00
Martin Nordholts cf4a4bf5a6 app: Make gimp_session_info_dock_restore() take a GimpDockContainer 2011-05-13 21:25:39 +02:00
Martin Nordholts 7edf717bae app: Add image_window boolean to GimpDialogFactoryEntry
Add image_window boolean to GimpDialogFactoryEntry and rename
FOREIGN_NOT_HIDEABLE() to IMAGE_WINDOW(). We need to treat image
windows a bit special when we restore a single-window mode session.
2011-05-13 21:25:39 +02:00
Martin Nordholts 0f19471e22 app: Make GimpDockContainer::get_docks() return a new list
Make GimpDockContainer::get_docks() return a new list and not just a
pointer to a list so that GimpImageWindow can implement it (who needs
to merge its two GimpDockColumns lists).
2011-05-13 21:04:23 +02:00
Michael Natterer 9e60dd547d app: keep a ref to the session info in gimp_session_info_restore()
because failing to restore a dock can destroy the newly created dock
and implicitly unref the session info.
2011-05-12 21:23:06 +02:00
Martin Nordholts 6d421f9d4d app: Add and use gimp_session_info_get_info_with_widget()
Add and use helper function
gimp_session_info_get_info_with_widget(). Might need it for
GimpImageWindow later...
2011-05-09 19:55:51 +02:00
Martin Nordholts 4b9243fc60 app: Make GimpDockWindow implement GimpDockContainer
Make GimpDockWindow implement the GimpDockContainer interface. The
plan is to make GimpImageWindow also implement the GimpDockContainer
interface when we start to session manage docks in single-window mode.
2011-05-09 19:55:51 +02:00
Martin Nordholts f75f61779c app: GimpSessionInfoDock::identifier -> dock_type
Rename GimpSessionInfoDock::identifier to dock_type, because it isn't
really an identifier; there might be several instance with dock_type
being "gimp-dock". This is a preparation for adding an actual
'identifier' member.
2011-04-21 18:59:12 +02:00
Michael Natterer 6c524ea1db app: GimpSessionInfo: use brute force to position dialogs
Window managers are such a crap. So on top of all friendly hinting and
geometry setting, simply use gtk_window_move() whenever a session
managed GtkDialog is shown. It should be very hard to ignore that, but
of course the WM has the last word no matter how hard we try.

Note: this code should be more complex and the signal connection
should happen in GimpDialogFactory. Left it in GimpSessionInfo for now
until it got a bit of testing.
2011-03-26 19:47:44 +01:00
Michael Natterer fcfb7cf160 Use the new g_[s]list_free_full() instead of foreach() and free() 2011-03-07 17:11:28 +01:00
Michael Natterer 37effb99a4 app: use the window's allocation instead of gdk_drawable_get_size() 2010-10-15 15:17:12 +02:00
Michael Natterer ac6ee07184 app: the tests should succeed, so should a normal gimp session
Don't divide by zero in gimp_session_info_class_apply_position_accuracy()
when klass->position_accuracy is 0, which happens on each exit in a normal
session.
2010-06-20 23:26:45 +02:00
Martin Nordholts 49d951d49e app: Introduce error margin in sessionrc in test cases
Introduce a few pixels of error margin in sessionrc, otherwise the
tests are too fragile, widgets have a tendency to change size a bit
and window managers have a tendency to move windows a bit.

Still needs more work, should probably do the same on book positions
too...
2010-06-19 23:55:35 +02:00
Martin Nordholts d7dc2dc1ab app: Make tooltips in the toolbox work again
We need to be able to pass a GimpUIManager to
gimp_dialog_factory_dialog_new(), so make that possible. Also make
sure to set ui_manager in gimp_dialog_factory_dialog_new_internal()
when we create both a dock window and a dock, so tooltips works in
toolboxes created from scratch.
2010-05-16 12:19:18 +02:00
Martin Nordholts fe6699cc1c app: Apply Windows→Hide docks on startup
Change GimpDialogFactory to apply Windows→Hide docks on startup. (We
already do this for docks in single-window mode.)
2010-03-09 08:03:23 +01:00
Martin Nordholts c5c92e484c app: We don't need to show restored dialogs twice 2010-03-09 08:03:23 +01:00
Martin Nordholts 909acba11d app: Introduce GIMP_DIALOG_VISIBILITY_HIDDEN
Introduce GIMP_DIALOG_VISIBILITY_HIDDEN because it is a bit
counter-intuitive to call gtk_widget_hide() on a dialog and then set
GIMP_DIALOG_VISIBILITY_VISIBLE on it. No change in program flow has
been (deliberately) introduced.
2010-03-09 08:03:22 +01:00
Martin Nordholts 11b1300b6f app: Introduce gimp_dialog_factory_get_singleton()
Instead of including dialogs/dialogs.h everywhere, introduce
gimp_dialog_factory_get_singleton(). The dialog factory singleton is
still initialized by dialogs.c though.

Right now the assumption is that we never will have another dialog
factory instance around. There were so many problems before when we
had four of them, so let's just keep one of them around.
2010-02-28 23:23:24 +01:00
Martin Nordholts 947e28596f app: Remove gimp_dialog_factory_from_name()
We only have one dialog factory now, and
gimp_dialog_factory_from_name() doesn't provide compile-time type
safety, so use global_dialog_factory directly instead.
2010-02-28 20:02:45 +01:00
Martin Nordholts dec798e0df app: Serialize factory entry name along with GimpSessionInfo
Serialize factory entry name along with GimpSessionInfo so we can make
the Recently Closed Docks feature work across sessions in a natural
way.
2010-02-20 13:05:16 +01:00
Martin Nordholts 7e94bb3ef2 app: Avoid crash when using Windows -> Recently Closed Docks
This is not a proper fix for anything, it is just avoidance of a
crash.
2010-02-13 17:17:56 +01:00
Martin Nordholts 02d3874eb7 app: Only add "gimp-toolbox" dock to "gimp-toolbox-window" 2010-01-31 20:21:17 +01:00
Martin Nordholts bf92270051 app: Don't crash when the toolbox dock window don't have docks
Session files from GIMP 2.6 don't need to have docks in the toolbox
top-level. Don't crash on that, instead add a "gimp-toolbox" dock
during sessionrc parsing.
2010-01-31 19:04:51 +01:00
Martin Nordholts 1093462ae9 app: Merge 'global_toolbox_factory' into 'global_dock_factory'
Get rid of 'global_toolbox_factory' and manage everything dock-related
with 'global_dock_factory'. The whole of 'global_toolbox_factory' was
a big special-case and getting rid of it makes it easier to extend the
session management with e.g. single-window mode dock functionality.

To get rid of 'global_toolbox_factory' we, roughly, have to
 * Replace 'global_toolbox_factory' with 'global_dock_factory'
   everywhere. We can also get rid of lots of code that did special
   things for the "toolbox" factory.
 * Make the use or interaction with the toolbox explicit in some
   places. For example, a function gimp_dock_window_has_toolbox() has
   been introduced.
 * Make GimpSessionInfoDock have an 'identifier' parameter so we can
   differentiate between the "gimp-dock" and "gimp-toolbox" dock
   types.
2010-01-20 18:29:54 +01:00
Martin Nordholts 56a8cb68a8 app: Have dialog factory entries for the dock windows
Let dock windows have proper GimpDialogFactory entries. This allows us
to get rid of a lot of ugly mostly duplicated code. This also makes us
ready the merge the dock window and toolbox factories which will soon
be done. A few things should be noted:

 * We adjust the wrap box aspect ratio in the toolbox to avoid having
   the toolbox dock window explode

 * We make sure that we still can handle sessionrc files from GIMP 2.6
   and older
2010-01-19 22:24:17 +01:00
Martin Nordholts 34ad9dad1a app: Session manage multi-column dock windows
Introduce GimpSessionInfoDock and session manage multi-column dock
windows. We are still backwards compatible with sessionrc, the only
difference is that a "session-info" entry now can have multiple "dock"
entries.

Also make ond dock window multi-column in the regression test
app/tests/test-session-management.c and adjust positions and image
selection menus a bit.
2009-12-06 14:49:53 +01:00
Martin Nordholts 3bb15eac78 app: Move out dock window logic from gimp_session_info_dock_restore()
Move out dock window logic, most notably aux info, from
gimp_session_info_dock_restore() and put it in
gimp_session_info_restore() where it belongs.
2009-12-05 22:43:32 +01:00
Michael Natterer 1a23b9ecf2 Build with GSEAL_ENABLE and #undef it where accessors are missing 2009-10-17 20:20:39 +02:00
Martin Nordholts c9d8aafb68 app: Change a few GIMP_IS_DOCK to GIMP_IS_DOCK_WINDOW
In many places we are interested in wether or not we have a dock
window, not a dock. This is in preparation for making GimpDock a
non-GimpDockWindow.
2009-09-26 14:26:49 +02:00
Martin Nordholts ae39604a64 app: Add more dialog-factory debug output 2009-09-20 19:30:10 +02:00
Martin Nordholts 94d95e4db2 app: Make GimpSessionInfo members private
Make GimpSessionInfo members private but put them in a shared header
file so gimpsessioninfo-dock.c can access them too.
2009-09-20 17:06:36 +02:00
Martin Nordholts 8bfcd14f9a app: Add GimpSessionInfo getters and setters 2009-09-20 14:51:03 +02:00
Martin Nordholts 7cac9dff67 app: gimp_session_info_set/get_geometry -> apply/read_geometry()
Rename gimp_session_info_set_geometry() to
gimp_session_info_apply_geometry() and gimp_session_info_get_geometry
to gimp_session_info_read_geometry(). The old functions were not
getters and setters and thus the names were misleading.
2009-09-20 13:17:27 +02:00
Martin Nordholts 4ab58d2e77 app: Have only one GimpDialogFactoryEntry member in GimpSessionInfo
Simplify the code a bit by replacing the 'toplevel_entry' and
'dockable_entry' members in GimpSessionInfo with a single
'factory_entry'. We compensate for this by adding a 'dockable'
gboolean to GimpDialogFactoryEntry.
2009-09-20 12:24:41 +02:00