From 4112c99679de66fb82272566597cf0c7cea61d17 Mon Sep 17 00:00:00 2001 From: Jaimos Skriletz Date: Sat, 6 Apr 2024 23:26:22 -0600 Subject: [PATCH] FvwmPager: Add option FocusAfterMove. This enables older code that would give focus to the window moved by the pager if the pager placed the window on the current desktop. This behavior is now disabled by default, and this option will enable the old behavior. --- doc/FvwmPager.adoc | 4 ++++ modules/FvwmPager/FvwmPager.c | 5 +++++ modules/FvwmPager/FvwmPager.h | 1 + modules/FvwmPager/x_pager.c | 20 +++++++++++--------- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/doc/FvwmPager.adoc b/doc/FvwmPager.adoc index a4a1b6c1a..fafce43e5 100644 --- a/doc/FvwmPager.adoc +++ b/doc/FvwmPager.adoc @@ -276,6 +276,10 @@ does not get the input focus. This may happen if you drag the pointer over one of the mini windows in the pager. There is nothing that can be done about this - except not using SloppyFocus in the pager. +*FvwmPager: FocusAfterMove:: + After moving a window using the pager (using mouse button 2), give the + window focus if it is moved to the same desktop as the current monitor. + *FvwmPager: SolidSeparators:: By default the pages of the virtual desktop are separated by dashed lines in the pager window. This option causes FvwmPager to use solid diff --git a/modules/FvwmPager/FvwmPager.c b/modules/FvwmPager/FvwmPager.c index 512fa8014..35f1a5ebb 100644 --- a/modules/FvwmPager/FvwmPager.c +++ b/modules/FvwmPager/FvwmPager.c @@ -122,6 +122,7 @@ bool is_transient = false; bool HilightDesks = true; bool ShowBalloons = false; bool error_occured = false; +bool FocusAfterMove = false; bool use_desk_label = true; bool win_hi_pix_set = false; bool WindowBorders3d = false; @@ -2382,6 +2383,10 @@ ImagePath = NULL; { do_focus_on_enter = true; } + else if (StrEquals(resource, "FocusAfterMove")) + { + FocusAfterMove = true; + } else if (StrEquals(resource, "SolidSeparators")) { use_dashed_separators = false; diff --git a/modules/FvwmPager/FvwmPager.h b/modules/FvwmPager/FvwmPager.h index 357e7beb7..f27288175 100644 --- a/modules/FvwmPager/FvwmPager.h +++ b/modules/FvwmPager/FvwmPager.h @@ -226,6 +226,7 @@ extern bool is_transient; extern bool HilightDesks; extern bool ShowBalloons; extern bool error_occured; +extern bool FocusAfterMove; extern bool use_desk_label; extern bool win_hi_pix_set; extern bool WindowBorders3d; diff --git a/modules/FvwmPager/x_pager.c b/modules/FvwmPager/x_pager.c index 22c93f7f0..924ade010 100644 --- a/modules/FvwmPager/x_pager.c +++ b/modules/FvwmPager/x_pager.c @@ -2736,29 +2736,30 @@ void MoveWindow(XEvent *Event) * "ewmhiwa" disables clipping to monitor/ewmh boundaries. */ pagerrec_to_fvwm(&rec, false, fp); - if (CurrentDeskPerMonitor && fAlwaysCurrentDesk) + if (CurrentDeskPerMonitor && fAlwaysCurrentDesk) { + NewDesk = fp->m->virtual_scr.CurrentDesk; /* Let fvwm handle any desk changes in this case. */ snprintf(buf, sizeof(buf), "Silent Move v+%dp v+%dp ewmhiwa", rec.x, rec.y); - else + } else { + NewDesk += desk1; snprintf(buf, sizeof(buf), "Silent Move desk %d v+%dp v+%dp ewmhiwa", - NewDesk + desk1, rec.x, rec.y); + NewDesk, rec.x, rec.y); + } SendText(fd, buf, t->w); XSync(dpy,0); SendText(fd, "Silent Raise", t->w); -done_moving: -#if 0 - /* Disabling for now, unsure how useful this feature is. */ - if (fp->m->virtual_scr.CurrentDesk == t->desk) { + if (FocusAfterMove && fp->m->virtual_scr.CurrentDesk == NewDesk) { XSync(dpy,0); usleep(5000); XSync(dpy,0); SendText(fd, "Silent FlipFocus NoWarp", t->w); } -#endif + +done_moving: if (is_transient) ExitPager(); /* does not return */ } @@ -3121,7 +3122,8 @@ void IconMoveWindow(XEvent *Event, PagerWindow *t) SendText(fd, buf, t->w); XSync(dpy, 0); SendText(fd, "Silent Raise", t->w); - //SendText(fd, "Silent FlipFocus NoWarp", t->w); + if (FocusAfterMove) + SendText(fd, "Silent FlipFocus NoWarp", t->w); } else { MoveResizePagerView(t, true); }