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.
John Lindgren [Sun, 20 Oct 2024 00:02:08 +0000 (20:02 -0400)]
session-lock: make session_lock_output_create() safe to call twice
session_lock_output_create() can safely no-op if the lock output has
already been created for the specified output. This scenario doesn't
happen currently, and the change is in preparation for some other
output-related changes I am working on. But I think it's a nice code
improvement worth merging separately.
John Lindgren [Sun, 20 Oct 2024 06:55:12 +0000 (02:55 -0400)]
output: remove ported wlr_output functions
We have several wlr_output_* functions which are just wrappers around
corresponding wlr_output_state_* functions and don't actually touch the
wlr_output itself. These probably made some sense historically, but IMHO
they are just confusing now. So remove them and call wlr_output_state_*
directly.
Rename wlr_output_commit() (still useful) to output_state_commit().
01micko [Mon, 21 Oct 2024 01:07:01 +0000 (11:07 +1000)]
src/main.c: add environment variable LABWC_VER
src/config/session.c add env var LABWC_VER
This could be useful going forward for helper programs
such as `labwc-menu-generator` or `labwc-tweaks`
Johan Malm [Sun, 27 Oct 2024 11:54:06 +0000 (11:54 +0000)]
keyboard: broadcast modifiers
...to all clients rather than just the one with keyboard focus on keyboard
enter/create, modifer press/release and wlr_seat_set_keyboard().
This enables:
- Clients such as panels to display the current keyboard layout without
introducing new wayland protocols or other IPC.
- Unfocused xdg-shell clients to understand button press with keyboard
modifiers for example Ctrl+click.
The keymap is forwarded to all clients in wlr_seat_set_keyboard(). When a
keymap contains multiple layouts, the selection is made via modifiers,
which previously were only sent to the client with keyboard focus.
tokyo4j [Sun, 13 Oct 2024 22:55:15 +0000 (07:55 +0900)]
src/theme.c: fix misuse of wl_list_for_each
The iterator value of `wl_list_for_each` should never be referenced
outside the loop because it points to invalid memory location when the
list is empty.
tokyo4j [Mon, 7 Oct 2024 00:20:58 +0000 (09:20 +0900)]
cursor: fix button release events sometimes not being sent
When `wlr_seat_pointer_notify_button()` is called on a button press event,
that funtion must also be called on the subsequent button release event
because otherwise wlroots thinks the button is kept pressed and it
causes issues with validating DnD requests from clients, where only one
button must be pressed. This was the case when a CSD client opens a
client-menu via `show_window_menu` request after pressing its window with
the right button because we were always not notifying button release
events while a menu is open.
So let's keep track of bound (pressed but not notified) buttons and notify
button release events only when the button is not bound, like we are doing
for key-state.
tokyo4j [Tue, 8 Oct 2024 21:41:52 +0000 (06:41 +0900)]
theme: round the corner button correctly
The rounded mask buffer to be applied to the corner button buffer should
be resized and shifted when there's a vertical gap between the button
and the window border.
Johan Malm [Tue, 8 Oct 2024 16:52:57 +0000 (17:52 +0100)]
theme: add window.titlebar.padding.{width,height}
...to replace padding.{width,height} to minimize breaking changes with the
visual appearance of the titlebar.
With the diverging labwc specification for the titlebar (listed below)
we have to choose between (a) not supporting the padding.{width,height}
option which exist in many extant Openbox themes to keep titlebar height
(almost) the same; or (b) making the allocated button areas much smaller
and not keeping the default hover going all the way to the edges. All in
all it just seems a lot simpler and cleaner to break this link to the
openbox spec.
Examples of previous change driving the requirement for this change:
- SVG and PNG support which often results in large icons with hover
effects.
- Theme option window.button.{height,width}
- Larger default areas for icons (26x26)
In way of an example, Numix theme sets a padding.height of 6 which would
have resulted in a titlebar 12px taller without this change.
Johan Malm [Sun, 29 Sep 2024 17:32:51 +0000 (18:32 +0100)]
theme: change padding.height default to 0
...because now that window.button.height determines the height of button
hover effect the visible appearance of the titlebar will change unless
we reduce the padding to zero.
Backward compatibility notice: If a users theme sets padding.height to a
value greater than zero, the titlebar will be taller compared with
openbox. This can be fixed by either reducing window.button.height or
overriding padding.height
Johan Malm [Sun, 29 Sep 2024 17:22:47 +0000 (18:22 +0100)]
theme: remove titlebar.height option
This theme setting does not exist in Openbox spec and has just been an
additional 'knob' to tweak the height which is otherwise derived from the
sizes of the objects within it plus padding.
Johan Malm [Fri, 20 Sep 2024 19:59:01 +0000 (20:59 +0100)]
theme: add window.button.height
window.button.{height,width} determine the space allocated for buttons.
Buttons can be smaller than this size and will then just be center aligned
within the allocated space. However, buttons will be clamped at this size
to prevent them from going outside of the allocated space.
Which handles:
- conversion from other pixel formats to ARGB32
- setting the logical size to the desired display size
- downscaling very large images using CAIRO_FILTER_GOOD