After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 61091 - remember window positions within a session: use USPosition/USSize in XSizeHint
remember window positions within a session: use USPosition/USSize in XSizeHint
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: User Interface
1.x
Other All
: Normal enhancement
: 2.0
Assigned To: GIMP Bugs
Daniel Egger
: 111972 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2001-09-24 21:25 UTC by Jamie Zawinski
Modified: 2003-05-02 18:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jamie Zawinski 2001-09-24 21:25:30 UTC
When I bring up a tool window, and then dismiss it, and then use
that tool again, the window should appear with exactly the same
size and position as it did before.

I assume that what's going on is that the windows are being destroyed
and re-created afresh, and so the window manager is being allowed to
position it again with whatever mechanism it uses.

If the windows were *not* destroyed, but where merely unmapped and then
re-mapped, they would show up with the size/position I had given them
last time.  Now, I'm not saying that you should keep the windows around:
that's an implementation detail that I don't care about.  But the
*behavior* should be as if the same windows were being re-used.

The way you do this is, when the first window is dismissed, remember
its size and position before you destroy it.  Then, after you've created
the second window, but before you map it, set both the USPosition and
USSize flags in the XSizeHints property on the window.  This tells the
window manager "the user has already chosen the size and position of
this window" -- which is true.  You must only set this for the second
and subsequent windows, though -- don't set it on the first window,
because in that case, the user has not yet given you a size/position.

If you have any questions about this, feel free to mail me -- the details
of window manager interaction are pretty obscure, but I understand them
pretty well.
Comment 1 Raphaël Quinet 2001-09-25 11:17:03 UTC
Again, another good point (as in bug #61089 and bug #61090) but I am
not sure if this should be done at the toolkit level (GTK+) or at the
application level (GIMP).  I am quite familiar with the way X apps
should interact with the window manager (XSizeHints and other stuff)
so I could also provide some help to whoever implements this feature
(I don't think that I will have the time to do it myself, though).
Comment 2 Sven Neumann 2001-09-25 14:53:51 UTC
It has to be done at the application level, but fortunately GTK+-2.0 
finally has an API for this kind of stuff:

void  gdk_window_set_type_hint      (GdkWindow         *window,
                                     GdkWindowTypeHint  hint);
void  gdk_window_set_modal_hint     (GdkWindow         *window,
                                     gboolean           modal);
void  gdk_window_set_geometry_hints (GdkWindow         *window,
                                     GdkGeometry       *geometry,
                                     GdkWindowHints     flags);

It shouldn't be too difficult to get this right for
Gimp-1.4.Preferably we will create a GimpToolDialog widget that takes
care of
this.
Comment 3 Michael Natterer 2003-05-02 15:31:06 UTC
*** Bug 111972 has been marked as a duplicate of this bug. ***
Comment 4 Michael Natterer 2003-05-02 18:45:06 UTC
Fixed in CVS:

2003-05-02  Michael Natterer  <mitch@gimp.org>

  * app/widgets/gimpdialogfactory.[ch]: added new function
  gimp_dialog_factory_add_foreign() which adds a dialog that was not
  created by the factory itself. Its identifier however must be
  registered with the factory. Connect to all toplevel dialogs'
  "configure_event" and remember the resulting window geometry so we
  get session management for *all* dialogs, not only for those which
  were open on exit.

  * app/gui/dialogs.c: added the "File New" dialog. Added foreign
  entries (without constructor) for all dialogs opened by tools.

  * app/gui/dialogs-constructors.[ch]: added a constructor for
  the file_new dialog.

  * app/gui/file-new-dialog.[ch]: renamed file_new_dialog_create()
  to file_new_dialog_new() and removed the gimage and template
  paramaters. Adder new function file_new_dialog_set() to set
  gimage and template after creation.

  * app/gui/file-commands.c
  * app/gui/templates-commands.c: changed accordingly.

  * app/tools/gimpimagemaptool.[ch]
  * app/tools/gimptransformtool.[ch]: added
  "const gchar *shell_identifier" to the tool structs. Register the
  tool dialogs using gimp_dialog_factory_add_foreign().

  * app/tools/gimpbrightnesscontrasttool.c
  * app/tools/gimpcolorbalancetool.c
  * app/tools/gimpcurvestool.c
  * app/tools/gimphuesaturationtool.c
  * app/tools/gimplevelstool.c
  * app/tools/gimpperspectivetool.c
  * app/tools/gimpposterizetool.c
  * app/tools/gimprotatetool.c
  * app/tools/gimpscaletool.c
  * app/tools/gimpsheartool.c
  * app/tools/gimpthresholdtool.c: set "shell_identifier" so the
  dialogs become session managed. Fixes bug #61091.

  * app/tools/gimpcroptool.c: register the crop dialog with the
  dialog factory. Fixes bug #52849.

  * app/tools/gimpcolorpickertool.c: ditto.

  Unrelated:

  * app/tools/gimptool.c: no need to cast the return value of
  g_object_new().