Subject: some GNOME diffs for your consideration

From: Matt Rossmiller <[email-masked]>
Date: Thu, 4 Nov 1999 17:24:16 -0600 (CST)

The following diff for events.c allows unbound mouse actions on the root
window to be forwarded to Gnome desktop.  This seems desirable to me,
as this is what the Gnome WM spec recommends.

*** events.c	Sat Oct 16 05:32:52 1999
--- ../../../fvwm/fvwm/events.c	Thu Nov  4 17:18:30 1999
***************
*** 1421,1430 ****
  			Event.xbutton.state, GetUnusedModifiers(), Context,
  			MOUSE_BINDING);
  #endif /* HAVE_STROKE */
!   if (action != NULL)
    {
      ExecuteFunction(action, Tmp_win, &Event, Context, -1, EXPAND_COMMAND);
    }
  
    OldPressedW = PressedW;
    PressedW = None;
--- 1421,1442 ----
  			Event.xbutton.state, GetUnusedModifiers(), Context,
  			MOUSE_BINDING);
  #endif /* HAVE_STROKE */
!   if (action != NULL && (strlen(action) != 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,1487 ****
  /* DEBUG printfs
     printf ("action is %p\n", action);
  */
!    if (action != NULL)
       ExecuteFunction(action,Tmp_win, &Event,Context,-1, EXPAND_COMMAND);
  }
  
  /***********************************************************************
--- 1492,1514 ----
  /* DEBUG printfs
     printf ("action is %p\n", action);
  */
!    if (action != NULL && strlen(action) != 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
+ 
  }
  
  /***********************************************************************

The following diff is just a little cleanup of the GNOME_Init func
in gnome.c  I think it's safe to use the same window for button press
proxying and announcing gnome compliance.

*** gnome.c	Mon Oct 18 05:18:14 1999
--- ../../../fvwm/fvwm/gnome.c	Thu Nov  4 17:23:15 1999
***************
*** 719,725 ****
    int i;
    Atom atom_set, list[11];
    CARD32 val;
-   Window win;

    atom_set = XInternAtom(dpy, XA_WIN_PROTOCOLS, False);
--- 719,724 ----
***************
*** 744,774 ****
  		  (unsigned char *)list, i);

    /* 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);
! 
    atom_set = XInternAtom(dpy, XA_WIN_SUPPORTING_WM_CHECK, False);
!   val = win;
    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);

    /* 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);
--- 743,772 ----
  		  (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
     */
!   __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 = __button_proxy;
    XChangeProperty(dpy, Scr.Root, 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
     */
  
    atom_set = XInternAtom(dpy, XA_WIN_DESKTOP_BUTTON_PROXY, False);
  
    XChangeProperty(dpy, Scr.Root, atom_set, XA_CARDINAL, 32,
  		  PropModeReplace, (unsigned char *)&val, 1);

-Matt
______________________________________________________________________
Matthew D. Rossmiller
Celox Communications
Member of Technical Staff
[email-masked]