Skip to content

Commit

Permalink
Add working area support to FvwmPager.
Browse files Browse the repository at this point in the history
This allows FvwmPager to take advantage of the change to how
EWMH working area is used to move windows into the current working
area of the monitor they are placed in. This helps windows being
placed by FvwmPager not appear slightly off screen. This adds a
new option, *FvwmPager: IgnoreWorkingArea, which turns off this
feature, returning to the previous behavior of using the option
`ewmhiwa` option when moving windows.
  • Loading branch information
somiaj committed Oct 15, 2024
1 parent e7c2206 commit 81b8609
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions modules/FvwmPager/FvwmPager.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ rectangle pwindow = {0, 0, 0, 0};
rectangle icon = {-10000, -10000, 0, 0};

/* Settings */
bool ewmhiwa = false;
bool IsShared = false;
bool MiniIcons = false;
bool Swallowed = 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 @@ -208,6 +208,7 @@ extern rectangle pwindow;
extern rectangle icon;

/* Settings */
extern bool ewmhiwa;
extern bool IsShared;
extern bool MiniIcons;
extern bool Swallowed;
Expand Down
2 changes: 2 additions & 0 deletions modules/FvwmPager/init_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,8 @@ void parse_options(void)
use_no_separators = false;
} else if (StrEquals(resource, "NoSeparators")) {
use_no_separators = true;
} else if (StrEquals(resource, "IgnoreWorkingArea")) {
ewmhiwa = true;
} else {
/* No Match, set this to continue parsing. */
flags = 0;
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 @@ -1834,7 +1834,7 @@ void MoveWindow(XEvent *Event)

fp = fpmonitor_from_xy(
rec.x * fp->virtual_scr.VWidth / desk_w,
rec.y * fp->virtual_scr.VHeight / desk_h);
rec.y * fp->virtual_scr.VHeight / (desk_h + label_h));
if (fp == NULL)
fp = fpmonitor_this(NULL);

Expand Down Expand Up @@ -1872,6 +1872,7 @@ void MoveWindow(XEvent *Event)
}

char buf[64];
const char *iwa = ewmhiwa ? "ewmhiwa" : "";

/* Move using the virtual screen's coordinates "+vXp +vYp", to avoid
* guessing which monitor fvwm will use. The "desk" option is sent
Expand All @@ -1883,13 +1884,13 @@ void MoveWindow(XEvent *Event)
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);
snprintf(buf, sizeof(buf), "Silent Move v+%dp v+%dp %s",
rec.x, rec.y, iwa);
} else {
NewDesk += desk1;
snprintf(buf, sizeof(buf),
"Silent Move desk %d v+%dp v+%dp ewmhiwa",
NewDesk, rec.x, rec.y);
"Silent Move desk %d v+%dp v+%dp %s",
NewDesk, rec.x, rec.y, iwa);
}
SendText(fd, buf, t->w);
XSync(dpy,0);
Expand Down Expand Up @@ -1989,6 +1990,7 @@ void IconMoveWindow(XEvent *Event, PagerWindow *t)
SendText(fd, "Silent Move Pointer", t->w);
} else if (moved) {
char buf[64];
const char *iwa = ewmhiwa ? "ewmhiwa" : "";

rec.x = x - rec.x;
rec.y = y - rec.y;
Expand All @@ -2000,15 +2002,15 @@ void IconMoveWindow(XEvent *Event, PagerWindow *t)
pagerrec_to_fvwm(&rec, true, fp);
if (CurrentDeskPerMonitor)
snprintf(buf, sizeof(buf),
"Silent Move v+%dp v+%dp ewmhiwa",
rec.x, rec.y);
"Silent Move v+%dp v+%dp %s",
rec.x, rec.y, iwa);
else
/* Keep window on current desk, even if another
* monitor is currently on a different desk.
*/
snprintf(buf, sizeof(buf),
"Silent Move desk %d v+%dp v+%dp ewmhiwa",
desk_i, rec.x, rec.y);
"Silent Move desk %d v+%dp v+%dp %s",
desk_i, rec.x, rec.y, iwa);
SendText(fd, buf, t->w);
XSync(dpy, 0);
SendText(fd, "Silent Raise", t->w);
Expand Down

0 comments on commit 81b8609

Please sign in to comment.