Re: About window decorations



Paul Davis <pbd op net> writes: 
> GTK defines 3 window types:

Yes, but these mean:

> 
>     TOPLEVEL

     - all windows an app would normally create

>     DIALOG

     - useless feature, don't use it even for dialogs

>     POPUP

     - GtkMenu, tool tips (i.e. windows that are expected to 
       last all of a couple seconds, and grab the pointer, 
       you would not normally consider these "windows" at all)

These types aren't especially logical or well-thought-out or anything,
they date from the very earliest days of GTK.

The actual differences between them under X:

 TOPLEVEL - a window-managed window

 DIALOG - like TOPLEVEL, but sets the window transient for the root
          window, which is now considered a Bad Idea according to
          Owen, and in any case does nothing if you correctly call
          gtk_window_set_transient_for() on the actual parent of the
          dialog. GTK 2 will make this a synonym for TOPLEVEL, I'm
          guessing. I have a bug in the tracker to consider doing so
          anyhow.

 POPUP - makes the window "override redirect" (so the window manager
         should not try to decorate it, move it, resize it, put it in
         task lists, or anything like that - e.g. just what you want
         for menus and tooltips). Also turns on save unders, which is
         a stupid optimization on modern machines that just eats
         memory. XFree 4 ignores the save under flag because of this.        

> all but the last receive WM decoration. i think it more appropriate to
> stick with these 3 types, and avoid the creation of extra "implicit"
> types, eg:
> 
>        DIALOG-without-decoration
>        DIALOG-with-decoration
>        DIALOG-with-most-decoration
>        DIALOG-with-a-little-decoration
>        etc.
>
> thats for the user to control via their WM config files.

Well yes, I haven't touched on the issue of "you shouldn't have broken
apps that turn off window manager decorations." I did miss my
opportunity to bitch about MP3 players that do this as I enjoy
doing. ;-)

But, GTK_WINDOW_POPUP doesn't help here - all you've done is lied
about your dialog and said it's a menu or tooltip, which doesn't help
the window manager obey user prefs.

> If an app wants to create a window with altered decoration, i don't
> think it should do so unless its prepared to follow the possibilities
> offered by the 3 window types. The closest possibility to the original
> question is POPUP.

A dialog with buttons (e.g. OK/Cancel) should be
GTK_WINDOW_TOPLEVEL. This is what GtkDialog uses and it's correct to
do so.

> The whole idea of creating a window with app-chosen WM decoration is
> quite problematic to me, *unless* it really is a popup window.
> 

But a GTK_WINDOW_POPUP window is a menu/tooltip, not a dialog. If
you're going to have a dialog with no decorations, better to use the
correct GtkWindow flavor, and just tweak the decorations.

But yeah, I agree that hosing the decorations for dialogs is
wrong. (Especially since if you call gtk_window_set_transient_for()
the window manager will know it's a dialog and often decorate the
window differently according to user preferences anyhow. e.g. lots of
sawfish themes put no titlebar on dialogs.)

There are cases where turning off decorations on a toplevel is correct
- e.g. the torn-off menu bars for GtkHandleBox are not actually
GtkWindow widgets but they are equivalent, with decorations turned off
via gdk_window_set_decorations(). Also, a torn-off GtkMenu is actually
a GtkWindow with type GTK_WINDOW_TOPLEVEL. Those are decorated though,
I guess.

Havoc




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