Subject: urgency hint support

From: Matthias Clasen <[email-masked]>
Date: Sat, 2 Jan 1999 02:17:02 +0100

The following little patch makes fvwm handle the urgency hint
from ICCCM 2.0 by calling user-definable functions when the
urgency hint changes. It may not be a very important addition
and I don't know if any programs actually use that mechanism, but
it doesn't cost much to add it.

Matthias

-- 
Matthias Clasen, 
Tel. 0761/203-5606
Email: [email-masked]
Mathematisches Institut, Albert-Ludwigs-Universitaet Freiburg

--- ChangeLog.1	Sat Jan  2 01:59:51 1999
+++ ChangeLog	Sat Jan  2 01:58:25 1999
@@ -1,3 +1,13 @@
+1999-01-02  Matthias Clasen  <[email-masked]>
+
+	* fvwm/events.c (HandlePropertyNotify): added some code to	
+	deal with the urgency hint in the WM_HINTS flags (this is an
+	ICCCM 2.0 addition). Handle it by calling `UrgencyFunc' and
+	`UrgencyDoneFunc' when the flag changes. 
+
+	* fvwm/fvwm.c (SetRCDefaults): added default definitions for
+	`UrgencyFunc' and `UrgencyDoneFunc'.
+
 1999-01-01  Matthias Clasen  <[email-masked]>
 
	* fvwm/misc.c (RaiseWindow): fixed problem with interaction of
--- fvwm/fvwm.c.orig  Fri Jan  1 21:50:52 1999
+++ fvwm/fvwm.c	      Sat Jan  2 01:24:42 1999
@@ -709,6 +709,11 @@
     "+ \"I\" WindowId $0 FlipFocus",
     "+ \"I\" WindowId $0 Raise",
     "+ \"I\" WindowId $0 WarpToWindow 5p 5p",
+    "AddToFunc UrgencyFunc \"I\" Iconify -1",
+    "+ \"I\" FlipFocus",
+    "+ \"I\" Raise",
+    "+ \"I\" WarpToWindow 5p 5p",
+    "AddToFunc UrgencyDoneFunc \"I\" Nop",
     NULL
   };
   int i=0;
--- fvwm/events.c.orig	Fri Jan  1 21:50:52 1999
+++ fvwm/events.c	Sat Jan  2 02:03:20 1999
@@ -403,6 +403,7 @@
 {
   XTextProperty text_prop;
   Boolean       OnThisPage    =  False;
+  int was_urgent;
 
   DBUG("HandlePropertyNotify","Routine Entered");
 
@@ -484,8 +485,13 @@
       break;
 
     case XA_WM_HINTS:
-      if (Tmp_win->wmhints)
+      /* [email-masked] - 02/01/1998 - new - 
+       the urgency flag is an ICCCM 2.0 addition to the WM_HINTS. */
+      was_urgent = 0;
+      if (Tmp_win->wmhints) {
+      was_urgent = Tmp_win->wmhints->flags & XUrgencyHint;
       XFree ((char *) Tmp_win->wmhints);
+      }
       Tmp_win->wmhints = XGetWMHints(dpy, Event.xany.window);
 
       if(Tmp_win->wmhints == NULL)
@@ -547,8 +553,25 @@
         DrawIconWindow(Tmp_win);
	     }
	     }
-      break;
 
+      /* [email-masked] - 02/01/1998 - new - 
+       the urgency flag is an ICCCM 2.0 addition to the WM_HINTS. 
+	 Treat urgency changes by calling user-settable functions.
+	  These could e.g. deiconify and raise the window or temporarily
+	   change the decor. */
+      if (!was_urgent && (Tmp_win->wmhints->flags & XUrgencyHint))
+      {
+        ExecuteFunction("Function UrgencyFunc",
+					  Tmp_win,&Event,C_WINDOW,-1);
+					  }
+      
+      if (was_urgent && !(Tmp_win->wmhints->flags & XUrgencyHint))
+      {
+        ExecuteFunction("Function UrgencyDoneFunc",
+					  Tmp_win,&Event,C_WINDOW,-1);
+					  }
+      
+      break;
     case XA_WM_NORMAL_HINTS:
 DB(("HandlePropertyNotify: XA_WM_NORMAL_HINTS calling GetWindowSizeHints"));
			    GetWindowSizeHints (Tmp_win);

--
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].