[comp.windows.x] Patch for customizing XMH icons

colas@babar.inria.fr (Colas Nahaboo) (03/19/90)

In article <21000@bellcore.bellcore.com> you write:
|> 2) Is there any way to change the mail notify icon to something else
|> (I'd like to use the inbox icon that xbiff has).

Well, that was something that I had in mind for a long time. So I just
modified the X11R4 xmh to add 2 new resources:

	 xmh.noMailBitmap
	 xmh.newMailBitmap

to be able to set the bitmaps to other icons.

So now, I just only have to write Gwm code to track icon changes, and beep
when new mail arrives while putting the icon in red, etc... :-)

The patch follows. It has one drawback in that the bitmaps MUST be specified
for xmh to run, so I will submit it officially to the MIT when I have found
out what is the solution to this problem. (toolkits guru listening?)

PS: once the patch is applied, you can remove the file icon.c which is then
useless (and the bitmaps *.bit too).

Colas Nahaboo, Bull Research France -- Koala Project -- GWM X11 Window Manager
colas@sa.inria.fr               Phone: (33) 93.65.77.70, Fax: (33) 93 65 77 66
INRIA - Sophia Antipolis, 2004, rte des Lucioles, 06565 Valbonne Cedex, FRANCE

diff -cr ./Imakefile /u/falbala/1/koala/colas/tmp/xmh/Imakefile
*** ./Imakefile Fri Oct  6 20:11:21 1989
--- /u/falbala/1/koala/colas/tmp/xmh/Imakefile  Mon Mar 19 13:49:27 1990
***************
*** 6,15 ****
          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)

!            SRCS = bbox.c command.c compfuncs.c folder.c icon.c init.c \
                    main.c menu.c mlist.c msg.c pick.c popup.c screen.c \
                    toc.c tocfuncs.c tocutil.c tsource.c util.c viewfuncs.c
!            OBJS = bbox.o command.o compfuncs.o folder.o icon.o init.o \
                    main.o menu.o mlist.o msg.o pick.o popup.o screen.o \
                    toc.o tocfuncs.o tocutil.o tsource.o util.o viewfuncs.o

--- 6,15 ----
          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)

!            SRCS = bbox.c command.c compfuncs.c folder.c init.c \
                    main.c menu.c mlist.c msg.c pick.c popup.c screen.c \
                    toc.c tocfuncs.c tocutil.c tsource.c util.c viewfuncs.c
!            OBJS = bbox.o command.o compfuncs.o folder.o init.o \
                    main.o menu.o mlist.o msg.o pick.o popup.o screen.o \
                    toc.o tocfuncs.o tocutil.o tsource.o util.o viewfuncs.o

diff -cr ./globals.h /u/falbala/1/koala/colas/tmp/xmh/globals.h
*** ./globals.h Sat Dec 16 09:34:03 1989
--- /u/falbala/1/koala/colas/tmp/xmh/globals.h  Mon Mar 19 13:47:58 1990
***************
*** 62,67 ****
--- 62,69 ----
      char      *pick_geometry;
      int               toc_percentage;
      Boolean   new_mail_check;         /* Whether to check for new mail. */
+     Pixmap    new_mail_bitmap;        /* icon when new mail is arrived */
+     Pixmap    no_mail_bitmap;         /* icon when no mail is pending */
      Boolean   make_checkpoints;     /* Whether to create checkpoint files. */
      int               check_frequency;        /* in minutes, of new
mail check
 */
      int               mail_waiting_flag;      /* If true, change icon
on new m
ail */
***************
*** 91,98 ****
  ext Widget      NullSource;   /* null text widget source */
  ext Dimension rootwidth;      /* Dimensions of root window.  */
  ext Dimension rootheight;
- ext Pixmap    NoMailPixmap;   /* Icon pixmap if no new mail. */
- ext Pixmap    NewMailPixmap;  /* Icon pixmap if new mail. */
  ext Pixmap    MenuItemBitmap; /* Options menu item checkmark */
  ext XtTranslations NoTextSearchAndReplace; /* no-op ^S and ^R in Text */

--- 93,98 ----
diff -cr ./init.c /u/falbala/1/koala/colas/tmp/xmh/init.c
*** ./init.c    Sat Dec 16 09:33:46 1989
--- /u/falbala/1/koala/colas/tmp/xmh/init.c     Mon Mar 19 14:02:23 1990
***************
*** 94,99 ****
--- 94,103 ----
         offset(toc_percentage), XtRImmediate, (XtPointer)33},
      {"checkNewMail", "CheckNewMail", XtRBoolean, sizeof(Boolean),
         offset(new_mail_check), XtRImmediate, (XtPointer)True},
+     {"newMailBitmap", "NewMailBitmap", XtRBitmap, sizeof(Pixmap),
+        offset(new_mail_bitmap), XtRString, "newmail.bit"},
+     {"noMailBitmap", "NoMailBitmap", XtRBitmap, sizeof(Pixmap),
+        offset(no_mail_bitmap), XtRString, "nomail.bit"},
      {"makeCheckpoints", "MakeCheckpoints", XtRBoolean, sizeof(Boolean),
         offset(make_checkpoints), XtRImmediate, (XtPointer)False},
      {"checkFrequency", "CheckFrequency", XtRInt, sizeof(int),
***************
*** 394,400 ****

      TocInit();
      InitPick();
-     IconInit();
      BBoxInit();

      XtAppAddActions( XtWidgetToApplicationContext(toplevel),
--- 398,403 ----
diff -cr ./screen.c /u/falbala/1/koala/colas/tmp/xmh/screen.c
*** ./screen.c  Sat Dec 16 09:33:53 1989
--- /u/falbala/1/koala/colas/tmp/xmh/screen.c   Mon Mar 19 14:00:48 1990
***************
*** 249,255 ****

      if (app_resources.mail_waiting_flag) {
        static Arg arglist[] = {XtNiconPixmap, NULL};
!       arglist[0].value = (XtArgVal) NoMailPixmap;
        XtSetValues(scrn->parent, arglist, XtNumber(arglist));
      }
  }
--- 249,255 ----

      if (app_resources.mail_waiting_flag) {
        static Arg arglist[] = {XtNiconPixmap, NULL};
!       arglist[0].value = (XtArgVal) app_resources.no_mail_bitmap;
        XtSetValues(scrn->parent, arglist, XtNumber(arglist));
      }
  }
diff -cr ./toc.c /u/falbala/1/koala/colas/tmp/xmh/toc.c
*** ./toc.c     Sun Dec 17 01:20:04 1989
--- /u/falbala/1/koala/colas/tmp/xmh/toc.c      Mon Mar 19 13:51:15 1990
***************
*** 249,255 ****
                        if (app_resources.mail_waiting_flag
                            && toc == InitialFolder) {
                            arglist[0].value = (XtArgVal)
!                               (hasmail ? NewMailPixmap : NoMailPixmap);
                            XtSetValues(scrn->parent,
                                        arglist, XtNumber(arglist));
                        }
--- 249,256 ----
                        if (app_resources.mail_waiting_flag
                            && toc == InitialFolder) {
                            arglist[0].value = (XtArgVal)
!                               (hasmail ? app_resources.new_mail_bitmap
!                                : app_resources.no_mail_bitmap);
                            XtSetValues(scrn->parent,
                                        arglist, XtNumber(arglist));
                        }