Johan Malm [Tue, 26 Nov 2024 20:02:36 +0000 (20:02 +0000)]
keyboard: add window rule to send release-events (#2377)
...of modifiers which are part of keybinds. This supports clients (for
example blender) that want to see modifier-release-events even if they are
part of a keybinds.
Most clients (including those using Qt and GTK) are setup to not see these
modifier release events and actually misbehave if they do. For example
Firefox shows the menu bar if alt is pressed and then released, whereas if
only pressed (because the release is absorbed) nothing happens. So, if
Firefox saw bound modifier-release-events it would show the menu bar every
time the window-switcher is used with alt-tab.
Consolatis [Tue, 26 Nov 2024 01:17:10 +0000 (02:17 +0100)]
CI: reduce job timeout to 10 minutes
Since GitHub runners now support hardware virtualization,
the maximal runtime of the FreeBSD runner is somewhere
around 3 to 6 minutes. It may still fail sometimes so
keep the timeout parameter around.
tokyo4j [Tue, 26 Nov 2024 01:56:10 +0000 (10:56 +0900)]
graphic-helpers: fix segfault when medium-size icon file is loaded
lab_data_buffer->logical_{width,height} are not the actual size of the
backing buffer, so wlr_buffer.{width,height} should be used when
duplicating it in get_cairo_surface_from_lab_data_buffer().
This mistake caused segfault when an icon file 1~2 times larger than
window.button.{width,height} is loaded, because the buffer for the raw
icon file is reused by setting lab_data_buffer->logical_{width,height}
with the size for display which is different from
wlr_buffer.{width,height} (see buffer_convert_cairo_surface_for_icon()),
and it is duplicated with get_cairo_surface_from_lab_data_buffer() for
hovered/rounded variants of titlebar button.
tokyo4j [Sun, 24 Nov 2024 05:39:35 +0000 (14:39 +0900)]
theme: set default values of window.*.border.color to #aaaaaa
This makes the colors of titlebar and window borders different, but will
let menu.border.color (which will be supported soon) inherit
window.active.border.color just like Openbox does, without making the menu
borders around a selected menu item invisible.
tokyo4j [Sat, 23 Nov 2024 05:17:15 +0000 (14:17 +0900)]
Add scaled_rect_buffer
scaled_rect_buffer is an implementation of scaled_scene_buffer and shows
an auto-scaling bordered rectangle. This is intended for menu borders,
but can be also useful for other elements like window switcher items.
We will support rounded corners for scaled_rect_buffer in the future.
John Lindgren [Sat, 23 Nov 2024 16:10:41 +0000 (11:10 -0500)]
output: fix assert() fail when enabling an output that was disabled
When the output is in the process of being enabled, but the new state
has not been committed yet, wlr_output->enabled is still false. So it's
not safe to assert that it's true in output_enable_adaptive_sync().
Fixes: 36e099fc93b3caf87e7f390a732fcec69373de8c
"view: ensure output is usable before setting adaptive sync"
Implementers can define impl->equal() which compares two
scaled-scene-buffers so that buffers are not allocated for visually
duplicated scaled-scene-buffers.
Currently this mechanism isn't applied for scaled-font-buffers since we
haven't defined impl->equal() for it.
This allows implementations of the interface to share a single
wlr_buffer for multiple wlr_scene_buffer nodes and still make
the scaled-scene-buffer handle the buffer drops.
wlr_scene_buffer holds an implicit lock while using a wlr_buffer
and scaled-scene-buffer.c holds additional locks for as long as
a buffer is within its internal cache.
This should ensure that a shared wlr_buffer never gets actually
dropped even if wlr_buffer_drop() has been called by another
scaled-scene-buffer instance using the same wlr_buffer.
tokyo4j [Mon, 18 Nov 2024 21:20:30 +0000 (06:20 +0900)]
src/menu.c: remove unnecessary re-renderings of font buffers
I missed that `scaled_font_buffer_update()` has `max_width` argument and
the subsequent calls to `scaled_font_buffer_set_max_width()` caused
unnecessary re-renderings.
tokyo4j [Thu, 14 Nov 2024 09:16:43 +0000 (18:16 +0900)]
menu: fix UAFs in menu_destroy() and item_destroy()
This fixes use-after-free when there's only 1 desktop and
menu_hide_submenu() is called to delete "Workspaces" submenu in
client-menu before menu scenes are initialized.
As menu_create() and item_create() no longer initialize scenes after 76515316, menu->scene_tree and item->tree should be null-checked.
tokyo4j [Wed, 13 Nov 2024 23:30:55 +0000 (08:30 +0900)]
menu: eliminate dead code
The deleted lines were dead code that didn't make any sense (even if it
were not dead, it should have recreated the parent of the hidden menu
rather than the hidden menu itself).
tokyo4j [Wed, 13 Nov 2024 23:14:11 +0000 (08:14 +0900)]
menu: fix menus disappearing when opening pipemenu
Commit 7651531 introduced a regression: `menu_update_scene()` which
re-creates a menu scene was called for all the menus when a pipemenu is
created, so the menus (parent of the pipemenu) were always moved to (0,0)
and hidden, and the pipemenu was incorrectly positioned.
This commit fixes it by calling `menu_update_scene()` only for the
pipemenu when it's created.
tokyo4j [Sun, 10 Nov 2024 09:54:01 +0000 (18:54 +0900)]
menu: refactor in preparation for richer menu design
This commit separates the process of creating scene-trees of the menu
items into `{item,separator,title}_create_scene()`. This will make it
easier to draw richer menu designs like borders, paddings and rounded
corners.
tokyo4j [Tue, 12 Nov 2024 01:54:59 +0000 (10:54 +0900)]
theme: move some variables into theme->window
For example, variables:
`theme->window_inactive_border_color`
`theme->window_active_border_color`
are converted to:
`theme->window[THEME_INACTIVE].border_color`
`theme->window[THEME_ACTIVE].border_color`
tokyo4j [Mon, 11 Nov 2024 22:46:08 +0000 (07:46 +0900)]
server: release all the resources on exit
Release all the resources including wlr_allocator, wlr_renderer,
wlr_backend and wlr_scene. This makes it a lot easier to detect memory
leaks with ASAN.
On wlroots side, the commit ce615a44 needs to be reverted to detect memory
leaks with EGL renderer.
enometh [Mon, 11 Nov 2024 23:33:38 +0000 (05:03 +0530)]
src/output.c: skip painting output when session is not active
On switching to a console vt when an application is painting,
labwc produces a stream of log messages of the form
```
`00:00:52.345 [ERROR] [../src/output-state.c:45] Failed to commit frame` lines.
``
This patch tries to follow the lead from the solution to this problem
in https://github.com/WayfireWM/wayfire/pull/2484.patch
As noted in that commit message, this patch depends on unreleased
patches to seatd (master) to work reliably, and there may be a a risk
of locking up the labwc if it is used with the seatd-0.8.0.
Check that the session is initialized (is not NULL) before checking it
is active.
John Lindgren [Sun, 20 Oct 2024 00:06:11 +0000 (20:06 -0400)]
output: move a few calls from new_output_notify()
... to more specific/logical locations, to make it possible in future to
*not* immediately auto-configure new outputs when connected.
In particular:
- Move regions_reconfigure_output() and session_lock_output_create()
into add_output_to_layout(), which would be called also if the output
is enabled later.
- Move seat_output_layout_changed() to do_output_layout_change() so it
is called for any layout change, not just adding new outputs.
Ricardo Steijn [Sun, 3 Nov 2024 21:05:46 +0000 (22:05 +0100)]
tearing: avoid permanent disable due to rejected commits (#2295)
Currently, the cursor plane does not allow async page flips which causes tearing page flips to be rejected if the cursor was moved.
However, in games where no cursor image is present, the async page flips can still work as expected.
Instead of permanently disabling tearing after too many failures, test the output state first before each frame to see if we can commit with tearing_page_flip set to true.