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 589084 - Quartz missing Modal support
Quartz missing Modal support
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: Quartz
2.19.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2009-07-20 06:31 UTC by Christian Hergert
Modified: 2018-02-10 03:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
basic fix (950 bytes, patch)
2009-07-29 04:12 UTC, Christian Hergert
none Details | Review
Show modal dialogs as sheets displayed from the parent like Cocoa (2.02 KB, patch)
2009-07-29 04:14 UTC, Christian Hergert
none Details | Review
Show modal dialogs as sheets displayed from the parent like Cocoa and don't move after (2.66 KB, patch)
2010-08-26 07:41 UTC, Mikkel Kruse Johnsen
none Details | Review
Show modal dialogs as sheets displayed from the parent like Cocoa and don't move after and close properly (3.74 KB, patch)
2010-08-26 10:01 UTC, Mikkel Kruse Johnsen
none Details | Review

Description Christian Hergert 2009-07-20 06:31:57 UTC
Please describe the problem:
The current implementation of Gdk for Quartz is missing support for Modal windows.

It might be nice if the modal windows were made to slide out of the parent as they do with Cocoa applications.

Steps to reproduce:
1. Create a parent window.
2. Create a child window and set it transient for the parent and set modal hint.
3. Select the parent window, it will be foremost above the child.


Actual results:
The parent window will be foremost; above the modal child.

Expected results:
The child window should stay foremost even if the parent is selected.

Does this happen every time?
Yes

Other information:
Comment 1 Christian Hergert 2009-07-27 21:48:50 UTC
So I've looked through the event loop code and at the API provided to us through NSApp and think I have an idea of how we would need to implement this.

On X11, you can have multiple Modal windows above their transient parents.  Each modal window can be worked with.  However, when using the Modal API with NSApp, the concept is more of a SINGLE modal window per application.  This means that you work with handling incoming messages in a loop similar to gtk_dialog_run().

To emulate how things work on X11, we would need to the event loop to pump the messages from the available modal "sessions".

Therefore,

 1) When modal-hint is called for a GdkWindow, we need to setup the modal session using [NSApp beginModalSessionForWindow:<NSWindow*>].  This asynchronously begins the modal session and returns us an opaque handle.
 2) The NSModalSession handle needs to be available to the event loop.
 3) During event loop iteration, if there are modal sessions pending, their events need to be pumped rather than the general event queue using [NSApp runModalSession:<NSModalSession>].  To get the effect of X11, I think we need to pump the various sessions cooperatively.

I'm going to take a stab at implementing this, or at least update based on my failures.
Comment 2 Christian Hergert 2009-07-29 01:43:10 UTC
FWIW I wasn't having a whole lot of luck going the route mentioned above.  But I was able to get this working in the slide down effect that Cocoa uses for many file dialogs.

http://x.dronelabs.com/chris/dropbox/gtkmodal-osx.png

After getting this working, I discovered why the previous wasn't working well so I'm going to try a couple patches to see the direction the maintainers which to go.

Patches coming soon'ish.
Comment 3 Christian Hergert 2009-07-29 04:12:42 UTC
Created attachment 139445 [details] [review]
basic fix

So this basic fix for the method guard gets things at least working.

Another patch to follow for showing modal's as sheets.
Comment 4 Christian Hergert 2009-07-29 04:14:00 UTC
Created attachment 139446 [details] [review]
Show modal dialogs as sheets displayed from the parent like Cocoa
Comment 5 Mikkel Kruse Johnsen 2010-08-26 07:41:52 UTC
Created attachment 168786 [details] [review]
Show modal dialogs as sheets displayed from the parent like Cocoa and don't move after

This makes sure that the window is not moved afterwards. Normally you would have a Window as Modal, TransientFor and position Center. On Mac don't move if it's displayed as a sheet.

There are still a serious problem. This only works one time, then it shows the window normally ?
Comment 6 Mikkel Kruse Johnsen 2010-08-26 10:01:47 UTC
Created attachment 168794 [details] [review]
Show modal dialogs as sheets displayed from the parent like Cocoa and don't move after and close properly

Will now use "[NSApp endSheet:impl->toplevel];" to close and hide the window, if it is Modal and has TransientFor.

Now the "Sheet" effect works every time.
Comment 7 Matthias Clasen 2018-02-10 03:38:08 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.