This patch doesn't work for me with FVWM.

But the patch attached is working for me. (but i'm a kinda noob in C !)

2006/5/9, Youness Alaoui <[EMAIL PROTECTED]>:
> On Tue, 09 May 2006 13:01:56 -0400, Sander Hoentjen <[EMAIL PROTECTED]>
> wrote:
>
> > On Tue, 2006-05-09 at 17:36 +0200, Boris Faure (aka billiob) wrote:
> >
> >> The TODO-List is not long, but too hard for me :( I've searched the
> >> thing about non fully compliant WM and linflash, but it gave me no
> >> interesting answers.
> >>
> > attached is a diff that will work.. But I'd rather have it use
> > freedesktop stuff when it has the option.. So someone that can code c
> > should look up how to query the WM for what messages it understands, and
> > according to that use the right way (including fallback to what we had
> > in amsn before)
> >
> > The diff was sent by a user on irc, forgot his name unfortunatly
>
> Yes, that was also my idea, to ask the WM, which messages it accepts, and
> check to make sure it does.. falling back to the way amsn worked before is
> as simple as :
> if (WM_doesn_t_support_flashing) return TCL_ERROR;
>
> since the old code is executed if the catch { linflash } fails...
>
>
> --
> KaKaRoTo
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Amsn-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amsn-devel
>


--
Boris FAURE (aka billiob)
mail, msn : [EMAIL PROTECTED]
No trees were killed in the sending of this message.
However, a large number of electrons were terribly
agitated.
--- flash.c	2006-03-15 18:29:05.000000000 +0100
+++ flash.c	2006-05-09 20:35:50.000000000 +0200
@@ -62,7 +62,7 @@
   }
 	
 
-  return flash_window(interp, objv[1], 1l);
+  return flash_window(interp, objv[1], 1);
 }
 
 int Tk_UnFlashWindow (ClientData clientData,
@@ -78,10 +78,10 @@
   }
 	
 
-  return flash_window(interp, objv[1], 0l);
+  return flash_window(interp, objv[1], 0);
 }
 
-int flash_window (Tcl_Interp *interp, Tcl_Obj *CONST objv1, long flash) {
+int flash_window (Tcl_Interp *interp, Tcl_Obj *CONST objv1, int flash) {
 
   // We declare our variables, we need one for every intermediate token we get,
   // so we can verify if one of the function calls returned NULL
@@ -90,6 +90,7 @@
   Window window;
   Display * xdisplay;
   Window root, parent, *children;
+  XWMHints *hints;
   unsigned int n;
 
   static Atom demandsAttention;
@@ -127,28 +128,25 @@
 
   xdisplay = Tk_Display(tkwin);
 
-  // We need Atom-s created only once, they don't change during runtime
-  demandsAttention = XInternAtom(xdisplay, "_NET_WM_STATE_DEMANDS_ATTENTION", True);
-  wmState = XInternAtom(xdisplay, "_NET_WM_STATE", True);
-
   XQueryTree(xdisplay, window, &root, &parent, &children, &n);
-  XFree(children);
 
-  e.xclient.type = ClientMessage;
-  e.xclient.message_type = wmState;
-  //Since under *nix Tk wraps all windows in another one to put a menu bar, we must use the parent window ID which is the top one
-  e.xclient.window = parent;
-  e.xclient.display = xdisplay;
-  e.xclient.format = 32;
-  e.xclient.data.l[0] = flash;
-  e.xclient.data.l[1] = demandsAttention;
-  e.xclient.data.l[2] = 0l;
-  e.xclient.data.l[3] = 0l;
-  e.xclient.data.l[4] = 0l;
-  
-  
-  if (XSendEvent(xdisplay, root, False, (SubstructureRedirectMask | SubstructureNotifyMask), &e) == 0) 
-    return TCL_ERROR;
+  XFree(children); // don't care about those, really...
+	  
+  hints = XGetWMHints(xdisplay, parent);
+
+  if (!hints)
+    hints = XAllocWMHints();
+  else 
+	return TCL_ERROR;
+
+  if (flash)
+    hints->flags |= XUrgencyHint;
+  else
+    hints->flags &= ~XUrgencyHint;
+
+  XSetWMHints(xdisplay, parent, hints);
+  XFree(hints);
+ 
   
   return TCL_OK;
 }
--- flash.h	2006-01-27 14:51:16.000000000 +0100
+++ flash.h	2006-05-09 19:38:52.000000000 +0200
@@ -64,7 +64,7 @@
 			   int objc,
 			   Tcl_Obj *CONST objv[]);
 
-EXTERN int flash_window (Tcl_Interp *interp, Tcl_Obj *CONST objv1, long flash);
+EXTERN int flash_window (Tcl_Interp *interp, Tcl_Obj *CONST objv1, int flash);
 
 
 

Reply via email to