Subject: GNOME XA_WIN_AREA fixes

From: Ben Winslow <[email-masked]>
Date: Sun, 12 Dec 1999 02:39:46 -0500

This patch fixes the XA_WIN_AREA problems with GNOME (it does indeed
need to be sent for both the root window as well as application windows). 
This fixes the GNOME Pager/Tasklist problems (with everything appearking on
the upper left workspace) that I e-mailed the list about a week or two ago,
which IMHO was the most annoying GNOME-related bug.

-- 
Ben Winslow           /   [email-masked]
bluecherry internet   /   http://www.bluecherry.net
|Rain| @ IRC          /   anynet: irc.anynet.org
Index: fvwm/fvwm.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.c,v
retrieving revision 1.178
diff -u -r1.178 fvwm.c
--- fvwm/fvwm.c	1999/11/27 15:13:09	1.178
+++ fvwm/fvwm.c	1999/12/12 07:32:14
@@ -832,6 +832,7 @@
     GNOME_SetHints(fw);
     GNOME_SetDesk(fw);
     GNOME_SetLayer(fw);
+    GNOME_SetWinArea(fw);
 #endif
 
     XSelectInput(dpy, fw->w, 0);
Index: fvwm/geometry.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/geometry.c,v
retrieving revision 1.2
diff -u -r1.2 geometry.c
--- fvwm/geometry.c	1999/11/28 12:57:19	1.2
+++ fvwm/geometry.c	1999/12/12 07:32:20
@@ -192,6 +192,7 @@
 #if 0
 fprintf(stderr,"uag: called for window '%s'\n", tmp_win->name);
 #endif
+
   /* store orig values in absolute coords */
   dest_g = (IS_MAXIMIZED(tmp_win)) ? &tmp_win->max_g : &tmp_win->normal_g;
   dest_g->x = tmp_win->frame_g.x + Scr.Vx;
@@ -203,6 +204,9 @@
   {
     dest_g->y += tmp_win->frame_g.height - dest_g->height;
   }
+#ifdef GNOME
+  GNOME_SetWinArea(tmp_win);
+#endif
 #if 0
 fprintf(stderr,"     frame:  %5d %5d, %4d x %4d\n", tmp_win->frame_g.x, tmp_win->frame_g.y, tmp_win->frame_g.width, tmp_win->frame_g.height);
 fprintf(stderr,"     normal: %5d %5d, %4d x %4d\n", tmp_win->normal_g.x, tmp_win->normal_g.y, tmp_win->normal_g.width, tmp_win->normal_g.height);
Index: fvwm/gnome.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/gnome.c,v
retrieving revision 1.15
diff -u -r1.15 gnome.c
--- fvwm/gnome.c	1999/12/05 23:50:37	1.15
+++ fvwm/gnome.c	1999/12/12 07:32:32
@@ -621,7 +621,7 @@
 {
   Atom atom_set;
   CARD32 val[2];
-
+  
   atom_set = XInternAtom(dpy, XA_WIN_AREA, False);
 
   val[0] = Scr.Vx / Scr.MyDisplayWidth;
@@ -631,7 +631,6 @@
 		  (unsigned char *)val, 2);
 }
 
-
 /* FIXME: what to do about negative desks ? */
 /* ignore them!!! */
 void
@@ -732,14 +731,31 @@
       XChangeProperty(dpy, Scr.Root, atom_set, XA_CARDINAL, 32,
 		      PropModeReplace, (unsigned char *)NULL, 0);
     }
+
 }
 
+void
+GNOME_SetWinArea(FvwmWindow *w)
+{
+  Atom atom_set;
+  CARD32 val[2];
+  
+  atom_set = XInternAtom(dpy, XA_WIN_AREA, False);
 
+  if (!DO_SKIP_WINDOW_LIST(w)) {
+	  val[0] = (w->frame_g.x + Scr.Vx) / Scr.MyDisplayWidth;
+	  val[1] = (w->frame_g.y + Scr.Vy) / Scr.MyDisplayHeight;
+          XChangeProperty(dpy, w->w, atom_set, XA_CARDINAL, 32,
+		      PropModeReplace, (unsigned char *)val, 2);
+    }
+}
+
 void
 GNOME_Init(void)
 {
   int i;
   Atom atom_set, list[11];
+  FvwmWindow *t;
   CARD32 val;

Index: fvwm/gnome.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/gnome.h,v
retrieving revision 1.2
diff -u -r1.2 gnome.h
--- fvwm/gnome.h	1999/12/05 23:50:37	1.2
+++ fvwm/gnome.h	1999/12/12 07:32:32
@@ -51,6 +51,7 @@
 
 void GNOME_SetLayer(FvwmWindow *fwin);
 void GNOME_SetDesk(FvwmWindow *fwin);
+void GNOME_SetWinArea(FvwmWindow *w);
 void HandleGnomePropRequest(unsigned int propm,
                             unsigned int prop,
                             Window win,
Index: fvwm/move_resize.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/move_resize.c,v
retrieving revision 1.77
diff -u -r1.77 move_resize.c
--- fvwm/move_resize.c	1999/11/28 11:16:45	1.77
+++ fvwm/move_resize.c	1999/12/12 07:32:50
@@ -523,6 +523,9 @@
       XMapWindow(dpy,w);
     }
   }
+#ifdef GNOME
+  XSync(dpy, 0); 
+#endif
   if (IS_MAXIMIZED(tmp_win))
   {
     tmp_win->max_g.x += dx;
@@ -536,13 +539,13 @@
     tmp_win->normal_g.y += dy;
     update_absolute_geometry(tmp_win);
   }
-
   return;
 }
 
 void move_window(F_CMD_ARGS)
 {
   move_window_doit(eventp,w,tmp_win,context,action,Module,False,False);
+
 }
 
 void animated_move_window(F_CMD_ARGS)
Index: fvwm/virtual.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/virtual.c,v
retrieving revision 1.65
diff -u -r1.65 virtual.c
--- fvwm/virtual.c	1999/12/08 10:24:03	1.65
+++ fvwm/virtual.c	1999/12/12 07:32:55
@@ -1174,6 +1174,7 @@
 #ifdef GNOME
   GNOME_SetDeskCount();
   GNOME_SetDesk(tmp_win);
+  GNOME_SetWinArea(tmp_win);
 #endif
 }

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 15 Dec 1999 22:53:27 +0100

> which IMHO was the most annoying GNOME-related bug.

I've applied the patch (with several changes), but I still think

 1) The tasklist/pager are buggy if they fail to work correctly
    without this hint set.
 2) This hint is the wrong way to do this.

Just consider windows that are halfway between two (or even four)
pages.  Which would be their correct page coordinates?  The
tasklist should take the window's geometry and then decide for
itself on which page to put it.

Bye

Dominik ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Ben Winslow <[email-masked]>
Date: Wed, 15 Dec 1999 23:22:31 -0500

On Wed, Dec 15, 1999 at 10:53:27PM +0100, Dominik Vogt wrote:
# Date: Wed, 15 Dec 1999 22:53:27 +0100
# From: Dominik Vogt <[email-masked]>
# To: [email-masked]
# Subject: Re: GNOME XA_WIN_AREA fixes
# Message-ID: <[email-masked]>
# Reply-To: [email-masked]
# Mail-Followup-To: [email-masked]
# References: <[email-masked]>
# Mime-Version: 1.0
# Content-Type: text/plain; charset=us-ascii
# X-Mailer: Mutt 0.95.6i
# In-Reply-To: <[email-masked]>; from Ben Winslow on Sun, Dec 12, 1999 at 02:39:46AM -0500
# Sender: [email-masked]
# Precedence: list
# X-Majordomo: 1.94.jlt7
# 
# I've applied the patch (with several changes), but I still think
# 
#  1) The tasklist/pager are buggy if they fail to work correctly
#     without this hint set.
I agree, though I can *kind of* see the reasoning for it.  There are a lot
of window managers out there, and who knows what they'll decide to use for
desktop areas (although I truely can't imagine it being much different).

#  2) This hint is the wrong way to do this.
Again, I agree.  *BUT*, GNOME is a real pain to use efficiently without the
hint set, so...

# 
# Just consider windows that are halfway between two (or even four)
# pages.  Which would be their correct page coordinates?  The
# tasklist should take the window's geometry and then decide for
# itself on which page to put it.
# 
# Bye
# 
# Dominik ^_^
# 
# --
# Dominik Vogt, [email-masked]
# Reply-To: [email-masked]
# --
# Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
# To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
# body of a message to [email-masked].
# To report problems, send mail to [email-masked]

---

From: Tim Janik <[email-masked]>
Date: Thu, 16 Dec 1999 08:27:28 +0100 (CET)

> itself on which page to put it.

this specific property has even more problems. according to the old
wm spec, pagers/tasklists should send a client message to the root
window for changing the current area, and for changing the current
area of a specific window. many window managers though expect the
pager to modify this property directly and will change the current
area for client messages that should only change the current area
of a specific window.

with the new wm spec coming out, i'll probably overhaul the pager/tasklist
wm backend to determine the current area purely based on the clients
geometry, especially with window managers that don't necessarily align
the current area to some multitude of the screen size (i.e. viewport
scrolling).

you should probbaly mail to wm-spec-list if you think that this property
should completely vanish (iirc it needs to be there at least for clients
to specify on what area they want to be initially mapped).

> Bye

---
ciaoTJ