On 03 June, 2001 - Mikhael Goikhman sent me these 1.9K bytes: > On 03 Jun 2001 05:21:36 +0200, Tomas Ogren wrote: > > > > There's still (cvs as of now) problems with focus in Nautilus.. I've > > been busy+++ lately, but I will have spare time to spend now.. It > > doesn't get any focus.. > > I though Dominik fixed this...
He tried.. > Did not the Nautilus author plan to fix this in Nautilus too without > using rare ICCCM features? > > > There is also a problem when an app sets it's (GNOME) WM layer before > > the window is shown. It then sets a property on the window which level > > it's supposed to be on, but it doesn't get read by fvwm it seems... > > I see the code in gnome.c and style.c to read it, but I don't know which > > order stuff is happening/supposed to happen, so it's a bit hard... > > > > Attached is a test program written in gtk/xlib... > > create some windows on layer 4 and then start the program.. one of the > > windows is supposed to land on layer 3 (below the others).. then you can > > raise/lower it with the up/down buttons.. > > > > If given any argument to the program, it will show (map) the window > > before trying to set the layer which makes it end up on the correct > > layer directly (almost.. you can see it starting infront of the windows, > > then jumping back) > > 1) There is a typo in the program, so it can't be compiled without a fix, > the variable "level" should be replaced with "layer" globally. Sorry.. I was quite tired when I sent this and I made some last second changes without compiling.. > 2) To compile it: gcc -o winhints `gtk-config --cflags --libs` winhints.c > > 3) I can't reproduce any problem with this program, it works just well > with or without arguments. Of course it is not consistent because it > first requests to place itself to "layer-1" and then to "layer". > But if you patch the program to replace "layer-1" with "layer" it will > become consistent. > > A note, it is intended that a window is lowered in FVWM when it changes a > layer, say from 5 to 4, and raised - when changes a layer from 3 to 4. Ok, I made some more changes to make it consistent now. The point is: It doesn't matter what layer I request if I do it _before_ mapping the window. Fvwm will still put it on the default layer. If you want to put it behind everything (like the nautilus background thingie), you don't want it to first cover the entire screen then pop back below everything. There seems to be code to read that stuff when the window is mapped, but I suppose it's called in the wrong order or something. How to reproduce stuff: 1) compile with $CC -o winhints `gtk-config --cflags --libs` winhints.c 2) make a window cover most of the screen so there will be overlapping 3) run winhints .. if your normal layer is 4 (which is default), then the larger of the windows from 'winhints' should be below the window from 2) but that doesn't happen. 4) Click on "Same" which will set the layer to layer 2 again but by sending an event this time, now it pops down to layer 2. 5) Clicking on up/down will raise/lower the window as expected. If you give any arguments to winhints, it will first map the window, then set the layer.. so it will appear at the default layer, then pop back to layer 2. > Am I missing something? You forgot to remind me to be less sleepy when sending in stuff :) /Tomas -- Tomas Ögren, [EMAIL PROTECTED], http://www.ing.umu.se/~stric/ |- Student at Computing Science, University of Umeå `- Sysadmin at {cs,ing,acc}.umu.se
#include <stdio.h> #include <stdlib.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> #include <X11/Xlib.h> #include <X11/Xmd.h> #include <X11/Xatom.h> void prepare_app(int argc); void layers_cb (GtkWidget *widget, void *data); void quit_cb (GtkWidget *widget, void *data); void mgnome_win_hints_set_layer(GtkWidget *window, int layer); #define XA_WIN_LAYER "_WIN_LAYER" GtkWidget *app; GtkWindow *dawin; int layer = 2; static Atom _XA_WIN_LAYER; int main(int argc, char *argv[]) { gtk_init (&argc, &argv); prepare_app (argc); gtk_main (); return 0; } void prepare_app(int argc) { GtkWidget *mvb; GtkWidget *button; _XA_WIN_LAYER = XInternAtom (GDK_DISPLAY(), XA_WIN_LAYER, False); app = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_realize (app); gtk_signal_connect (GTK_OBJECT (app), "delete_event", GTK_SIGNAL_FUNC (quit_cb), NULL); mvb=gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER(app), mvb); button = gtk_button_new_with_label ("Up"); gtk_container_add (GTK_CONTAINER(mvb), button); gtk_signal_connect (GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(layers_cb), (void*)1); gtk_widget_show (button); button = gtk_button_new_with_label ("Same"); gtk_container_add (GTK_CONTAINER(mvb), button); gtk_signal_connect (GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(layers_cb), (void*)0); gtk_widget_show (button); button = gtk_button_new_with_label ("Down"); gtk_container_add (GTK_CONTAINER(mvb), button); gtk_signal_connect (GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(layers_cb), (void*)-1); gtk_widget_show (button); gtk_widget_show (mvb); gtk_widget_show (app); /* Create the win we're raising/lowering */ dawin = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_realize (GTK_WIDGET(dawin)); if (argc > 1) { gtk_widget_show (GTK_WIDGET(dawin)); mgnome_win_hints_set_layer (GTK_WIDGET(dawin), layer); } else { mgnome_win_hints_set_layer (GTK_WIDGET(dawin), layer); gtk_widget_show (GTK_WIDGET(dawin)); } } void layers_cb (GtkWidget *widget, void *data) { layer += (int)data; mgnome_win_hints_set_layer (GTK_WIDGET(dawin), layer); return; } void quit_cb (GtkWidget *widget, void *data) { gtk_main_quit (); return; } void mgnome_win_hints_set_layer(GtkWidget *window, int layer) { XEvent xev; GdkWindowPrivate *priv; priv = (GdkWindowPrivate*)(GTK_WIDGET(window)->window); if (GTK_WIDGET_MAPPED(window)) { xev.type = ClientMessage; xev.xclient.type = ClientMessage; xev.xclient.window = priv->xwindow; xev.xclient.message_type = _XA_WIN_LAYER; xev.xclient.format = 32; xev.xclient.data.l[0] = (long)layer; xev.xclient.data.l[1] = gdk_time_get(); XSendEvent(GDK_DISPLAY(), GDK_ROOT_WINDOW(), False, SubstructureNotifyMask, (XEvent*) &xev); printf("Sending event to put win %x on layer %d\n", (int)priv->xwindow, layer); } else { long data[1]; data[0] = layer; XChangeProperty(GDK_DISPLAY(), priv->xwindow, _XA_WIN_LAYER, XA_CARDINAL, 32, PropModeAppend, (unsigned char *)data, 1); printf("Setting prop to put win %x on layer %d\n", (int)priv->xwindow, layer); } }