Before this commit, setting empty values in <libinput> entires and
executing Reconfigure left libinput devices with old configurations.
This commit makes sure that default values are set in libinput devices
on every Reconfigure to make rc.xml more declarative.
update_keycodes_iter() currently has 4(!) levels of nested loops, which
makes the logic (especially the break/continue statements) difficult to
understand. The logic also appears to continue looping uselessly after
a given keycode has already been added to a keybind.
Refactor by adding some small utility functions:
- keybind_contains_keycode()
- keybind_contains_keysym()
- keybind_contains_any_keysym()
No functional change intended.
...because that is more flexible and how it is in openbox.
I have had in mind that we should do this since the original
implementation, and #2994 just jogged my memory.
Sequence of events:
- menu_finish() frees the sub-menu first
- the selection.menu of the parent menu is now dangling
- menu_finish() frees the parent menu
- menu_free() calls menu_close_root() on the parent menu
- menu_close_root() tries to close the (freed) sub-menu
- boom
Extending nullify_item_pointing_to_this_menu() avoids the crash.
Allow overwriting the icon of item linking to another menu like below
(the icon for "krita" should be shown):
<openbox_menu>
<menu id="static-menu" label="Static Menu" icon="mpv" />
<menu id="root-menu" label="Root">
<menu id="static-menu" icon="krita" />
</menu>
</openbox_menu>
This commit also fixes my mistake in 17d66e5 (s/parent->icon/menu->icon/)
that showed incorrect icon in an item linking to another menu.
...and allow If Action without activator view.
For example:
<action name="If">
<prompt message="Toggle maximize?"/>
<then>
<action name="ToggleMaximize" />
</then>
</action>
Also revert the change in b9c84f9 that <else> branch is always taken when
no window is focused.
Co-Authored-by: johanmalm
Co-Authored-by: tokyo4j
Fixes up e530f43.
When IME (e.g. fcitx5) is killed, relay->input_method is destroyed and
then relay->input_method->keyboard_grab is destroyed, which causes null
pointer dereference and crashes labwc.
Possible solutions are:
- Let wlroots keep emitting keyboard grab as `data` from keyboard grab's
destroy handler just like before
- Let wlroots destroy keyboard grab before input method
- Let compositor store keyboard grab as relay->keyboard_grab
But let's just revert the change in e530f43 for now.
Currently, the dependencies between foreign-toplevel[-internal],
ext-foreign, and wlr-foreign are cyclical and a bit complex.
I suggest we reorganize it into a simpler hierarchy:
foreign-toplevel/
-> foreign.c/h
-> (depends on) ext-foreign.c/h
-> (depends on) wlr-foreign.c/h
The refactored code is smaller and (IMO) easier to follow.
In detail:
- Add include/foreign-toplevel folder mirroring src/foreign-toplevel
- Split foreign-toplevel-internal.h to ext-foreign.h and wlr-foreign.h
- Eliminate ext-/wlr-foreign.c -> foreign.c reverse dependencies
(including internal signals and foreign_request* functions)
- Make struct foreign_toplevel private to foreign.c
Lightly tested with qmpanel (which uses wlr-foreign-toplevel).
v2: reorder foreign-toplevel internal API funcs
If the handle gets destroyed from the wlroots side before the view
is destroyed, the internal signals (emitted from the view) are not
disconnected and will assert() if invoked.
If they are not empty, then we are headed for use-after-free shortly.
An assert() failure is easier to debug than UAF, so let's fail early.
Inspired by:
8f56f7ca43
It is not really useful for other output backends and just results
in no outputs being enabled at all. (This is mainly an annoyance for
developers normally running with drm but occasionally nested.)
...with the same approach as rcxml.c
- `If` actions now works for menus
- `name` argument no longer have to be the first argument of <action>
- `label` argument no longer have to be the first argument of <item>
In addition to <snapping><range>, <snapping><cornerRange> configures the
distance from the screen corner to trigger quater window snapping.
Also, new values "up-left", "up-right", "down-left" and "down-right" are
allowed for <action name="(Toggle)SnapToEdge" direction="[value]"> and
<query tiled="[value]">.
..in preparation for If/ForEach action with <prompt>, which should be
executed whether or not any window is focused.
This patch makes <If> actions execute <else> branch if no window is
focused or hovered.