Skip to content

Commit

Permalink
FvwmPager: Add option FocusAfterMove.
Browse files Browse the repository at this point in the history
  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.
  • Loading branch information
somiaj authored and ThomasAdam committed Apr 10, 2024
1 parent 93a5d56 commit 4112c99
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
4 changes: 4 additions & 0 deletions doc/FvwmPager.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions modules/FvwmPager/FvwmPager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions modules/FvwmPager/FvwmPager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 11 additions & 9 deletions modules/FvwmPager/x_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 4112c99

Please sign in to comment.