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

Wayland: fix monitor and scaling detection #356

Merged
merged 2 commits into from
Nov 5, 2023

Conversation

stacyharper
Copy link
Contributor

@stacyharper stacyharper commented Sep 16, 2023

The whole management of monitor_name with the Wayland backend seems heavily
broken, and doesn't allow to (1) select the target output with -m, and (2) to
correctly detect the used output and use correct attributes.

When used with two monitors with different scale values, depending on
the output order, you get a blurry menu.

To fix this we attach a listener to wayland surfaces to store which outputs
it belongs to. This rewrite almost completly the "recreate_windows"
function.

This also drop completly the xdg-output-unstable-v1 protocol, cause v4
already add the "name" event to fetch the output name.

I did not pushed this to support v6, with the new
"preferred_buffer_scale" event, cause anyway we need to fetch the
output max_height.

@stacyharper
Copy link
Contributor Author

To reproduce the issue I had, connect two outputs with different scaling values, and try bemenu. On one or the other output, bemenu is blurry.

@stacyharper stacyharper changed the title Wayland: fix monitor and scaling detection Draft: Wayland: fix monitor and scaling detection Sep 16, 2023
@stacyharper
Copy link
Contributor Author

Draft for now. We should probably wait for https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/220

@Cloudef
Copy link
Owner

Cloudef commented Sep 25, 2023

Perhaps the xdg-output protocol could be updated as well #297

@dkwo
Copy link

dkwo commented Nov 2, 2023

Would this also fix the bug that on wayland (wlroots, river) with wlr-randr --scale 2 the fonts in bemenu look blurry?

@stacyharper
Copy link
Contributor Author

Would this also fix the bug that on wayland (wlroots, river) with wlr-randr --scale 2 the fonts in bemenu look blurry?

Depends. I only reproduce this when two monitor got different scaling.

@dkwo
Copy link

dkwo commented Nov 3, 2023

@stacyharper if use single monitor, but with --scale 2, does your font in bemenu look blurry?

@stacyharper stacyharper changed the title Draft: Wayland: fix monitor and scaling detection Wayland: fix monitor and scaling detection Nov 4, 2023
@stacyharper
Copy link
Contributor Author

Perhaps the xdg-output protocol could be updated as well #297

I dropped this completly. Wayland v4 added the "name" event to wl_outputs a long time ago now.

@stacyharper if use single monitor, but with --scale 2, does your font in bemenu look blurry?

That seems completely expected if your output isn't scaled to 2.

@stacyharper
Copy link
Contributor Author

stacyharper commented Nov 4, 2023

I rewrote this patch, and adapted the commit message, and merge request body.

Draft for now. We should probably wait for https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/220

Nak, we don't need this because we still need to fetch the max_height value.

@stacyharper
Copy link
Contributor Author

stacyharper commented Nov 4, 2023

The Flatpak image wayland protocol seems outdated. Wayland protocol v4 has been merged upstream the 24 jan 2021.

@Cloudef: it is possible to bump it a bit?

@Cloudef
Copy link
Owner

Cloudef commented Nov 5, 2023

@stacyharper does it work if you bump the runtime version in both of the .yml files to 22.08?
https://github.com/Cloudef/bemenu/blob/master/.github/workflows/flatpak.yml#L13 you might need to change the image here too

The whole management of monitor_name with the Wayland backend seems heavily
broken, and doesn't allow to (1) select the target output with -m, and (2) to
correctly detect the used output and use correct attributes.

When used with two monitors with different scale values, depending on
the output order, you get a blurry menu.

To fix this we attach a listener to wayland surfaces to store which outputs
it belongs to. This rewrite almost completly the "recreate_windows"
function.

This also drop completly the xdg-output-unstable-v1 protocol, cause v4
already add the "name" event to fetch the output name.

I did not pushed this to support v6, with the new
"preferred_buffer_scale" event, cause anyway we need to fetch the
output max_height.
@stacyharper stacyharper force-pushed the fix-multiple-outputs branch 2 times, most recently from 4798e77 to 81ca5ff Compare November 5, 2023 09:06
@stacyharper
Copy link
Contributor Author

@stacyharper does it work if you bump the runtime version in both of the .yml files to 22.08? https://github.com/Cloudef/bemenu/blob/master/.github/workflows/flatpak.yml#L13 you might need to change the image here too

Ah nice, it works!

@Cloudef
Copy link
Owner

Cloudef commented Nov 5, 2023

Thanks, merged

@Cloudef Cloudef merged commit c22cc64 into Cloudef:master Nov 5, 2023
4 checks passed
@dkwo
Copy link

dkwo commented Jan 29, 2024

With the recent update to bemenu v0.6.17 (and I believe due to this commit), I'm getting

$ sh -c 'grep -v '\''^#'\'' ~/bookmarks | bemenu -i -l 50 | cut -d'\'' '\'' -f1'
wl_surface@12: error 2: Buffer size (1920x625) is not divisible by scale (2)

logged as

info(wlroots): [wayland] error in client communication (pid 2463)
wl_surface@12: error 2: Buffer size (1920x625) is not divisible by scale (2)

My setup is unchanged from prior working version, and it has a single monitor and
wlr-randr --output ${external} --scale 2 in river init script.

@stacyharper
Copy link
Contributor Author

@dkwo could you run this command, and paste here the full output?

$ sh -c 'grep -v '\''^#'\'' ~/bookmarks | WAYLAND_DEBUG=1 bemenu -i -l 50 | cut -d'\'' '\'' -f1'

@dkwo
Copy link

dkwo commented Jan 30, 2024

@stacyharper Sure:

$ sh -c 'grep -v '\''^#'\'' ~/bookmarks | WAYLAND_DEBUG=1 bemenu -i -l 50 | cut -d'\'' '\'' -f1' 
[ 897494.154]  -> wl_display@1.get_registry(new id wl_registry@2)
[ 897494.176]  -> wl_display@1.sync(new id wl_callback@3)
[ 897494.319] wl_display@1.delete_id(3)
[ 897494.336] wl_registry@2.global(1, "wl_shm", 1)
[ 897494.345]  -> wl_registry@2.bind(1, "wl_shm", 1, new id [unknown]@4)
[ 897494.353] wl_registry@2.global(2, "wl_drm", 2)
[ 897494.359] wl_registry@2.global(3, "zwp_linux_dmabuf_v1", 4)
[ 897494.364] wl_registry@2.global(4, "wl_compositor", 5)
[ 897494.370]  -> wl_registry@2.bind(4, "wl_compositor", 4, new id [unknown]@5)
[ 897494.378] wl_registry@2.global(5, "wl_subcompositor", 1)
[ 897494.390] wl_registry@2.global(6, "xdg_wm_base", 2)
[ 897494.403] wl_registry@2.global(7, "zwlr_layer_shell_v1", 4)
[ 897494.418]  -> wl_registry@2.bind(7, "zwlr_layer_shell_v1", 2, new id [unknown]@6)
[ 897494.434] wl_registry@2.global(8, "zwlr_foreign_toplevel_manager_v1", 3)
[ 897494.449] wl_registry@2.global(9, "xdg_activation_v1", 1)
[ 897494.464] wl_registry@2.global(10, "zwp_primary_selection_device_manager_v1", 1)
[ 897494.478] wl_registry@2.global(11, "zxdg_decoration_manager_v1", 1)
[ 897494.494] wl_registry@2.global(12, "zxdg_output_manager_v1", 3)
[ 897494.508] wl_registry@2.global(13, "zwlr_output_manager_v1", 4)
[ 897494.521] wl_registry@2.global(14, "zwlr_output_power_manager_v1", 1)
[ 897494.535] wl_registry@2.global(15, "ext_idle_notifier_v1", 1)
[ 897494.549] wl_registry@2.global(16, "zwp_pointer_constraints_v1", 1)
[ 897494.562] wl_registry@2.global(17, "zwp_relative_pointer_manager_v1", 1)
[ 897494.576] wl_registry@2.global(18, "zwlr_virtual_pointer_manager_v1", 2)
[ 897494.590] wl_registry@2.global(19, "zwp_virtual_keyboard_manager_v1", 1)
[ 897494.603] wl_registry@2.global(20, "wl_seat", 8)
[ 897494.618]  -> wl_registry@2.bind(20, "wl_seat", 7, new id [unknown]@7)
[ 897494.632] wl_registry@2.global(21, "zwp_pointer_gestures_v1", 3)
[ 897494.646] wl_registry@2.global(22, "zriver_control_v1", 1)
[ 897494.659] wl_registry@2.global(23, "zriver_status_manager_v1", 4)
[ 897494.672] wl_registry@2.global(24, "river_layout_manager_v3", 2)
[ 897494.686] wl_registry@2.global(25, "zwp_idle_inhibit_manager_v1", 1)
[ 897494.700] wl_registry@2.global(26, "ext_session_lock_manager_v1", 1)
[ 897494.713] wl_registry@2.global(27, "wl_data_device_manager", 3)
[ 897494.726] wl_registry@2.global(28, "zwlr_data_control_manager_v1", 2)
[ 897494.740] wl_registry@2.global(29, "zwlr_export_dmabuf_manager_v1", 1)
[ 897494.753] wl_registry@2.global(30, "zwlr_gamma_control_manager_v1", 1)
[ 897494.767] wl_registry@2.global(31, "zwlr_screencopy_manager_v1", 3)
[ 897494.781] wl_registry@2.global(32, "wp_single_pixel_buffer_manager_v1", 1)
[ 897494.794] wl_registry@2.global(33, "wp_viewporter", 1)
[ 897494.807] wl_registry@2.global(35, "wl_output", 4)
[ 897494.823]  -> wl_registry@2.bind(35, "wl_output", 4, new id [unknown]@8)
[ 897494.854] wl_callback@3.done(2662)
[ 897494.869]  -> wl_display@1.sync(new id wl_callback@3)
[ 897494.980] wl_display@1.delete_id(3)
[ 897494.995] wl_shm@4.format(0)
[ 897495.007] wl_shm@4.format(1)
[ 897495.019] wl_shm@4.format(875709016)
[ 897495.031] wl_shm@4.format(875708993)
[ 897495.043] wl_shm@4.format(875710274)
[ 897495.055] wl_shm@4.format(842094674)
[ 897495.067] wl_shm@4.format(842088786)
[ 897495.078] wl_shm@4.format(892426322)
[ 897495.090] wl_shm@4.format(892420434)
[ 897495.101] wl_shm@4.format(909199186)
[ 897495.112] wl_shm@4.format(808665688)
[ 897495.124] wl_shm@4.format(808665665)
[ 897495.136] wl_shm@4.format(1211384408)
[ 897495.148] wl_shm@4.format(1211384385)
[ 897495.159] wl_shm@4.format(942948952)
[ 897495.171] wl_shm@4.format(942948929)
[ 897495.183] wl_seat@7.name("default")
[ 897495.195] wl_seat@7.capabilities(3)
[ 897495.209]  -> wl_seat@7.get_keyboard(new id wl_keyboard@9)
[ 897495.222]  -> wl_seat@7.get_pointer(new id wl_pointer@10)
[ 897495.234] wl_output@8.geometry(0, 0, 600, 340, 0, "Dell Inc.", "DELL U2723QE", 0)
[ 897495.253] wl_output@8.mode(1, 3840, 2160, 59997)
[ 897495.267] wl_output@8.scale(2)
[ 897495.279] wl_output@8.name("DP-3")
[ 897495.291] wl_output@8.description("Dell Inc. DELL U2723QE 6JX6WN3 (DP-3)")
[ 897495.303] wl_output@8.done()
[ 897495.314] wl_callback@3.done(2662)
[ 897495.337]  -> wl_compositor@5.create_surface(new id wl_surface@3)
[ 897495.351]  -> zwlr_layer_shell_v1@6.get_layer_surface(new id zwlr_layer_surface_v1@11, wl_surface@3, nil, 3, "menu")
[ 897495.367]  -> zwlr_layer_surface_v1@11.set_anchor(13)
[ 897495.379]  -> zwlr_layer_surface_v1@11.set_size(0, 32)
[ 897495.391]  -> wl_surface@3.commit()
[ 897495.404]  -> wl_display@1.sync(new id wl_callback@12)
[ 897495.516] wl_display@1.delete_id(12)
[ 897495.531] wl_keyboard@9.keymap(1, fd 5, 64806)
[ 897502.044] wl_keyboard@9.repeat_info(60, 300)
[ 897502.076] zwlr_layer_surface_v1@11.configure(2663, 1920, 32)
[ 897502.091]  -> zwlr_layer_surface_v1@11.ack_configure(2663)
[ 897502.101] zwlr_layer_surface_v1@11.configure(2664, 1920, 32)
[ 897502.111]  -> zwlr_layer_surface_v1@11.ack_configure(2664)
[ 897502.119] wl_callback@12.done(2664)
[ 897502.129]  -> zwlr_layer_surface_v1@11.set_size(1920, 32)
[ 897502.138]  -> zwlr_layer_surface_v1@11.set_exclusive_zone(0)
[ 897502.147]  -> wl_surface@3.commit()
[ 897502.156]  -> wl_display@1.sync(new id wl_callback@12)
[ 897502.305] wl_display@1.delete_id(12)
[ 897502.321] zwlr_layer_surface_v1@11.configure(2665, 1920, 32)
[ 897502.331]  -> zwlr_layer_surface_v1@11.ack_configure(2665)
[ 897502.340] wl_callback@12.done(2665)
[ 897502.348]  -> zwlr_layer_surface_v1@11.set_keyboard_interactivity(0)
[ 897502.357]  -> wl_surface@3.commit()
[ 897502.366]  -> wl_display@1.sync(new id wl_callback@12)
[ 897502.435] wl_display@1.delete_id(12)
[ 897502.464] zwlr_layer_surface_v1@11.configure(2666, 1920, 32)
[ 897502.488]  -> zwlr_layer_surface_v1@11.ack_configure(2666)
[ 897502.510] wl_callback@12.done(2666)
[ 897502.593]  -> zwlr_layer_surface_v1@11.destroy()
[ 897502.619]  -> wl_surface@3.destroy()
[ 897502.642]  -> wl_compositor@5.create_surface(new id wl_surface@12)
[ 897502.666]  -> zwlr_layer_shell_v1@6.get_layer_surface(new id zwlr_layer_surface_v1@13, wl_surface@12, nil, 3, "menu")
[ 897502.692]  -> zwlr_layer_surface_v1@13.set_anchor(13)
[ 897502.714]  -> zwlr_layer_surface_v1@13.set_size(0, 32)
[ 897502.736]  -> wl_surface@12.commit()
[ 897502.754]  -> wl_display@1.sync(new id wl_callback@14)
[ 897502.874] wl_display@1.delete_id(11)
[ 897502.902] wl_display@1.delete_id(3)
[ 897502.924] wl_display@1.delete_id(14)
[ 897502.946] zwlr_layer_surface_v1@13.configure(2667, 1920, 32)
[ 897502.970]  -> zwlr_layer_surface_v1@13.ack_configure(2667)
[ 897502.992] zwlr_layer_surface_v1@13.configure(2668, 1920, 32)
[ 897503.011]  -> zwlr_layer_surface_v1@13.ack_configure(2668)
[ 897503.020] wl_callback@14.done(2668)
[ 897503.029]  -> zwlr_layer_surface_v1@13.set_size(1920, 32)
[ 897503.037]  -> zwlr_layer_surface_v1@13.set_exclusive_zone(0)
[ 897503.046]  -> wl_surface@12.commit()
[ 897503.054]  -> wl_display@1.sync(new id wl_callback@14)
[ 897503.125] wl_display@1.delete_id(14)
[ 897503.151] zwlr_layer_surface_v1@13.configure(2669, 1920, 32)
[ 897503.174]  -> zwlr_layer_surface_v1@13.ack_configure(2669)
[ 897503.198] wl_callback@14.done(2669)
[ 897503.220]  -> zwlr_layer_surface_v1@13.set_keyboard_interactivity(0)
[ 897503.244]  -> wl_surface@12.commit()
[ 897503.266]  -> wl_display@1.sync(new id wl_callback@14)
[ 897503.339] wl_display@1.delete_id(14)
[ 897503.364] zwlr_layer_surface_v1@13.configure(2670, 1920, 32)
[ 897503.388]  -> zwlr_layer_surface_v1@13.ack_configure(2670)
[ 897503.398] wl_callback@14.done(2670)
[ 897503.408]  -> zwlr_layer_surface_v1@13.set_exclusive_zone(-1)
[ 897503.416]  -> wl_surface@12.commit()
[ 897503.424]  -> wl_display@1.sync(new id wl_callback@14)
[ 897503.484] wl_display@1.delete_id(14)
[ 897503.509] zwlr_layer_surface_v1@13.configure(2671, 1920, 32)
[ 897503.532]  -> zwlr_layer_surface_v1@13.ack_configure(2671)
[ 897503.554] wl_callback@14.done(2671)
[ 897503.740]  -> zwlr_layer_surface_v1@13.set_keyboard_interactivity(1)
[ 897503.768]  -> wl_surface@12.commit()
[ 897503.791]  -> wl_display@1.sync(new id wl_callback@14)
[ 897503.888] wl_display@1.delete_id(14)
[ 897503.916] zwlr_layer_surface_v1@13.configure(2672, 1920, 32)
[ 897503.939]  -> zwlr_layer_surface_v1@13.ack_configure(2672)
[ 897503.962] wl_callback@14.done(2672)
[ 897504.061]  -> wl_shm@4.create_pool(new id wl_shm_pool@14, fd 7, 245760)
[ 897504.092]  -> wl_shm_pool@14.create_buffer(new id wl_buffer@3, 0, 1920, 32, 7680, 0)
[ 897504.117]  -> wl_shm_pool@14.destroy()
[ 897504.534]  -> wl_surface@12.set_buffer_scale(1)
[ 897528.082]  -> zwlr_layer_surface_v1@13.set_size(1920, 625)
[ 897528.129]  -> wl_surface@12.commit()
[ 897528.146]  -> wl_display@1.sync(new id wl_callback@11)
[ 897528.297] wl_display@1.delete_id(14)
[ 897528.319] wl_display@1.delete_id(11)
[ 897528.327] zwlr_layer_surface_v1@13.configure(2673, 1920, 625)
[ 897528.336]  -> zwlr_layer_surface_v1@13.ack_configure(2673)
[ 897528.343] wl_callback@11.done(2673)
[ 897528.352]  -> wl_buffer@3.destroy()
[ 897528.422]  -> wl_shm@4.create_pool(new id wl_shm_pool@11, fd 7, 4800000)
[ 897528.433]  -> wl_shm_pool@11.create_buffer(new id wl_buffer@14, 0, 1920, 625, 7680, 0)
[ 897528.441]  -> wl_shm_pool@11.destroy()
[ 897528.457]  -> wl_surface@12.set_buffer_scale(1)
[ 897536.193]  -> wl_surface@12.damage_buffer(0, 0, 1920, 625)
[ 897536.219]  -> wl_surface@12.attach(wl_buffer@14, 0, 0)
[ 897536.228]  -> wl_surface@12.commit()
[ 897536.249]  -> wl_surface@12.frame(new id wl_callback@15)
[ 897536.257]  -> wl_surface@12.commit()
[ 897543.557] wl_display@1.delete_id(3)
[ 897543.578] wl_display@1.delete_id(11)
[ 897543.592] wl_buffer@14.release()
[ 897543.599] wl_surface@12.enter(wl_output@8)
[ 897543.608] zwlr_layer_surface_v1@13.configure(2675, 1920, 625)
[ 897543.620]  -> zwlr_layer_surface_v1@13.ack_configure(2675)
[ 897543.628] wl_keyboard@9.enter(2678, wl_surface@12, array[4])
[ 897543.637] wl_keyboard@9.modifiers(2679, 0, 0, 0, 0)
[ 897543.652] wl_pointer@10.enter(2681, wl_surface@12, 223.84375000, 305.15625000)
[ 897543.663] wl_pointer@10.frame()
[ 897550.206] wl_display@1.delete_id(15)
[ 897550.226] wl_callback@15.done(1770485)
[ 897550.237]  -> wl_buffer@14.destroy()
[ 897550.320]  -> wl_shm@4.create_pool(new id wl_shm_pool@15, fd 7, 19200000)
[ 897550.333]  -> wl_shm_pool@15.create_buffer(new id wl_buffer@11, 0, 3840, 1250, 15360, 0)
[ 897550.343]  -> wl_shm_pool@15.destroy()
[ 897550.370]  -> wl_surface@12.set_buffer_scale(2)
[ 897581.998]  -> zwlr_layer_surface_v1@13.set_size(1920, 1075)
[ 897582.020]  -> wl_surface@12.commit()
[ 897582.033]  -> wl_display@1.sync(new id wl_callback@3)
[ 897582.070] wl_keyboard@9.key(2682, 1770490, 28, 0)
[ 897592.513] wl_display@1.delete_id(14)
[ 897592.547] wl_display@1.delete_id(15)
[ 897592.567] wl_display@1.error(wl_surface@12, 2, "Buffer size (1920x625) is not divisible by scale (2)")
wl_surface@12: error 2: Buffer size (1920x625) is not divisible by scale (2)

@stacyharper
Copy link
Contributor Author

I don't reproduce. Even when I end up with a 1920/651 buffer, on an output 3840/2160, there is no crash.

Can you give your output resolution, scale value, your $BEMENU_OPTS environmental value, and any other specific config you might have?

@stacyharper
Copy link
Contributor Author

Mhh, it looks like River send surface.enter events after layer_surface.ack_configure. So bemenu create buffers with the wrong scale values

@dkwo
Copy link

dkwo commented Jan 30, 2024

just to give more details, this is on river 0.2.4 (current version on void linux) and the shell is zsh.

$ wlr-randr             
DP-3 "Dell Inc. DELL U2723QE 6JX6WN3 (DP-3)"
  Make: Dell Inc.
  Model: DELL U2723QE
  Serial: 6JX6WN3
  Physical size: 600x340 mm
  Enabled: yes
  Modes:
    3840x2160 px, 59.997002 Hz (preferred, current)
    3840x2160 px, 29.981001 Hz
    2560x1440 px, 59.951000 Hz
    2048x1280 px, 60.195999 Hz
    2048x1152 px, 60.000000 Hz
    1920x1200 px, 59.884998 Hz
    2048x1080 px, 23.997000 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 60.000000 Hz
    1920x1080 px, 59.939999 Hz
    1920x1080 px, 50.000000 Hz
    1920x1080 px, 24.000000 Hz
    1920x1080 px, 23.976000 Hz
    1600x1200 px, 60.000000 Hz
    1680x1050 px, 59.953999 Hz
    1280x1024 px, 75.025002 Hz
    1280x1024 px, 60.020000 Hz
    1280x800 px, 59.810001 Hz
    1152x864 px, 75.000000 Hz
    1280x720 px, 60.000000 Hz
    1280x720 px, 59.939999 Hz
    1280x720 px, 50.000000 Hz
    1024x768 px, 75.028999 Hz
    1024x768 px, 60.004002 Hz
    800x600 px, 75.000000 Hz
    800x600 px, 60.317001 Hz
    720x576 px, 50.000000 Hz
    720x576 px, 50.000000 Hz
    720x480 px, 60.000000 Hz
    720x480 px, 60.000000 Hz
    720x480 px, 59.939999 Hz
    720x480 px, 59.939999 Hz
    640x480 px, 75.000000 Hz
    640x480 px, 60.000000 Hz
    640x480 px, 59.939999 Hz
    640x480 px, 59.939999 Hz
    720x400 px, 70.082001 Hz
  Position: 2560,0
  Transform: normal
  Scale: 2.000000
  Adaptive Sync: disabled
eDP-1 "Panasonic Industry Company 0x96A2 (eDP-1)"
  Make: Panasonic Industry Company
  Model: 0x96A2
  Serial: (null)
  Physical size: 310x170 mm
  Enabled: no
  Modes:
    2560x1440 px, 59.999001 Hz (preferred)
    2560x1440 px, 48.000000 Hz

and

$ printenv 
TEXMFHOME=/home/dkwo/.local/share/texmf
MAIL=/var/mail/dkwo
USER=dkwo
XDG_SESSION_TYPE=wayland
SHLVL=1
XDG_CACHE_HOME=/home/dkwo/.cache
XCURSOR_SIZE=24
HOME=/home/dkwo
MOTD_SHOWN=pam
OLDPWD=/home/dkwo
ASPELL_CONF=per-conf /home/dkwo/.config/aspell/aspell.conf; personal /home/dkwo/.config/aspell/en.pws; repl /home/dkwo/.config/aspell/en.prepl
BEMENU_OPTS=--tb "#285577" --hb "#285577" --tf "#eeeeee" --hf "#eeeeee" --nf "#bbbbbb" --fn "Terminus 18"
XDG_STATE_HOME=/home/dkwo/.local/state
INTEL_DEBUG=noccs
W3M_DIR=/home/dkwo/.local/state/w3m
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
XKB_DEFAULT_LAYOUT=us
XKB_DEFAULT_OPTIONS=compose:lwin
WAYLAND_DISPLAY=wayland-1
LOGNAME=dkwo
TEXMFVAR=/home/dkwo/.cache/texlive/texmf-var
_=/usr/bin/printenv
TERM=foot
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin:/opt/texlive/2023/bin/x86_64-linux
XDG_RUNTIME_DIR=/run/user/1000
XKB_DEFAULT_MODEL=thinkpad
LANG=en_US.UTF-8
XDG_CURRENT_DESKTOP=river
XDG_DATA_HOME=/home/dkwo/.local/share
XDG_CONFIG_HOME=/home/dkwo/.config
TEXMFCONFIG=/home/dkwo/.config/texlive/texmf-config
DOT_SAGE=/home/dkwo/.config/sage
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.svg=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:
LIBVA_DRIVER_NAME=iHD
PASSWORD_STORE_DIR=/home/dkwo/.local/share/pass
SHELL=/usr/bin/zsh
PWD=/home/dkwo
MANPATH=:/opt/texlive/2023/texmf-dist/doc/man
COLORTERM=truecolor
GPG_TTY=/dev/pts/3
SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh

@stacyharper
Copy link
Contributor Author

stacyharper commented Jan 30, 2024

Here the output on Sway 1.9-rc1, with a similar screen output, with the same BEMENU_OPTS, and the same command line arguments:

 -> wl_display@1.get_registry(new id wl_registry@2)
 -> wl_display@1.sync(new id wl_callback@3)
wl_display@1.delete_id(3)
wl_registry@2.global(1, "wl_shm", 1)
 -> wl_registry@2.bind(1, "wl_shm", 1, new id [unknown]@4)
wl_registry@2.global(2, "wl_drm", 2)
wl_registry@2.global(3, "zwp_linux_dmabuf_v1", 4)
wl_registry@2.global(4, "wl_compositor", 6)
 -> wl_registry@2.bind(4, "wl_compositor", 4, new id [unknown]@5)
wl_registry@2.global(5, "wl_subcompositor", 1)
wl_registry@2.global(6, "wl_data_device_manager", 3)
wl_registry@2.global(7, "zwlr_gamma_control_manager_v1", 1)
wl_registry@2.global(8, "zxdg_output_manager_v1", 3)
wl_registry@2.global(9, "ext_idle_notifier_v1", 1)
wl_registry@2.global(10, "zwp_idle_inhibit_manager_v1", 1)
wl_registry@2.global(11, "zwlr_layer_shell_v1", 4)
 -> wl_registry@2.bind(11, "zwlr_layer_shell_v1", 2, new id [unknown]@6)
wl_registry@2.global(12, "xdg_wm_base", 2)
wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
wl_registry@2.global(14, "org_kde_kwin_server_decoration_manager", 1)
wl_registry@2.global(15, "zxdg_decoration_manager_v1", 1)
wl_registry@2.global(16, "zwp_relative_pointer_manager_v1", 1)
wl_registry@2.global(17, "zwp_pointer_constraints_v1", 1)
wl_registry@2.global(18, "wp_presentation", 1)
wl_registry@2.global(19, "zwlr_output_manager_v1", 4)
wl_registry@2.global(20, "zwlr_output_power_manager_v1", 1)
wl_registry@2.global(21, "zwp_input_method_manager_v2", 1)
wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
wl_registry@2.global(23, "zwlr_foreign_toplevel_manager_v1", 3)
wl_registry@2.global(24, "ext_session_lock_manager_v1", 1)
wl_registry@2.global(25, "wp_drm_lease_device_v1", 1)
wl_registry@2.global(26, "zwlr_export_dmabuf_manager_v1", 1)
wl_registry@2.global(27, "zwlr_screencopy_manager_v1", 3)
wl_registry@2.global(28, "zwlr_data_control_manager_v1", 2)
wl_registry@2.global(29, "wp_security_context_manager_v1", 1)
wl_registry@2.global(30, "wp_viewporter", 1)
wl_registry@2.global(31, "wp_single_pixel_buffer_manager_v1", 1)
wl_registry@2.global(32, "wp_content_type_manager_v1", 1)
wl_registry@2.global(33, "wp_fractional_scale_manager_v1", 1)
wl_registry@2.global(34, "zxdg_exporter_v1", 1)
wl_registry@2.global(35, "zxdg_importer_v1", 1)
wl_registry@2.global(36, "zxdg_exporter_v2", 1)
wl_registry@2.global(37, "zxdg_importer_v2", 1)
wl_registry@2.global(38, "xdg_activation_v1", 1)
wl_registry@2.global(39, "wp_cursor_shape_manager_v1", 1)
wl_registry@2.global(40, "zwp_virtual_keyboard_manager_v1", 1)
wl_registry@2.global(41, "zwlr_virtual_pointer_manager_v1", 2)
wl_registry@2.global(42, "zwlr_input_inhibit_manager_v1", 1)
wl_registry@2.global(43, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
wl_registry@2.global(44, "zwp_pointer_gestures_v1", 3)
wl_registry@2.global(45, "wl_seat", 8)
 -> wl_registry@2.bind(45, "wl_seat", 7, new id [unknown]@7)
wl_registry@2.global(47, "zwp_primary_selection_device_manager_v1", 1)
wl_registry@2.global(65, "wl_output", 4)
 -> wl_registry@2.bind(65, "wl_output", 4, new id [unknown]@8)
wl_registry@2.global(66, "wl_output", 4)
 -> wl_registry@2.bind(66, "wl_output", 4, new id [unknown]@9)
wl_callback@3.done(5634)
 -> wl_display@1.sync(new id wl_callback@3)
wl_display@1.delete_id(3)
wl_shm@4.format(0)
wl_shm@4.format(1)
wl_shm@4.format(875709016)
wl_shm@4.format(875708993)
wl_shm@4.format(875710274)
wl_shm@4.format(842094674)
wl_shm@4.format(842088786)
wl_shm@4.format(892426322)
wl_shm@4.format(892420434)
wl_shm@4.format(909199186)
wl_shm@4.format(808665688)
wl_shm@4.format(808665665)
wl_shm@4.format(1211384408)
wl_shm@4.format(1211384385)
wl_shm@4.format(942948952)
wl_shm@4.format(942948929)
wl_seat@7.name("seat0")
wl_seat@7.capabilities(3)
 -> wl_seat@7.get_keyboard(new id wl_keyboard@10)
 -> wl_seat@7.get_pointer(new id wl_pointer@11)
wl_output@8.geometry(0, 0, 1210, 680, 0, "XXX", "Beyond TV", 0)
wl_output@8.mode(1, 3840, 2160, 30000)
wl_output@8.scale(2)
wl_output@8.name("HDMI-A-1")
wl_output@8.description("XXX Beyond TV 0x00010000 (HDMI-A-1)")
wl_output@8.done()
wl_output@9.geometry(0, 0, 310, 170, 0, "Chimei Innolux Corporation", "0x14B1", 0)
wl_output@9.mode(1, 1920, 1080, 60008)
wl_output@9.scale(2)
wl_output@9.name("eDP-1")
wl_output@9.description("Chimei Innolux Corporation 0x14B1 (eDP-1)")
wl_output@9.done()
wl_callback@3.done(5634)
 -> wl_compositor@5.create_surface(new id wl_surface@3)
 -> zwlr_layer_shell_v1@6.get_layer_surface(new id zwlr_layer_surface_v1@12, wl_surface@3, nil, 3, "menu")
 -> zwlr_layer_surface_v1@12.set_anchor(13)
 -> zwlr_layer_surface_v1@12.set_size(0, 32)
 -> wl_surface@3.commit()
 -> wl_display@1.sync(new id wl_callback@13)
wl_display@1.delete_id(13)
wl_keyboard@10.keymap(1, fd 5, 64789)
wl_keyboard@10.repeat_info(25, 600)
wl_surface@3.enter(wl_output@8)
zwlr_layer_surface_v1@12.configure(5636, 1920, 32)
 -> zwlr_layer_surface_v1@12.ack_configure(5636)
zwlr_layer_surface_v1@12.configure(5639, 1920, 32)
 -> zwlr_layer_surface_v1@12.ack_configure(5639)
wl_callback@13.done(5640)
 -> zwlr_layer_surface_v1@12.set_size(1920, 32)
 -> zwlr_layer_surface_v1@12.set_exclusive_zone(0)
 -> wl_surface@3.commit()
 -> wl_display@1.sync(new id wl_callback@13)
wl_display@1.delete_id(13)
zwlr_layer_surface_v1@12.configure(5642, 1920, 32)
 -> zwlr_layer_surface_v1@12.ack_configure(5642)
wl_callback@13.done(5643)
 -> zwlr_layer_surface_v1@12.set_keyboard_interactivity(0)
 -> wl_surface@3.commit()
 -> wl_display@1.sync(new id wl_callback@13)
wl_display@1.delete_id(13)
zwlr_layer_surface_v1@12.configure(5645, 1920, 32)
 -> zwlr_layer_surface_v1@12.ack_configure(5645)
wl_callback@13.done(5646)
 -> zwlr_layer_surface_v1@12.destroy()
 -> wl_surface@3.destroy()
 -> wl_compositor@5.create_surface(new id wl_surface@13)
 -> zwlr_layer_shell_v1@6.get_layer_surface(new id zwlr_layer_surface_v1@14, wl_surface@13, nil, 3, "menu")
 -> zwlr_layer_surface_v1@14.set_anchor(13)
 -> zwlr_layer_surface_v1@14.set_size(0, 32)
 -> wl_surface@13.commit()
 -> wl_display@1.sync(new id wl_callback@15)
wl_display@1.delete_id(12)
wl_display@1.delete_id(3)
wl_display@1.delete_id(15)
wl_surface@13.enter(wl_output@8)
zwlr_layer_surface_v1@14.configure(5650, 1920, 32)
 -> zwlr_layer_surface_v1@14.ack_configure(5650)
zwlr_layer_surface_v1@14.configure(5653, 1920, 32)
 -> zwlr_layer_surface_v1@14.ack_configure(5653)
wl_callback@15.done(5654)
 -> zwlr_layer_surface_v1@14.set_size(1920, 32)
 -> zwlr_layer_surface_v1@14.set_exclusive_zone(0)
 -> wl_surface@13.commit()
 -> wl_display@1.sync(new id wl_callback@15)
wl_display@1.delete_id(15)
zwlr_layer_surface_v1@14.configure(5656, 1920, 32)
 -> zwlr_layer_surface_v1@14.ack_configure(5656)
wl_callback@15.done(5657)
 -> zwlr_layer_surface_v1@14.set_keyboard_interactivity(0)
 -> wl_surface@13.commit()
 -> wl_display@1.sync(new id wl_callback@15)
wl_display@1.delete_id(15)
zwlr_layer_surface_v1@14.configure(5659, 1920, 32)
 -> zwlr_layer_surface_v1@14.ack_configure(5659)
wl_callback@15.done(5660)
 -> zwlr_layer_surface_v1@14.set_exclusive_zone(-1)
 -> wl_surface@13.commit()
 -> wl_display@1.sync(new id wl_callback@15)
wl_display@1.delete_id(15)
zwlr_layer_surface_v1@14.configure(5662, 1920, 32)
 -> zwlr_layer_surface_v1@14.ack_configure(5662)
wl_callback@15.done(5663)
 -> zwlr_layer_surface_v1@14.set_keyboard_interactivity(1)
 -> wl_surface@13.commit()
 -> wl_display@1.sync(new id wl_callback@15)
wl_display@1.delete_id(15)
zwlr_layer_surface_v1@14.configure(5665, 1920, 32)
 -> zwlr_layer_surface_v1@14.ack_configure(5665)
wl_callback@15.done(5666)
 -> wl_shm@4.create_pool(new id wl_shm_pool@15, fd 7, 983040)
 -> wl_shm_pool@15.create_buffer(new id wl_buffer@3, 0, 3840, 64, 15360, 0)
 -> wl_shm_pool@15.destroy()
 -> wl_surface@13.set_buffer_scale(2)
 -> zwlr_layer_surface_v1@14.set_size(1920, 1073)
 -> wl_surface@13.commit()
 -> wl_display@1.sync(new id wl_callback@12)
wl_display@1.delete_id(15)
wl_display@1.delete_id(12)
zwlr_layer_surface_v1@14.configure(5668, 1920, 1073)
 -> zwlr_layer_surface_v1@14.ack_configure(5668)
wl_callback@12.done(5669)
 -> wl_buffer@3.destroy()
 -> wl_shm@4.create_pool(new id wl_shm_pool@12, fd 7, 32962560)
 -> wl_shm_pool@12.create_buffer(new id wl_buffer@15, 0, 3840, 2146, 15360, 0)
 -> wl_shm_pool@12.destroy()
 -> wl_surface@13.set_buffer_scale(2)
 -> wl_surface@13.damage_buffer(0, 0, 3840, 2146)
 -> wl_surface@13.attach(wl_buffer@15, 0, 0)
 -> wl_surface@13.commit()
 -> wl_surface@13.frame(new id wl_callback@16)
 -> wl_surface@13.commit()
wl_display@1.delete_id(3)
wl_display@1.delete_id(12)
wl_pointer@11.enter(5672, wl_surface@13, 896.00000000, 73.00000000)
wl_pointer@11.frame()
zwlr_layer_surface_v1@14.configure(5674, 1920, 1073)
 -> zwlr_layer_surface_v1@14.ack_configure(5674)
wl_keyboard@10.enter(5678, wl_surface@13, array[0])
wl_keyboard@10.modifiers(5679, 0, 0, 0, 0)
wl_buffer@15.release()
wl_display@1.delete_id(16)
wl_callback@16.done(90775654)
 -> wl_surface@13.set_buffer_scale(2)
 -> wl_surface@13.damage_buffer(0, 0, 3840, 2146)
 -> wl_surface@13.attach(wl_buffer@15, 0, 0)
 -> wl_surface@13.commit()
wl_buffer@15.release()
wl_keyboard@10.key(5680, 90778756, 1, 1)
 -> wl_buffer@15.destroy()
 -> zwlr_layer_surface_v1@14.destroy()
 -> wl_surface@13.destroy()
 -> zwlr_layer_shell_v1@6.destroy()

We can see that here we never create a buffer with scale=1. We receive the surface enter first, so that bemenu knows that we use scale=2.

My opinion is that River doesn't trigger the events in the correct order. I'm not sure yet if it is possible to work-around in this circumstance. It would probably means the first frame would be rendered incorrectly anyway.

@stacyharper
Copy link
Contributor Author

Also, I don't really understand why River would fails that lately about the 1920x625 scale=2. I mean this buffer has already been configured as scale=1. And it probably already has been displayed on the output. But the next frame, that is correctly created as 3840x1250 scale=2, cause a crash that speak about 625 not divisible by 2.

Maybe there really is something wrong with River here? wl_buffer@14 has already been destroyed

@dkwo
Copy link

dkwo commented Jan 30, 2024

hmm, maybe @ifreund has ideas?

@dkwo
Copy link

dkwo commented Jan 30, 2024

Note that bemenu-run works fine.

@ifreund
Copy link

ifreund commented Jan 31, 2024

Regardless of what river is doing here, bemenu is committing a protocol error. From the set_buffer_scale request in wayland.xml:

Note that if the scale is larger than 1, then you have to attach
a buffer that is larger (by a factor of scale in each dimension)
than the desired surface size.

In the log shared by @dkwo, this request is made but no buffer with proper dimensions is attached to the surface despite the fact that a buffer with proper dimensions (wl_buffer@11) is created around the same time:

[ 897550.320]  -> wl_shm@4.create_pool(new id wl_shm_pool@15, fd 7, 19200000)
[ 897550.333]  -> wl_shm_pool@15.create_buffer(new id wl_buffer@11, 0, 3840, 1250, 15360, 0)
[ 897550.343]  -> wl_shm_pool@15.destroy()
[ 897550.370]  -> wl_surface@12.set_buffer_scale(2)
[ 897581.998]  -> zwlr_layer_surface_v1@13.set_size(1920, 1075)
[ 897582.020]  -> wl_surface@12.commit()
[ 897582.033]  -> wl_display@1.sync(new id wl_callback@3)
[ 897582.070] wl_keyboard@9.key(2682, 1770490, 28, 0)
[ 897592.513] wl_display@1.delete_id(14)
[ 897592.547] wl_display@1.delete_id(15)
[ 897592.567] wl_display@1.error(wl_surface@12, 2, "Buffer size (1920x625) is not divisible by scale (2)")
wl_surface@12: error 2: Buffer size (1920x625) is not divisible by scale (2)

I think this is pretty clearly indicative of a bemenu bug.

As for the relative ordering the wl_surface.enter event here, there are no guarantees made by the protocol so clients must be able to handle it at any time relative to the layer surface configure sequence for portability.

If there is a meaningful user-facing improvement that can be had by sending it earlier feel free to open a river issue, note however that river's master branch now leverages the wlroots scene graph API to send enter events though and note that compositors supporting wl_compositor version 6 (most widely used compositors I think) now send an easier to use and more accurate preferred_buffer_scale event.

@ifreund
Copy link

ifreund commented Jan 31, 2024

Here is the offending commit, likely all that needs to be done to fix this is to attach the new buffer before this line:

wl_surface_commit(window->surface);

Or perhaps the proper fix is to move the wl_buffer_set_buffer_scale() call from here into the bm_wl_window_render() function and only call it if a buffer is attached: https://github.com/Cloudef/bemenu/blob/ec6d7f9cdfc4a512f3b76b0dbf2dcfa7e0970456/lib/renderers/wayland/window.c#L192C1-L192C65

(also, that wl_display_roundtrip() is some major code smell, roundtrips should not be necessary after initial wl_registry setup)

@stacyharper
Copy link
Contributor Author

stacyharper commented Jan 31, 2024

@dkwo might give a try to the merge request #380 ?

thanks ifreud for the clue o/

@dkwo
Copy link

dkwo commented Jan 31, 2024

Thank you both so much.
The patch solves the issue for me.

@Cloudef
Copy link
Owner

Cloudef commented Feb 2, 2024

I see also conceptual issue here, the scale is queried after the surface enter event, but the surface enter is not available unless we have commited a buffer to a compositor, thus we need to recreate the buffer with new scale immediately... Is this because we want to avoid using some xdg protocol?

@Cloudef
Copy link
Owner

Cloudef commented Feb 2, 2024

I haven't done wayland dev in long time, but is wlr layer protocol's interpretation of buffer scale somehow different?

[3492571.042] wl_callback@12.done(6667574)
[3492571.045]  -> wl_buffer@3.destroy()
[3492571.080]  -> wl_shm@4.create_pool(new id wl_shm_pool@12, fd 7, 5242880)
[3492571.084]  -> wl_shm_pool@12.create_buffer(new id wl_buffer@15, 0, 10240, 128, 40960, 0)
[3492571.087]  -> wl_shm_pool@12.destroy()
[3492574.537]  -> wl_surface@13.set_buffer_scale(4)
[3492574.544]  -> wl_surface@13.damage_buffer(0, 0, 10240, 128)
[3492574.546]  -> wl_surface@13.attach(wl_buffer@15, 0, 0)
[3492574.549]  -> wl_surface@13.commit()

yet the surface isn't being rendered 4x bigger neither in hyprland or sway.
BEMENU_BACKEND=x11 BEMENU_SCALE=4 should give you the proper behavior.

EDIT:
I guess it's correct behavior? The compositor scales the buffer down due to my monitor being scale == 1.
This makes me wonder if BEMENU_SCALE should ignore wayland's buffer scale ...

@stacyharper
Copy link
Contributor Author

I see also conceptual issue here, the scale is queried after the surface enter event, but the surface enter is not available unless we have commited a buffer to a compositor, thus we need to recreate the buffer with new scale immediately... Is this because we want to avoid using some xdg protocol

This behavior depend on the compositor. Sway 1.9-rc1 doesn't do this:

[ 780029.143]  -> wl_display@1.get_registry(new id wl_registry@2)
[ 780029.172]  -> wl_display@1.sync(new id wl_callback@3)
[ 780029.292] wl_display@1.delete_id(3)
[ 780029.321] wl_registry@2.global(1, "wl_shm", 1)
[ 780029.339]  -> wl_registry@2.bind(1, "wl_shm", 1, new id [unknown]@4)
[ 780029.355] wl_registry@2.global(2, "wl_drm", 2)
[ 780029.369] wl_registry@2.global(3, "zwp_linux_dmabuf_v1", 4)
[ 780029.385] wl_registry@2.global(4, "wl_compositor", 6)
[ 780029.400]  -> wl_registry@2.bind(4, "wl_compositor", 4, new id [unknown]@5)
[ 780029.414] wl_registry@2.global(5, "wl_subcompositor", 1)
[ 780029.428] wl_registry@2.global(6, "wl_data_device_manager", 3)
[ 780029.443] wl_registry@2.global(7, "zwlr_gamma_control_manager_v1", 1)
[ 780029.457] wl_registry@2.global(8, "zxdg_output_manager_v1", 3)
[ 780029.472] wl_registry@2.global(9, "ext_idle_notifier_v1", 1)
[ 780029.485] wl_registry@2.global(10, "zwp_idle_inhibit_manager_v1", 1)
[ 780029.498] wl_registry@2.global(11, "zwlr_layer_shell_v1", 4)
[ 780029.513]  -> wl_registry@2.bind(11, "zwlr_layer_shell_v1", 2, new id [unknown]@6)
[ 780029.527] wl_registry@2.global(12, "xdg_wm_base", 2)
[ 780029.540] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
[ 780029.553] wl_registry@2.global(14, "org_kde_kwin_server_decoration_manager", 1)
[ 780029.567] wl_registry@2.global(15, "zxdg_decoration_manager_v1", 1)
[ 780029.580] wl_registry@2.global(16, "zwp_relative_pointer_manager_v1", 1)
[ 780029.593] wl_registry@2.global(17, "zwp_pointer_constraints_v1", 1)
[ 780029.607] wl_registry@2.global(18, "wp_presentation", 1)
[ 780029.620] wl_registry@2.global(19, "zwlr_output_manager_v1", 4)
[ 780029.634] wl_registry@2.global(20, "zwlr_output_power_manager_v1", 1)
[ 780029.648] wl_registry@2.global(21, "zwp_input_method_manager_v2", 1)
[ 780029.661] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
[ 780029.675] wl_registry@2.global(23, "zwlr_foreign_toplevel_manager_v1", 3)
[ 780029.688] wl_registry@2.global(24, "ext_session_lock_manager_v1", 1)
[ 780029.702] wl_registry@2.global(25, "wp_drm_lease_device_v1", 1)
[ 780029.716] wl_registry@2.global(26, "zwlr_export_dmabuf_manager_v1", 1)
[ 780029.729] wl_registry@2.global(27, "zwlr_screencopy_manager_v1", 3)
[ 780029.743] wl_registry@2.global(28, "zwlr_data_control_manager_v1", 2)
[ 780029.756] wl_registry@2.global(29, "wp_security_context_manager_v1", 1)
[ 780029.769] wl_registry@2.global(30, "wp_viewporter", 1)
[ 780029.782] wl_registry@2.global(31, "wp_single_pixel_buffer_manager_v1", 1)
[ 780029.795] wl_registry@2.global(32, "wp_content_type_manager_v1", 1)
[ 780029.808] wl_registry@2.global(33, "wp_fractional_scale_manager_v1", 1)
[ 780029.822] wl_registry@2.global(34, "zxdg_exporter_v1", 1)
[ 780029.836] wl_registry@2.global(35, "zxdg_importer_v1", 1)
[ 780029.849] wl_registry@2.global(36, "zxdg_exporter_v2", 1)
[ 780029.862] wl_registry@2.global(37, "zxdg_importer_v2", 1)
[ 780029.872] wl_registry@2.global(38, "xdg_activation_v1", 1)
[ 780029.881] wl_registry@2.global(39, "wp_cursor_shape_manager_v1", 1)
[ 780029.889] wl_registry@2.global(40, "zwp_virtual_keyboard_manager_v1", 1)
[ 780029.900] wl_registry@2.global(41, "zwlr_virtual_pointer_manager_v1", 2)
[ 780029.910] wl_registry@2.global(42, "zwlr_input_inhibit_manager_v1", 1)
[ 780029.920] wl_registry@2.global(43, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[ 780029.930] wl_registry@2.global(44, "zwp_pointer_gestures_v1", 3)
[ 780029.940] wl_registry@2.global(45, "wl_seat", 8)
[ 780029.950]  -> wl_registry@2.bind(45, "wl_seat", 7, new id [unknown]@7)
[ 780029.960] wl_registry@2.global(47, "zwp_primary_selection_device_manager_v1", 1)
[ 780029.968] wl_registry@2.global(50, "wl_output", 4)
[ 780029.978]  -> wl_registry@2.bind(50, "wl_output", 4, new id [unknown]@8)
[ 780029.988] wl_registry@2.global(51, "wl_output", 4)
[ 780029.997]  -> wl_registry@2.bind(51, "wl_output", 4, new id [unknown]@9)
[ 780030.010] wl_callback@3.done(2217)
[ 780030.020]  -> wl_display@1.sync(new id wl_callback@3)
[ 780030.114] wl_display@1.delete_id(3)
[ 780030.131] wl_shm@4.format(0)
[ 780030.141] wl_shm@4.format(1)
[ 780030.150] wl_shm@4.format(875709016)
[ 780030.159] wl_shm@4.format(875708993)
[ 780030.168] wl_shm@4.format(875710274)
[ 780030.176] wl_shm@4.format(842094674)
[ 780030.186] wl_shm@4.format(842088786)
[ 780030.194] wl_shm@4.format(892426322)
[ 780030.203] wl_shm@4.format(892420434)
[ 780030.211] wl_shm@4.format(909199186)
[ 780030.220] wl_shm@4.format(808665688)
[ 780030.228] wl_shm@4.format(808665665)
[ 780030.238] wl_shm@4.format(1211384408)
[ 780030.246] wl_shm@4.format(1211384385)
[ 780030.255] wl_shm@4.format(942948952)
[ 780030.264] wl_shm@4.format(942948929)
[ 780030.273] wl_seat@7.name("seat0")
[ 780030.282] wl_seat@7.capabilities(3)
[ 780030.291]  -> wl_seat@7.get_keyboard(new id wl_keyboard@10)
[ 780030.301]  -> wl_seat@7.get_pointer(new id wl_pointer@11)
[ 780030.310] wl_output@8.geometry(0, 0, 540, 300, 0, "Acer Technologies", "VG252Q", 0)
[ 780030.320] wl_output@8.mode(1, 1920, 1080, 119982)
[ 780030.329] wl_output@8.scale(2)
[ 780030.337] wl_output@8.name("DP-1")
[ 780030.348] wl_output@8.description("Acer Technologies VG252Q TH6EE0018521 (DP-1)")
[ 780030.357] wl_output@8.done()
[ 780030.365] wl_output@9.geometry(0, 0, 540, 300, 0, "Acer Technologies", "VG252Q", 0)
[ 780030.375] wl_output@9.mode(1, 1920, 1080, 119982)
[ 780030.384] wl_output@9.scale(2)
[ 780030.394] wl_output@9.name("HDMI-A-1")
[ 780030.404] wl_output@9.description("Acer Technologies VG252Q TH6EE0018521 (HDMI-A-1)")
[ 780030.414] wl_output@9.done()
[ 780030.422] wl_callback@3.done(2217)
[ 780030.441]  -> wl_compositor@5.create_surface(new id wl_surface@3)
[ 780030.451]  -> zwlr_layer_shell_v1@6.get_layer_surface(new id zwlr_layer_surface_v1@12, wl_surface@3, nil, 3, "menu")
[ 780030.461]  -> zwlr_layer_surface_v1@12.set_anchor(13)
[ 780030.469]  -> zwlr_layer_surface_v1@12.set_size(0, 32)
[ 780030.478]  -> wl_surface@3.commit()
[ 780030.487]  -> wl_display@1.sync(new id wl_callback@13)
[ 780030.582] wl_display@1.delete_id(13)
[ 780030.589] wl_keyboard@10.keymap(1, fd 5, 64789)
[ 780033.279] wl_keyboard@10.repeat_info(25, 600)
[ 780033.285] wl_surface@3.enter(wl_output@8)
[ 780033.289] zwlr_layer_surface_v1@12.configure(2219, 1371, 32)
[ 780033.292]  -> zwlr_layer_surface_v1@12.ack_configure(2219)
[ 780033.294] zwlr_layer_surface_v1@12.configure(2223, 1371, 32)
[ 780033.296]  -> zwlr_layer_surface_v1@12.ack_configure(2223)
[ 780033.298] wl_callback@13.done(2225)
[ 780033.300]  -> zwlr_layer_surface_v1@12.set_size(1371, 32)
[ 780033.303]  -> zwlr_layer_surface_v1@12.set_exclusive_zone(0)
[ 780033.305]  -> wl_surface@3.commit()
[ 780033.307]  -> wl_display@1.sync(new id wl_callback@13)
[ 780033.363] wl_display@1.delete_id(13)
[ 780033.367] zwlr_layer_surface_v1@12.configure(2227, 1371, 32)
[ 780033.369]  -> zwlr_layer_surface_v1@12.ack_configure(2227)
[ 780033.371] wl_callback@13.done(2229)
[ 780033.373]  -> zwlr_layer_surface_v1@12.set_keyboard_interactivity(0)
[ 780033.375]  -> wl_surface@3.commit()
[ 780033.377]  -> wl_display@1.sync(new id wl_callback@13)
[ 780033.410] wl_display@1.delete_id(13)
[ 780033.413] zwlr_layer_surface_v1@12.configure(2231, 1371, 32)
[ 780033.416]  -> zwlr_layer_surface_v1@12.ack_configure(2231)
[ 780033.418] wl_callback@13.done(2233)
[ 780033.436]  -> zwlr_layer_surface_v1@12.destroy()
[ 780033.439]  -> wl_surface@3.destroy()
[ 780033.441]  -> wl_compositor@5.create_surface(new id wl_surface@13)
[ 780033.444]  -> zwlr_layer_shell_v1@6.get_layer_surface(new id zwlr_layer_surface_v1@14, wl_surface@13, nil, 3, "menu")
[ 780033.449]  -> zwlr_layer_surface_v1@14.set_anchor(13)
[ 780033.451]  -> zwlr_layer_surface_v1@14.set_size(0, 32)
[ 780033.454]  -> wl_surface@13.commit()
[ 780033.456]  -> wl_display@1.sync(new id wl_callback@15)
[ 780033.506] wl_display@1.delete_id(12)
[ 780033.509] wl_display@1.delete_id(3)
[ 780033.511] wl_display@1.delete_id(15)
[ 780033.513] wl_surface@13.enter(wl_output@8)
[ 780033.516] zwlr_layer_surface_v1@14.configure(2238, 1371, 32)
[ 780033.518]  -> zwlr_layer_surface_v1@14.ack_configure(2238)
[ 780033.521] zwlr_layer_surface_v1@14.configure(2242, 1371, 32)
[ 780033.523]  -> zwlr_layer_surface_v1@14.ack_configure(2242)
[ 780033.525] wl_callback@15.done(2244)
[ 780033.527]  -> zwlr_layer_surface_v1@14.set_size(1371, 32)
[ 780033.529]  -> zwlr_layer_surface_v1@14.set_exclusive_zone(0)
[ 780033.531]  -> wl_surface@13.commit()
[ 780033.532]  -> wl_display@1.sync(new id wl_callback@15)
[ 780033.566] wl_display@1.delete_id(15)
[ 780033.569] zwlr_layer_surface_v1@14.configure(2246, 1371, 32)
[ 780033.571]  -> zwlr_layer_surface_v1@14.ack_configure(2246)
[ 780033.573] wl_callback@15.done(2248)
[ 780033.575]  -> zwlr_layer_surface_v1@14.set_keyboard_interactivity(0)
[ 780033.577]  -> wl_surface@13.commit()
[ 780033.579]  -> wl_display@1.sync(new id wl_callback@15)
[ 780033.611] wl_display@1.delete_id(15)
[ 780033.614] zwlr_layer_surface_v1@14.configure(2250, 1371, 32)
[ 780033.616]  -> zwlr_layer_surface_v1@14.ack_configure(2250)
[ 780033.618] wl_callback@15.done(2252)
[ 780033.620]  -> zwlr_layer_surface_v1@14.set_anchor(13)
[ 780033.623]  -> zwlr_layer_surface_v1@14.set_size(1291, 32)
[ 780033.625]  -> wl_surface@13.commit()
[ 780033.627]  -> wl_display@1.sync(new id wl_callback@15)
[ 780033.660] wl_display@1.delete_id(15)
[ 780033.663] zwlr_layer_surface_v1@14.configure(2254, 1291, 32)
[ 780033.665]  -> zwlr_layer_surface_v1@14.ack_configure(2254)
[ 780033.667] wl_callback@15.done(2256)
[ 780033.669]  -> zwlr_layer_surface_v1@14.set_anchor(15)
[ 780033.671]  -> wl_surface@13.commit()
[ 780033.673]  -> wl_display@1.sync(new id wl_callback@15)
[ 780033.702] wl_display@1.delete_id(15)
[ 780033.705] zwlr_layer_surface_v1@14.configure(2258, 1291, 32)
[ 780033.707]  -> zwlr_layer_surface_v1@14.ack_configure(2258)
[ 780033.709] wl_callback@15.done(2260)
[ 780033.721]  -> zwlr_layer_surface_v1@14.set_keyboard_interactivity(1)
[ 780033.724]  -> wl_surface@13.commit()
[ 780033.725]  -> wl_display@1.sync(new id wl_callback@15)
[ 780033.755] wl_display@1.delete_id(15)
[ 780033.757] zwlr_layer_surface_v1@14.configure(2262, 1291, 32)
[ 780033.759]  -> zwlr_layer_surface_v1@14.ack_configure(2262)
[ 780033.761] wl_callback@15.done(2264)
[ 780033.797]  -> wl_shm@4.create_pool(new id wl_shm_pool@15, fd 7, 660992)
[ 780033.801]  -> wl_shm_pool@15.create_buffer(new id wl_buffer@3, 0, 2582, 64, 10328, 0)
[ 780033.804]  -> wl_shm_pool@15.destroy()
[ 780045.341]  -> zwlr_layer_surface_v1@14.set_size(1291, 346)
[ 780045.347]  -> wl_buffer@3.destroy()
[ 780045.395]  -> wl_shm@4.create_pool(new id wl_shm_pool@12, fd 8, 7146976)
[ 780045.401]  -> wl_shm_pool@12.create_buffer(new id wl_buffer@16, 0, 2582, 692, 10328, 0)
[ 780045.408]  -> wl_shm_pool@12.destroy()
[ 780050.634]  -> wl_surface@13.set_buffer_scale(2)
[ 780050.640]  -> wl_surface@13.damage_buffer(0, 0, 2582, 692)
[ 780050.643]  -> wl_surface@13.attach(wl_buffer@16, 0, 0)
[ 780050.646]  -> wl_surface@13.commit()
[ 780050.657]  -> wl_surface@13.frame(new id wl_callback@17)
[ 780050.660]  -> wl_surface@13.commit()
[ 780051.769] wl_display@1.delete_id(15)
[ 780051.774] wl_display@1.delete_id(3)
[ 780051.776] wl_display@1.delete_id(12)
[ 780051.779] wl_pointer@11.enter(2266, wl_surface@13, 253.50000000, 29.50000000)
[ 780051.783] wl_pointer@11.frame()
[ 780051.785] zwlr_layer_surface_v1@14.configure(2268, 1291, 346)
[ 780051.788]  -> zwlr_layer_surface_v1@14.ack_configure(2268)
[ 780051.791] wl_keyboard@10.enter(2273, wl_surface@13, array[4])
[ 780051.794] wl_keyboard@10.modifiers(2274, 0, 0, 0, 0)
[ 780051.798] wl_buffer@16.release()
[ 780053.164] wl_display@1.delete_id(17)
[ 780053.167] wl_callback@17.done(446295)
[ 780053.940]  -> wl_surface@13.set_buffer_scale(2)
[ 780053.944]  -> wl_surface@13.damage_buffer(0, 0, 2582, 692)
[ 780053.947]  -> wl_surface@13.attach(wl_buffer@16, 0, 0)
[ 780053.950]  -> wl_surface@13.commit()
[ 780054.611] wl_buffer@16.release()
[ 780128.650] wl_keyboard@10.key(2275, 446370, 28, 0)
[ 781496.706] wl_keyboard@10.key(2276, 447738, 1, 1)
[ 781496.726]  -> wl_buffer@16.destroy()
[ 781496.734]  -> zwlr_layer_surface_v1@14.destroy()
[ 781496.738]  -> wl_surface@13.destroy()
[ 781496.743]  -> zwlr_layer_shell_v1@6.destroy()

Here, we can see that bemenu receive wl_surface@13.enter(wl_output@8) before the very first wl_shm@4.create_pool. We receive enter as soon as the layer shell is configured, when Sway knows what to do with this surface.

AFAIK if the compositor require to attach a buffer, then it become impossible for us to render a correct first frame.

@Cloudef
Copy link
Owner

Cloudef commented Feb 2, 2024

Perhaps the issue is then only if you use for example BEMENU_SCALE=4 the bm_wl_window_render is first called with buffer scale = 1 and then 4 (happens with sway too)

@stacyharper
Copy link
Contributor Author

Perhaps the issue is then only if you use for example BEMENU_SCALE=4 the bm_wl_window_render is first called with buffer scale = 1 and then 4 (happens with sway too)

Mhh no:

diff --git a/lib/renderers/wayland/window.c b/lib/renderers/wayland/window.c
index dd2bea0..d3e3e4a 100644
--- a/lib/renderers/wayland/window.c
+++ b/lib/renderers/wayland/window.c
@@ -253,6 +253,7 @@ bm_wl_window_render(struct window *window, struct wl_display *display, struct bm
         window->notify.render(&buffer->cairo, buffer->width, window->max_height, menu, &result);
         window->displayed = result.displayed;
 
+        fprintf(stderr, "bm_wl_window_render loop scale %d\n", buffer->cairo.scale);
         if (window->height == result.height / buffer->cairo.scale)
             break;
 
[3056066.862]  -> wl_display@1.get_registry(new id wl_registry@2)
[3056066.882]  -> wl_display@1.sync(new id wl_callback@3)
[3056066.972] wl_display@1.delete_id(3)
[3056066.985] wl_registry@2.global(1, "wl_shm", 1)
[3056066.998]  -> wl_registry@2.bind(1, "wl_shm", 1, new id [unknown]@4)
[3056067.008] wl_registry@2.global(2, "wl_drm", 2)
[3056067.017] wl_registry@2.global(3, "zwp_linux_dmabuf_v1", 4)
[3056067.026] wl_registry@2.global(4, "wl_compositor", 6)
[3056067.035]  -> wl_registry@2.bind(4, "wl_compositor", 4, new id [unknown]@5)
[3056067.044] wl_registry@2.global(5, "wl_subcompositor", 1)
[3056067.053] wl_registry@2.global(6, "wl_data_device_manager", 3)
[3056067.062] wl_registry@2.global(7, "zwlr_gamma_control_manager_v1", 1)
[3056067.071] wl_registry@2.global(8, "zxdg_output_manager_v1", 3)
[3056067.080] wl_registry@2.global(9, "ext_idle_notifier_v1", 1)
[3056067.088] wl_registry@2.global(10, "zwp_idle_inhibit_manager_v1", 1)
[3056067.097] wl_registry@2.global(11, "zwlr_layer_shell_v1", 4)
[3056067.106]  -> wl_registry@2.bind(11, "zwlr_layer_shell_v1", 2, new id [unknown]@6)
[3056067.116] wl_registry@2.global(12, "xdg_wm_base", 2)
[3056067.125] wl_registry@2.global(13, "zwp_tablet_manager_v2", 1)
[3056067.135] wl_registry@2.global(14, "org_kde_kwin_server_decoration_manager", 1)
[3056067.147] wl_registry@2.global(15, "zxdg_decoration_manager_v1", 1)
[3056067.160] wl_registry@2.global(16, "zwp_relative_pointer_manager_v1", 1)
[3056067.169] wl_registry@2.global(17, "zwp_pointer_constraints_v1", 1)
[3056067.178] wl_registry@2.global(18, "wp_presentation", 1)
[3056067.187] wl_registry@2.global(19, "zwlr_output_manager_v1", 4)
[3056067.196] wl_registry@2.global(20, "zwlr_output_power_manager_v1", 1)
[3056067.204] wl_registry@2.global(21, "zwp_input_method_manager_v2", 1)
[3056067.213] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
[3056067.223] wl_registry@2.global(23, "zwlr_foreign_toplevel_manager_v1", 3)
[3056067.232] wl_registry@2.global(24, "ext_session_lock_manager_v1", 1)
[3056067.241] wl_registry@2.global(25, "wp_drm_lease_device_v1", 1)
[3056067.249] wl_registry@2.global(26, "zwlr_export_dmabuf_manager_v1", 1)
[3056067.258] wl_registry@2.global(27, "zwlr_screencopy_manager_v1", 3)
[3056067.267] wl_registry@2.global(28, "zwlr_data_control_manager_v1", 2)
[3056067.276] wl_registry@2.global(29, "wp_security_context_manager_v1", 1)
[3056067.284] wl_registry@2.global(30, "wp_viewporter", 1)
[3056067.293] wl_registry@2.global(31, "wp_single_pixel_buffer_manager_v1", 1)
[3056067.302] wl_registry@2.global(32, "wp_content_type_manager_v1", 1)
[3056067.310] wl_registry@2.global(33, "wp_fractional_scale_manager_v1", 1)
[3056067.319] wl_registry@2.global(34, "zxdg_exporter_v1", 1)
[3056067.327] wl_registry@2.global(35, "zxdg_importer_v1", 1)
[3056067.336] wl_registry@2.global(36, "zxdg_exporter_v2", 1)
[3056067.345] wl_registry@2.global(37, "zxdg_importer_v2", 1)
[3056067.353] wl_registry@2.global(38, "xdg_activation_v1", 1)
[3056067.362] wl_registry@2.global(39, "wp_cursor_shape_manager_v1", 1)
[3056067.371] wl_registry@2.global(40, "zwp_virtual_keyboard_manager_v1", 1)
[3056067.379] wl_registry@2.global(41, "zwlr_virtual_pointer_manager_v1", 2)
[3056067.388] wl_registry@2.global(42, "zwlr_input_inhibit_manager_v1", 1)
[3056067.397] wl_registry@2.global(43, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[3056067.406] wl_registry@2.global(44, "zwp_pointer_gestures_v1", 3)
[3056067.414] wl_registry@2.global(45, "wl_seat", 8)
[3056067.424]  -> wl_registry@2.bind(45, "wl_seat", 7, new id [unknown]@7)
[3056067.435] wl_registry@2.global(47, "zwp_primary_selection_device_manager_v1", 1)
[3056067.444] wl_registry@2.global(50, "wl_output", 4)
[3056067.453]  -> wl_registry@2.bind(50, "wl_output", 4, new id [unknown]@8)
[3056067.462] wl_registry@2.global(51, "wl_output", 4)
[3056067.471]  -> wl_registry@2.bind(51, "wl_output", 4, new id [unknown]@9)
[3056067.484] wl_callback@3.done(17060)
[3056067.494]  -> wl_display@1.sync(new id wl_callback@3)
[3056067.567] wl_display@1.delete_id(3)
[3056067.579] wl_shm@4.format(0)
[3056067.590] wl_shm@4.format(1)
[3056067.600] wl_shm@4.format(875709016)
[3056067.610] wl_shm@4.format(875708993)
[3056067.620] wl_shm@4.format(875710274)
[3056067.630] wl_shm@4.format(842094674)
[3056067.639] wl_shm@4.format(842088786)
[3056067.649] wl_shm@4.format(892426322)
[3056067.659] wl_shm@4.format(892420434)
[3056067.669] wl_shm@4.format(909199186)
[3056067.679] wl_shm@4.format(808665688)
[3056067.689] wl_shm@4.format(808665665)
[3056067.698] wl_shm@4.format(1211384408)
[3056067.706] wl_shm@4.format(1211384385)
[3056067.714] wl_shm@4.format(942948952)
[3056067.723] wl_shm@4.format(942948929)
[3056067.731] wl_seat@7.name("seat0")
[3056067.740] wl_seat@7.capabilities(3)
[3056067.749]  -> wl_seat@7.get_keyboard(new id wl_keyboard@10)
[3056067.758]  -> wl_seat@7.get_pointer(new id wl_pointer@11)
[3056067.767] wl_output@8.geometry(0, 0, 540, 300, 0, "Acer Technologies", "VG252Q", 0)
[3056067.777] wl_output@8.mode(1, 1920, 1080, 119982)
[3056067.786] wl_output@8.scale(2)
[3056067.795] wl_output@8.name("DP-1")
[3056067.804] wl_output@8.description("Acer Technologies VG252Q TH6EE0018521 (DP-1)")
[3056067.813] wl_output@8.done()
[3056067.821] wl_output@9.geometry(0, 0, 540, 300, 0, "Acer Technologies", "VG252Q", 0)
[3056067.831] wl_output@9.mode(1, 1920, 1080, 119982)
[3056067.840] wl_output@9.scale(2)
[3056067.848] wl_output@9.name("HDMI-A-1")
[3056067.857] wl_output@9.description("Acer Technologies VG252Q TH6EE0018521 (HDMI-A-1)")
[3056067.866] wl_output@9.done()
[3056067.874] wl_callback@3.done(17060)
[3056067.890]  -> wl_compositor@5.create_surface(new id wl_surface@3)
[3056067.900]  -> zwlr_layer_shell_v1@6.get_layer_surface(new id zwlr_layer_surface_v1@12, wl_surface@3, nil, 3, "menu")
[3056067.911]  -> zwlr_layer_surface_v1@12.set_anchor(13)
[3056067.919]  -> zwlr_layer_surface_v1@12.set_size(0, 32)
[3056067.929]  -> wl_surface@3.commit()
[3056067.937]  -> wl_display@1.sync(new id wl_callback@13)
[3056068.020] wl_display@1.delete_id(13)
[3056068.027] wl_keyboard@10.keymap(1, fd 5, 64789)
[3056071.314] wl_keyboard@10.repeat_info(25, 600)
[3056071.320] wl_surface@3.enter(wl_output@8)
[3056071.327] zwlr_layer_surface_v1@12.configure(17062, 1371, 32)
[3056071.331]  -> zwlr_layer_surface_v1@12.ack_configure(17062)
[3056071.334] zwlr_layer_surface_v1@12.configure(17066, 1371, 32)
[3056071.337]  -> zwlr_layer_surface_v1@12.ack_configure(17066)
[3056071.339] wl_callback@13.done(17068)
[3056071.342]  -> zwlr_layer_surface_v1@12.set_size(1371, 32)
[3056071.345]  -> zwlr_layer_surface_v1@12.set_exclusive_zone(0)
[3056071.348]  -> wl_surface@3.commit()
[3056071.351]  -> wl_display@1.sync(new id wl_callback@13)
[3056071.401] wl_display@1.delete_id(13)
[3056071.406] zwlr_layer_surface_v1@12.configure(17070, 1371, 32)
[3056071.409]  -> zwlr_layer_surface_v1@12.ack_configure(17070)
[3056071.412] wl_callback@13.done(17072)
[3056071.414]  -> zwlr_layer_surface_v1@12.set_keyboard_interactivity(0)
[3056071.416]  -> wl_surface@3.commit()
[3056071.419]  -> wl_display@1.sync(new id wl_callback@13)
[3056071.464] wl_display@1.delete_id(13)
[3056071.468] zwlr_layer_surface_v1@12.configure(17074, 1371, 32)
[3056071.471]  -> zwlr_layer_surface_v1@12.ack_configure(17074)
[3056071.473] wl_callback@13.done(17076)
[3056071.490]  -> zwlr_layer_surface_v1@12.destroy()
[3056071.493]  -> wl_surface@3.destroy()
[3056071.495]  -> wl_compositor@5.create_surface(new id wl_surface@13)
[3056071.498]  -> zwlr_layer_shell_v1@6.get_layer_surface(new id zwlr_layer_surface_v1@14, wl_surface@13, nil, 3, "menu")
[3056071.502]  -> zwlr_layer_surface_v1@14.set_anchor(13)
[3056071.504]  -> zwlr_layer_surface_v1@14.set_size(0, 32)
[3056071.506]  -> wl_surface@13.commit()
[3056071.509]  -> wl_display@1.sync(new id wl_callback@15)
[3056071.563] wl_display@1.delete_id(12)
[3056071.566] wl_display@1.delete_id(3)
[3056071.568] wl_display@1.delete_id(15)
[3056071.569] wl_surface@13.enter(wl_output@8)
[3056071.572] zwlr_layer_surface_v1@14.configure(17081, 1371, 32)
[3056071.574]  -> zwlr_layer_surface_v1@14.ack_configure(17081)
[3056071.576] zwlr_layer_surface_v1@14.configure(17085, 1371, 32)
[3056071.578]  -> zwlr_layer_surface_v1@14.ack_configure(17085)
[3056071.581] wl_callback@15.done(17087)
[3056071.583]  -> zwlr_layer_surface_v1@14.set_size(1371, 32)
[3056071.586]  -> zwlr_layer_surface_v1@14.set_exclusive_zone(0)
[3056071.588]  -> wl_surface@13.commit()
[3056071.589]  -> wl_display@1.sync(new id wl_callback@15)
[3056071.623] wl_display@1.delete_id(15)
[3056071.625] zwlr_layer_surface_v1@14.configure(17089, 1371, 32)
[3056071.628]  -> zwlr_layer_surface_v1@14.ack_configure(17089)
[3056071.630] wl_callback@15.done(17091)
[3056071.633]  -> zwlr_layer_surface_v1@14.set_keyboard_interactivity(0)
[3056071.635]  -> wl_surface@13.commit()
[3056071.637]  -> wl_display@1.sync(new id wl_callback@15)
[3056071.669] wl_display@1.delete_id(15)
[3056071.671] zwlr_layer_surface_v1@14.configure(17093, 1371, 32)
[3056071.674]  -> zwlr_layer_surface_v1@14.ack_configure(17093)
[3056071.676] wl_callback@15.done(17095)
[3056071.679]  -> zwlr_layer_surface_v1@14.set_anchor(13)
[3056071.681]  -> zwlr_layer_surface_v1@14.set_size(1291, 32)
[3056071.683]  -> wl_surface@13.commit()
[3056071.685]  -> wl_display@1.sync(new id wl_callback@15)
[3056071.724] wl_display@1.delete_id(15)
[3056071.728] zwlr_layer_surface_v1@14.configure(17097, 1291, 32)
[3056071.731]  -> zwlr_layer_surface_v1@14.ack_configure(17097)
[3056071.733] wl_callback@15.done(17099)
[3056071.735]  -> zwlr_layer_surface_v1@14.set_anchor(15)
[3056071.738]  -> wl_surface@13.commit()
[3056071.741]  -> wl_display@1.sync(new id wl_callback@15)
[3056071.773] wl_display@1.delete_id(15)
[3056071.775] zwlr_layer_surface_v1@14.configure(17101, 1291, 32)
[3056071.778]  -> zwlr_layer_surface_v1@14.ack_configure(17101)
[3056071.780] wl_callback@15.done(17103)
[3056071.793]  -> zwlr_layer_surface_v1@14.set_keyboard_interactivity(1)
[3056071.797]  -> wl_surface@13.commit()
[3056071.798]  -> wl_display@1.sync(new id wl_callback@15)
[3056071.830] wl_display@1.delete_id(15)
[3056071.835] zwlr_layer_surface_v1@14.configure(17105, 1291, 32)
[3056071.838]  -> zwlr_layer_surface_v1@14.ack_configure(17105)
[3056071.841] wl_callback@15.done(17107)
[3056071.878]  -> wl_shm@4.create_pool(new id wl_shm_pool@15, fd 7, 2643968)
[3056071.882]  -> wl_shm_pool@15.create_buffer(new id wl_buffer@3, 0, 5164, 128, 20656, 0)
[3056071.886]  -> wl_shm_pool@15.destroy()
bm_wl_window_render loop scale 4
[3056086.840]  -> zwlr_layer_surface_v1@14.set_size(1291, 266)
[3056086.845]  -> wl_buffer@3.destroy()
[3056086.906]  -> wl_shm@4.create_pool(new id wl_shm_pool@12, fd 8, 21977984)
[3056086.913]  -> wl_shm_pool@12.create_buffer(new id wl_buffer@16, 0, 5164, 1064, 20656, 0)
[3056086.917]  -> wl_shm_pool@12.destroy()
bm_wl_window_render loop scale 4
[3056104.269]  -> wl_surface@13.set_buffer_scale(4)
[3056104.275]  -> wl_surface@13.damage_buffer(0, 0, 5164, 1064)
[3056104.279]  -> wl_surface@13.attach(wl_buffer@16, 0, 0)
[3056104.282]  -> wl_surface@13.commit()
[3056104.303]  -> wl_surface@13.frame(new id wl_callback@17)
[3056104.308]  -> wl_surface@13.commit()
[3056111.046] wl_display@1.delete_id(15)
[3056111.054] wl_display@1.delete_id(3)
[3056111.057] wl_display@1.delete_id(12)
[3056111.060] wl_pointer@11.enter(17109, wl_surface@13, 477.00000000, 103.00000000)
[3056111.064] wl_pointer@11.frame()
[3056111.067] zwlr_layer_surface_v1@14.configure(17111, 1291, 266)
[3056111.071]  -> zwlr_layer_surface_v1@14.ack_configure(17111)
[3056111.074] wl_keyboard@10.enter(17116, wl_surface@13, array[0])
[3056111.077] wl_keyboard@10.modifiers(17117, 0, 0, 0, 0)
[3056111.083] wl_buffer@16.release()
[3056111.946] wl_display@1.delete_id(17)
[3056111.950] wl_callback@17.done(2722354)
bm_wl_window_render loop scale 4
[3056116.248]  -> wl_surface@13.set_buffer_scale(4)
[3056116.254]  -> wl_surface@13.damage_buffer(0, 0, 5164, 1064)
[3056116.257]  -> wl_surface@13.attach(wl_buffer@16, 0, 0)
[3056116.261]  -> wl_surface@13.commit()
[3056118.507] wl_buffer@16.release()
[3056990.454] wl_keyboard@10.key(17118, 2723232, 1, 1)
[3056990.472]  -> wl_buffer@16.destroy()
[3056990.481]  -> zwlr_layer_surface_v1@14.destroy()
[3056990.483]  -> wl_surface@13.destroy()
[3056990.486]  -> zwlr_layer_shell_v1@6.destroy()

@Cloudef
Copy link
Owner

Cloudef commented Feb 2, 2024

3156dac
Fixes BEMENU_SCALE on wayland

@stacyharper Nevermind I just realized the bm_wl_window_render has to create the buffer twice in scenario where it still does not know the final height.

@stacyharper
Copy link
Contributor Author

Okay! I think now I understand how BEMENU_SCALE was miss-behaving. It doensn't mess with the wayland scaling, but it upscale the bemenu window completly, while still being scaled pixel perfect.

Am I right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants