Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FvwmPager: present overview of all monitors if "Monitor:" is not used #978

Merged
merged 41 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
019000c
DesktopConfiguration: broadcast to modules
ThomasAdam Mar 22, 2024
d165e8c
FvwmPager: Make a highlighted window for each monitor.
somiaj Mar 22, 2024
00f4b37
FvwmPager: only show CPagerWin of tracked monitor
somiaj Mar 22, 2024
7f33791
FvwmPager IconView per-monitor support.
somiaj Mar 23, 2024
dc11175
FvwmPager: Make Scroll "work" with per-monitor.
somiaj Mar 23, 2024
94370a6
FvwmPager: handle dead space for per-monitor mode
somiaj Mar 23, 2024
6b6bab1
DesktopConfiguration: broadcast to modules
ThomasAdam Mar 22, 2024
2a974e1
FvwmPager: try and not crash on new monitor
ThomasAdam Mar 22, 2024
a9331aa
modules: send Monitor updates
ThomasAdam Mar 23, 2024
4c430d7
FvwmPager: react to changes from RandR
ThomasAdam Mar 23, 2024
71ff5ed
FvwmPager: split initialize_pager()
ThomasAdam Mar 23, 2024
4b4c516
FvwmPager: track display{width,height}
ThomasAdam Mar 23, 2024
fe20289
BroadCastMonitor: issue DesktopSize
ThomasAdam Mar 23, 2024
cd3ee5e
FvwmPager: refresh window list on Monitor changes
ThomasAdam Mar 23, 2024
e0f4880
FvwmPager: adding and removing of fpmonitors
somiaj Mar 24, 2024
2f6b411
FvwmPager: monitor_*() to use fpmonitor prefix
somiaj Mar 24, 2024
dd6d530
FvwmPager ReConfigure: update for monitor changes
somiaj Mar 24, 2024
8a80db3
FvwmPager: remove old debug/comments
ThomasAdam Mar 23, 2024
4e73a2d
update_fvwm_monitor: don't broadcast monitor
ThomasAdam Mar 24, 2024
19a62da
RandR: unmark new monitors correctly
ThomasAdam Mar 24, 2024
ae6266a
FindScreenOfXY: handle negative numbers
somiaj Mar 24, 2024
b1d4e43
FvwmPager: disallow fallback on disabled monitors
somiaj Mar 24, 2024
afcf852
FvwmPager: monitor_by_output is never NULL
ThomasAdam Mar 24, 2024
1fb3c43
FvwmPager: Use correct monitor for PagerWindows
somiaj Mar 24, 2024
9aeb426
GotoDeskAndPage: don't broadcast monitor list
ThomasAdam Mar 24, 2024
abe5575
Move: add relative to virtual screen prefix
somiaj Mar 25, 2024
05d5265
FvwmPager man page face lift.
somiaj Mar 26, 2024
7cfa3a5
FvwmPager: Allow label clicks when Monitor set
ThomasAdam Mar 25, 2024
8ea04ac
FvwmPager: fix initial size of desk windows
somiaj Mar 27, 2024
ebd476e
FvwmPager: disable expose bound event checks
somiaj Mar 27, 2024
8026a2f
DesktopConfiguration: broadcast is_tracking_shared
somiaj Mar 27, 2024
18fea50
FvwmPager: add MonitorLabels and 'shared' support
somiaj Mar 27, 2024
7491416
FvwmPager: show MonitorLabels independent of DeskLabels
somiaj Mar 27, 2024
35f66e3
FvwmPager: right click scroll fixes.
somiaj Mar 27, 2024
929f59c
FvwmPager: MonitorLabels only show the monitor being tracked.
somiaj Mar 27, 2024
bcef335
FvwmPager: CalGeom: don't segfault on NULL
ThomasAdam Mar 28, 2024
4d67774
FvwmPager: Shorten fallback labels
somiaj Mar 28, 2024
3217152
FvwmPager: CalcGeom: initial rectangle off screen
somiaj Mar 28, 2024
3394c14
FvwmPager: remove redundant section
ThomasAdam Mar 29, 2024
4dab240
Remove use of allow_null bool in fpmonitor_from_xy
Mar 29, 2024
eee3462
virtual: silence compiler warning
ThomasAdam Mar 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 156 additions & 127 deletions doc/FvwmPager.adoc

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions doc/fvwm3_manpage_source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3927,7 +3927,7 @@ Move shuffle Up Left
*Move* can be used to moved a window to a specified position:
+

> *Move* [screen _S_] \[w | m]_x_[p | w] \[w | m]_y_[p | w] [Warp] [ewmhiwa]
> *Move* [screen _S_] \[w | m | v]_x_[p | w] \[w | m | v]_y_[p | w] [Warp] [ewmhiwa]

+
This will move the window to the _x_ and _y_ position (see below).
Expand All @@ -3950,8 +3950,11 @@ while a trailing '_w_' means percent of the window width/height. To move the
window relative to its current position, add the '_w_' (for "window") prefix
before the _x_ and/or _y_ value. To move the window to a position relative to
the current location of the pointer, add the '_m_' (for "mouse") prefix. To
leave either coordinate unchanged, "_keep_" can be specified in place of
_x_ or _y_.
move the window relative to the virtual screen coordinates, add the '_v_'
(for "virtual screen") prefix. This is mostly for internal use with FvwmPager,
but can be used to give exact coordinates on the virtual screen and is best
used with the '_p_' suffix. To leave either coordinate unchanged, "_keep_"
can be specified in place of _x_ or _y_.
+
For advanced uses, the arguments _x_ and _y_ can be used multiple
times, but without the prefix '_m_' or '_w_'. (See complex examples
Expand Down
5 changes: 4 additions & 1 deletion fvwm/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,9 @@ void monitor_update_ewmh(void)
set_ewmhc_strut_values(m, ewbs);
}
EWMH_Init(m);

/* Clear the flag now that it's been registered. */
m->flags &= ~MONITOR_NEW;
}

TAILQ_FOREACH_SAFE(mo, &monitorsold_q, oentry, mo1) {
Expand Down Expand Up @@ -4872,4 +4875,4 @@ void CMD_XSync(F_CMD_ARGS)
XSync(dpy, 0);

return;
}
}
2 changes: 0 additions & 2 deletions fvwm/ewmh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,8 +1963,6 @@ void EWMH_Init(struct monitor *m)
EWMH_SetDesktopGeometry(m);
EWMH_SetClientList(m);
EWMH_SetClientListStacking(m);

m->flags &= ~MONITOR_NEW;
}

/*
Expand Down
9 changes: 8 additions & 1 deletion fvwm/fvwm3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2417,9 +2417,16 @@ int main(int argc, char **argv)
LoadWindowStates(state_filename);

is_tracking_shared = false;
RB_FOREACH(m, monitors, &monitor_q)
RB_FOREACH(m, monitors, &monitor_q) {
EWMH_Init(m);

/* Having initialised the monitor at startup here, we can
* remove this flag, as the monitor is no longer considered
* new.
*/
m->flags &= ~MONITOR_NEW;
}

SetRCDefaults();
flush_window_updates();
simplify_style_list();
Expand Down
34 changes: 30 additions & 4 deletions fvwm/module_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,21 +468,47 @@ void BroadcastName(
void BroadcastMonitorList(fmodule *this)
{
char *name;
const char *m_info;
struct monitor *m;
fmodule_list_itr moditr;
fmodule *module;

module_list_itr_init(&moditr);

m_info = "Monitor %s %d %d %d %d %d %d %d %d %d %d";

while ((module = module_list_itr_next(&moditr)) != NULL) {
RB_FOREACH(m, monitors, &monitor_q) {
if (m->flags & MONITOR_DISABLED)
continue;
xasprintf(&name, "Monitor %s", m->si->name);
xasprintf(&name, m_info, m->si->name, m->flags,
m->dx, m->dy, m->virtual_scr.Vx,
m->virtual_scr.Vy, m->virtual_scr.VxMax,
m->virtual_scr.VyMax, m->virtual_scr.CurrentDesk,
monitor_get_all_widths(), monitor_get_all_heights());

SendName(module, M_CONFIG_INFO, 0, 0, 0, name);
free(name);
}
xasprintf(&name, "DesktopConfiguration %d %d",
monitor_mode, is_tracking_shared);
SendName(module, M_CONFIG_INFO, 0, 0, 0, name);
free(name);

/* Reissue the DesktopSize command here, rather than sending
* down the DesktopSize -- we want FvwmPager in particular to
* react to a M_NEW_PAGE event, which DesktopSize will do; and
* this avoids duplication in FvwmPager as a result.
*/
char action[256];

/* Every monitor will have the same dx/dy values, so just take
* the fist entry in our list.
*/
struct monitor *m = RB_MIN(monitors, &monitor_q);

snprintf(action, sizeof(action), "DesktopSize %dx%d",
m->dx, m->dy);
execute_function_override_window(NULL, NULL, action, NULL, 0,
NULL);
}
}

Expand Down Expand Up @@ -1001,4 +1027,4 @@ void CMD_Send_WindowList(F_CMD_ARGS)
}

SendPacket(mod, M_END_WINDOWLIST, 0);
}
}
58 changes: 46 additions & 12 deletions fvwm/move_resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ static int GetOnePositionArgument(
{
int final_pos;
int pos_change = 0;
int return_val = 1;
float wfactor;

if (s1 == 0 || *s1 == 0)
Expand All @@ -571,6 +572,12 @@ static int GetOnePositionArgument(
final_pos = window_pos;
s1++;
break;
case 'v':
case 'V':
final_pos = 0;
return_val = 2;
s1++;
break;
case 'm':
case 'M':
{
Expand Down Expand Up @@ -677,7 +684,7 @@ static int GetOnePositionArgument(
}
*pFinalPos = final_pos;

return 1;
return return_val;
}

/* GetMoveArguments is used for Move & AnimatedMove
Expand All @@ -688,6 +695,8 @@ static int GetOnePositionArgument(
* 10p -0p Absolute pixel position, from bottom
* w+5 w-10p Relative position, right 5%, up ten pixels
* m+5 m-10p Pointer relative position, right 5%, up ten pixels
* v+5p v+10p Virtual screen absolute position, place at position
* (5p,10p) in the virtual screen, with (0p,0p) top left.
* Returns 2 when x & y have parsed without error, 0 otherwise
*/
int GetMoveArguments(FvwmWindow *fw,
Expand All @@ -704,6 +713,8 @@ int GetMoveArguments(FvwmWindow *fw,
int scr_h = monitor_get_all_heights();
Bool use_working_area = True;
Bool global_flag_parsed = False;
Bool use_virt_x = False;
Bool use_virt_y = False;
int retval = 0;

if (!paction)
Expand Down Expand Up @@ -786,34 +797,57 @@ int GetMoveArguments(FvwmWindow *fw,

if (s1 != NULL && s2 != NULL)
{
int n;
retval = 0;
if (fKeep == True && StrEquals(s1, "keep"))
{
retval++;
}
else if (
GetOnePositionArgument(
s1, pFinal->x, s.width, &(pFinal->x),
(float)scr_w / 100, scr_w, scr_pos.x, True))
else
{
retval++;
n = GetOnePositionArgument(
s1, pFinal->x, s.width, &(pFinal->x),
(float)scr_w / 100, scr_w, scr_pos.x, True);
if (n > 0)
{
retval++;
if (n == 2)
{
use_virt_x = True;
}
}
}
if (fKeep == True && StrEquals(s2, "keep"))
{
retval++;
}
else if (
GetOnePositionArgument(
s2, pFinal->y, s.height, &(pFinal->y),
(float)scr_h / 100, scr_h, scr_pos.y, False))
else
{
retval++;
n = GetOnePositionArgument(
s2, pFinal->y, s.height, &(pFinal->y),
(float)scr_h / 100, scr_h, scr_pos.y, False);
if (n > 0)
{
retval++;
if (n == 2)
{
use_virt_y = True;
}
}
}
if (retval == 0)
if (retval < 2)
{
/* make sure warping is off for interactive moves */
*fWarp = False;
}
else if (use_virt_x || use_virt_y)
{
/* Adjust position when using virtual screen. */
struct monitor *m = FindScreenOfXY(
pFinal->x, pFinal->y);
pFinal->x -= (use_virt_x) ? m->virtual_scr.Vx : 0;
pFinal->y -= (use_virt_y) ? m->virtual_scr.Vy : 0;
}
}
else
{
Expand Down
1 change: 0 additions & 1 deletion fvwm/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,6 @@ Bool update_fvwm_monitor(FvwmWindow *fw)
EWMH_SetCurrentDesktop(fw->m);
desk_add_fw(fw);
BroadcastConfig(M_CONFIGURE_WINDOW, fw);
BroadcastMonitorList(NULL);

return True;
}
Expand Down
7 changes: 3 additions & 4 deletions fvwm/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -2548,7 +2548,7 @@ void CMD_DesktopSize(F_CMD_ARGS)
*/
void CMD_GotoDesk(F_CMD_ARGS)
{
struct monitor *m, *m_loop;
struct monitor *m = NULL, *m_loop;
char *token;
int new_desk;

Expand Down Expand Up @@ -2623,7 +2623,7 @@ void CMD_GotoDeskAndPage(F_CMD_ARGS)
int current_desk;
Bool is_new_desk;
char *token;
struct monitor *m;
struct monitor *m = NULL;

token = PeekToken(action, NULL);
if (StrEquals(token, "screen")) {
Expand Down Expand Up @@ -2699,7 +2699,6 @@ void CMD_GotoDeskAndPage(F_CMD_ARGS)
BroadcastRestackAllWindows();
}
done:
BroadcastMonitorList(NULL);
EWMH_SetCurrentDesktop(m);

return;
Expand Down Expand Up @@ -3152,4 +3151,4 @@ void CMD_DesktopName(F_CMD_ARGS)

RB_FOREACH(m, monitors, &monitor_q)
apply_desktops_monitor(m);
}
}
46 changes: 30 additions & 16 deletions libs/FScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,13 +613,13 @@ scan_screens(Display *dpy)
if (!(m->flags & (MONITOR_FOUND|MONITOR_NEW))) {
m->flags |= MONITOR_DISABLED;
m->emit |= MONITOR_DISABLED;
} else if (m->flags & (MONITOR_FOUND|MONITOR_DISABLED)) {
} else if ((m->flags & (MONITOR_FOUND|MONITOR_DISABLED)) ==
(MONITOR_FOUND|MONITOR_DISABLED)) {
m->flags &= ~MONITOR_DISABLED;
} else {
m->emit |= MONITOR_ENABLED;
m->flags |= MONITOR_ENABLED;
}
m->flags &= ~MONITOR_FOUND;

}
/* Now that all monitors have been inserted, assign them a number from
* 0 -> n so that they can be referenced in order.
Expand Down Expand Up @@ -695,6 +695,22 @@ void FScreenInit(Display *dpy)
exit(101);
}

void
monitor_refresh_module(Display *dpy)
{
struct monitor *m = NULL;

RB_FOREACH(m, monitors, &monitor_q)
m->flags &= ~MONITOR_NEW;

scan_screens(dpy);

RB_FOREACH(m, monitors, &monitor_q) {
if (m->flags & MONITOR_NEW)
fprintf(stderr, "MON: %s is NEW...\n", m->si->name);
}
}

void
monitor_dump_state(struct monitor *m)
{
Expand Down Expand Up @@ -785,17 +801,15 @@ struct monitor *
FindScreenOfXY(int x, int y)
{
struct monitor *m;
int xa, ya;
int all_widths, all_heights;

all_widths = monitor_get_all_widths();
all_heights = monitor_get_all_heights();
int all_widths = monitor_get_all_widths();
int all_heights = monitor_get_all_heights();

xa = abs(x);
ya = abs(y);

xa %= all_widths;
ya %= all_heights;
x %= all_widths;
y %= all_heights;
if (x < 0)
x += all_widths;
if (y < 0)
y += all_heights;

RB_FOREACH(m, monitors, &monitor_q) {
/* If we have more than one screen configured, then don't match
Expand All @@ -805,8 +819,8 @@ FindScreenOfXY(int x, int y)
if (monitor_get_count() > 0 &&
strcmp(m->si->name, GLOBAL_SCREEN_NAME) == 0)
continue;
if (xa >= m->si->x && xa < m->si->x + m->si->w &&
ya >= m->si->y && ya < m->si->y + m->si->h)
if (x >= m->si->x && x < m->si->x + m->si->w &&
y >= m->si->y && y < m->si->y + m->si->h)
return (m);
}

Expand Down Expand Up @@ -1398,4 +1412,4 @@ int FScreenFetchMangledScreenFromUSPosHints(XSizeHints *hints)
screen = 0;

return screen;
}
}
1 change: 1 addition & 0 deletions libs/FScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ void monitor_output_change(Display *, XRRScreenChangeNotifyEvent *);
int monitor_get_all_widths(void);
int monitor_get_all_heights(void);
void monitor_assign_virtual(struct monitor *);
void monitor_refresh_module(Display *);
void checkPanFrames(struct monitor *);

#define FSCREEN_MANGLE_USPOS_HINTS_MAGIC ((short)-32109)
Expand Down
Loading
Loading