home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
x
/
volume13
/
unclutter
/
patch1
/
patches.3
Wrap
Text File
|
1991-07-16
|
13KB
|
411 lines
diff -r -c old/README unclutter/README
*** old/README Tue Jun 18 18:15:51 1991
--- unclutter/README Thu May 30 12:30:29 1991
***************
*** 16,22 ****
will apparently leave the window, even though its x y position doesnt change.
The first version of this program used a grab to remove the cursor.
! This methid is still available with a "-grab" option to the program.
The program is released into the public domain. Only the considerate
will leave credit for the author.
--- 16,31 ----
will apparently leave the window, even though its x y position doesnt change.
The first version of this program used a grab to remove the cursor.
! This method is still available with a "-grab" option to the program.
!
! Thanks for their help with "remote debugging" with xscope of various servers to
! dave edsall@iastate.edu
! Roland McGrath <roland@geech.gnu.ai.mit.edu>
! Rainer Sinkwitz <sinkwitz@ifi.unizh.ch>
! Michael L. Brown astroatc!ftms!brown@cs.wisc.edu
! patti@hosehead.hf.intel.com
! and, for vroot.h, Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>
! and to all those who tested various development versions sent by mail.
The program is released into the public domain. Only the considerate
will leave credit for the author.
diff -r -c old/patchlevel.h unclutter/patchlevel.h
*** old/patchlevel.h Tue Jun 18 18:15:53 1991
--- unclutter/patchlevel.h Tue Jun 18 18:11:50 1991
***************
*** 4,8 ****
* level 1: -grab option to use old method, new method creates small input
* only sub-window. (distributed by mail only, not posted)
* level 2: use Andreas Stolcke's vroot.h for tvtwm and similar winmans.
*/
! #define PATCHLEVEL 2
--- 4,10 ----
* level 1: -grab option to use old method, new method creates small input
* only sub-window. (distributed by mail only, not posted)
* level 2: use Andreas Stolcke's vroot.h for tvtwm and similar winmans.
+ * level 3: -not option takes list of windows to avoid and -visible ignores
+ * visibility events for some servers.
*/
! #define PATCHLEVEL 3
diff -r -c old/unclutter.c unclutter/unclutter.c
*** old/unclutter.c Tue Jun 18 18:15:47 1991
--- unclutter/unclutter.c Tue Jun 18 18:11:50 1991
***************
*** 8,13 ****
--- 8,16 ----
* shapes depending on whether they have pointer focus or not.
* Whereas version 1 did a grab cursor, version 2 creates a small subwindow.
* This may work better with some window managers.
+ * Some servers return a Visibility event when the subwindow is mapped.
+ * Sometimes this is Unobscured, or even FullyObscured. Ignore these and
+ * rely on LeaveNotify events.
* Mark M Martin. cetia 1991 mmm@cetia.fr
*/
#include <X11/Xos.h>
***************
*** 30,36 ****
-grab use grabpointer method not createwindow\n\
-reset reset the timer whenever cursor becomes\n\
visible even if it hasn't moved\n\
! -root apply to cursor on root window too");
}
#define ALMOSTEQUAL(a,b) (abs(a-b)<=jitter)
--- 33,42 ----
-grab use grabpointer method not createwindow\n\
-reset reset the timer whenever cursor becomes\n\
visible even if it hasn't moved\n\
! -root apply to cursor on root window too\n\
! -visible ignore visibility events\n\
! -not names... dont apply to windows whose wm-name begins.\n\
! (must be last argument)");
}
#define ALMOSTEQUAL(a,b) (abs(a-b)<=jitter)
***************
*** 51,61 ****
(*defaulthandler)(display,error);
}
main(argc,argv)char **argv;{
Display *display;
Cursor cursor;
int screen,oldx,oldy = -99;
! int doroot = 0, jitter = 0, idletime = 5, usegrabmethod = 0, waitagain = 0;
Window root;
Pixmap cursormask;
XGCValues xgc;
--- 57,93 ----
(*defaulthandler)(display,error);
}
+ char **names; /* -> argv list of names to avoid */
+
+ /*
+ * return true if window has a wm_name and the start of it matches
+ * one of the given names to avoid
+ */
+ nameinlist(display,window)
+ Display *display;
+ Window window;
+ {
+ char **cpp;
+ char *name;
+
+ if(names==0)return 0;
+ if(XFetchName (display, window, &name)){
+ for(cpp = names;*cpp!=0;cpp++){
+ if(strncmp(*cpp,name,strlen(*cpp))==0)
+ break;
+ }
+ XFree(name);
+ return(*cpp!=0);
+ }
+ return 0;
+ }
+
main(argc,argv)char **argv;{
Display *display;
Cursor cursor;
int screen,oldx,oldy = -99;
! int doroot = 0, jitter = 0, idletime = 5, usegrabmethod = 0, waitagain = 0,
! dovisible = 1;
Window root;
Pixmap cursormask;
XGCValues xgc;
***************
*** 80,85 ****
--- 112,124 ----
usegrabmethod = 1;
}else if(strcmp(*argv,"-reset")==0){
waitagain = 1;
+ }else if(strcmp(*argv,"-visible")==0){
+ dovisible = 0;
+ }else if(strcmp(*argv,"-not")==0){
+ /* take rest of srg list */
+ names = ++argv;
+ if(*names==0)names = 0; /* no args follow */
+ argc = 0;
}else if(strcmp(*argv,"-display")==0){
argc--,argv++;
if(argc<0)usage();
***************
*** 110,115 ****
--- 149,155 ----
Window dummywin,windowin;
int rootx,rooty,winx,winy;
unsigned int modifs;
+ Window lastwindowavoided = None;
/* wait for pointer to not move and no buttons down */
while(1){
***************
*** 120,126 ****
}else if((!doroot && windowin==None) || (modifs & ANYBUTTON) ||
!(ALMOSTEQUAL(rootx,oldx) && ALMOSTEQUAL(rooty,oldy))){
oldx = rootx, oldy = rooty;
! }else break;
sleep(idletime);
}
/* wait again next time */
--- 160,187 ----
}else if((!doroot && windowin==None) || (modifs & ANYBUTTON) ||
!(ALMOSTEQUAL(rootx,oldx) && ALMOSTEQUAL(rooty,oldy))){
oldx = rootx, oldy = rooty;
! }else if(windowin==None){
! windowin = root;
! break;
! }else if(windowin!=lastwindowavoided){
! /* descend tree of windows under cursor to bottommost */
! Window childin;
! int toavoid = xFalse;
! lastwindowavoided = childin = windowin;
! do{
! windowin = childin;
! if(nameinlist (display, windowin)){
! toavoid = xTrue;
! break;
! }
! }while(XQueryPointer(display, windowin, &dummywin,
! &childin, &rootx, &rooty, &winx, &winy, &modifs)
! && childin!=None);
! if(!toavoid){
! lastwindowavoided = None;
! break;
! }
! }
sleep(idletime);
}
/* wait again next time */
***************
*** 146,165 ****
Window cursorwindow;
Window childin;
- /* descend tree of windows under cursor to bottommost */
- if(windowin!=None)
- while(XQueryPointer(display, windowin, &dummywin, &childin,
- &rootx, &rooty, &winx, &winy, &modifs)
- && childin!=None)
- windowin = childin;
- else windowin = root;
/* create small input-only window under cursor
* as a sub window of the window currently under the cursor
*/
attributes.event_mask = LeaveWindowMask |
- VisibilityChangeMask |
StructureNotifyMask |
FocusChangeMask;
attributes.override_redirect = True;
attributes.cursor = cursor;
cursorwindow = XCreateWindow
--- 207,220 ----
Window cursorwindow;
Window childin;
/* create small input-only window under cursor
* as a sub window of the window currently under the cursor
*/
attributes.event_mask = LeaveWindowMask |
StructureNotifyMask |
FocusChangeMask;
+ if(dovisible)
+ attributes.event_mask |= VisibilityChangeMask;
attributes.override_redirect = True;
attributes.cursor = cursor;
cursorwindow = XCreateWindow
***************
*** 187,193 ****
event.type!=CirculateNotify &&
event.type!=ReparentNotify &&
event.type!=DestroyNotify &&
! event.type!=VisibilityNotify);
/* check if a second unclutter is running cos they thrash */
if(event.type==LeaveNotify &&
event.xcrossing.window==cursorwindow &&
--- 242,250 ----
event.type!=CirculateNotify &&
event.type!=ReparentNotify &&
event.type!=DestroyNotify &&
! (event.type!=VisibilityNotify ||
! event.xvisibility.state==VisibilityUnobscured)
! );
/* check if a second unclutter is running cos they thrash */
if(event.type==LeaveNotify &&
event.xcrossing.window==cursorwindow &&
diff -r -c old/unclutter.man unclutter/unclutter.man
*** old/unclutter.man Tue Jun 18 18:15:48 1991
--- unclutter/unclutter.man Fri May 24 19:13:55 1991
***************
*** 14,19 ****
--- 14,21 ----
.RB [ -grab ]
.RB [ -reset ]
.RB [ -root ]
+ .RB [ -not ]
+ .I "name ...
.SH DESCRIPTION
.B unclutter
removes the cursor image from the screen so that it does not
***************
*** 50,55 ****
--- 52,64 ----
-root
means remove the cursor even if it is on the root background, where in
principle it should not be obscuring anything useful.
+ .TP
+ -not
+ is followed by a list of window names where the cursor should not be
+ removed.
+ The first few characters of the WM_NAME property on the window need
+ to match one the listed names.
+ This argument must be the last on the command line.
.SH LIMITATIONS
Unfortunately, clients like emacs set different text cursor
shapes depending on whether they have pointer focus or not,
***************
*** 67,70 ****
This situation quickly deteriorates into a fight no one can win, so
it is detected when possible and the program gives up.
.SH AUTHOR
! Mark M Martin. cetia 1991. mmm@cetia.fr
--- 76,79 ----
This situation quickly deteriorates into a fight no one can win, so
it is detected when possible and the program gives up.
.SH AUTHOR
! Mark M Martin. cetia 24may1991. mmm@cetia.fr
diff -r -c old/vroot.h unclutter/vroot.h
*** old/vroot.h Tue Jun 18 18:15:49 1991
--- unclutter/vroot.h Fri May 24 19:13:55 1991
***************
*** 28,35 ****
* after all the X11 header files. It has been tested on such popular
* X clients as xphoon, xfroot, xloadimage, and xaqua.
*
! * Andreas Stolcke (stolcke@ICSI.Berkeley.EDU), 9/7/90
! * minor mods signalled with: mmm and DONTOPTIMISE.
*/
#define DONTOPTIMISE /* unclutter needs to search from scratch each time */
--- 28,36 ----
* after all the X11 header files. It has been tested on such popular
* X clients as xphoon, xfroot, xloadimage, and xaqua.
*
! * Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>, 9/7/90
! * - replaced all NULL's with properly cast 0's, 5/6/91
! * - free children list (suggested by Mark Martin <mmm@cetia.fr>), 5/16/91
*/
#define DONTOPTIMISE /* unclutter needs to search from scratch each time */
***************
*** 40,83 ****
VirtualRootWindow(dpy, screen)
Display *dpy;
{
! static Display *save_dpy = (Display *)NULL;
static int save_screen = -1;
! static Window root = (Window)NULL;
- Atom __SWM_VROOT = None;
- int i;
- Window rootReturn, parentReturn, *children;
- unsigned int numChildren;
-
#ifdef DONTOPTIMISE
{
#else
! if ( dpy != save_dpy || screen != save_screen ) {
#endif
root = RootWindow(dpy, screen);
/* go look for a virtual root */
__SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
! if(XQueryTree(dpy, root, &rootReturn, &parentReturn,
! &children, &numChildren)){ /* mmm */
! for (i = 0; i < numChildren; i++) {
! Atom actual_type;
! int actual_format;
! unsigned long nitems, bytesafter; /* mmm */
! Window *newRoot = NULL;
! if (XGetWindowProperty(dpy, children[i], __SWM_VROOT,
! 0, 1, False, XA_WINDOW,
! &actual_type, &actual_format,
! &nitems, &bytesafter,
! (unsigned char **) &newRoot) == Success
! && newRoot) {
! root = *newRoot;
! break;
}
! }
! if(children)XFree((char *)children); /* mmm */
}
save_dpy = dpy;
save_screen = screen;
}
--- 41,86 ----
VirtualRootWindow(dpy, screen)
Display *dpy;
{
! static Display *save_dpy = (Display *)0;
static int save_screen = -1;
! static Window root = (Window)0;
#ifdef DONTOPTIMISE
{
#else
! if (dpy != save_dpy || screen != save_screen) {
#endif
+ Atom __SWM_VROOT = None;
+ int i;
+ Window rootReturn, parentReturn, *children;
+ unsigned int numChildren;
+
root = RootWindow(dpy, screen);
/* go look for a virtual root */
__SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
! if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
! &children, &numChildren)) {
! for (i = 0; i < numChildren; i++) {
! Atom actual_type;
! int actual_format;
! unsigned long nitems, bytesafter;
! Window *newRoot = (Window *)0;
! if (XGetWindowProperty(dpy, children[i],
! __SWM_VROOT, 0, 1, False, XA_WINDOW,
! &actual_type, &actual_format,
! &nitems, &bytesafter,
! (unsigned char **) &newRoot) == Success
! && newRoot) {
! root = *newRoot;
! break;
! }
}
! if (children)
! XFree((char *)children);
}
+
save_dpy = dpy;
save_screen = screen;
}