After fiddling around with the code, I did find a way to get the
click->raise behavior I want with SloppyFocus. I only did it for
Button 1 as I like to use Button 2 to paste in windows without them
getting raised. Here are the patches I made (also includes the icon
focus patch from my last message). I am sure there are probably ways
of confusing it I haven't found yet, so use at your own risk.
*** events.c.orig Tue Nov 14 10:47:37 1995
--- events.c Thu Dec 7 17:32:45 1995
***************
*** 920,932 ****
int LocalContext;
/* click to focus stuff goes here */
! if((Tmp_win)&&(Tmp_win->flags & ClickToFocus)&&(Tmp_win != Scr.Ungrabbed)&&
((Event.xbutton.state&
(ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) == 0))
{
if(Tmp_win)
{
! SetFocus(Tmp_win->w,Tmp_win,1);
#ifdef CLICKY_MODE_1
if((Event.xany.window != Tmp_win->w)&&
(Event.xbutton.subwindow != Tmp_win->w)&&
--- 920,943 ----
int LocalContext;
/* click to focus stuff goes here */
! if((Tmp_win)&&((Tmp_win->flags & ClickToFocus)&&(Tmp_win != Scr.Ungrabbed)||
! (Tmp_win->flags & SloppyFocus)&&(Tmp_win == Scr.Ungrabbed))&&
((Event.xbutton.state&
(ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) == 0))
{
if(Tmp_win)
{
! if(Tmp_win->flags & SloppyFocus)
! {
! /* if we do sloppy focus, remove the grab on mouse events that
! * was made to detect the a raise request */
! XUngrabButton(dpy,1,0,Tmp_win->frame);
! XUngrabButton(dpy,1,LockMask,Tmp_win->frame);
! Scr.Ungrabbed = NULL;
! }
! else
! SetFocus(Tmp_win->w,Tmp_win,1);
!
#ifdef CLICKY_MODE_1
if((Event.xany.window != Tmp_win->w)&&
(Event.xbutton.subwindow != Tmp_win->w)&&
***************
*** 1051,1057 ****
if (!Tmp_win)
return;
! if(!(Tmp_win->flags & ClickToFocus))
{
if(Scr.Focus != Tmp_win)
{
--- 1062,1068 ----
if (!Tmp_win)
return;
! if((!(Tmp_win->flags & ClickToFocus))&&(!(Tmp_win->flags & ICONIFIED)))
{
if(Scr.Focus != Tmp_win)
{
*** focus.c.orig Tue May 2 12:23:02 1995
--- focus.c Thu Dec 7 17:34:46 1995
***************
*** 36,41 ****
--- 36,42 ----
{
int i;
extern Time lastTimestamp;
+ static FvwmWindow *lastSloppyGrab;
/* ClickToFocus focus queue manipulation - only performed for
* Focus-by-mouse type focus events */
***************
*** 79,84 ****
--- 80,95 ----
Scr.Ungrabbed = NULL;
XSetInputFocus(dpy, Scr.NoFocusWin,RevertToParent,lastTimestamp);
}
+ else if((Scr.Ungrabbed != NULL)&&(Scr.Ungrabbed->flags & SloppyFocus))
+ {
+ /* if we do sloppy focus, remove the grab on mouse events that
+ * was made to detect the a raise request */
+ XUngrabButton(dpy,1,0,Scr.Ungrabbed->frame);
+ XUngrabButton(dpy,1,LockMask,Scr.Ungrabbed->frame);
+ Scr.Focus = NULL;
+ Scr.Ungrabbed = NULL;
+ XSetInputFocus(dpy, Scr.NoFocusWin,RevertToParent,lastTimestamp);
+ }
return;
}
}
***************
*** 103,108 ****
--- 114,131 ----
Scr.FvwmCursors[SYS]);
Scr.Ungrabbed = NULL;
}
+ else if((Scr.Ungrabbed != NULL)&&
+ (Scr.Ungrabbed->flags & SloppyFocus)
+ && (Scr.Ungrabbed != Fw) && (Fw != NULL))
+ {
+ /* if we do sloppy focus, remove the grab on mouse 1 events that
+ * was made to detect the a raise request */
+ XUngrabButton(dpy,1,0,Scr.Ungrabbed->frame);
+ XUngrabButton(dpy,1,LockMask,Scr.Ungrabbed->frame);
+ Scr.Ungrabbed = NULL;
+ }
+
+
/* if we do click to focus, remove the grab on mouse events that
* was made to detect the focus change */
if((Fw != NULL)&&(Fw->flags&ClickToFocus))
***************
*** 115,120 ****
--- 138,155 ----
}
Scr.Ungrabbed = Fw;
}
+ else if((Fw != NULL)&&(Fw->flags&SloppyFocus)
+ && (Scr.Ungrabbed != Fw) && (lastSloppyGrab != Fw))
+ {
+ /* need to grab button 1 for window that we are about to
+ * give focus so it will be raised on next button press */
+ XSync(dpy,0);
+ XGrabButton(dpy,1,0,Fw->frame,True,
+ ButtonPressMask, GrabModeSync,GrabModeAsync,None,
+ Scr.FvwmCursors[SYS]);
+ Scr.Ungrabbed = lastSloppyGrab = Fw;
+ }
+
if((Fw)&&(Fw->flags & ICONIFIED)&&(Fw->icon_w))
w= Fw->icon_w;
--
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 Thu Dec 07 1995 - 19:45:07 GMT