wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
18.18k stars 813 forks source link

wl_surface@45: error 2: Buffer size (820x611) is not divisible by scale (2) #3234

Closed grappas closed 1 year ago

grappas commented 1 year ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

Hyprland

WezTerm version

20230310-182648-fe6280f0

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

wezterm 20230310-182648-fe6280f0

To Reproduce

Everything is ok when I'm resizing window on 96 dpi but when I create new window next to existing one on 192 dpi all instances are crashing with error from title.

Configuration

local wezterm = require 'wezterm'
local act = wezterm.action
local mykeys = {
}

local My_font_size = 14.0
local Font_size = My_font_size

local clock = os.clock
function Sleep(n)
local t0 = clock()
while clock() - t0 <= n do end
end

function Recompute_font_size(window)
    local window_dims = window:get_dimensions()
    local overrides = window:get_config_overrides() or {}
    local Dpi = window_dims.dpi / 96
    local Scale_factor = 100 * Dpi
    if (window_dims.pixel_width / Scale_factor) > My_font_size
    then
        Font_size = My_font_size
    else
        Font_size = window_dims.pixel_width / Scale_factor
    end
    overrides.font_size = Font_size
    window:set_config_overrides(overrides)
end

wezterm.on('window-resized', function(window)
    Recompute_font_size(window)
end)

for i = 1, 8 do
    -- CTRL+ALT + number to activate that tab
    table.insert(mykeys, {
        key = tostring(i),
        mods = 'CTRL|ALT',
        action = act.ActivateTab(i - 1),
    })
    -- F1 through F8 to activate that tab
    table.insert(mykeys, {
        key = 'F' .. tostring(i),
        action = act.ActivateTab(i - 1),
    })
end

if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
    default_prog = { 'powershell.exe' }
else
    default_prog = { 'zsh' }
end

if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
    font = wezterm.font 'VictorMono NF'
else
    font = wezterm.font 'VictorMono Nerd Font'
end

-- if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
--     enable_wayland = false
-- else
--     enable_wayland = true
-- end

return {
    font = font,
    font_size = Font_size,
    color_scheme = 'Gruvbox Dark',
    window_background_opacity = 0.9,
    default_prog = default_prog,
    enable_wayland = true,
    -- enable_wayland = enable_wayland,
    keys = {
        {
            key = 'F1',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F2',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F3',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F4',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F5',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F6',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F7',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F8',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F9',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F10',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F11',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
        {
            key = 'F12',
            mods = 'CMD',
            action = wezterm.action.DisableDefaultAssignment,
        },
    }
}

Expected Behavior

Not crashing (proper flooring of window size division).

Logs

It's crashing - have tail of $(WEZTERM_LOG=debug wezterm) instead (character limit).

20:01:28.357  DEBUG  wezterm_term::terminalstate            > Foreground(PaletteIndex(244))
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > perform PrintString("─╯")
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > perform CSI(Sgr(Foreground(Default)))
20:01:28.357  DEBUG  wezterm_term::terminalstate            > Foreground(Default)
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > perform CSI(Cursor(Left(40)))
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > perform CSI(Mode(SetDecPrivateMode(Code(ApplicationCursorKeys))))
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > perform Esc(Code(DecApplicationKeyPad))
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > DECKPAM on
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > perform CSI(Mode(ResetDecPrivateMode(Code(StartBlinkingCursor))))
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > perform CSI(Mode(SetDecPrivateMode(Code(ShowCursor))))
20:01:28.357  DEBUG  wezterm_term::terminalstate::performer > perform CSI(Mode(SetDecPrivateMode(Code(BracketedPaste))))
20:01:28.357  DEBUG  wezterm_gui::termwindow                > Notification(Any { .. })
20:01:28.357  DEBUG  wezterm_gui::termwindow                > Notification(Any { .. })
20:01:28.357  DEBUG  wezterm_gui::termwindow                > Notification(Any { .. })
wl_surface@32: error 2: Buffer size (820x611) is not divisible by scale (2)
20:01:28.357  DEBUG  wezterm_gui::frontend                  > workspace is default, fixup windows
20:01:28.358  DEBUG  wezterm_gui::frontend                  > workspace is default, fixup windows
20:01:28.360  ERROR  wezterm_gui                            > running message loop: error during event_q.dispatch protocol_error=Some(ProtocolError { code: 2, object_id: 32, object_interface: "wl_surface", message: "" }): Protocol error (os error 71); terminating

Anything else?

No response

wez commented 1 year ago

Duplicate of https://github.com/wez/wezterm/issues/2445

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.