Re: FVWM: moving windows patch

From: Henrique Martins <martins_at_martins.hpl.hp.com>
Date: Wed, 06 Mar 1996 23:22:48 -0800

> I think I haven't tried hacking fvwm's code since way back in 0.9/1.x
> times, pre-modules, so I'm not sure of all the side effects of the
> changes below, specially on the impact on inter-module traffic and module
> behavior, but this patch will make the "window icons" in the pager move,
> while a window is being moved by fvwm, i.e. non-pager initiated moves.


  Either no one tried that patch, or no one noticed that it doesn't work
  very well when moving icons. As I seldom have icons in my dekstop I
  didn't notice it until today.

  This new patch, implemented somewhat differently, does seem to behave
  properly for moving icons, and windows of course. To accomplish this,
  and greatly reduce the communications overhead during a move, I created a
  new message type, M_MOVING_WINDOW.

  While I was debugging it, I had to patch FvwmDebug to handle this new
  type of message, as wells as two other messages it was currently
  regarding as unknown.

  The patch below should be applied from the fvwm-2.0.41 directory and to
  the ORIGINAL code, i.e. it is not a patch to my previous patch, but a
  patch to the released code.

  -- Henrique

*** modules/FvwmPager/FvwmPager.h.orig Wed Mar 6 09:11:06 1996
--- modules/FvwmPager/FvwmPager.h Wed Mar 6 13:57:36 1996
***************
*** 90,95 ****
--- 90,96 ----
  
  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);
*** modules/FvwmPager/FvwmPager.c.orig Wed Mar 6 09:09:54 1996
--- modules/FvwmPager/FvwmPager.c Wed Mar 6 14:49:21 1996
***************
*** 218,223 ****
--- 218,226 ----
      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;
***************
*** 305,310 ****
--- 308,346 ----
    (*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/FvwmDebug/FvwmDebug.h.orig Wed Mar 6 15:00:09 1996
--- modules/FvwmDebug/FvwmDebug.h Wed Mar 6 13:53:32 1996
***************
*** 12,17 ****
--- 12,18 ----
  
  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);
***************
*** 29,34 ****
--- 30,37 ----
  void list_class(unsigned long *body);
  void list_res_name(unsigned long *body);
  void list_end(void);
+ void list_def_icon_name(unsigned long *body);
+ void list_icon_file(unsigned long *body);
  
  
  
*** modules/FvwmDebug/FvwmDebug.c.orig Wed Mar 6 15:00:15 1996
--- modules/FvwmDebug/FvwmDebug.c Wed Mar 6 23:17:15 1996
***************
*** 107,113 ****
--- 107,115 ----
    fd[0] = atoi(argv[1]);
    fd[1] = atoi(argv[2]);
  
+ #if 0
    spawn_xtee();
+ #endif
    
    /* Data passed in command line */
    fprintf(stderr,"Application Window 0x%s\n",argv[4]);
***************
*** 154,159 ****
--- 156,164 ----
   ***********************************************************************/
  void process_message(unsigned long type,unsigned long *body)
  {
+ int shift;
+ unsigned long dup;
+
    switch(type)
      {
      case M_ADD_WINDOW:
***************
*** 161,166 ****
--- 166,174 ----
      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;
***************
*** 194,199 ****
--- 202,210 ----
      case M_WINDOW_NAME:
        list_window_name(body);
        break;
+ case M_DEFAULTICON:
+ list_def_icon_name(body);
+ break;
      case M_ICON_NAME:
        list_icon_name(body);
        break;
***************
*** 206,213 ****
      case M_END_WINDOWLIST:
        list_end();
        break;
      default:
! list_unknown(body);
        break;
      }
  }
--- 217,233 ----
      case M_END_WINDOWLIST:
        list_end();
        break;
+ case M_ICON_FILE:
+ list_icon_file(body);
+ break;
      default:
! if (type == 0)
! fprintf (stderr,"Illegal packet type %d\n", type);
! else {
! for (shift = 0, dup = type; (dup & 0x1) != 0x1; shift++, dup>>=1);
! fprintf (stderr,"Unknown packet type %d, bit %d\n", type, shift);
! list_unknown (body);
! }
        break;
      }
  }
***************
*** 262,267 ****
--- 282,302 ----
  /***********************************************************************
   *
   * Procedure:
+ * list_moving_window - displays packet contents to stderr
+ *
+ ***********************************************************************/
+ void list_moving_window(unsigned long *body)
+ {
+ fprintf(stderr,"Moving Window\n");
+ fprintf(stderr,"\t ID %lx\n",body[0]);
+ fprintf(stderr,"\t x %ld\n",(long)body[1]);
+ fprintf(stderr,"\t y %ld\n",(long)body[2]);
+ fprintf(stderr,"\t desk %ld\n",(long)body[3]);
+ }
+
+ /***********************************************************************
+ *
+ * Procedure:
   * list_configure - displays packet contents to stderr
   *
   ***********************************************************************/
***************
*** 333,338 ****
--- 368,375 ----
    fprintf(stderr,"\t x %ld\n",(long)body[0]);
    fprintf(stderr,"\t y %ld\n",(long)body[1]);
    fprintf(stderr,"\t desk %ld\n",(long)body[2]);
+ fprintf(stderr,"\t x max %ld\n",(long)body[3]);
+ fprintf(stderr,"\t y max %ld\n",(long)body[4]);
  }
  
  /***********************************************************************
***************
*** 385,391 ****
   ***********************************************************************/
  void list_unknown(unsigned long *body)
  {
! fprintf(stderr,"Unknown packet type\n");
  }
  
  /***********************************************************************
--- 422,428 ----
   ***********************************************************************/
  void list_unknown(unsigned long *body)
  {
! /*fprintf(stderr,"Unknown packet type\n");*/
  }
  
  /***********************************************************************
***************
*** 472,477 ****
--- 509,540 ----
    fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
    fprintf(stderr,"\t window name %s\n",(char *)(&body[3]));
  
+ }
+
+
+ /***********************************************************************
+ *
+ * Procedure:
+ * list_icon_file - displays packet contents to stderr
+ *
+ ***********************************************************************/
+ void list_icon_file(unsigned long *body)
+ {
+ fprintf(stderr,"icon file\n");
+ fprintf(stderr,"\tfile name %s\n",(char *)(&body[3]));
+ }
+
+
+ /***********************************************************************
+ *
+ * Procedure:
+ * list_icon_name - displays packet contents to stderr
+ *
+ ***********************************************************************/
+ void list_def_icon_name(unsigned long *body)
+ {
+ fprintf(stderr,"default icon\n");
+ fprintf(stderr,"\t icon name %s\n",(char *)(&body[3]));
  }
  
  
*** fvwm/move.c.orig Mon Feb 26 19:59:18 1996
--- fvwm/move.c Wed Mar 6 14:53:09 1996
***************
*** 242,247 ****
--- 242,251 ----
                  XMoveWindow(dpy,tmp_win->frame,xl,yt);
              }
            DisplayPosition(tmp_win,xl+Scr.Vx,yt+Scr.Vy,False);
+ Broadcast (M_MOVING_WINDOW, 4,
+ tmp_win->w, xl, yt, tmp_win->Desk,
+ 0, 0, 0);
+ FlushQueues ();
            done = TRUE;
            break;
  
*** fvwm/module.h.orig Wed Mar 6 08:55:24 1996
--- fvwm/module.h Wed Mar 6 13:34:12 1996
***************
*** 16,22 ****
  
  #define START_FLAG 0xffffffff
  
! #define M_NEW_PAGE (1)
  #define M_NEW_DESK (1<<1)
  #define M_ADD_WINDOW (1<<2)
  #define M_RAISE_WINDOW (1<<3)
--- 16,22 ----
  
  #define START_FLAG 0xffffffff
  
! #define M_NEW_PAGE (1<<0)
  #define M_NEW_DESK (1<<1)
  #define M_ADD_WINDOW (1<<2)
  #define M_RAISE_WINDOW (1<<3)
***************
*** 38,44 ****
  #define M_END_CONFIG_INFO (1<<19)
  #define M_ICON_FILE (1<<20)
  #define M_DEFAULTICON (1<<21)
! #define MAX_MESSAGES 22
  #define MAX_MASK ((1<<MAX_MESSAGES)-1)
  
  #define HEADER_SIZE 4
--- 38,45 ----
  #define M_END_CONFIG_INFO (1<<19)
  #define M_ICON_FILE (1<<20)
  #define M_DEFAULTICON (1<<21)
! #define M_MOVING_WINDOW (1<<22)
! #define MAX_MESSAGES 23
  #define MAX_MASK ((1<<MAX_MESSAGES)-1)
  
  #define HEADER_SIZE 4
*** fvwm/events.c.orig Mon Feb 26 19:59:08 1996
--- fvwm/events.c Wed Mar 6 23:17:36 1996
***************
*** 1444,1446 ****
--- 1444,1481 ----
    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);
+ }
+ }
+ }
+
+ }
+
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Thu Mar 07 1996 - 01:23:07 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:58 BST