[gtk-list] Re: MDI?



On Tue, May 19, 1998 at 09:43:58PM +0000, David Sundqvist wrote:

.
> > property called WM_TRANSIENT_FOR(WINDOW) which is what Netscape uses (you
.

I finally found the time to look into this property, and it does indeed
reproduce the required behavior. Almost.

Here's a code snippets (dots represent missing code). Comments follow.

.
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
.
extern GtkWidget *mainWindow;
GtkWidget *connectWindow = NULL;
.
void initConnectWindow()
{
.
   gint x;
   gint y;
   GdkModifierType state;
.
   connectWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
.
   gtk_widget_realize (connectWindow);

   gdk_window_get_pointer (GDK_ROOT_PARENT(), &x, &y, &state);
   gtk_widget_set_uposition (connectWindow, x, y);

   XSetTransientForHint (GDK_WINDOW_XDISPLAY (connectWindow->window),
                         GDK_WINDOW_XWINDOW (connectWindow->window),
                         GDK_WINDOW_XWINDOW (mainWindow->window));

   gtk_widget_show (connectWindow);
}


Why am I messing around with automatically positioning the window? That's a
perfectly good question. It appears as if when XSetTransientForHint is used,
manual placement is immediately deactivated by the window manager (I've
tested this with fvwm2 and AfterStep) - which is bad.
The best thing I could do is to automatically place the window in a logical
enough position, and the cursor position seems to be as good as any.
If there is a way to avoid that, please do let me know.

Other than that, XSetTransientForHint seems to work very well. I've not
experienced any other side effects.

(Obviously, this should probably be incorporated into gtk's internal
structures in some way. The current solution is merely a kludge).

                                                   Nimrod



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