Our codebase for ssd scenes has grown with a lot of technical debts:
- We needed to call `ssd_get_part()` everywhere to get the scene node of a
ssd part. We then needed to cast it to `wlr_scene_rect` and
`wlr_scene_buffer`. This bloated our codebase and even blocked
duplicated button types in `<titlebar><layout>`.
- `ssd_get_part_type()` was a dirty hack. It compared parent, grandparent
and grandgrandparent of a node with each subtree in the ssd to get the
part type of the node.
To resolve this issues, this commit changes how ssd scenes are managed:
- Access scene rects and scene buffers just as a member of `struct ssd`.
- `ssd_part` is now a attachment to a scene node that can be accessed via
node_descriptor->data, with a new node-descriptor type
`LAB_NODE_DESC_SSD_PART`. `LAB_NODE_DESC_SSD_BUTTON` is unified into it.
Now the scene graph under ssd->tree looks like below. The parentheses
indicate the type of ssd_part attached to the node:
ssd->tree (LAB_SSD_NONE)
+--titlebar (LAB_SSD_PART_TITLEBAR)
| +--inactive
| | +--background bar
| | +--left corner
| | +--right corner
| | +--title (LAB_SSD_PART_TITLE)
| | +--iconify button (LAB_SSD_BUTTON_ICONIFY)
| | | +--normal close icon image
| | | +--hovered close icon image
| | | +--...
| | +--window icon (LAB_SSD_BUTTON_WINDOW_ICON)
| | | +--window icon image
| | +--...
| +--active
| +--...
+--border
| +--inactive
| | +--top
| | +--...
| +--active
| +--top
| +--...
+--shadow
| +--inactive
| | +--top
| | +--...
| +--active
| +--top
| +--...
+--extents
+--top
+--...
When hovering on SSD, `get_cursor_context()` traverses this scene node
from the leaf. If it finds a `ssd_part` attached to the node, it returns
`ssd_part_type` that represents the resizing direction, button types or
`Title`/`Titlebar`.
I needed to debug an input configuration issue and found the debug
output not-super-helpful, so I made some improvements:
- Print the name and "sysname" (e.g. event11) of the device being
configured. Note that the name alone isn't enough since there can
be multiple identically-named devices.
- Print the config category matched for each device.
- Print the config values (if any) being applied. For enums, only the
numeric value is printed since I'm lazy.
- Don't print "pointer acceleration configured" if neither a pointer
speed nor acceleration profile is configured (it's confusing).
- add LAB_WINDOW_TYPE_INVALID in place of literal -1
- document more clearly that enum lab_view_criteria is a bitset
- other one-off replacements of integer values/types for consistency
Note: variables of type enum lab_view_criteria are already used
extensively throughout the code to contain combinations of the declared
enum values. I am not introducing any new usage here, just changing the
single uint32_t to be consistent with all the other usages.
I like the new common/edge.h. I don't like how inconsistently we use it.
Current situation:
- enum wlr_edges and wlr_direction are designed to be used as bitset,
and are defined compatibly
- enum lab_edge is *also* designed to be used as bitset, but
incompatible with the others (LEFT/RIGHT come before UP/DOWN)
- we use an inconsistent mix of all three *AND* uint32_t (usually with
the WLR_EDGE constants rather than the LAB_EDGE constants), and
convert between them on an ad-hoc basis, sometimes implicitly
Let's clean this up:
- reorder enum lab_edge to be compatible with the two wlr enums
(check this by static_assert)
- use TOP/BOTTOM naming rather than UP/DOWN (matches wlr_edges)
- add constants for the remaining possible combinations of the 4 edges
- use lab_edge for all internal edge/direction fields, consistently
- add lab_edge_is_cardinal() as a sanity check before casting to
enum wlr_direction, and then eliminate all of direction.c/h
Instead of "enum wlr_edges direction", we now have
"enum lab_edge direction" which is not that much better. At least we
are now clear that we're overloading one enum with two meanings.
Adds an option "toogle" to GoToDesktop.
In case the target is already where we are, we go back to the last desktop
instead.
Example of rc.xml
<keybind key="C-F1">
<action name="GoToDesktop">
<to>1</to>
<toggle>yes</toggle>
</action>
</keybind>
In 943f5751, I initialized heap-allocated `view_query` used for
`If` actions with `decoration=LAB_SSD_MODE_INVALID`, but I forgot to do
that for stack-allocated `view_query` used for window rules.
When implementing single-axis maximize some time ago, I made the
simplifying assumption that a view couldn't be resized while maximized
(even in only one axis). And indeed for compositor-initiated resize,
we always unmaximize the view first.
However, I didn't account for the client resizing the non-maximized
axis, which we can't (and shouldn't) prevent. When this happens, we
should also update the natural geometry of that single axis so that we
don't undo the resize when un-maximizing.
P.S. xdg-shell clients resizing the *maximized* axis is still an
unsolved problem, exacerbated by the fact that xdg-shell protocol
doesn't allow clients to even know about single-axis maximize.
P.P.S. the view_invalidate_last_layout_geometry() logic may need
similar updates, I'm not sure.
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.
Based on swaynag (https://github.com/swaywm/sway/tree/master/swaynag)
Copied at commit:
03483ff370
Contains the following modifiations:
- Some functional changes including:
- Disable exclusive-zone by default (Written-by: @Consolatis) and add
command line option -x|--exclusive-zone
- Add close timeout (Written-by: @Consolatis) and -t|--timeout option
- Use index of button (from right-to-left) for exit code
- Disable reading from config file and remove associated --type option
- Refactoring including:
- Use wlr_log() instead of the log.{c,h} functions
- Use wl_list instead of sway's list.c implementation
- In the pango wrapper functions, use glib's g_strdup_vprintf() rather
than the original stringop.c functions
- Align with labwc coding style to pass checkpatch.pl
- Re-licenced from MIT to GPL-2.0, and add Copyright notices for original
authors
v2
- Remove option -s|--dismiss-button and the default "X" button. To get
such a button, "-Z X :"
- Remove options -b and -z because there is no requirement to run
in a terminal.
- Remove *-no-terminal from options --button and --button-dismiss because
commands are now always run directly without a terminal.
v3
- Allow -B/-Z options without action-argument
- Invert button order of -B/-Z so that `labnag -m foo -Z x -Z y -Z z`
results in three buttons with "x" furthest to the left, and "z" on the
right (rather than the other way around).
- Use signalfd() to prevent race conditions on SIGTERM
v4
- Limit number of stdin lines to 200 to avoid hogging CPU
Co-Authored-by: tokyo4j
...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.