Consolatis [Fri, 6 Jan 2023 18:54:51 +0000 (19:54 +0100)]
output: Use better arg naming for output_update_all_usable_areas()
This restores the original approach of naming the argument `layout_changed`
which fits much better than `enforce_view_arrange`. Especially when extending
the function to also handle region updates once merged.
Move the desktop_arrange_all_views() call outside layers_arrange() into
a new function, output_update_usable_area(). The new function currently
does exactly what layers_arrange() used to, but will be expanded in a
later commit.
Add output_update_all_usable_areas(), which is the same as calling
output_update_usable_area() for each output, but only calls
desktop_arrange_all_views() once.
Johan Malm [Mon, 5 Dec 2022 21:46:16 +0000 (21:46 +0000)]
theme: support theme setting override
...by reading <config-dir>/themerc-override where <config-dir> is normally
$HOME/.config/labwc can be other locations as described in labwc-config(5)
and can also be specified by the command line option -C.
The reason for supporting theme override is to give users more fine-
grained control of settings without making local copies and modifying
themes.
Consolatis [Mon, 2 Jan 2023 21:40:17 +0000 (22:40 +0100)]
src/debug.c: reset last_view
Before this patch following would cause a use-after-free:
- calling the Debug action when there was at least one view around
- closing that view
- calling the Debug action again
01micko [Mon, 2 Jan 2023 02:20:36 +0000 (12:20 +1000)]
nls: updates for new strings in menus
- also fixes updating tr.po file
- more descriptive instructions in CONTRIBUTING.md
- fix comments in po/pot files when using meson gettext tools
Consolatis [Sat, 31 Dec 2022 20:20:50 +0000 (21:20 +0100)]
src/view.c: on un-fullscreen restore SSD before applying previous geometry
Before this patch following would cause the SSD to be rendered offscreen:
- snap a window to left or right edge
- toggle fullscreen to fullscreen
- toggle fullscreen to un-fullscreen
To fix that restore the SSD before calculating the new geometry.
Consolatis [Fri, 23 Dec 2022 21:59:27 +0000 (22:59 +0100)]
ssd: scale down button icons if necessary
This allows using large XBM button icons (larger than
the button width / height) for high and mixed DPI usecases.
Instead of scaling up the low pixel icons when moving a window to a
high DPI output we scale the icons down when moving to a non-scaled
output. The user is still responsible to create / use larger XBM
icons for their theme.
Johan Malm [Thu, 22 Dec 2022 21:58:55 +0000 (21:58 +0000)]
layer: use scene-graph API more fully
...and thus simplify the usage of wlr_scene_node_at(). Specifically:
- desktop.c: in get_cursor_context() use node-description for
layer-surfaces and layer-popups. This lays the foundations for a
pointer-enter-event being sent when a new layer-surfaces appears under
the pointer (even if the pointer doesn not move).
- layers.c:
* Iterate over `struct wlr_scene_tree *layer_tree[]` rather than
`struct wl_list layers[]` when arranging layers to avoid surfaces
being out of sync with nodes
* Set signal handlers after scene node creation to avoid configure
race conditions
* Handle scene-node destroy event rather than event of
`struct wlr_layer_surface_v1`
John Lindgren [Thu, 22 Dec 2022 21:44:08 +0000 (16:44 -0500)]
rcxml: Make sure a default libinput category always exists
Previously, if rc.xml defined only non-default libinput categories,
no default category was created. This meant that configure_libinput()
might totally skip configuring some devices even with default
settings, like tap-to-click.
Fix this by making sure that a default category is always created.
bi4k8 [Sat, 17 Dec 2022 20:47:46 +0000 (20:47 +0000)]
don't set view->w and view->h when mapping xdg views
these should only be set on commit. doing so before then confuses
code that expects these fields to be in sync with the scene tree,
such as `handle_commit`.
these were only being set so that `view_center` could read them to
compute a centered position, so instead we can simply forward the
values directly to `view_compute_centered_position` and `view_move`.
bi4k8 [Thu, 8 Dec 2022 05:28:16 +0000 (05:28 +0000)]
don't NULL-check output when it can't be
`output` here is the `pos` argument of `wl_list_for_each`, which means
it is always assigned a return value of `wl_container_of`; this in
turn means that it is never NULL.
checking against NULL here just confuses static analysis and readers
bi4k8 [Thu, 8 Dec 2022 05:27:25 +0000 (05:27 +0000)]
fix cleanup issues in xdg_surface_new
`view->surface` had not been set to a non-`NULL` value here, so it
was not yet appropriate to access its `resource` member. instead,
use the resource from the argument xdg_surface.
furthermore, we need to free the newly-allocated `xdg_toplevel_view`
before error return.
John Lindgren [Sat, 26 Nov 2022 21:46:28 +0000 (16:46 -0500)]
ssd: Allocate `struct ssd` and `struct ssd_hover_state` separately
- Store a pointer to the `struct view` in `struct ssd`
- Pass `struct ssd *` instead of `struct view *` to ssd functions
- Add `ssd_get_margin()` convenience function
John Lindgren [Sun, 27 Nov 2022 03:49:10 +0000 (22:49 -0500)]
view: Fix SSD margin computation
If `view->ssd_enabled` is false when calling `ssd_create()` then
`ssd_thickness()` returns zeroes which are stored in `ssd->margins`.
The quick fix is just to ensure we set `view->ssd_enabled` before
calling `ssd_create()`. At some point, it might be nice to refactor
so that `ssd_create()` does not reference `view->ssd_enabled`.
John Lindgren [Sat, 26 Nov 2022 21:06:22 +0000 (16:06 -0500)]
ssd: Cosmetic cleanups
- Minimize includes in `ssd.h`
- Avoid repetitive `view->ssd.margin` pattern
- Use `struct ssd *` or `const struct ssd *` rather than `struct view *`
where convenient
Part of the motivation is to make it easier to separate `struct ssd`
from `struct view` in a future commit.
John Lindgren [Sat, 26 Nov 2022 07:23:15 +0000 (02:23 -0500)]
ssd: Add missing state updates
- Update `ssd.state` in `ssd_create()` to avoid doing unnecessary work in
the next call to `ssd_update_geometry()`
- Reset `ssd.margin` in `ssd_destroy()` to avoid accidentally using stale
values
John Lindgren [Sat, 26 Nov 2022 07:17:04 +0000 (02:17 -0500)]
ssd: Simplify ssd_create()
- Add `active` argument for consistency with `ssd_set_active()`
- `assert()` that `ssd_create()` is not called twice without an
`ssd_destroy()` in between
John Lindgren [Sat, 26 Nov 2022 07:00:38 +0000 (02:00 -0500)]
view: Enable/disable decorations explicitly
`view_set_decorations()` now calls `ssd_create()` and `ssd_destroy()`
explicitly to enable/disable decorations. As a result, the implicit
enable/disable logic in `ssd_update_geometry()` is no longer needed.