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

monitor_dump_state shows only one monitor despite two being added #1064

Closed
farblos opened this issue Oct 9, 2024 · 1 comment
Closed

monitor_dump_state shows only one monitor despite two being added #1064

farblos opened this issue Oct 9, 2024 · 1 comment
Labels
skip:changelog Issue/PR should skip CHANGELOG type:bug Something's broken!

Comments

@farblos
Copy link
Contributor

farblos commented Oct 9, 2024

Thanks for reporting your bug here! The following template will help with
giving as much information as possible so that it's easier to diagnose and
fix.

Upfront Information

Please provide the following information by running the command and providing
the output.

  • Fvwm3 version (run: fvwm3 --version)

Commit b92ecb2, then built as in Debian with

./autogen.sh 
./configure --verbose --disable-imlibtest --with-imlib-prefix=/no/dir --with-readline-ibrary=yes --enable-mandoc --enable-htmldoc --program-transform-name='/vwm[^3]/ s/vwm/vwm3/'
  • Linux distribution or BSD name/version

Debian testing with Fvwm3 built from main.

  • Platform (run: uname -sp)

Linux unknown

Expected Behaviour

I'm trying to understand Fvwm's monitor handling and patched it as follows:

diff --git a/libs/FScreen.c b/libs/FScreen.c
index a7742f66..38e2d7b9 100644
--- a/libs/FScreen.c
+++ b/libs/FScreen.c
@@ -626,6 +626,7 @@ out:
         */
        monitor_assign_number();
        monitor_check_primary();
+       monitor_dump_state(NULL);
        XRRFreeMonitors(rrm);
 }

Then I ensured that xrandr finds both monitors:

[~]$ xrandr --listactivemonitors
Monitors: 2
 0: +*eDP-1 1920/285x1200/190+0+0  eDP-1
 1: +DP-3-2 1920/519x1200/324+0+0  DP-3-2

In that scenario, I'd expect that the call to monitor_dump_state would list also both these monitors when I restart Fvwm3 with above changes.

Actual Behaviour

However, I get the following in my journal:

fvwm3[2467]: [1728509559.609360] FScreenInit: Using RandR 1.6
fvwm3[2467]: [1728509559.709165] scan_screens: Case 1: Add new monitors
fvwm3[2467]: [1728509559.709474] monitor_mark_new: Added new monitor: eDP-1 (0x55863a1999b0)
fvwm3[2467]: [1728509559.709580] monitor_mark_new: Added new monitor: DP-3-2 (0x55863a189760)
fvwm3[2467]: [1728509559.709861] monitor_dump_state: Monitor Debug
fvwm3[2467]: [1728509559.709874] monitor_dump_state:         number of outputs: 1
fvwm3[2467]: [1728509559.709893] monitor_dump_state:         Number:        0
fvwm3[2467]:         Name:        eDP-1
fvwm3[2467]:         Disabled:        false
fvwm3[2467]:         Is Primary:        yes
fvwm3[2467]:         Is Current:        yes
fvwm3[2467]:         Is Previous:        no
fvwm3[2467]:         Output:        66
fvwm3[2467]:         Coords:        {x: 0, y: 0, w: 1920, h: 1200}
fvwm3[2467]:         VirtScr: {
fvwm3[2467]:                 VxMax: 0, VyMax: 0, Vx: 0, Vy: 0
fvwm3[2467]:                 EdgeScrollX: 0, EdgeScrollY: 0
fvwm3[2467]:                 CurrentDesk: 0
fvwm3[2467]:                 CurrentPage: {x: 0, y: 0}
fvwm3[2467]:                 MyDisplayWidth: 1920, MyDisplayHeight: 1200
fvwm3[2467]:         }
fvwm3[2467]:         EWMH: {
fvwm3[2467]:                 BaseStrut Top:    0
fvwm3[2467]:                 BaseStrut Bottom: 0
fvwm3[2467]:                 BaseStrut Left:   0
fvwm3[2467]:                 BaseStrut Right:  0
fvwm3[2467]:         }
fvwm3[2467]:         Desktops:        no
fvwm3[2467]:         Flags:global
fvwm3[2467]: [1728509559.788909] main: Loading window states via /home/jschmidt/.fvwm/.fs-restart-sappc1:0

So monitor_add/monitor_mark_new get called on both monitors, but the resulting dump shows only one?!

Unfortunately, my gdb foo is not good enough to trace down the RB-tree ops. What I could get from gdb was that information from monitor_get_count (with the same monitor setup as shown above):

(gdb) b monitor_get_count
Breakpoint 2 at 0x5593b830a440: monitor_get_count. (2 locations)
(gdb) c
Continuing.

Breakpoint 2.2, monitor_get_count () at FScreen.c:808
808             RB_FOREACH(m, monitors, &monitor_q) {
(gdb) p monitor_q
$3 = {rbh_root = 0x5593d674a9b0}
(gdb) p monitor_q->rbh_root
$4 = (struct monitor *) 0x5593d674a9b0
(gdb) p *monitor_q->rbh_root 
$5 = {si = 0x5593d674ab00, flags = 8, emit = 4, number = 0, dx = 1, dy = 1, 
  is_prev = false, was_primary = false, Desktops = 0x5593d6754c90, ewmhc = {
    NumberOfDesktops = 0, MaxDesktops = 0, CurrentNumberOfDesktops = 1, 
    NeedsToCheckDesk = 0, BaseStrut = {left = 0, right = 0, top = 0, 
      bottom = 0}}, edge = {top = false, bottom = false, left = false, 
    right = false}, virtual_scr = {VxMax = 0, VyMax = 0, Vx = 0, Vy = 0, 
    edge_thickness = 2, last_edge_thickness = 2, EdgeScrollX = 0, 
    EdgeScrollY = 0, CurrentDesk = 0, prev_page_x = 0, prev_page_y = 0, 
    prev_desk = 0, prev_desk_and_page_desk = 0, prev_desk_and_page_page_x = 0, 
    prev_desk_and_page_page_y = 0, is_swapping = false}, PanFrameTop = {
    win = 0, isMapped = 0, command = 0x0, command_leave = 0x0}, 
  PanFrameLeft = {win = 0, isMapped = 0, command = 0x0, command_leave = 0x0}, 
  PanFrameRight = {win = 0, isMapped = 0, command = 0x0, command_leave = 0x0}, 
  PanFrameBottom = {win = 0, isMapped = 0, command = 0x0, 
    command_leave = 0x0}, pan_frames_mapped = false, entry = {rbe_left = 0x0, 
    rbe_right = 0x0, rbe_parent = 0x0, rbe_color = 0}, oentry = {
    tqe_next = 0x0, tqe_prev = 0x0}}
(gdb) d
Delete all breakpoints, watchpoints, tracepoints, and catchpoints? (y or n) y
(gdb) c
@farblos farblos added the type:bug Something's broken! label Oct 9, 2024
@farblos
Copy link
Contributor Author

farblos commented Oct 9, 2024

Ah ... probably the key here is that both monitors are mirrored and have the same x and y coordinates.

Does that mean that they are identical in terms of function monitor_compare and, hence, show up only once in the RB-tree?

That would probably explain some of my confusion.

@ThomasAdam ThomasAdam added the skip:changelog Issue/PR should skip CHANGELOG label Oct 9, 2024
@ThomasAdam ThomasAdam closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip:changelog Issue/PR should skip CHANGELOG type:bug Something's broken!
Projects
None yet
Development

No branches or pull requests

2 participants