Re: How to position a dialog box atop an application's main window?
- From: Havoc Pennington <hp redhat com>
- To: Guy Harris <gharris flashcom net>
- Cc: gtk-list gnome org
- Subject: Re: How to position a dialog box atop an application's main window?
- Date: 04 Jul 2000 00:45:45 -0400
Guy Harris <gharris@flashcom.net> writes:
> I remember some discussion within, I think, the past few months about
> how to make dialog boxes for an application pop up atop the main window
> for the application, rather than being placed wherever the window
> manager feels like it (which appears to mean "placed somewhere random,
> often not near the window, so that you don't necessarily see it pop up).
>
If you set the transient for hint, either the window manager will do
something good, or the window manager is sucking.
If this is a general audience app, I would really consider setting
transient for the right thing to do. If users want to use a WM that
handles this badly (in a way not to their liking), that's their own
choice.
Also, transient for usually has one crucial effect you can't do from
your app, which is to keep the transient on top of the parent.
Of course the usual disclaimer applies, if it's an in-house or kiosk
type of app where you control the user environment, these
considerations may not matter.
> Unfortunately, I can't find the messages discussing this; I suspect it
> involves getting the position of the main window (with
> "gdk_window_get_position()") and then setting the dialog box's position
> (with "gdk_window_set_position()"), but I have the impression there may
> have been more involved than just that.
>
Assuming the parent window is already onscreen, you can do pretty well
by just getting its size (widget->allocation.width,
widget->allocation.height, gdk_window_get_position() I think) and then
setting the uposition on the dialog before you show it
(gtk_window_set_uposition()).
> (I have the impression that window managers don't necessarily to
> position transient-for windows atop the window for which they're
> transient, and can't necessarily even be configured by the user to do
> this - I didn't find any obvious code in KWM to do this, for example;
Right, but users do choose a window manager they like, so if their WM
lacks this feature it really isn't your place to add it. Many people
prefer GTK_WIN_POS_MOUSE type of behavior for example.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]