Re: application modality vs. window modality

Christopher Blizzard <blizzard redhat com> writes:

> There's a bug in Mozilla* that got me thinking.  It might be very nice
> to have the ability to set a window ( a dialog or whatever ) as modal
> to a specific parent window.  There are cases where you need a
> decision made in an application's window where other windows that are
> in that application don't need to be blocked.
> Right now I'm pretty sure that all we have is the concept of
> application-wide modality.  I think that right now you can create a
> transient dialog for a window but putting a grab on that window so
> that events can't be sent to the parent window doesn't work without
> blocking all of the windows in the app.
>  From an API standpoint I'm thinking along the same lines of how you
> set transient parents for dialogs.
> What do people think?  I think it would be a useful addition and it
> shouldn't be too tough to do from an implementation standpoint.

I needed this as well when working on the replacement for GtkPlug/Socket.

The case here was that a GtkPlug may logically be part of a different
application, so needs to have it's modality go along with it.

My first stab at an interface was simply:

void       gtk_window_set_grab_group (GtkWindow *window,
				      GtkWindow *grab_group);
GtkWindow *gtk_window_get_grab_group (GtkWindow *window);

So a "grab group" is identified by a group leader all windows in
that group point at.

The implementation is appended, though it won't work as it is here,
since there are traces of it of another change as well - notification
of shadowing by a grab.

The main problem here, or with any partial-modality is that it
does break something that some of the GTK+ widgets used to
do, which was to combine a gdk_pointer_grab() with owner_events=TRUE
with gtk_grab_add(), to get an effect similar to a
gdk_pointer_grab() with owner_events=FALSE. 

This simply doesn't work if gtk_grab_add() doesn't grab all the e
events. But it's typically pretty easy to work around by simply
grabbing with owner_events=FALSE.



Attachment: modality-patch
Description: Binary data

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]