]> git.mdlowis.com Git - proto/labwc.git/log
proto/labwc.git
2 years agoxwayland: update stacking order in move_to_front/back()
John Lindgren [Sat, 21 Oct 2023 05:29:19 +0000 (01:29 -0400)]
xwayland: update stacking order in move_to_front/back()

Currently xwayland views are restacked on top of the XWayland server
stacking order when activated (i.e. focused). This is wrong because
focus/raise are independent concepts (though often occurring together).
The stacking order should be updated when the view is raised/lowered,
not when the view is focused.

Work is in progress elsewhere (draft PR) that will result in views more
often being raised without being focused. Without this fix, those views
don't get restacked properly, resulting in clicks "passing through" to
views underneath.

2 years agoregions: perform rounding more carefully
John Lindgren [Sat, 21 Oct 2023 18:02:21 +0000 (14:02 -0400)]
regions: perform rounding more carefully

Add percentages (x + width, y + height) before scaling so that there is
no gap between regions due to rounding variations

2 years agoview: commonize sub-view logic in view_move_to_front/back()
John Lindgren [Sat, 21 Oct 2023 01:34:29 +0000 (21:34 -0400)]
view: commonize sub-view logic in view_move_to_front/back()

The logic was the same for xdg-shell and xwayland views, so move it from
the view->impl layer out to the view_move_to_front/back() functions.

view->impl->move_to_front/back() still exist for now, in case we want to
add xdg/xwayland-specific logic in future, but they now move only one
view and not sub-views.

2 years agocommon: move MIN and MAX to common/macros.h
John Lindgren [Sat, 21 Oct 2023 00:24:29 +0000 (20:24 -0400)]
common: move MIN and MAX to common/macros.h

2 years agocommon: add and use CONNECT_SIGNAL macro
John Lindgren [Mon, 16 Oct 2023 06:01:35 +0000 (02:01 -0400)]
common: add and use CONNECT_SIGNAL macro

This makes the code a bit more readable IMHO (and forces us to be
consistent with event handler function names).

Adjust scripts/checkpatch.pl to not complain.

2 years agocommon: rename array-size.h to macros.h
John Lindgren [Fri, 20 Oct 2023 22:34:14 +0000 (18:34 -0400)]
common: rename array-size.h to macros.h

2 years agoxdg: add xdg_shell_init()
Johan Malm [Fri, 20 Oct 2023 21:04:08 +0000 (22:04 +0100)]
xdg: add xdg_shell_init()

...to have the event-handler functions in the same translation unit as
the signal connector.

No functional change intended.

2 years agoscaled_scene_buffer: make dropping the buffer optional
Consolatis [Sat, 14 Oct 2023 20:26:40 +0000 (22:26 +0200)]
scaled_scene_buffer: make dropping the buffer optional

In preparation to also use the scaled_scene_buffer for
theme components like rounded corner images and button
icons.

No functional change intended.

2 years agodocs/labwc-config.5.scd: describe <snapping> section
Johan Malm [Sat, 9 Jul 2022 08:56:20 +0000 (09:56 +0100)]
docs/labwc-config.5.scd: describe <snapping> section

2 years agodoc: Add GrowToEdge, ShrinkToEdge actions
Axel Burri [Sat, 5 Aug 2023 21:58:40 +0000 (23:58 +0200)]
doc: Add GrowToEdge, ShrinkToEdge actions

2 years agoGrowToEdge, ShrinkToEdge: Implement actions
Axel Burri [Sat, 5 Aug 2023 21:58:40 +0000 (23:58 +0200)]
GrowToEdge, ShrinkToEdge: Implement actions

2 years agodoc: Adapt MoveToEdge action
Axel Burri [Sat, 5 Aug 2023 21:58:40 +0000 (23:58 +0200)]
doc: Adapt MoveToEdge action

2 years agoMoveToEdge: Snap to window edge
Axel Burri [Sat, 5 Aug 2023 21:58:40 +0000 (23:58 +0200)]
MoveToEdge: Snap to window edge

Add configurable option (enabled by default) to snap to next window
edge instead of screen edge.

2 years agoAdd snap to window edge framework
Axel Burri [Sat, 5 Aug 2023 21:53:01 +0000 (23:53 +0200)]
Add snap to window edge framework

Adds functions for calculation of distances between window edges, as
well as for window growing and shrinking.

All calculations are based on the "pending" geometry.

Ignored from snapping:

 - views that do not share the same output
 - minimized views
 - maximized views
 - views that are neither:
   - part of the current workspace
   - part of the always-on-top tree

2 years agoMove min/max view width/height to header
Axel Burri [Sat, 5 Aug 2023 21:53:01 +0000 (23:53 +0200)]
Move min/max view width/height to header

Preparatory for snap to window edge framework.

2 years agoUse output_usable_area_scaled() helper
Axel Burri [Sat, 5 Aug 2023 21:53:01 +0000 (23:53 +0200)]
Use output_usable_area_scaled() helper

2 years agoAdd output_usable_area_scaled() helper
Axel Burri [Sat, 5 Aug 2023 21:53:01 +0000 (23:53 +0200)]
Add output_usable_area_scaled() helper

Preparatory for snap to window edge framework.

2 years agodocs/environment: comment out variables
Johan Malm [Tue, 17 Oct 2023 20:12:53 +0000 (21:12 +0100)]
docs/environment: comment out variables

...to avoid users copying this file to ~/.config/labwc/ without editing
it and ending up with Swedish keyboard layout, etc.

Fixes: #1011
2 years agosrc/config/session.c: set _JAVA_AWT_WM_NONREPARENTING=1
Johan Malm [Wed, 18 Oct 2023 20:46:55 +0000 (21:46 +0100)]
src/config/session.c: set _JAVA_AWT_WM_NONREPARENTING=1

2 years agoxwayland: center stored natural geometry for initially maximized views
John Lindgren [Wed, 18 Oct 2023 03:06:12 +0000 (23:06 -0400)]
xwayland: center stored natural geometry for initially maximized views

For views that are initially maximized or fullscreen and have no
explicitly specified position, we need to center the stored natural
geometry, or the view may end up partially offscreen once unmaximized/
unfullscreened.

2 years agoxwayland: honor initially maximized requests via _NET_WM_STATE
John Lindgren [Wed, 18 Oct 2023 02:40:57 +0000 (22:40 -0400)]
xwayland: honor initially maximized requests via _NET_WM_STATE

X11 clients may request to be initially fullscreen or maximized by
setting hints in the _NET_WM_STATE property. For some reason, we are
currently only honoring fullscreen requests but not maximize.

The fixes issues with GTK apps (notably Firefox, but others as well)
not starting maximized.

There is a remaining issue that the window position may not be set
correctly after unmaximizing. This will be fixed in a follow-up commit.

2 years agoxdg,xwayland: raise sub-view correctly relative to other sub-views
John Lindgren [Tue, 17 Oct 2023 05:28:36 +0000 (01:28 -0400)]
xdg,xwayland: raise sub-view correctly relative to other sub-views

When a parent view has multiple sub-views (dialogs) visible, focusing
one sub-view ought to raise it above the others. This doesn't currently
happen -- focusing a sub-view raises the whole group of views together,
but has no effect on the relative stacking order between them.

This seems like a simple oversight in xdg/xwayland_view_move_to_front()
that's pretty easy to fix.

Add FIXMEs to deduplicate this logic in future.

Tested with HomeBank: the Import dialog pops up an additional Open File
dialog, which before this change appears behind the Import dialog (and
clicking on it does not raise it to the front). After this change, the
Open File dialog appears in front as expected.

2 years agoxwayland: assume views wanting decorations also want focus
John Lindgren [Mon, 16 Oct 2023 01:33:18 +0000 (21:33 -0400)]
xwayland: assume views wanting decorations also want focus

Assume that Globally Active xwayland views do want focus if they want
window decorations (according to _MOTIF_WM_HINTS). This is a stop-gap
fix to ensure that various applications (mainly Java-based ones such as
IntelliJ IDEA) get focus normally and appear in the window switcher. It
would be better to match based on _NET_WM_WINDOW_TYPE instead, but that
property isn't currently available through wlroots API.

Fixes (partially): 7e72bf975fb65c8290b398d21b2ad9d87a22880f
("view/xwayland: avoid focusing views that don't want focus")

2 years agolayers: remove redundant function argument
Johan Malm [Mon, 16 Oct 2023 20:27:12 +0000 (21:27 +0100)]
layers: remove redundant function argument

2 years agodesktop: allow re-focus between "globally active" views of the same PID
John Lindgren [Sat, 14 Oct 2023 20:29:13 +0000 (16:29 -0400)]
desktop: allow re-focus between "globally active" views of the same PID

Commit 7e72bf975fb6 changed behavior to not automatically focus xwayland
views using the "Globally Active" input model (WM_HINTS.inputs = false
but WM_TAKE_FOCUS listed in WM_PROTOCOLS).

One undesired side effect of this change is that when a dialog is
closed, the parent window is not re-focused if "Globally Active". This
issue is seen for example with JDownloader. It can be solved taking a
similar approach to what is done for unmanaged xwayland views: allow
automatic re-focus between views sharing the same PID.

Note that it's difficult to completely solve all of the focus issues
with Globally Active views without proper WM_TAKE_FOCUS support.
Implementing proper support is difficult since it requires wlroots
changes and would also mean waiting for a message round-trip in
desktop_focus_topmost_view().

Fixes (partially): 7e72bf975fb65c8290b398d21b2ad9d87a22880f
("view/xwayland: avoid focusing views that don't want focus")

2 years agoview: add view_wants_focus enum (NEVER/ALWAYS/OFFER) and function
John Lindgren [Sun, 15 Oct 2023 05:11:12 +0000 (01:11 -0400)]
view: add view_wants_focus enum (NEVER/ALWAYS/OFFER) and function

This allows identifying XWayland views using the ICCCM "Globally Active"
input model. Later commits will improve handling of these views.

No functional change in this commit.

2 years agoseat: move session-lock check down to seat_focus() level
John Lindgren [Sun, 15 Oct 2023 06:59:58 +0000 (02:59 -0400)]
seat: move session-lock check down to seat_focus() level

We were checking for a locked session in desktop_focus_view(), but there
are several other call sites of seat_focus_surface() which were missing
such a check. Any one of those could cause the lock screen to lose focus
(making the session impossible to unlock) or another surface to gain it
(breaching the session lock).

To fix the issue, make any call to seat_focus_surface() no-op when the
session is locked. Add a specific seat_focus_lock_surface() function
which is the only way to bypass the check and is called only from
session-lock.c.

2 years agoview: only focus topmost view if unmapped view was focused
John Lindgren [Sun, 15 Oct 2023 02:29:24 +0000 (22:29 -0400)]
view: only focus topmost view if unmapped view was focused

The unmap() handlers should only call desktop_focus_topmost_view() if
the unmapped view was the focused view. Unmapping a view that was not
focused should not change the focus.

I expect this rarely had any effect in practice; it would only matter in
a focus-follows-mouse config where some view other than the one on top
was focused. But it still seems better to fix.

Rather than repeating the logic in two places, create a small
view_impl_unmap() helper. Perhaps more common "unmap" logic could be
moved there in future.

2 years agoAdd MoveToCursor action
Arnaudv6 [Sat, 14 Oct 2023 12:57:44 +0000 (14:57 +0200)]
Add MoveToCursor action

2 years agoview: add view_is_related()
John Lindgren [Sun, 15 Oct 2023 04:15:16 +0000 (00:15 -0400)]
view: add view_is_related()

Allows removing xwayland-specific stuff from seat.c.

Based on a suggestion from @Consolatis.

v2: add comments

2 years agoCI: limit workflow runs to 20 minutes
Consolatis [Sun, 15 Oct 2023 14:37:10 +0000 (16:37 +0200)]
CI: limit workflow runs to 20 minutes

This prevents the FreeBSD runner to run for 6 hours in a bootloop.

2 years agodesktop.c: prevent switching workspaces for always-on-bottom windows
Consolatis [Sat, 14 Oct 2023 21:42:56 +0000 (23:42 +0200)]
desktop.c: prevent switching workspaces for always-on-bottom windows

Fixes: #1170
Reported-by: @stefonarch
Reported-by: @tsujan
2 years agocursor: backport null check from wlroots-0.17 branch
John Lindgren [Sat, 14 Oct 2023 17:56:03 +0000 (13:56 -0400)]
cursor: backport null check from wlroots-0.17 branch

Check that wlr_layer_surface_v1_from_wlr_surface() doesn't return NULL.
This may be unnecessary with wlroots 0.16 (not sure) but doesn't hurt
and reduces the delta to the wlroots-0.17 branch.

2 years agoseat: ignore focus change to unmanaged surface belonging to same PID
John Lindgren [Sat, 14 Oct 2023 16:41:31 +0000 (12:41 -0400)]
seat: ignore focus change to unmanaged surface belonging to same PID

If an xwayland-unmanaged surface was focused belonging to the same
application as the focused view, allow the view to remain active. This
fixes an issue with menus immediately closing in some X11 apps (try
LibreOffice with SAL_USE_VCLPLUGIN=gen).

Fixes: 4028a9482f9399e3c3587f5c6eca6c0b128c9afc
("seat: use focus_change event to update focused/active view")

2 years agooutput: fix invisible cursor after wlopm --off && wlopm --on
John Lindgren [Wed, 11 Oct 2023 04:08:52 +0000 (00:08 -0400)]
output: fix invisible cursor after wlopm --off && wlopm --on

Use the same fix/workaround as in output_update_for_layout_change() to
make sure that the cursor is also visible after (re-)enabling an output
in handle_output_power_manager_set_mode().

2 years agokeyboard: add missing Hyper_ and Meta_ syms to modifier detection
Consolatis [Tue, 10 Oct 2023 17:07:58 +0000 (19:07 +0200)]
keyboard: add missing Hyper_ and Meta_ syms to modifier detection

This was forgotten in 65bd32d62500389a1d6affafac6d1989ba28042f
Reported-by: @jonhiggs (thanks)
Also stop treating the synthetic layout change sym as modifier
but still prevent it from being added to the set of pressed keys.

Additionally slightly reformat the code.

2 years agomenu: use wl_list instead of array
Johan Malm [Mon, 9 Oct 2023 19:59:04 +0000 (20:59 +0100)]
menu: use wl_list instead of array

...to make it easier to split menu.c into smaller chunks without
exposing nr_menus variable.

2 years agomenu: minor coding style tweaks
Johan Malm [Mon, 9 Oct 2023 19:46:23 +0000 (20:46 +0100)]
menu: minor coding style tweaks

2 years agomenu: split parse_xml() in readiness for pipemenus
Johan Malm [Mon, 9 Oct 2023 19:43:43 +0000 (20:43 +0100)]
menu: split parse_xml() in readiness for pipemenus

2 years agokeyboard: add option to enable Num Lock automatically (default=enabled)
John Lindgren [Mon, 9 Oct 2023 02:26:26 +0000 (22:26 -0400)]
keyboard: add option to enable Num Lock automatically (default=enabled)

Co-authored-by: @Consolatis
2 years agoview: fix some inconsistencies in view_ functions
John Lindgren [Tue, 26 Sep 2023 02:42:06 +0000 (22:42 -0400)]
view: fix some inconsistencies in view_ functions

... especially regarding whether a (view *) parameter may be NULL. It's
confusing when some functions accept NULL and others don't, and could
trip someone up.

I'm partly to blame for the inconsistency, since (if memory serves) I
added view_is_tiled() and view_is_floating(), which do accept NULL.

In detail:

- Make view_is_tiled() and view_is_floating() no longer accept NULL.

- Rename view_isfocusable -> view_is_focusable for consistency with
  other view_is_ functions.

- Eliminate view_inhibits_keybinds() as it only existed to safely accept
  NULL and check a single flag, which can be checked directly.

- Add assert(view) to remaining public view_ functions to catch
  accidentally passing NULL.

- Inline inhibit_keybinds() into view_toggle_keybinds(). It is closely
  related and not called from anywhere else; inlining it allows
  eliminating an extra assert() which is now impossible.

2 years agodocs: update supported keybind and mousebind modifiers
Consolatis [Mon, 9 Oct 2023 05:11:34 +0000 (07:11 +0200)]
docs: update supported keybind and mousebind modifiers

2 years agokeyboard: prevent storing synthetic layout change key event
Consolatis [Sun, 8 Oct 2023 17:26:16 +0000 (19:26 +0200)]
keyboard: prevent storing synthetic layout change key event

Before this patch, we were storing the key in our pressed set
and didn't remove it which in turn caused all further keybinds
to fail. The behavior was dependent on the exact flow of press
and release events and was most obvious when using
XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle

We now simply treat it as a modifier and thus do not store it
in the pressed set.

Fixes: #1129
2 years agokeybinds: add support for Meta and Hyper modifiers
Consolatis [Sun, 8 Oct 2023 17:24:35 +0000 (19:24 +0200)]
keybinds: add support for Meta and Hyper modifiers

The modifiers can be used in keybinds via M-key and H-key

Additionally adds support for:
- Mod1 (same as A)
- Mod3 (same as H)
- Mod4 (same as W)
- Mod5 (same as M)

This is compatible with the format used by Openbox.
(http://openbox.org/wiki/Help:Bindings#Syntax)

Mod2 (NumLock) and Caps are still not supported due to
their locking behavior but could theoretically be added.

Fixes: #1061
2 years agoRefactor title height to use 'titlebar.height' from themerc
Moises Lima [Mon, 2 Oct 2023 15:44:30 +0000 (12:44 -0300)]
Refactor title height to use 'titlebar.height' from themerc

2 years agokeyboard: allow switching VT when locked
John Lindgren [Wed, 4 Oct 2023 22:43:11 +0000 (18:43 -0400)]
keyboard: allow switching VT when locked

2 years agosession-lock: reconfigure for output layout changes
John Lindgren [Thu, 5 Oct 2023 03:54:27 +0000 (23:54 -0400)]
session-lock: reconfigure for output layout changes

Currently, if the output layout changes while the session is locked,
the lock surfaces may end up wrongly positioned, which looks bad and
may reveal some of the user's workspace underneath.

To prevent this, re-align the scene trees and reconfigure the lock
surfaces when the output layout changes.

2 years agodesktop: add commentary clarifying focus rules
John Lindgren [Tue, 3 Oct 2023 02:37:12 +0000 (22:37 -0400)]
desktop: add commentary clarifying focus rules

2 years agoRevert "desktop: try harder to avoid focusing unfocusable views"
John Lindgren [Tue, 3 Oct 2023 02:12:22 +0000 (22:12 -0400)]
Revert "desktop: try harder to avoid focusing unfocusable views"

Some X11 applications (MATLAB is known to be one) apparently still use
the outdated "globally active" input focus model, in which they declare
they don't want the window manager to give them input focus, but expect
to be able to take it explicitly themselves via XSetInputFocus().

Such applications are not a good fit for the Wayland world, and may have
issues even with remotely modern X11 window managers that prevent such
"focus stealing". Labwc certainly doesn't (and won't) allow it. However,
to avoid breaking such applications entirely, let's still allow the user
to give focus by clicking in the window.

For the sake of applications that legitimately don't want to be given
input focus (such as taskbars or other "panels"), we still don't give
focus to them automatically when another view is closed, and they aren't
shown in Alt-Tab.

This reverts commit cae96b0cce441dd9f1981c312ae0108b3b4e42c9.

2 years agos/::/./
Johan Malm [Mon, 2 Oct 2023 18:47:59 +0000 (19:47 +0100)]
s/::/./

2 years agocursor: fix layer subsurface focus bug
Johan Malm [Mon, 2 Oct 2023 21:04:40 +0000 (22:04 +0100)]
cursor: fix layer subsurface focus bug

...by simply not focusing layer-shell subsurfaces on button press.

This is a temporary patch to fix a regression.

Fixes: issue #1131
2 years agocommon: use fnmatch() for pattern matching
Consus [Sun, 1 Oct 2023 11:39:47 +0000 (14:39 +0300)]
common: use fnmatch() for pattern matching

Drop-in POSIX-compliant function that has a nice glob(7) manual page for
reference.

2 years agoworkspaces: allow referencing the current workspace
Consus [Tue, 29 Aug 2023 10:12:09 +0000 (13:12 +0300)]
workspaces: allow referencing the current workspace

This value allows a user to reference the currently visible workspace.

2 years agoaction: add If and ForEach actions
Consus [Mon, 28 Aug 2023 16:14:04 +0000 (19:14 +0300)]
action: add If and ForEach actions

Add If and ForEach actions as described in OpenBox specification.

Limitations:

- If and ForEach cannot contain nested If and ForEach.

2 years agoUnbreak match_glob
Consus [Mon, 28 Aug 2023 15:56:39 +0000 (18:56 +0300)]
Unbreak match_glob

Since bool is not a C89 type, include <stdbool.h> in match.h.

2 years agoview: introduce view_matches_query()
Consus [Mon, 28 Aug 2023 15:55:29 +0000 (18:55 +0300)]
view: introduce view_matches_query()

Add new function view_matches_query() that will be required by If and
ForEach actions in the future.

2 years agoaction: Simplify the code
Consus [Mon, 28 Aug 2023 15:29:20 +0000 (18:29 +0300)]
action: Simplify the code

Replace action_str_from_arg() and action_get_first_arg() with
action_get_str().

Two reasons:

- This optimization reduces neither LOC nor amount of work done during
  the arguments processing, but requires two additional functions.

- Logging only the first argument of an action creates an illusion that
  only one argument was given. Instead of confusing the user just log
  the fact that the action is being handled.

2 years agoaction: Reduce code duplication
Consus [Mon, 28 Aug 2023 15:21:49 +0000 (18:21 +0300)]
action: Reduce code duplication

Introduce function action_get_arg() and a set of thin wrappers around
it. This function is responsible for finding the argument and checking
it's type, while the wrappers only to do the necessary type casting.

2 years agoREADME.md: update section 1.4 too
Johan Malm [Sun, 1 Oct 2023 06:58:57 +0000 (07:58 +0100)]
README.md: update section 1.4 too

2 years agoREADME.md: tone down no-frills statement
Johan Malm [Sat, 30 Sep 2023 08:10:56 +0000 (09:10 +0100)]
README.md: tone down no-frills statement

Features such as icons, gradients and drop-shadows were declined in the
early phases of the project to focus on designing the fundamental building
blocks well without pressure to implement additional features which may
have compromised good design decisions.

As a core team we are not against these features per se other than when
they sacrifice the ability to run well on low spec hardware, or
disproportionately increase code complexity and long term maintenance
burden.

2 years agoREADME.md: describe --wrap-mode=nodownload
Johan Malm [Sat, 30 Sep 2023 07:57:36 +0000 (08:57 +0100)]
README.md: describe --wrap-mode=nodownload

Fixes: issue #1063
2 years agoREADME.md: specify librsvg version and that it is optional
Johan Malm [Sat, 30 Sep 2023 07:57:03 +0000 (08:57 +0100)]
README.md: specify librsvg version and that it is optional

2 years agoxwayland: do not set xsurface->data for unmanaged surface
John Lindgren [Sat, 30 Sep 2023 05:31:37 +0000 (01:31 -0400)]
xwayland: do not set xsurface->data for unmanaged surface

xsurface->data is presumed to be a (struct view *) if set, so it must be
left NULL for an unmanaged surface. Otherwise view_from_wlr_surface()
may return a (struct xwayland_unmanaged *) where a (struct view *) was
expected, leading to a crash.

valgrind backtrace:

    Invalid read of size 1
      at 0x48F8FFC: wlr_scene_node_set_enabled (wlr_scene.c:903)
      by 0x124C9F: ssd_set_active (ssd.c:323)
      by 0x124C9F: ssd_set_active (ssd.c:318)
      by 0x124C9F: view_set_activated (view.c:215)
      by 0x118851: focus_change_notify (seat.c:353)
      by 0x487E01D: wl_signal_emit_mutable (wayland-server.c:2241)
      by 0x48FC8F2: wlr_seat_keyboard_enter (wlr_seat_keyboard.c:298)
      by 0x119E60: seat_focus.lto_priv.0 (seat.c:473)
      by 0x1248FD: seat_focus_surface (seat.c:491)
      by 0x1248FD: unmanaged_handle_map (xwayland-unmanaged.c:51)
      by 0x487E01D: wl_signal_emit_mutable (wayland-server.c:2241)
      by 0x487E01D: wl_signal_emit_mutable (wayland-server.c:2241)
      by 0x490FC91: surface_commit_state (wlr_compositor.c:499)
      by 0x56A24F5: ffi_call_unix64 (unix64.S:104)
      by 0x569EF5D: ffi_call_int.lto_priv.0 (ffi64.c:673)
    Address 0xa0e15ff30788b68 is not stack'd, malloc'd or (recently) free'd

Fixes: 4028a9482f9399e3c3587f5c6eca6c0b128c9afc
("seat: use focus_change event to update focused/active view")

2 years agokey-state: rename function for consistency
Johan Malm [Sat, 30 Sep 2023 08:19:59 +0000 (09:19 +0100)]
key-state: rename function for consistency

...with the equivalent function that returns the number of pressed keys.

s/key_state_nr_keys/key_state_nr_bound_keys/

2 years agoFix typo in output.c
Ikko Eltociear Ashimine [Sat, 30 Sep 2023 07:53:10 +0000 (16:53 +0900)]
Fix typo in output.c

specifc -> specific

2 years agoxwayland: add explanatory comment on WM_HINTS.input
John Lindgren [Wed, 27 Sep 2023 23:19:58 +0000 (19:19 -0400)]
xwayland: add explanatory comment on WM_HINTS.input

2 years agodesktop: try harder to avoid focusing unfocusable views
John Lindgren [Sat, 23 Sep 2023 16:20:44 +0000 (12:20 -0400)]
desktop: try harder to avoid focusing unfocusable views

Make desktop_focus_view() do nothing if the view is not focusable.

2 years agoview/xwayland: avoid focusing views that don't want focus
John Lindgren [Sat, 23 Sep 2023 15:51:47 +0000 (11:51 -0400)]
view/xwayland: avoid focusing views that don't want focus

XWayland views can self-declare that they don't want keyboard focus via
the ICCCM WM_HINTS property. Most of the logic is already in place to
avoid giving focus to such views (e.g. taskbars).

Add a couple of missing pieces to make this work:

- Hook up view_isfocusable() to look at WM_HINTS for XWayland views
- Adjust desktop_focus_topmost_mapped_view() to skip unfocusable views

2 years agoChase wlroots: Stop using wlr_xwayland_surface event data
Consolatis [Fri, 29 Sep 2023 02:50:47 +0000 (04:50 +0200)]
Chase wlroots: Stop using wlr_xwayland_surface event data

Follow-up from b816c1670150e265719b2fc2ff2a149b50181298
Chase wlroots: Stop using wlr_xwayland_surface event data

Chases: 27edd024f83892f4af9c5084d47b73f26966aaf1
xwayland: pass NULL as event data

2 years agoChase wlroots: Stop using wlr_drag_icon event data
Consolatis [Fri, 29 Sep 2023 02:50:38 +0000 (04:50 +0200)]
Chase wlroots: Stop using wlr_drag_icon event data

Chases: af4181f3880dedcc7c717cfd54c047737bd95ee4
drag: use unified map logic

2 years agosrc/view.c: guard xwayland include
Consolatis [Fri, 29 Sep 2023 00:29:30 +0000 (02:29 +0200)]
src/view.c: guard xwayland include

Fixes: #1118
2 years agoseat: use focus_change event to update focused/active view
John Lindgren [Wed, 27 Sep 2023 22:24:35 +0000 (18:24 -0400)]
seat: use focus_change event to update focused/active view

- Connect to wlr_seat_keyboard_state's focus_change event.
- Add view_from_wlr_surface(), which does what the name says.
- Use focus_change event along with view_from_wlr_surface() to update
  server->focused_view and set SSD states via view_set_activated().
- Eliminate desktop_focused_view() since server->focused_view should be
  reliably up-to-date now.
- Eliminate view_focus/defocus() since we can now just call
  seat_focus_surface() directly.

2 years agoREADME.md: describe --force-fallback-for option
Johan Malm [Thu, 28 Sep 2023 21:07:05 +0000 (22:07 +0100)]
README.md: describe --force-fallback-for option

2 years agokeyboard: fix release event bug after session lock
Johan Malm [Thu, 28 Sep 2023 19:44:57 +0000 (20:44 +0100)]
keyboard: fix release event bug after session lock

Do not withhold the release event associated with a keybind which executes
a keyboard-input-inhibiting client like swaylock.

In other words, make release-events of absorbed keys (those used up by a
keybind) de-register as such even though session-lock or input-inhibit is
in-force.

Fixes: issue #1114
Helped-by: @Consolatis
2 years agodesktop: switch workspaces and optionally raise in desktop_focus_view()
John Lindgren [Wed, 27 Sep 2023 22:37:28 +0000 (18:37 -0400)]
desktop: switch workspaces and optionally raise in desktop_focus_view()

Make desktop_focus_view() always switch to the workspace containing the
view being focused. It doesn't make much sense for an invisible view to
have the keyboard focus.

Also add an optional "raise" parameter to desktop_focus_view(). This
allows the common pattern of desktop_focus_view() + view_move_to_front()
to be reduced to a single function call.

2 years agokeyboard: make keybind match stricter
Johan Malm [Tue, 26 Sep 2023 16:51:54 +0000 (17:51 +0100)]
keyboard: make keybind match stricter

...and avoid failing to send release events to clients for any keys that were
not absorbed by a keybind.

Do not match keybinds if there are other non-modifier keys (not part of any
defined bind) pressed at the same time.

Only store non-modifier keycodes in the key-state.c 'pressed' array.
This makes the call to wlr_seat_keyboard_notify_enter() in seat_focus()
consistent with the equivalent in sway (in seat_keyboard_notify_enter()).

Fixes: issue #1091
2 years agoview: try to reduce confusion in focused_view tracking
John Lindgren [Tue, 26 Sep 2023 05:35:36 +0000 (01:35 -0400)]
view: try to reduce confusion in focused_view tracking

Our current approach to handling the focused/active view is a bit
confusing. In particular, it's hard to be sure when server->focused_view
is or isn't in sync with the real wlroots keyboard focus.

Try to clean things up a bit. In particular:

- Add comments to server->focused_view and desktop_focused_view() to
  clarify that they should match, but it's not guaranteed.

- desktop_focused_view() now prints a warning if it detects that
  server->focused_view is out of sync. We should keep an eye out for
  this warning, and if we see it, try to figure out why it happened.

- For consistency, use only "focus/defocus" as the verbs in function
  names rather than "activate". This is a bit arbitrary, but the idea is
  that focus is the primary action while the active/inactive state is a
  side effect.

- view_focus/defocus() replace view_set_activated() and now update both
  focus and active/inactive state, to try to keep them in sync.

- Add comments at view_focus/defocus() to warn against calling them
  directly (we should generally call the desktop.c functions).

- desktop_focus_view(NULL) is now forbidden and is no longer handled as
  a special case to clear the focus. This was (at least to me) a
  surprising behavior and caused trouble when working on another change.

- To maintain existing behavior, desktop_focus_topmost_mapped_view() now
  explicitly clears the focus if there are no mapped views.

There should be no behavioral change here.

2 years agoCONTRIBUTING.md: add wl_array_len() and ARRAY_SIZE() to API section
Johan Malm [Sat, 23 Sep 2023 16:12:25 +0000 (17:12 +0100)]
CONTRIBUTING.md: add wl_array_len() and ARRAY_SIZE() to API section

2 years agoCONTRIBUTING.md: updates notes on up-versioning
Johan Malm [Sat, 23 Sep 2023 16:05:59 +0000 (17:05 +0100)]
CONTRIBUTING.md: updates notes on up-versioning

2 years agoAdd default menu descriptions to labwc-menu.5.scd
Standreas [Fri, 22 Sep 2023 19:10:10 +0000 (21:10 +0200)]
Add default menu descriptions to labwc-menu.5.scd

2 years agoview: account for base size in resize indicator
John Lindgren [Fri, 22 Sep 2023 05:22:19 +0000 (01:22 -0400)]
view: account for base size in resize indicator

For views with a non-pixel size increment (e.g. X11 terminals), it's
helpful to subtract the base size of the window (typically including
menu bar, scrollbars, etc.) before computing the number of size
increments (e.g. cells/characters). This way, the displayed size will
exactly match the terminal grid (e.g. 80x25 or whatever).

wlr_box isn't really the best fit for size hints, so let's define a
struct view_size_hints and a nice view_get_size_hints() function,
wrapping view->impl->get_size_hints().

This also seems like a great opportunity to make view_adjust_size()
window-system-agnostic and eliminate xwayland_apply_size_hints().

2 years agobuild: bump version to 0.6.5
Johan Malm [Sat, 23 Sep 2023 15:53:32 +0000 (16:53 +0100)]
build: bump version to 0.6.5

2 years agoNEWS.md: add notes for 0.6.5
Johan Malm [Wed, 20 Sep 2023 20:07:56 +0000 (21:07 +0100)]
NEWS.md: add notes for 0.6.5

2 years agoNEWS.md: use latest keep-a-changelogs link format
Johan Malm [Mon, 18 Sep 2023 19:14:38 +0000 (20:14 +0100)]
NEWS.md: use latest keep-a-changelogs link format

...which points to https://github.com/.../compare/v0.0.1...v0.0.2
rather than a 'release' page.

2 years agocommon/buf.c: do not use memcpy for overlapping regions
Johan Malm [Sat, 23 Sep 2023 14:16:57 +0000 (15:16 +0100)]
common/buf.c: do not use memcpy for overlapping regions

2 years agoaction: do not expand env vars in Exec action
Johan Malm [Thu, 21 Sep 2023 22:09:05 +0000 (23:09 +0100)]
action: do not expand env vars in Exec action

...<command> argument (but still resolve tilde).

This makes it easier to write sh -c '' constructs without turning labwc
into a shell parser in order to expand environment variables, whilst
respecting single quotes and escaped characters as well as ignoring
subshells syntax like $(foo) and backticks.

Also, fix bug where buffer length+alloc get out-of-sync

2 years agobuf: do not expand $() in buf_expand_shell_variables()
Johan Malm [Thu, 21 Sep 2023 21:51:54 +0000 (22:51 +0100)]
buf: do not expand $() in buf_expand_shell_variables()

2 years agosrc/ssd: use view->ssd_titlebar_hidden for ssd_thickness calculations
Consolatis [Sun, 17 Sep 2023 20:41:46 +0000 (22:41 +0200)]
src/ssd: use view->ssd_titlebar_hidden for ssd_thickness calculations

Before this patch we were using the internal .enabled flag of the titlebar
tree node. This failed due to ssd_thickness() not having view->ssd assigned
when initially called. Instead of assigning view->ssd within ssd_create()
we just always use the view boolean flag directly. This fixes an issue
where a border-only view that has been snapped to an edge or region would
have a gap in the size of the titlebar on top after a Reconfigure.

Fixes #1083

2 years agoEnsure xdg and xwayland string_prop() handlers deal with destroying views
Consolatis [Thu, 21 Sep 2023 16:13:44 +0000 (18:13 +0200)]
Ensure xdg and xwayland string_prop() handlers deal with destroying views

When a view is destroyed (including override_redirect in the xwayland
case), the view_destroy() handler is called which checks for a currently
open A-Tab window switcher and causes an update there to remove the
destroying view from the list. Before view_destroy() is called, both
xwayland and xdg handlers reset the xdg_surface / xwayland_surface.

The window switcher update then creates a list of all windows which do
not have the 'skipWindowSwitcher' window rule property set. If there is
at least one 'matchOnce' window rule configured, this also tries to get
string properties of the destroying view which already had their
xdg_surface / xwayland_surface reset and thus run into an assert.

This patch fixes that so that the string_prop() handlers always return
an empty string in those cases rather than running into the assert.

For a more in-depth analyses and alternative solutions see the linked
issue.

Fixes #1082

2 years agoAdded note for localization support to menu.xml
Standreas [Wed, 20 Sep 2023 07:05:02 +0000 (09:05 +0200)]
Added note for localization support to menu.xml

Maybe mention it in the man page too?

2 years agoAdd ARRAY_SIZE() macro
Johan Malm [Sat, 16 Sep 2023 21:25:41 +0000 (22:25 +0100)]
Add ARRAY_SIZE() macro

2 years agoFix typo in labwc-theme.5.scd
Standreas [Tue, 19 Sep 2023 20:03:50 +0000 (22:03 +0200)]
Fix typo in labwc-theme.5.scd

2 years agobuild: make svg buttons optional
Johan Malm [Sun, 17 Sep 2023 10:40:48 +0000 (11:40 +0100)]
build: make svg buttons optional

Add -Dsvg=disabled to your meson setup/configure command to disable svg
buttons even if the correct version of librsvg is available.

Note that regardless of this patch and the value of the 'svg' variable,
the build will gracefully fall back to not using librsvg if the correct
version is not available.

Helped-by: @01micko
2 years agobutton-png.c: s/png_load/button_png_load/
Johan Malm [Sat, 16 Sep 2023 21:36:31 +0000 (22:36 +0100)]
button-png.c: s/png_load/button_png_load/

2 years agoSupport svg buttons
Johan Malm [Mon, 21 Aug 2023 20:26:08 +0000 (21:26 +0100)]
Support svg buttons

In the theme directory add close-{active,inactive}.svg instead of
close.xbm - and similarly for iconify, menu and max.

2 years agocommon/file-helpers.c: share file_exists() to reduce duplication
Johan Malm [Mon, 21 Aug 2023 20:07:28 +0000 (21:07 +0100)]
common/file-helpers.c: share file_exists() to reduce duplication

2 years agobutton/common.c: share button_filename() to reduce duplication
Johan Malm [Mon, 21 Aug 2023 20:03:46 +0000 (21:03 +0100)]
button/common.c: share button_filename() to reduce duplication

2 years agosrc/common/parse-bool.c: support on/off boolean values
redtide [Tue, 12 Sep 2023 23:06:29 +0000 (01:06 +0200)]
src/common/parse-bool.c: support on/off boolean values

2 years agoMerge pull request #1072 from Consolatis/feature/keycode_binds
Consolatis [Mon, 11 Sep 2023 20:00:39 +0000 (22:00 +0200)]
Merge pull request #1072 from Consolatis/feature/keycode_binds

Keybinds: keyboard layout agnostic keybinds

2 years agokeybinds: add optional layoutDependent argument
Consolatis [Mon, 11 Sep 2023 13:15:37 +0000 (15:15 +0200)]
keybinds: add optional layoutDependent argument

This allows to define keybinds as layout dependent. E.g. keybinds
only trigger if the configured key exists in the currently active
keyboard layout. The keybind will also only trigger on the physical
key that is mapped to the configured key in the active layout.

By default the new argument is false which means all keybinds by
default are layout agnostic. This optional argument can be used
to restore the earlier default behavior of having keys layout
dependent.