]> git.mdlowis.com Git - proto/labwc.git/log
proto/labwc.git
2 years agoChase wlroots: convert to try_from
John Lindgren [Fri, 3 Feb 2023 19:53:26 +0000 (14:53 -0500)]
Chase wlroots: convert to try_from

Chases: 711a1a3ed42150fdbc716e80719d482006075f69
xdg-shell: convert to try_from

Chases: f9bd416d4156942ce3951a6c5cf9f81a3cf4a3dd
layer-shell-v1: convert to try_from

Chases: fbf5982e3838ee28b5345e98832f6956c402b225
xwayland/xwm: introduce wlr_xwayland_surface_try_from_wlr_surface()

2 years agoChase wlroots: wlr_output_layout refactor
Consolatis [Tue, 24 Jan 2023 02:57:10 +0000 (03:57 +0100)]
Chase wlroots: wlr_output_layout refactor

Chases 097ea84cda70a71ad8ea5940b3b3d277167424e5
output-layout: improve API

2 years agoChase wlroots: wlr_session refactor
Consolatis [Tue, 24 Jan 2023 03:12:02 +0000 (04:12 +0100)]
Chase wlroots: wlr_session refactor

Chases 41b7acbab78597e2eb0724e415ed94b910d113c1
backend: return wlr_session in wlr_backend_autocreate() call

2 years agoChase wlroots: wlr_surface refactor
Consolatis [Tue, 24 Jan 2023 02:32:45 +0000 (03:32 +0100)]
Chase wlroots: wlr_surface refactor

Chases 258bf9be1e44d8a2fb953d727ff4ffcf9ebd6503
compositor: drop wlr_surface.{sx,sy}

2 years agoChase wlroots: Layershell version
Consolatis [Tue, 24 Jan 2023 02:35:13 +0000 (03:35 +0100)]
Chase wlroots: Layershell version

Chases 9f793d350379872aeee56ea5c476adfeedc8bc88
layer-shell-v1: specify version in constructor

2 years agoChase wlroots: Update meson.build wlroots requirement to >= 0.17
Consolatis [Tue, 24 Jan 2023 02:29:38 +0000 (03:29 +0100)]
Chase wlroots: Update meson.build wlroots requirement to >= 0.17

2 years agobuild: bump version to 0.6.6
Johan Malm [Sat, 25 Nov 2023 21:08:56 +0000 (21:08 +0000)]
build: bump version to 0.6.6

2 years agoNEWS.md: update notes for 0.6.6
Johan Malm [Sat, 25 Nov 2023 21:07:20 +0000 (21:07 +0000)]
NEWS.md: update notes for 0.6.6

2 years agoxwayland: assign view->surface earlier in map handler
Johan Malm [Sat, 25 Nov 2023 17:40:44 +0000 (17:40 +0000)]
xwayland: assign view->surface earlier in map handler

...as it needs to be set before honouring xwayland_surface->fullscreen
because that calls desktop_update_top_layer_visiblity() which relies on
view->surface being set in view_is_focusable() since 13d0b14.

Fix bug introduced by PR #1237 which fails to hide the xfce4-panel (or
any other layer-shell client in the top layer) whilst gaming in
fullscreen. The bug can be observed with the following games:

- Alan Wake 2 (wine)
- Starfield (steam+proton)
- Cyberpunk (steam+proton)
- Quake 1 Remaster (steam-native)

Fixes: #661 (the last bit of it)
Reported-by: @ScarecrowDM
Helped-by: @Consolatis
2 years agoxwayland: do not re-set deocrations on unminimize
Johan Malm [Tue, 21 Nov 2023 22:02:22 +0000 (22:02 +0000)]
xwayland: do not re-set deocrations on unminimize

Reproduce issue by:

1. Run an XWayland client
2. ToggleDecorations twice to hide deco
3. Minimize/unminimize from panel
4. Observe that deco is back

Reported-by: @Consolatis
2 years agoKeep xwayland stacking order in sync when switching workspaces
Consolatis [Tue, 21 Nov 2023 02:09:22 +0000 (03:09 +0100)]
Keep xwayland stacking order in sync when switching workspaces

Until we expose the workspaces to xwayland we need a way to
ensure that xwayland views on the current workspace are always
stacked above xwayland views on other workspaces.

If we fail to do so, issues arise in scenarios where we change
the mouse focus but do not change the (xwayland) stacking order.

Reproducer:
- If followMouse is enabled, raiseOnFocus must be disabled
- Open at least two xwayland windows which allow scrolling
  (some X11 terminal with 'man man' for example)
- Switch to another workspace, open another xwayland window
  which allows scrolling and maximize it
- Switch back to the previous workspace with the two windows
- Move the mouse to the xwayland window that does *not* have
  focus
- Start scrolling
- All scroll events should end up on the maximized window on
  the other workspace

This patch fixes the issue by simply raising all windows from
the current workspace again in their original stacking order
when switching workspaces.

Reported-by: Domo via IRC (thanks!)
2 years agocommon/array.h: add wl_array_for_each_reverse macro
Consolatis [Tue, 21 Nov 2023 02:07:10 +0000 (03:07 +0100)]
common/array.h: add wl_array_for_each_reverse macro

2 years agosrc/view.c: add always_on_top criteria
Consolatis [Tue, 21 Nov 2023 02:08:04 +0000 (03:08 +0100)]
src/view.c: add always_on_top criteria

2 years agokeyboard: fix key repeat bug on surface focus change
Johan Malm [Tue, 14 Nov 2023 18:57:40 +0000 (18:57 +0000)]
keyboard: fix key repeat bug on surface focus change

The bug can be reproduced by using the following keybinds and then taking
the steps below with an XWayland client, for example xterm:

    <keybind key="C-S-h">
      <action name="GoToDesktop" to="left" wrap="yes"/>
    </keybind>
    <keybind key="C-S-l">
      <action name="GoToDesktop" to="right" wrap="yes"/>
    </keybind>

1. Press C-S-h
2. Press C-S-l
3. Observe llllllll.... in xterm

Store the key-state in `handle_keybind()` before any call to
`action_run()` as this may lead to `seat_focus()` which passes
'pressed-sent' keys to the new surface.

This partially reverts 7571c4b, which as a standalone commit was fine, but
when 'pressed_mods' were then included in 'bound' in 98bf316,
`key_state_store_pressed_keys_as_bound()` was again required in
`handle_keybind()` to ensure modifers are not passed as non-modifiers in
`wlr_seat_keyboard_notify_enter()` in `seat_focus()`

2 years agokey-state.c: add logging for 'pressed-sent'
Johan Malm [Tue, 14 Nov 2023 18:57:22 +0000 (18:57 +0000)]
key-state.c: add logging for 'pressed-sent'

2 years agoNEWS.md: interim update for 0.6.6
Johan Malm [Sun, 12 Nov 2023 21:32:21 +0000 (21:32 +0000)]
NEWS.md: interim update for 0.6.6

2 years agoUpdate top layer visiblity on workspace switch
Consolatis [Fri, 10 Nov 2023 22:58:25 +0000 (23:58 +0100)]
Update top layer visiblity on workspace switch

Fixes: #1158
2 years agokeyboard: include pressed modifiers in bound set
John Lindgren [Sat, 11 Nov 2023 04:43:46 +0000 (23:43 -0500)]
keyboard: include pressed modifiers in bound set

This prevents applications from seeing and handling the release event
for a modifier key that was part of a keybinding (e.g. Firefox displays
its menu bar for a lone Alt press + release).

2 years agokeyboard: remove exceptions from storing pressed keys
John Lindgren [Sat, 11 Nov 2023 03:53:17 +0000 (22:53 -0500)]
keyboard: remove exceptions from storing pressed keys

These exceptions were added to prevent certain keys (modifiers and
synthetic layout switch key-events) from disabling keybindings (due to
the "nr_pressed_keys > 1" check). That check no longer exists, so the
exceptions should no longer be necessary.

Partially reverts e77330bc3fe7 and 3e2baa3f05ac.

2 years agokeyboard: remove nr_pressed_keys == 1 restriction for keybindings
John Lindgren [Sat, 11 Nov 2023 03:00:04 +0000 (22:00 -0500)]
keyboard: remove nr_pressed_keys == 1 restriction for keybindings

This restriction should be unnecessary now (see the previous commit for
details) and caused issues with keybindings not working on some systems
where irregular keypress events are received (e.g. XF86XK_WakeUp)
without an accompanying release event.

Kept separate from the previous commit for the sake of potential future
bisects.

Partially reverts e77330bc3fe7.

2 years agokeyboard: avoid stuck keys due to keybindings (alternate approach)
John Lindgren [Sat, 4 Nov 2023 05:23:43 +0000 (01:23 -0400)]
keyboard: avoid stuck keys due to keybindings (alternate approach)

Before commit e77330bc3fe7, there were issues with keys becoming "stuck"
if other keys were pressed at the time a keybinding was matched, because
those other keys were included in the "bound" set and the release events
were incorrectly eaten by labwc.

Commit e77330bc3fe7 solved that issue with the "big hammer" approach of
preventing keybindings from working at all if other keys were pressed:

        if (key_state_nr_pressed_keys() > 1) {
                return false;
        }

This is an alternate approach to solving the original problem, by (1)
not including those other keys in the "bound" set and (2) making sure we
always forward release events for un-bound keys to clients (even if a
menu or OSD is displayed).

Details:

- Since we only ever want to store the single matched keycode as bound,
  key_state_store_pressed_keys_as_bound() doesn't really make sense in
  the plural, so rename it to key_state_store_pressed_key_as_bound() and
  pass in the keycode.

- The calls to key_state_store_pressed_keys_as_bound() within
  handle_keybinding() appear to be redundant since it is also called
  from the parent function (handle_compositor_keybindings()). So remove
  these calls.

- Finally, rework the logic for handling key-release events so that we
  always forward release events for keys not in the "bound" set.

This PR does not remove the "key_state_nr_pressed_keys() > 1" check, and
because of that should not result in any functional change. It should
however make it possible to relax or remove that check in future.

2 years agoCI: avoid heavy dependency in FreeBSD job
Jan Beich [Sun, 12 Nov 2023 00:59:20 +0000 (01:59 +0100)]
CI: avoid heavy dependency in FreeBSD job

Not testing runtime yet, so disable Mesa drivers.

2 years agoCI: run FreeBSD job on Ubuntu
Jan Beich [Sat, 11 Nov 2023 23:31:49 +0000 (00:31 +0100)]
CI: run FreeBSD job on Ubuntu

2 years agokeyboard: fix shifted keystroke delay
Johan Malm [Sat, 11 Nov 2023 22:04:14 +0000 (22:04 +0000)]
keyboard: fix shifted keystroke delay

Remove wlr_seat_set_keyboard() from `keyboard_modifiers_notify()`
but leave it in `keyboard_key_notify()`

Fixes regression introduced in 984aeb0

Reported-by: @jlindgren90
Fixes: #1238
2 years agowindow-rules: add fixedPosition property
Johan Malm [Thu, 9 Nov 2023 21:44:51 +0000 (21:44 +0000)]
window-rules: add fixedPosition property

...to address regression introduced by 57075ce and enables panel/desktop
clients which rely on window rules to remain in the same position when
the usable-area changes (normally because an exclusive layer-shell
clients is started/finished).

Also disallows interactive move/resize, for example by alt +
mouse-press.

Fixes: #1235
2 years agointeractive: Make window snapping with mouse more intuitive
tokyo4j [Tue, 7 Nov 2023 05:43:53 +0000 (14:43 +0900)]
interactive: Make window snapping with mouse more intuitive

1. Prevent window snapping triggered by mouse from moving the window
 into the adjacent output.
2. Make the coordinates used to check whether window snapping is
 triggered relative to the output the cursor is at, not the output the
 view is belonging to. This allows users to grab a tiled window and move
 it into another output or tile it again in another output in a single
 drag.

2 years agoAdd unfocus action
Johan Malm [Tue, 7 Nov 2023 18:53:27 +0000 (18:53 +0000)]
Add unfocus action

...to enable unfocusing currently focused window on desktop click.

Works with:

    <mouse>
      <default />
      <context name="Root">
        <mousebind button="Left" action="Press">
          <action name="Unfocus" />
        </mousebind>
      </context>
    </mouse>

Fixes: #1230
2 years agoxdg: try to handle missing set_window_geometry with Qt apps
John Lindgren [Sat, 21 Oct 2023 23:49:38 +0000 (19:49 -0400)]
xdg: try to handle missing set_window_geometry with Qt apps

Qt applications occasionally fail to call set_window_geometry after a
configure request, but do correctly update the actual surface extent.
This results in a mismatch between the window decorations (which follow
the logical geometry) and the visual size of the client area. As a
workaround, try to detect this case and ignore the out-of-date window
geometry.

Fixes: #1194
2 years agoview: ensure that floating views don't overlap top panels
John Lindgren [Fri, 3 Nov 2023 16:38:07 +0000 (12:38 -0400)]
view: ensure that floating views don't overlap top panels

The top_left_edge_boundary_check() function in xwayland.c ensures that
views trying to position themselves at 0,0 don't end up with a titlebar
offscreen. However, it doesn't take into account the usable area and
thus these views can still end up overlapping a top panel.

Also, there is no good reason for top_left_edge_boundary_check() to be
xwayland-specific. This logic should really be part of
view_adjust_for_layout_change().

To fix all this, add a new view_adjust_floating_geometry() function,
which replaces the existing similar (and duplicated) logic in
view_apply_natural_geometry() and view_adjust_for_layout_change().

view_adjust_for_layout_change() is already being called from xwayland's
set_initial_position(), so top_left_edge_boundary_check() is now
redundant and can just be deleted.

Lightly tested with waybar and feh --geometry 640x480+0+0. The feh
window is now correctly positioned below waybar, even if started before
waybar (in that case, the feh window is moved when waybar starts).

2 years agokeyboard: allow applying keyboard layout per window
Consolatis [Thu, 7 Sep 2023 14:41:47 +0000 (16:41 +0200)]
keyboard: allow applying keyboard layout per window

Fixes #1076

It can be enabled with a config like

~/.config/labwc/rc.xml:
<keyboard layoutScope="window">

~/.config/labwc/environment:
XKB_DEFAULT_LAYOUT=de,us
XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,grp_led:scroll

With a configuration like this each window should now remember
the active keyboard layout when switching between windows.

By default, the keyboard layout keeps being a global state.

2 years agoNEWS.md: interim update for 0.6.6
Johan Malm [Wed, 1 Nov 2023 21:43:12 +0000 (21:43 +0000)]
NEWS.md: interim update for 0.6.6

2 years agoNEWS.md: minor style fixes
Johan Malm [Thu, 2 Nov 2023 18:16:53 +0000 (18:16 +0000)]
NEWS.md: minor style fixes

2 years agocursor: allow re-focusing xwayland-unmanaged surfaces
John Lindgren [Thu, 2 Nov 2023 03:01:19 +0000 (23:01 -0400)]
cursor: allow re-focusing xwayland-unmanaged surfaces

We already allow some xwayland-unmanaged surfaces to take focus on map,
if indicated by wlr_xwayland_or_surface_wants_focus(). But once these
surfaces lose focus, they never regain it again.

Add desktop_focus_view_or_surface() and call it in the appropriate
places to allow these views to regain focus in the usual ways (e.g.
clicking on them or focus-follows-mouse).

2 years agoview.h: changed the type of tiled in struct view to enum view_edge
Tomi Ollila [Tue, 31 Oct 2023 20:12:12 +0000 (22:12 +0200)]
view.h: changed the type of tiled in struct view to enum view_edge

The type enum view_edge used to be defined in a .c file, so a
structure member 'tiled' in struct view had to be defined to
use another type.

Later (2023-08-02, commit 1ee8715) the definition of enum view_edge
was moved to view.h, so now 'tiled' can be defined to use that type.

2 years agohow to specify variant layout
GNUser [Tue, 31 Oct 2023 18:01:31 +0000 (14:01 -0400)]
how to specify variant layout

2 years agoMove input handler init() and finish() functions to input/input.c
Consolatis [Sun, 3 Sep 2023 17:21:16 +0000 (19:21 +0200)]
Move input handler init() and finish() functions to input/input.c

2 years agoMove keyboard functions into input/keyboard.h
Consolatis [Sun, 3 Sep 2023 17:15:50 +0000 (19:15 +0200)]
Move keyboard functions into input/keyboard.h

2 years agoMake touch depend on cursor to prevent racing
Consolatis [Sun, 3 Sep 2023 17:07:55 +0000 (19:07 +0200)]
Make touch depend on cursor to prevent racing

2 years agoMove gesture handling out of cursor.c
Consolatis [Sun, 3 Sep 2023 16:56:20 +0000 (18:56 +0200)]
Move gesture handling out of cursor.c

2 years agoMove input related source files into src/input/
Consolatis [Sun, 3 Sep 2023 15:39:48 +0000 (17:39 +0200)]
Move input related source files into src/input/

2 years agosrc/common/spawn.c: Restore SIGPIPE default handler before exec
Consolatis [Sun, 29 Oct 2023 09:54:44 +0000 (10:54 +0100)]
src/common/spawn.c: Restore SIGPIPE default handler before exec

Fixes: #1209
Reported-by: @bdantas
2 years agoview: implement separate horizontal/vertical maximize
John Lindgren [Thu, 26 Oct 2023 04:38:29 +0000 (00:38 -0400)]
view: implement separate horizontal/vertical maximize

This is a useful (if lesser-known) feature of at least a few popular X11
window managers, for example Openbox and XFWM4. Typically right-click on
the maximize button toggles horizontal maximize, while middle-click
toggles vertical maximize.

Support in labwc uses the same configuration syntax as Openbox, where the
Maximize/ToggleMaximize actions have an optional "direction" argument:
horizontal, vertical, or both (default). The default mouse bindings match
the XFWM4 defaults (not sure what Openbox has by default).

Most of the external protocols still assume "maximized" is a Boolean,
which is no longer true internally. For the sake of the outside world,
a view is only "maximized" if maximized in both directions.

Internally, I've taken the following approach:

- SSD code decorates the view as "maximized" (i.e. hiding borders) only
  if maximized in both directions.

- Layout code (interactive move/resize, tiling, etc.) generally treats
  the view as "maximized" (with the restrictions that entails) if
  maximized in either direction. For example, moving a vertically-
  maximized view first restores the natural geometry (this differs from
  Openbox, which instead allows the view to move only horizontally.)

v2: use enum view_axis for view->maximized
v3:
  - update docs
  - allow resizing if partly maximized
  - add TODOs & corrections noted by Consolatis

2 years agoCONTRIBUTING.md: update list of package maintainers
Consolatis [Wed, 25 Oct 2023 17:53:26 +0000 (19:53 +0200)]
CONTRIBUTING.md: update list of package maintainers

2 years agosrc/keyboard.c: always try to remove keys from the pressed set on release
Consolatis [Mon, 23 Oct 2023 17:48:52 +0000 (19:48 +0200)]
src/keyboard.c: always try to remove keys from the pressed set on release

Fixes: #1200
Reported-by: @kyak
2 years agoview: avoid raising same view over and over
John Lindgren [Sat, 21 Oct 2023 15:28:00 +0000 (11:28 -0400)]
view: avoid raising same view over and over

Since view_move_to_front() now does more work than it used to
(updating XWayland server stacking order), try to avoid doing that
work unnecessarily.

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.