diff -r -c fvwm-2.0.46/fvwm/events.c fvwm-2.0.46-patched/fvwm/events.c *** fvwm-2.0.46/fvwm/events.c Thu Aug 7 11:14:22 1997 --- fvwm-2.0.46-patched/fvwm/events.c Sat Nov 15 20:30:59 1997 *************** *** 392,403 **** --- 392,419 ---- void HandlePropertyNotify() { XTextProperty text_prop; + Boolean OnThisPage = False; DBUG("HandlePropertyNotify","Routine Entered"); if ((!Tmp_win)||(XGetGeometry(dpy, Tmp_win->w, &JunkRoot, &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0)) return; + + /* + Make sure at least part of window is on this page + before giving it focus... + */ + if ( (Tmp_win->Desk == Scr.CurrentDesk) && + ( ((Tmp_win->frame_x + Tmp_win->frame_width) >= 0 && + Tmp_win->frame_x < Scr.MyDisplayWidth) && + ((Tmp_win->frame_y + Tmp_win->frame_height) >= 0 && + Tmp_win->frame_y < Scr.MyDisplayHeight) + ) + ) + { + OnThisPage = True; + } switch (Event.xproperty.atom) { *************** *** 544,551 **** if((Tmp_win != NULL)&&(Tmp_win->flags & ClickToFocus) &&(Tmp_win == Scr.Focus)) { ! Scr.Focus = NULL; ! SetFocus(Tmp_win->w,Tmp_win,0); } } break; --- 560,570 ---- if((Tmp_win != NULL)&&(Tmp_win->flags & ClickToFocus) &&(Tmp_win == Scr.Focus)) { ! if (OnThisPage) ! { ! Scr.Focus = NULL; ! SetFocus(Tmp_win->w,Tmp_win,0); ! } } } break; *************** *** 656,661 **** --- 675,681 ---- { extern long isIconicState; extern Bool PPosOverride; + Boolean OnThisPage = False; Event.xany.window = Event.xmaprequest.window; *************** *** 674,679 **** --- 694,713 ---- if (Tmp_win == NULL) return; } + /* + Make sure at least part of window is on this page + before giving it focus... + */ + if ( (Tmp_win->Desk == Scr.CurrentDesk) && + ( ((Tmp_win->frame_x + Tmp_win->frame_width) >= 0 && + Tmp_win->frame_x < Scr.MyDisplayWidth) && + ((Tmp_win->frame_y + Tmp_win->frame_height) >= 0 && + Tmp_win->frame_y < Scr.MyDisplayHeight) + ) + ) + { + OnThisPage = True; + } if(KeepRaised != None) XRaiseWindow(dpy,KeepRaised); *************** *** 709,715 **** if((Tmp_win->flags & ClickToFocus)&& ((!Scr.Focus)||(Scr.Focus->flags & ClickToFocus))) { ! SetFocus(Tmp_win->w,Tmp_win,1); } } else --- 743,752 ---- if((Tmp_win->flags & ClickToFocus)&& ((!Scr.Focus)||(Scr.Focus->flags & ClickToFocus))) { ! if (OnThisPage) ! { ! SetFocus(Tmp_win->w,Tmp_win,1); ! } } } else *************** *** 752,757 **** --- 789,796 ---- ***********************************************************************/ void HandleMapNotify() { + Boolean OnThisPage = False; + DBUG("HandleMapNotify","Routine Entered"); if (!Tmp_win) *************** *** 769,774 **** --- 808,828 ---- * don't need or want windows associated with the sunstructurenotifymask */ if(Event.xmap.event != Event.xmap.window) return; + + /* + Make sure at least part of window is on this page + before giving it focus... + */ + if ( (Tmp_win->Desk == Scr.CurrentDesk) && + ( ((Tmp_win->frame_x + Tmp_win->frame_width) >= 0 && + Tmp_win->frame_x < Scr.MyDisplayWidth) && + ((Tmp_win->frame_y + Tmp_win->frame_height) >= 0 && + Tmp_win->frame_y < Scr.MyDisplayHeight) + ) + ) + { + OnThisPage = True; + } /* * Need to do the grab to avoid race condition of having server send *************** *** 800,806 **** if((Tmp_win->flags & ClickToFocus)&&(Scr.Focus)&& ((!Scr.Focus)||(Scr.Focus->flags & ClickToFocus))) { ! SetFocus(Tmp_win->w,Tmp_win,1); } if((!(Tmp_win->flags &(BORDER|TITLE)))&&(Tmp_win->boundary_width <2)) { --- 854,863 ---- if((Tmp_win->flags & ClickToFocus)&&(Scr.Focus)&& ((!Scr.Focus)||(Scr.Focus->flags & ClickToFocus))) { ! if (OnThisPage) ! { ! SetFocus(Tmp_win->w,Tmp_win,1); ! } } if((!(Tmp_win->flags &(BORDER|TITLE)))&&(Tmp_win->boundary_width <2)) { diff -r -c fvwm-2.0.46/fvwm/focus.c fvwm-2.0.46-patched/fvwm/focus.c *** fvwm-2.0.46/fvwm/focus.c Sat Nov 8 23:51:59 1997 --- fvwm-2.0.46-patched/fvwm/focus.c Sat Nov 15 19:23:20 1997 *************** *** 35,40 **** --- 35,41 ---- void SetFocus(Window w, FvwmWindow *Fw, Bool FocusByMouse) { int i; + Boolean OnThisPage = False; extern Time lastTimestamp; /* ClickToFocus focus queue manipulation - only performed for *************** *** 83,89 **** } } ! if((Fw != NULL)&&(Fw->Desk != Scr.CurrentDesk)) { Fw = NULL; w = Scr.NoFocusWin; --- 84,108 ---- } } ! if (Fw != NULL) ! { ! /* ! Make sure at least part of window is on this page ! before giving it focus... ! */ ! if ( (Fw->Desk == Scr.CurrentDesk) && ! ( ((Fw->frame_x + Fw->frame_width) >= 0 && ! Fw->frame_x < Scr.MyDisplayWidth) && ! ((Fw->frame_y + Fw->frame_height) >= 0 && ! Fw->frame_y < Scr.MyDisplayHeight) ! ) ! ) ! { ! OnThisPage = True; ! } ! } ! ! if((Fw != NULL)&&(! OnThisPage)) { Fw = NULL; w = Scr.NoFocusWin;