From 24f9409a71d321d8b011b89a1b4470abc6a8cb4c Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 10:54:20 +0100 Subject: [PATCH 1/4] Fix and document "bugopts debugrandr". --- doc/fvwm3/fvwm3.adoc | 2 ++ fvwm/builtins.c | 5 ++++- fvwm/events.c | 5 ++++- fvwm/focus.c | 5 ++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/fvwm3/fvwm3.adoc b/doc/fvwm3/fvwm3.adoc index 8c0b723c4..86d7a97d0 100644 --- a/doc/fvwm3/fvwm3.adoc +++ b/doc/fvwm3/fvwm3.adoc @@ -3094,6 +3094,8 @@ AddToMenu RootMenu turn the option on or off, or "toggle" to switch is back and forth. If _bool_ is omitted, the default setting is restored. + +_DebugRandR_ activates monitor layout debug messages. ++ _FlickeringMoveWorkaround_ disables ConfigureNotify events that are usually sent to an application while it is moved. If some windows flicker annoyingly while being moved, this option may help you. Note diff --git a/fvwm/builtins.c b/fvwm/builtins.c index da16be8bd..53e6d287e 100644 --- a/fvwm/builtins.c +++ b/fvwm/builtins.c @@ -3850,7 +3850,10 @@ void CMD_BugOpts(F_CMD_ARGS) Scr.bo.do_debug_randr = 0; break; } - monitor_dump_state(NULL); + if (Scr.bo.do_debug_randr) + { + monitor_dump_state(NULL); + } } else if (StrEquals(opt, "TransliterateUtf8")) { diff --git a/fvwm/events.c b/fvwm/events.c index 51af3bfef..49c23b799 100644 --- a/fvwm/events.c +++ b/fvwm/events.c @@ -1770,7 +1770,10 @@ void monitor_update_ewmh(void) struct monitor *m, *mref; fvwm_debug(__func__, "monitor debug...\n"); - monitor_dump_state(NULL); + if (Scr.bo.do_debug_randr) + { + monitor_dump_state(NULL); + } mref = TAILQ_FIRST(&monitor_q); diff --git a/fvwm/focus.c b/fvwm/focus.c index bffd3fde0..8cb40c3b2 100644 --- a/fvwm/focus.c +++ b/fvwm/focus.c @@ -671,7 +671,10 @@ static void __activate_window_by_command( } m = fw->m; - monitor_dump_state(m); + if (Scr.bo.do_debug_randr) + { + monitor_dump_state(m); + } do_not_warp = StrEquals(PeekToken(action, NULL), "NoWarp"); if (!do_not_warp) { From 44e54a36254a8fe14c39e77397c9593c8e81d401 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 10:55:32 +0100 Subject: [PATCH 2/4] Sanitize screen related code indentation. --- libs/FScreen.c | 85 ++++++++++++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/libs/FScreen.c b/libs/FScreen.c index bd274419b..32ee78a75 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -332,7 +332,9 @@ monitor_assign_virtual(struct monitor *ref) if (m == ref) continue; - memcpy(&m->virtual_scr, &ref->virtual_scr, sizeof(m->virtual_scr)); + memcpy( + &m->virtual_scr, &ref->virtual_scr, + sizeof(m->virtual_scr)); } } @@ -443,7 +445,10 @@ scan_screens(Display *dpy) char *name = XGetAtomName(dpy, rrm[i].name); if (name == NULL) { - fprintf(stderr, "%s: couldn't detect monitor with empty name\n", __func__); + fprintf( + stderr, + "%s: couldn't detect monitor with empty name\n", + __func__); exit (101); } @@ -570,40 +575,41 @@ monitor_dump_state(struct monitor *m) } if (m != NULL && m2 != m) continue; - fvwm_debug(__func__, - "\tName:\t%s\n" - "\tDisabled:\t%s\n" - "\tIs Primary:\t%s\n" - "\tIs Current:\t%s\n" - "\tOutput:\t%d\n" - "\tCoords:\t{x: %d, y: %d, w: %d, h: %d}\n" - "\tVirtScr: {\n" - "\t\tVxMax: %d, VyMax: %d, Vx: %d, Vy: %d\n" - "\t\tEdgeScrollX: %d, EdgeScrollY: %d\n" - "\t\tCurrentDesk: %d\n" - "\t\tCurrentPage: {x: %d, y: %d}\n" - "\t\tMyDisplayWidth: %d, MyDisplayHeight: %d\n\t}\n" - "\tDesktops:\t%s\n" - "\tFlags:%s\n\n", - m2->si->name, - (m2->flags & MONITOR_DISABLED) ? "true" : "false", - (m2->flags & MONITOR_PRIMARY) ? "yes" : "no", - (mcur && m2 == mcur) ? "yes" : "no", - (int)m2->si->rr_output, - m2->si->x, m2->si->y, m2->si->w, m2->si->h, - m2->virtual_scr.VxMax, m2->virtual_scr.VyMax, - m2->virtual_scr.Vx, m2->virtual_scr.Vy, - m2->virtual_scr.EdgeScrollX, - m2->virtual_scr.EdgeScrollY, - m2->virtual_scr.CurrentDesk, - (int)(m2->virtual_scr.Vx / monitor_get_all_widths()), - (int)(m2->virtual_scr.Vy / monitor_get_all_heights()), - monitor_get_all_widths(), - monitor_get_all_heights(), - m2->Desktops ? "yes" : "no", - monitor_mode == MONITOR_TRACKING_G ? "global" : - monitor_mode == MONITOR_TRACKING_M ? "per-monitor" : - "Unknown" + fvwm_debug( + __func__, + "\tName:\t%s\n" + "\tDisabled:\t%s\n" + "\tIs Primary:\t%s\n" + "\tIs Current:\t%s\n" + "\tOutput:\t%d\n" + "\tCoords:\t{x: %d, y: %d, w: %d, h: %d}\n" + "\tVirtScr: {\n" + "\t\tVxMax: %d, VyMax: %d, Vx: %d, Vy: %d\n" + "\t\tEdgeScrollX: %d, EdgeScrollY: %d\n" + "\t\tCurrentDesk: %d\n" + "\t\tCurrentPage: {x: %d, y: %d}\n" + "\t\tMyDisplayWidth: %d, MyDisplayHeight: %d\n\t}\n" + "\tDesktops:\t%s\n" + "\tFlags:%s\n\n", + m2->si->name, + (m2->flags & MONITOR_DISABLED) ? "true" : "false", + (m2->flags & MONITOR_PRIMARY) ? "yes" : "no", + (mcur && m2 == mcur) ? "yes" : "no", + (int)m2->si->rr_output, + m2->si->x, m2->si->y, m2->si->w, m2->si->h, + m2->virtual_scr.VxMax, m2->virtual_scr.VyMax, + m2->virtual_scr.Vx, m2->virtual_scr.Vy, + m2->virtual_scr.EdgeScrollX, + m2->virtual_scr.EdgeScrollY, + m2->virtual_scr.CurrentDesk, + (int)(m2->virtual_scr.Vx / monitor_get_all_widths()), + (int)(m2->virtual_scr.Vy / monitor_get_all_heights()), + monitor_get_all_widths(), + monitor_get_all_heights(), + m2->Desktops ? "yes" : "no", + monitor_mode == MONITOR_TRACKING_G ? "global" : + monitor_mode == MONITOR_TRACKING_M ? "per-monitor" : + "Unknown" ); } } @@ -973,7 +979,9 @@ int FScreenParseGeometry( if (scr != NULL) { m = monitor_resolve_name(scr); - fprintf(stderr, "Found monitor with name of: %s (%s)\n", scr, m->si->name); + fprintf( + stderr, "Found monitor with name of: %s (%s)\n", scr, + m->si->name); x = m->si->x; y = m->si->y; w = m->si->w; @@ -1055,7 +1063,8 @@ int FScreenGetGeometry( arg.mouse_ev = NULL; arg.name = scr; - FScreenGetScrRect(&arg, FSCREEN_BY_NAME, &scr_x, &scr_y, &scr_w, &scr_h); + FScreenGetScrRect( + &arg, FSCREEN_BY_NAME, &scr_x, &scr_y, &scr_w, &scr_h); /* II. Interpret and fill in the values */ From 059ec6b2e32a893fde0379ba9bad30c2a6844052 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 10:55:53 +0100 Subject: [PATCH 3/4] Correct typo. --- fvwm/conditional.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fvwm/conditional.c b/fvwm/conditional.c index f81e5a498..e64cabf69 100644 --- a/fvwm/conditional.c +++ b/fvwm/conditional.c @@ -782,7 +782,7 @@ void CreateConditionMask(char *flags, WindowConditionMask *mask) if (tmp && *tmp) { fvwm_debug( __func__, - "Use comma instead of whiespace to separate " + "Use comma instead of whitespace to separate " "conditions"); } else { if (allocated_condition != NULL) From e6c2a8bc798c8ecef5bcd522de40869fe601a8c1 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Sun, 14 Nov 2021 11:02:48 +0100 Subject: [PATCH 4/4] Enable EWMH debug messages with "bugopts debugrandr". --- fvwm/ewmh.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/fvwm/ewmh.c b/fvwm/ewmh.c index 8bbb2e8f0..1f00ddb23 100644 --- a/fvwm/ewmh.c +++ b/fvwm/ewmh.c @@ -983,9 +983,13 @@ void ewmh_ComputeAndSetWorkArea(struct monitor *m) width = m->si->w - (left + right); height = m->si->h - (top + bottom); - fvwm_debug(__func__, "monitor '%s': {l: %d, r: %d, t: %d, b: %d} " - "{x: %d, y: %d, w: %d, h: %d}\n", m->si->name, - left, right, top, bottom, x, y, width, height); + if (Scr.bo.do_debug_randr) + { + fvwm_debug( + __func__, "monitor '%s': {l: %d, r: %d, t: %d, b: %d} " + "{x: %d, y: %d, w: %d, h: %d}\n", m->si->name, + left, right, top, bottom, x, y, width, height); + } if ( m->Desktops->ewmh_working_area.x != x || @@ -998,7 +1002,10 @@ void ewmh_ComputeAndSetWorkArea(struct monitor *m) m->Desktops->ewmh_working_area.width = width; m->Desktops->ewmh_working_area.height = height; - fvwm_debug(__func__, "differ, so setting work area\n"); + if (Scr.bo.do_debug_randr) + { + fvwm_debug(__func__, "differ, so setting work area\n"); + } ewmh_SetWorkArea(m); } @@ -1075,10 +1082,15 @@ void EWMH_GetWorkAreaIntersection( int area_h = m->Desktops->ewmh_working_area.height; Bool is_dynamic = False; - fvwm_debug(__func__, "mon: %s {ax: %d, ay: %d, aw: %d, ah: %d\n", - m->si->name, area_x, area_y, area_w, area_h); - fvwm_debug(__func__, "mon: %s {x: %d, y: %d, w: %d, h: %d\n", - m->si->name, *x, *y, *w, *h); + if (Scr.bo.do_debug_randr) + { + fvwm_debug( + __func__, "mon: %s {ax: %d, ay: %d, aw: %d, ah: %d\n", + m->si->name, area_x, area_y, area_w, area_h); + fvwm_debug( + __func__, "mon: %s {x: %d, y: %d, w: %d, h: %d\n", + m->si->name, *x, *y, *w, *h); + } /* FIXME: needs broadcast if global monitor in use. */ @@ -1111,8 +1123,13 @@ void EWMH_GetWorkAreaIntersection( *w = nw; *h = nh; - fvwm_debug(__func__, "mon: %s finalising: {x: %d, y: %d, w: %d, h: %d}\n", - m->si->name, *x, *y, *w, *h); + if (Scr.bo.do_debug_randr) + { + fvwm_debug( + __func__, + "mon: %s finalising: {x: %d, y: %d, w: %d, h: %d}\n", + m->si->name, *x, *y, *w, *h); + } return; }