FVWM: Patch: Expand the M_MINI_ICON packet

From: Randy J. Ray <rjray_at_uswest.com>
Date: Sun, 4 May 1997 02:43:50 -0600

As promised, here is a patch to expand the M_MINI_ICON packet type to include
the normal window-identification triple, as well as tack the filename of the
icon itself at the end. Apply this patch from the *root* of your fvwm 2.0.45
source tree (my patch to the windowshade packets was relative to the fvwm
subdir; however, this patch also affects modules/FvwmIconMan) with:

patch -p -N < this_file

This patch does the following:

* Cause M_MINI_ICON packets to use their own send routines: SendMiniIcon and
  BroadcastMiniIcon

* Updates add_window.c to use these routines, as well as later in module.c

* Updates the struct used in modules/FvwmIconMan/fvwm.c to recognize the new
  format. The code itself needed no update, since it doesn't use any of the
  added fields

The new structure for packets of type M_MINI_ICON is:

word meaning
0 0xffffffff
1 packet type (M_MINI_ICON)
2 length of packet
3 timestamp
4 X window ID
5 X ID of frame encompassing window
6 Fvwm internal database pointer
7 Width of mini-icon
8 Height of mini-icon
9 Depth (number of planes) of mini-icon
10 X Pixmap ID (not to confuse with XPM) of the mini-icon
11 X Pixmap ID of the mask
12+ Name cast into longs as per other textual packets, null-padded

I do not update the modules.tex file, because it doesn't yet mention these
packets, and it needs heavy revision anyway.

Release 0.4 of my Perl module X11::Fvwm will support this format, and will
also bundle this patch along with the code. Any code utilizing these packets
will need to be updated after this patch is applied.

Randy
- --
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS Phone: (303)595-2869
                Denver, CO rjray_at_uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin
===============================================================================

(patch begins here)

Index: ./modules/FvwmIconMan/fvwm.c
*** ./modules/FvwmIconMan/fvwm.c.orig Tue Apr 29 14:58:16 1997
--- ./modules/FvwmIconMan/fvwm.c Tue Apr 29 15:32:58 1997
***************
*** 64,70 ****
  
  #ifdef MINI_ICONS
  typedef struct {
! Ulong app_id, picture, mask, width, height, depth;
  } m_mini_icon_data;
  #endif
  
--- 64,75 ----
  
  #ifdef MINI_ICONS
  typedef struct {
! Ulong app_id, frame_id, dbase_entry;
! Ulong width, height, depth, picture, mask;
! union {
! Ulong name_long[1];
! Uchar name[4];
! } name;
  } m_mini_icon_data;
  #endif
  

Index: ./fvwm/module.c
*** ./fvwm/module.c.orig Sun May 4 01:20:28 1997
--- ./fvwm/module.c Sun May 4 01:42:33 1997
***************
*** 533,538 ****
--- 533,589 ----
      SendName(i,event_type,data1,data2,data3,name);
  }
  
+ #ifdef MINI_ICONS
+ void SendMiniIcon(int module, unsigned long event_type,
+ unsigned long data1, unsigned long data2,
+ unsigned long data3, unsigned long data4,
+ unsigned long data5, unsigned long data6,
+ unsigned long data7, unsigned long data8,
+ char *name)
+ {
+ int l;
+ unsigned long *body;
+ extern Time lastTimestamp;
+
+ if ((name == NULL) || (event_type != M_MINI_ICON))
+ return;
+ l = strlen(name)/(sizeof(unsigned long))+HEADER_SIZE+9;
+ body = (unsigned long *)safemalloc(l*sizeof(unsigned long));
+
+ body[0] = START_FLAG;
+ body[1] = event_type;
+ body[2] = l;
+ body[3] = lastTimestamp;
+
+ body[HEADER_SIZE] = data1;
+ body[HEADER_SIZE+1] = data2;
+ body[HEADER_SIZE+2] = data3;
+ body[HEADER_SIZE+3] = data4;
+ body[HEADER_SIZE+4] = data5;
+ body[HEADER_SIZE+5] = data6;
+ body[HEADER_SIZE+6] = data7;
+ body[HEADER_SIZE+7] = data8;
+ strcpy((char *)&body[HEADER_SIZE+8],name);
+
+ PositiveWrite(module,(unsigned long *)body, l*sizeof(unsigned long));
+
+ free(body);
+ }
+
+ void BroadcastMiniIcon(unsigned long event_type,
+ unsigned long data1, unsigned long data2,
+ unsigned long data3, unsigned long data4,
+ unsigned long data5, unsigned long data6,
+ unsigned long data7, unsigned long data8,
+ char *name)
+ {
+ int i;
+
+ for(i=0;i<npipes;i++)
+ SendMiniIcon(i, event_type,
+ data1, data2, data3, data4, data5, data6, data7, data8, name);
+ }
+ #endif /* MINI_ICONS */
  
  /*
  ** send an arbitrary string to all instances of a module
***************
*** 696,708 ****
                         (unsigned long)t,0,0,0,0);
  #ifdef MINI_ICONS
            if (t->mini_icon != NULL)
! SendPacket(*Module, M_MINI_ICON, 6,
! t->w,
! t->mini_icon->picture,
! t->mini_icon->mask,
! t->mini_icon->width,
! t->mini_icon->height,
! t->mini_icon->depth, 0);
  #endif
          }
        if(Scr.Hilite == NULL)
--- 747,760 ----
                         (unsigned long)t,0,0,0,0);
  #ifdef MINI_ICONS
            if (t->mini_icon != NULL)
! SendMiniIcon(*Module, M_MINI_ICON,
! t->w, t->frame, (unsigned long)t,
! t->mini_icon->width,
! t->mini_icon->height,
! t->mini_icon->depth,
! t->mini_icon->picture,
! t->mini_icon->mask,
! t->mini_pixmap_file);
  #endif
          }
        if(Scr.Hilite == NULL)


Index: ./fvwm/add_window.c
*** ./fvwm/add_window.c.orig Sun May 4 01:20:42 1997
--- ./fvwm/add_window.c Sun May 4 02:24:18 1997
***************
*** 684,696 ****
                  (unsigned long)tmp_win,tmp_win->class.res_name);
  #ifdef MINI_ICONS
    if (tmp_win->mini_icon != NULL)
! Broadcast(M_MINI_ICON, 6,
! tmp_win->w, /* Watch Out ! : I reduced the set of infos... */
! tmp_win->mini_icon->picture,
! tmp_win->mini_icon->mask,
! tmp_win->mini_icon->width,
! tmp_win->mini_icon->height,
! tmp_win->mini_icon->depth, 0);
  #endif
  
    FetchWmProtocols (tmp_win);
--- 684,697 ----
                  (unsigned long)tmp_win,tmp_win->class.res_name);
  #ifdef MINI_ICONS
    if (tmp_win->mini_icon != NULL)
! BroadcastMiniIcon(M_MINI_ICON,
! tmp_win->w, tmp_win->frame, (unsigned long)tmp_win,
! tmp_win->mini_icon->width,
! tmp_win->mini_icon->height,
! tmp_win->mini_icon->depth,
! tmp_win->mini_icon->picture,
! tmp_win->mini_icon->mask,
! tmp_win->mini_pixmap_file);
  #endif
  
    FetchWmProtocols (tmp_win);
--
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 Sun May 04 1997 - 03:44:32 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:38:00 BST