Subject: My Gnome updates

From: Matt Rossmiller <[email-masked]>
Date: Fri, 5 Nov 1999 11:13:00 -0600 (CST)

Please disregard the diffs I sent yesterday in favor of the following 
diffs. In addition to the changes from yesterday, the following allows
gnome applications to sticky and windowshade themselves (or others as 
gnome pager does) and also added the gnomeshowdesks configurable to tell
gnome exactly how many desks to show... also, desk change requests outside
of gnome's range will not be sent to gnome, which seems to improve the
panel's ability to stay on the correct desk/screen when not sticky and
using FvwmPager. 

diff -u ./events.c /home/matt/latest_fvwm/fvwm/fvwm/events.c
--- ./events.c	Sat Oct 16 05:32:52 1999
+++ /home/matt/latest_fvwm/fvwm/fvwm/events.c	Fri Nov  5 12:11:10 1999
@@ -1421,10 +1421,22 @@
 			Event.xbutton.state, GetUnusedModifiers(), Context,
 			MOUSE_BINDING);
 #endif /* HAVE_STROKE */
-  if (action != NULL)
+  if (action != NULL && (action[0] != 0))
   {
     ExecuteFunction(action, Tmp_win, &Event, Context, -1, EXPAND_COMMAND);
   }
+#ifdef GNOME
+  else
+  {
+/*-----------------------------------------------------------------------
+    do gnome buttonpress forwarding if win == root
+ -----------------------------------------------------------------------*/
+      if (Scr.Root == Event.xany.window)
+      {
+          GNOME_ProxyButtonEvent(&Event);
+      }
+  }
+#endif
 
   OldPressedW = PressedW;
   PressedW = None;
@@ -1480,8 +1492,23 @@
 /* DEBUG printfs
    printf ("action is %p\n", action);
 */
-   if (action != NULL)
+   if (action != NULL && (action[0] != 0))
+   {
      ExecuteFunction(action,Tmp_win, &Event,Context,-1, EXPAND_COMMAND);
+   }
+#ifdef GNOME
+   else
+   {
+/*-----------------------------------------------------------------------
+    do gnome buttonpress forwarding if win == root
+ -----------------------------------------------------------------------*/
+      if (Scr.Root == Event.xany.window)
+      {
+          GNOME_ProxyButtonEvent(&Event);
+      }
+   }
+#endif
+
 }
 
 /***********************************************************************
diff -u ./functions.c /home/matt/latest_fvwm/fvwm/fvwm/functions.c
--- ./functions.c	Wed Nov  3 09:39:48 1999
+++ /home/matt/latest_fvwm/fvwm/fvwm/functions.c	Thu Nov  4 18:36:08 1999
@@ -170,6 +170,7 @@
   {"globalopts",   SetGlobalOptions, F_GLOBAL_OPTS,         0},
 #ifdef GNOME
   {"gnomebutton",  GNOME_ButtonFunc, F_MOUSE,               0},
+  {"gnomeshowdesks", GNOME_ShowDesks, F_DESK,               0},
 #endif /* GNOME */
   {"gotodesk",     changeDesks_func, F_DESK,                0},
   {"gotodeskandpage",  gotoDeskAndPage_func, F_DESK,        0},
diff -u ./gnome.c /home/matt/latest_fvwm/fvwm/fvwm/gnome.c
--- ./gnome.c	Mon Oct 18 05:18:14 1999
+++ /home/matt/latest_fvwm/fvwm/fvwm/gnome.c	Fri Nov  5 11:33:02 1999
@@ -31,7 +31,7 @@
 #include "stack.h"
 #include "virtual.h"
 #include "style.h"
-
+#include "gnome.h"

 /*********************************************************/
@@ -247,6 +247,9 @@
 static Window __button_proxy = 0;

+/* how many desks does gnome know about */
+static unsigned int gnome_max_desk = 1;
+
 static void *
 AtomGet(Window win, Atom to_get, Atom type, int *size)
 {
@@ -566,6 +569,12 @@
 
   atom_set = XInternAtom(dpy, XA_WIN_WORKSPACE, False);
   val = fwin->Desk;
+  if (val >= gnome_max_desk)
+  {
+      fvwm_msg(ERR, "GNOME_SetDesk",
+               "Attemped to set window to desk gnome does not know about");
+      val = (gnome_max_desk -1);
+  }
   XChangeProperty(dpy, fwin->w, atom_set, XA_CARDINAL, 32,
 		  PropModeReplace, (unsigned char *)&val, 1);
 }
@@ -623,6 +632,7 @@

 /* FIXME: what to do about negative desks ? */
+/* ignore them!!! */
 void
 GNOME_SetDeskCount(void)
 {
@@ -631,17 +641,21 @@
   FvwmWindow *t;
 
   atom_set = XInternAtom(dpy, XA_WIN_WORKSPACE_COUNT, False);
-  val = Scr.CurrentDesk;
+  val = 0;
   for (t = get_next_window_in_stack_ring(&Scr.FvwmRoot);
        t != &Scr.FvwmRoot;
        t = get_next_window_in_stack_ring(t))
-    {
+  {
       if (t->Desk > val)
-	{
-	  val = t->Desk;
-	}
-    }
+      {
+          val = t->Desk;
+      }
+  }
   val++;
+  if (gnome_max_desk > val)
+  {
+      val = gnome_max_desk;
+  }
   XChangeProperty(dpy, Scr.Root, atom_set, XA_CARDINAL, 32, PropModeReplace,
 		  (unsigned char *)&val, 1);
 }
@@ -656,6 +670,13 @@
 
   atom_set = XInternAtom(dpy, XA_WIN_WORKSPACE, False);
   val = (CARD32) Scr.CurrentDesk;
+  if (val >= gnome_max_desk)
+  {
+      fvwm_msg(ERR, "GNOME_SetCurrentDesk",
+               "Attemped to change to desk gnome does not know about");
+      val = (gnome_max_desk -1);
+  }
+  
   XChangeProperty(dpy, Scr.Root, atom_set, XA_CARDINAL, 32, PropModeReplace,
 		  (unsigned char *)&val, 1);
   GNOME_SetCurrentArea();
@@ -719,7 +740,6 @@
   int i;
   Atom atom_set, list[11];
   CARD32 val;
-  Window win;

   atom_set = XInternAtom(dpy, XA_WIN_PROTOCOLS, False);
@@ -744,31 +764,30 @@
 		  (unsigned char *)list, i);

+/*-----------------------------------------------------------------------
+    wny use two windows when one does just fine ?
+ -----------------------------------------------------------------------*/
   /* create a window which is a child of the root window and set the
    * XA_WIN_SUPPORTING_WM_CHECK property on it, and also set the
    * same property on the root window with the window ID of of the
    * window we just created
    */
-  win = XCreateWindow(dpy, Scr.Root, -10, -10, 10, 10, 0, 0,
-		      InputOnly, CopyFromParent, 0, NULL);
-
+  __button_proxy = XCreateWindow(dpy, Scr.Root, -10, -10, 10, 10, 0, 0,
+                                 InputOnly, CopyFromParent, 0, NULL);
+                                 
   atom_set = XInternAtom(dpy, XA_WIN_SUPPORTING_WM_CHECK, False);
-  val = win;
+  val = __button_proxy;
   XChangeProperty(dpy, Scr.Root, atom_set, XA_CARDINAL, 32, PropModeReplace,
 		  (unsigned char *)&val, 1);
-  XChangeProperty(dpy, win, atom_set, XA_CARDINAL, 32, PropModeReplace,
-		  (unsigned char *)&val, 1);
+  XChangeProperty(dpy, __button_proxy, atom_set, XA_CARDINAL, 32,
+                  PropModeReplace, (unsigned char *)&val, 1);

   /* create a window which is the child of the root window for proxying
    * root window clicks
    */
 
-  __button_proxy = XCreateWindow(dpy, Scr.Root, -10, -10, 10, 10, 0, 0,
-				 InputOnly, CopyFromParent, 0, NULL);
-
   atom_set = XInternAtom(dpy, XA_WIN_DESKTOP_BUTTON_PROXY, False);
-  val = __button_proxy;
 
   XChangeProperty(dpy, Scr.Root, atom_set, XA_CARDINAL, 32,
 		  PropModeReplace, (unsigned char *)&val, 1);
@@ -788,6 +807,30 @@
 }

+/*-----------------------------------------------------------------------
+    tell gnome how many desks to show
+ -----------------------------------------------------------------------*/
+void
+GNOME_ShowDesks(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+            unsigned long context,char *action, int *Module)
+{
+    int n;
+    Atom atom_set;
+    CARD32 val[1];
+
+    atom_set = XInternAtom(dpy, XA_WIN_WORKSPACE_COUNT, False);
+
+    DBUG("GNOME_ShowDesks","Routine Entered");
+    n = GetIntegerArguments(action, NULL, (int *)val, 1);
+    if(n != 1)
+    {
+        fvwm_msg(ERR,"GnomeShowDesks","requires one argument");
+        return;
+    }
+    gnome_max_desk = val[0];
+    XChangeProperty(dpy, Scr.Root, atom_set, XA_CARDINAL, 32,
+                    PropModeReplace, (unsigned char *)(&val[0]), 1);
+}

 /*** RECIVING MESSAGES ***/
@@ -821,10 +864,104 @@
       new_layer (fwin, ev->xclient.data.l[0]);
       return 1;
     }
+    
+  a = XInternAtom(dpy, XA_WIN_STATE, False);
+  if (ev->xclient.message_type == a && fwin)
+    {
+      HandleGnomePropRequest(ev->xclient.data.l[0],
+                             ev->xclient.data.l[1],
+                             ev->xclient.window,
+                             ev);
+      return 1;
+    }
 
   return 0;
 }
 
+void HandleGnomePropRequest(unsigned int propm,
+                            unsigned int prop,
+                            Window win,
+                            XEvent *ev)
+{
+    Atom atype;
+    Atom a;
+    int aformat;
+    FvwmWindow *fwin;
+    unsigned char *indi;
+    unsigned long nitems, bytes_remain, oldprop;
+    indi = (unsigned char *)&oldprop;
+    DBUG("HandleGnomePropRequest","Routine Entered");
+
+    a = XInternAtom(dpy, XA_WIN_STATE, False);
+
+    for (fwin=Scr.FvwmRoot.next;
+         fwin !=(FvwmWindow*)0;
+         fwin=fwin->next)
+    {
+        if (fwin->w == win)
+            break;
+    }
+    
+/*-----------------------------------------------------------------------
+    First change the props on the window so the gnome app knows we did
+    somthing.
+ -----------------------------------------------------------------------*/
+    fvwm_msg(DBG, "HandleGnomePropRequest", "window is %d", fwin->w);
+    if (fwin == (FvwmWindow*) 0)
+        return;
+        
+    fvwm_msg(DBG, "HandleGnomePropRequest", "prop req is %d", prop);
+    fvwm_msg(DBG, "HandleGnomePropRequest", "propm req is %d", propm);
+    XGetWindowProperty(dpy, fwin->w, a, 0L, 3L, False, a,
+                       &atype, &aformat, &nitems, &bytes_remain, &indi);
+    oldprop &= ~(propm);
+    oldprop |= (propm & prop);
+    fvwm_msg(DBG, "HandleGnomePropRequest", "oldprop req is %d", oldprop);
+    XChangeProperty(dpy, fwin->w, a, XA_CARDINAL, 32,
+                    PropModeReplace, (unsigned char *)&oldprop, 1);
+
+/*-----------------------------------------------------------------------
+    Then apply the requests
+ -----------------------------------------------------------------------*/
+ 
+/*-----------------------------------------------------------------------
+    Sticky
+ -----------------------------------------------------------------------*/
+     if (propm & WIN_STATE_STICKY)
+    {
+        if (prop & WIN_STATE_STICKY)
+        {
+            SET_STICKY(fwin, 1);
+        } else {
+            SET_STICKY(fwin, 0);
+        }
+        SetBorder(fwin,True,True,True,None);
+    }
+/*-----------------------------------------------------------------------
+    WindowShade
+ -----------------------------------------------------------------------*/
+
+     if (propm & WIN_STATE_SHADED)
+     {
+         if (prop & WIN_STATE_SHADED)
+         {
+/* shade up */
+             ExecuteFunction("WindowShade 1", fwin, ev,
+                             C_WINDOW, -1, EXPAND_COMMAND);  
+         }
+        else
+        {
+/* shade down */
+            ExecuteFunction("WindowShade 0", fwin, ev,
+                            C_WINDOW, -1, EXPAND_COMMAND);  
+
+        }
+    }
+/*-----------------------------------------------------------------------
+    
+ -----------------------------------------------------------------------*/
+
+}
 
 void
 GNOME_ProxyButtonEvent(XEvent *ev)
@@ -853,3 +990,4 @@
 }
 
 #endif /* GNOME */
+
diff -u ./gnome.h /home/matt/latest_fvwm/fvwm/fvwm/gnome.h
--- ./gnome.h	Sat Jun 26 12:25:48 1999
+++ /home/matt/latest_fvwm/fvwm/fvwm/gnome.h	Fri Nov  5 11:20:03 1999
@@ -31,6 +31,14 @@
 	 char *action,
 	 int *Module);
 
+void GNOME_ShowDesks(
+         XEvent *eventp,
+	 Window w,
+	 FvwmWindow *fwin,
+	 unsigned long context,
+	 char *action,
+	 int *Module);
+
 /* get hints on a window; sets parameters in a FvwmWindow */
 void GNOME_GetHints(FvwmWindow *fwin);
 /* get hints on a window, set parameters in style */
@@ -41,6 +49,10 @@
 
 void GNOME_SetLayer(FvwmWindow *fwin);
 void GNOME_SetDesk(FvwmWindow *fwin);
+void HandleGnomePropRequest(unsigned int propm,
+                            unsigned int prop,
+                            Window win,
+                            XEvent *ev);
 
 /* update public window manager information */
 void GNOME_SetAreaCount(void);

-thx
Matt

---

From: [email-masked] (Paul D. Smith)
Date: 12 Nov 1999 11:14:35 -0500

Has anyone looked at Matt's GNOME enhancements?  I haven't seen any CVS
notices about them go by, so I guess they haven't been merged?

I don't know much about GNOME but from the descriptions of the changes
they look useful.

Does anyone who _does_ know something about it have an opinion?

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
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: Dan Espen <[email-masked]>
Date: Fri, 12 Nov 1999 11:28:49 -0500

> Does anyone who _does_ know something about it have an opinion?

Last year we were seeking improved Gnome documentation.  I think the
response then made it clear that we are "Gnome Challenged".

--
Dan Espen
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854                     Phone: (732) 699-5570
--
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: Dominik Vogt <[email-masked]>
Date: Fri, 12 Nov 1999 17:33:04 +0100

> notices about them go by, so I guess they haven't been merged?

No, they haven't.

> Does anyone who _does_ know something about it have an opinion?

No, sorry. I had written a reply asking a few question about his
patches, but it got lost over a mail server crash here and I didn't
have the time to write it again yet. I guess since Matthias Claasen
has vanished (or are you still lurking in the background, Matthias?),
we have nobody with good knowledge of the GNOME patches. Personally
I don't want to spend much time for it myself since most of the stuff
Matt coded will be obsolete with the next version of the GNOME/KDE
specs anyway.

Bye

Dominik ^_^

-- 
Dominik Vogt, Agilent Technologies, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/464-4596, fax: 07031/464-3883, [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: Matthias Clasen <[email-masked]>
Date: Fri, 12 Nov 1999 17:33:15 +0100

> has vanished (or are you still lurking in the background, Matthias?),

Lurk, lurk.

> Matt coded will be obsolete with the next version of the GNOME/KDE

The same feeling here. Besides I don't have time to hack fvwm anyway.

-- 
Matthias Clasen, 
Tel. 0761/203-5606
Email: [email-masked]
Mathematisches Institut, Albert-Ludwigs-Universitaet Freiburg
--
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: Tomas Ogren <[email-masked]>
Date: Mon, 15 Nov 1999 21:13:54 +0100

> > Does anyone who _does_ know something about it have an opinion?
[...]
> Personally I don't want to spend much time for it myself since most of
> the stuff Matt coded will be obsolete with the next version of the
> GNOME/KDE specs anyway.

Which will be in a year or so... Personally, I'm swamped right now - but
I'd like the patches integrated if they don't ruin something else.

/Tomas
-- 
Tomas Ögren, [email-masked], http://www.ing.umu.se/~stric/
|- Student at Computing Science, University of Umeå
`- Sysadmin at {cs,ing,acc}.umu.se
--
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: [email-masked] (Paul D. Smith)
Date: 16 Nov 1999 23:29:33 -0500

>> Matt coded will be obsolete with the next version of the GNOME/KDE

  mc> The same feeling here. Besides I don't have time to hack fvwm anyway.

I'm much less optimistic about the mythical WM unification.  As far as I
can tell, that effort is going nowhere pretty quickly.  I think holding
off waiting for it isn't a good idea.

The patches look like good stuff to me, although I don't use GNOME much
(at all).  If no one has any problem with them I'll try to find some
time to apply them.

---

From: Dominik Vogt <[email-masked]>
Date: Wed, 17 Nov 1999 16:03:29 +0100

> off waiting for it isn't a good idea.

I didn't want to say that I'm against including any patches, just
that personally I won't spend time to understand the old spec when
I'm participating in the 2.0 discussion myself.  And I'm not using
GNOME at all.

> (at all).  If no one has any problem with them I'll try to find some

That would be great.

Bye

Dominik ^_^

---

From: Tomas Ogren <[email-masked]>
Date: Sun, 28 Nov 1999 05:20:20 +0100

On 05 November, 1999 - Matt Rossmiller sent me these 12K bytes:

> In addition to the changes from yesterday, the following allows
> gnome pager does)

I've added this to my tree for inclusion. Also adding more, see below.

> and also added the gnomeshowdesks configurable to tell gnome exactly
> how many desks to show...

Why would you want this? Why can't GNOME know about all desks?

> also, desk change requests outside of gnome's range will not be sent
> to gnome, which seems to improve the panel's ability to stay on the
> correct desk/screen when not sticky and using FvwmPager. 

So... if you've said that GNOME should only know about 2 and you switch
to #3... then the window lists etc won't be correct anymore.. Why this?

I've been poking around to get the _WIN_AREA atom set on all windows
which says on which virtual page the window is on right now but I need
some hints where to place all the updating functions.. Is it a gazillion
places or can I get away with just a few places?

It needs to be updated when a window is moved or anything else changes
which changes the x,y virtual page the window is on...

Dom?

/Tomas