Subject: moving windows patch -- revisited?

From: Andrew Veliath <[email-masked]>
Date: Thu, 21 Nov 1996 05:36:34 -0500

Hi Henrique (and fvwm :),

Any chance you might do another FvwmPager moving windows patch for
2.0.43 with maybe some sort of option to toggle it on or off?  I
thought this was a nifty thing.

Regards,
Andrew

--
Andrew Veliath <[email-masked]>        http://www.rpi.edu/~veliaa
One day, all forms of communication will be superseded by a FAQ.
Finger for PGP Public Key
Key fingerprint =  51 56 5D 3E 51 43 8B 74  7C B2 E4 B6 84 8E 8B 08
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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: Henrique Martins <[email-masked]>
Date: Thu, 21 Nov 1996 18:03:47 -0800

> thought this was a nifty thing.

  Patch below, MINIMALLY TESTED! Patch with "-c -p".  New function
  PagerRTMoves controls the added behavior. This is the addition to the man
  page:

    PagerRTMoves [value]

    Specifies whether FvwmPager will track window moves in
    real-time. Default is on. "PagerRTMoves 0" turns it off. "PagerRTMoves
    <non zero value> turns it on. "PagerRTMoves" with no argument, toggles
    current value.

  -- Henrique ([email-masked])

*** ./modules/FvwmPager/FvwmPager.c.orig	Thu Nov 21 15:55:46 1996
--- ./modules/FvwmPager/FvwmPager.c	Thu Nov 21 15:57:27 1996
***************
*** 161,166 ****
--- 161,167 ----
  
    SetMessageMask(fd,
                   M_ADD_WINDOW|
+                  M_MOVING_WINDOW|
                   M_CONFIGURE_WINDOW|
                   M_DESTROY_WINDOW|
                   M_FOCUS_CHANGE|
***************
*** 234,239 ****
--- 235,243 ----
      case M_CONFIGURE_WINDOW:
        list_configure(body);
        break;
+     case M_MOVING_WINDOW:
+       list_moving_window (body);
+       break;
      case M_DESTROY_WINDOW:
        list_destroy(body);
        break;
***************
*** 321,326 ****
--- 325,363 ----
    (*prev)->text = body[22];
    (*prev)->back = body[23];
    AddNewWindow(*prev);
+ }
+ 
+ /***********************************************************************
+  *
+  *  Procedure:
+  *	list_moving_window - displays packet contents to stderr
+  *
+  ***********************************************************************/
+ 
+ void list_moving_window (unsigned long *body)
+ {
+   PagerWindow *t;
+   Window target_w;
+   
+   for (target_w = body[0],
+          t = Start;
+        t != NULL && t->w != target_w;
+        t = t->next);
+ 
+   if(t != NULL) {
+     t->x = body[1];
+     t->y = body[2];
+ 
+     if(t->desk != body[3])
+       ChangeDeskForWindow (t, body[3]);
+     else
+       MoveResizePagerView (t);
+ 
+     if (FocusWin == t)
+       Hilight (t, ON);
+     else
+       Hilight (t, OFF);
+   }
  }
  
  /***********************************************************************
*** ./modules/FvwmPager/FvwmPager.h.orig	Thu Nov 21 15:57:36 1996
--- ./modules/FvwmPager/FvwmPager.h	Thu Nov 21 15:57:51 1996
***************
*** 91,96 ****
--- 91,97 ----
  
  void list_add(unsigned long *body);
  void list_configure(unsigned long *body);
+ void list_moving_window (unsigned long *body);
  void list_destroy(unsigned long *body);
  void list_focus(unsigned long *body);
  void list_toggle(unsigned long *body);
*** ./fvwm/parse.h.orig	Thu Nov 21 17:10:46 1996
--- ./fvwm/parse.h	Thu Nov 21 17:21:07 1996
***************
*** 73,78 ****
--- 73,79 ----
  #define F_COLORMAP_FOCUS        55
  #define F_TITLESTYLE            56
  #define F_EXEC_SETUP            57
+ #define F_PAGER_RT_MOVES        58
  /* Functions which require a target window */
  #define F_RESIZE		100
  #define F_RAISE			101
*** ./fvwm/functions.c.orig	Thu Nov 21 17:10:53 1996
--- ./fvwm/functions.c	Thu Nov 21 17:31:22 1996
***************
*** 75,80 ****
--- 75,81 ----
    {"Next",         NextFunc,         F_NEXT,                FUNC_NO_WINDOW},
    {"None",         NoneFunc,         F_NONE,                FUNC_NO_WINDOW},
    {"OpaqueMoveSize", SetOpaque,      F_OPAQUE,              FUNC_NO_WINDOW},
+   {"PagerRTMoves", SetPagerRTMoves,  F_PAGER_RT_MOVES,      FUNC_NO_WINDOW},
    {"PipeRead",     PipeRead,         F_READ,                FUNC_NO_WINDOW},
  #ifdef XPM
    {"PixmapPath",   setPixmapPath,    F_PIXMAP_PATH,         FUNC_NO_WINDOW},
*** ./fvwm/builtins.c.orig	Thu Nov 21 17:14:52 1996
--- ./fvwm/builtins.c	Thu Nov 21 17:36:23 1996
***************
*** 977,982 ****
--- 977,995 ----
    }
  }
  
+ void SetPagerRTMoves (XEvent *eventp,Window w,FvwmWindow *tmp_win,
+                    unsigned long context, char *action,int* Module)
+ {
+   int n, val1, val1_unit;
+ 
+   n = GetOneArgument(action, &val1, &val1_unit);
+ 
+   if(n != 1)
+     RTMoves = !RTMoves;
+   else
+     RTMoves = val1 != 0;
+ }
+ 
  void SetEdgeScroll(XEvent *eventp,Window w,FvwmWindow *tmp_win,
                     unsigned long context, char *action,int* Module)
  {
*** ./fvwm/misc.h.orig	Thu Nov 21 17:17:22 1996
--- ./fvwm/misc.h	Thu Nov 21 17:30:51 1996
***************
*** 115,120 ****
--- 115,121 ----
  extern unsigned long Globalgcm;
  extern Time lastTimestamp;
  extern XEvent Event;
+ extern int RTMoves;
  
  extern char NoName[];
  extern char NoClass[];
***************
*** 305,310 ****
--- 306,313 ----
  void SetBox(char *text, FILE *fd, char **arg,int *);
  void set_func(char *, FILE *, char **,int *);
  void copy_config(FILE **config_fd);
+ void SetPagerRTMoves (XEvent *eventp,Window w,FvwmWindow *tmp_win,
+                    unsigned long context, char *action,int* Module);
  void SetEdgeScroll(XEvent *eventp,Window w,FvwmWindow *tmp_win,
  		     unsigned long context, char *action,int *Module);
  void SetEdgeResistance(XEvent *eventp,Window w,FvwmWindow *tmp_win,
*** ./fvwm/move.c.orig	Thu Nov 21 15:58:37 1996
--- ./fvwm/move.c	Thu Nov 21 17:20:35 1996
***************
*** 28,33 ****
--- 28,34 ----
  extern XEvent Event;
  extern int menuFromFrameOrWindowOrTitlebar;
  Bool NeedToResizeToo;
+ int RTMoves = 1;
  
  /****************************************************************************
   *
***************
*** 202,208 ****
  	case MotionNotify:
  	  xl = Event.xmotion.x_root;
  	  yt = Event.xmotion.y_root;
! 	  HandlePaging(Scr.MyDisplayWidth,Scr.MyDisplayHeight,&xl,&yt,
  		       &delta_x,&delta_y,False);
  	  /* redraw the rubberband */
  	  xl += XOffset;
--- 203,209 ----
  	case MotionNotify:
  	  xl = Event.xmotion.x_root;
  	  yt = Event.xmotion.y_root;
! 	  HandlePaging(Scr.EdgeScrollX,Scr.EdgeScrollY,&xl,&yt,
  		       &delta_x,&delta_y,False);
  	  /* redraw the rubberband */
  	  xl += XOffset;
***************
*** 242,247 ****
--- 243,254 ----
  		XMoveWindow(dpy,tmp_win->frame,xl,yt);
  	    }
  	  DisplayPosition(tmp_win,xl+Scr.Vx,yt+Scr.Vy,False);
+           if (RTMoves) {
+             Broadcast (M_MOVING_WINDOW, 6,
+                        tmp_win->w, xl, yt, tmp_win->Desk,
+                        xl - XOffset, yt - YOffset, 0);
+             FlushQueues ();
+           }
  	  done = TRUE;
  	  break;
  
*** ./fvwm/events.c.orig	Thu Nov 21 16:00:55 1996
--- ./fvwm/events.c	Thu Nov 21 16:01:25 1996
***************
*** 1454,1456 ****
--- 1454,1490 ----
    return 0;
  }
  
+ void FlushQueues ()
+ {
+   extern int fd_width;
+   fd_set out_fdset;
+   int i;
+   int retval;
+ 
+   FD_ZERO(&out_fdset);
+   for(i=0; i<npipes; i++)
+     {
+       if(pipeQueue[i]!= NULL)
+ 	{
+ 	  FD_SET(writePipes[i], &out_fdset);
+ 	}
+     }
+   
+ #ifdef __hpux
+   retval=select(fd_width, 0, (int *)&out_fdset,0, NULL);
+ #else
+   retval=select(fd_width, 0, &out_fdset, 0, NULL);
+ #endif
+   
+   for(i=0;i<npipes;i++)
+     {
+       if(writePipes[i] >= 0)
+ 	{
+ 	  if((retval>0)&&(FD_ISSET(writePipes[i], &out_fdset)))
+ 	    {
+ 	      FlushQueue(i);
+ 	    }
+ 	}
+     }
+ 
+ }
*** ./fvwm/module.h.orig	Thu Nov 21 16:29:39 1996
--- ./fvwm/module.h	Thu Nov 21 16:30:11 1996
***************
*** 39,45 ****
  #define M_ICON_FILE          (1<<20)
  #define M_DEFAULTICON        (1<<21)
  #define M_STRING             (1<<22)
! #define MAX_MESSAGES         23
  #define MAX_MASK             ((1<<MAX_MESSAGES)-1)
  
  #define HEADER_SIZE         4
--- 39,46 ----
  #define M_ICON_FILE          (1<<20)
  #define M_DEFAULTICON        (1<<21)
  #define M_STRING             (1<<22)
! #define M_MOVING_WINDOW      (1<<23)
! #define MAX_MESSAGES         24
  #define MAX_MASK             ((1<<MAX_MESSAGES)-1)
  
  #define HEADER_SIZE         4
*** ./fvwm/fvwm2.man.orig	Thu Nov 21 17:42:17 1996
--- ./fvwm/fvwm2.man	Thu Nov 21 17:48:56 1996
***************
*** 917,922 ****
--- 917,927 ----
  are moved as rubber-bands.

+ .IP "PagerRTMoves \fI[value]\fP"
+ Specifies whether FvwmPager will track window moves in real-time. Default
+ is on. "PagerRTMoves 0" turns it off. "PagerRTMoves \fI<non zero value>\fP
+ turns it on. "PagerRTMoves" with no argument, toggles current value.
+ 
  .IP "PipeRead \fIcmd\fP"
  Causes fvwm to read commands outputted from the program named
  \fIcmd\fP.  Useful for building up dynamic menu entries based on a
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
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: Andrew Veliath <[email-masked]>
Date: Mon, 25 Nov 1996 02:09:30 -0500

>> Any chance you might do another FvwmPager moving windows patch
    >> for 2.0.43 with maybe some sort of option to toggle it on or
    >> off?  I thought this was a nifty thing.
  
    Henrique>   Patch below, MINIMALLY TESTED! Patch with "-c -p".
    Henrique> New function PagerRTMoves controls the added
    Henrique> behavior. This is the addition to the man page:

    Henrique>     PagerRTMoves [value]

    Henrique>     Specifies whether FvwmPager will track window moves
    Henrique> in real-time. Default is on. "PagerRTMoves 0" turns it
    Henrique> off. "PagerRTMoves <non zero value> turns it
    Henrique> on. "PagerRTMoves" with no argument, toggles current
    Henrique> value.

Thanks, this was nice and quick!!

The niftiness lives on! :)

Regards,
Andrew