Commit graph

2417 commits

Author SHA1 Message Date
Johan Malm
98c876d796 build: bump version to 0.8.0 2024-08-16 16:41:36 +01:00
Johan Malm
c63dce83c4 NEWS.md: update notes for 0.8.0 2024-08-16 16:40:24 +01:00
Consolatis
6a1ecd6b7d scene-helpers: use pending_commit_damage, chases wlr!4253
Using the output damage_ring for early out will break VRR in
direct scanout mode. The reason being that the damage_ring
will be completely ignored in that mode so we need to check
`output->pending_commit_damage` instead. This matches with
what wlroots has been doing since [0] and it was missed in
the initial port to wlroots 0.18.x.

However, that would then break the magnifier which only adds
its damage to the damage ring. After some discussion with
the wlroots devs we came up with a solution that should work
for both, wlroots 0.18.0 and when [1] is backported to 0.18.1.

Note that even with this PR, VRR in direct scanout mode is
broken in 0.18.0 from the wlroots side and will be fixed once
[1] is backported to the 0.18 branch and 0.18.1 is released.

Fixes: #2078

[0] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4253
[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4753
2024-08-15 20:51:20 +01:00
Jens Peters
00512d055f input: ensure that our own tablet structs are created 2024-08-13 18:40:34 +02:00
Jens Peters
dd0cee02a4 input: move cursor event listeners from tablet to seat
Otherwise we would subscribe multiple times to the
same event when having multiple tablets.
2024-08-13 18:40:34 +02:00
Jens Peters
538eb3ee83 input: use CONNECT_SIGNAL macro 2024-08-13 18:40:34 +02:00
tokyo4j
6687640665 xdg: fix error when launching windowed Chromium
Chromium sends 2 commits before the commit with a buffer attached. We
were just checking `wlr_box_empty(&view->pending)` to handle the cases
where an initially maximized/fullscreen client is windowed, but that
check was also returning true on the 2nd commit from Chromium, resulting
in an error message: "view has empty geometry, not centering".
2024-08-11 16:48:40 -04:00
tokyo4j
de38c771fc xdg-activation: temporarily disable source surface verification
71451173 validates the xdg-activation token more strictly by verifying
the source surface attached to the token. That  improves the security by
preventing arbitrary focus-stealing.

However, not all clients attach a right source surface to the token or
use the received token for activation. For example, when a notification
client requests thunderbird to activate its window, thunderbird doesn't
use the token passed by the notification client and instead use their own
token, thus the activation is rejected as the surface attached to the
token is not focused.

We will add options to configure the policy for activation requests or
implement urgency hint in some way in the future and reland the source
surface verification.
2024-08-11 09:33:26 +02:00
Johan Malm
72df8fe73c keyboard: fix bug with empty XKB_DEFAULT_LAYOUT
With XKB_DEFAULT_LAYOUT= (set to empty rather than unset) the keyboard
just does not work.

Ref: https://github.com/labwc/labwc-tweaks/issues/89
2024-08-08 21:35:06 +02:00
Jens Peters
f20b2c7632 input: apply tablet rotation before area transformation
This makes the behavior consistent with auto-rotation
as a result of output mapping.
2024-08-08 20:27:06 +01:00
Jens Peters
df12572f29 docs: clarify tablet rotation for mapped outputs 2024-08-08 20:27:06 +01:00
Jens Peters
060626e9c7 input: subscribe to tablet tool events from cursor
Contrary to the raw tablet events, the cursor events transform
the coordinates based on a mapped output orientation.
Otherwise those events are the same.
2024-08-08 20:27:06 +01:00
tokyo4j
670cc0f511 Rename <snapping><dragResistance> to <resistance><unSnapThreshold>
As we already have <resistance><{screen,window}EdgeStrength>,
<resistance> will be a better place for this setting.
2024-08-08 09:49:53 +09:00
Johan Malm
dc387f7765 NEWS.md: interim update 2024-08-07 21:48:27 +01:00
Jens Peters
433a4509af
tearing: add fullscreen options (#1941)
Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
2024-08-06 21:23:10 +01:00
Johan Malm
19f0b769de labwc-config(5): minor refactor to fix pandoc rendering 2024-08-06 21:01:36 +02:00
Tobias Bengfort
116382fd89 keybind: implement allowWhenLocked
fixes #2034

see bc258a3be2/sway/sway.5.scd (L409)
2024-08-06 19:15:06 +02:00
Tobias Bengfort
6dd0d69889 docs: integrate onRelease into keybind 2024-08-06 19:15:06 +02:00
John Lindgren
0f6d5cc26a view: stay fullscreen when view's output is disconnected
I intended to fix this quite some time ago but didn't get around to it.

I don't think there's any good reason why we need to un-fullscreen a
view when its output is disconnected. We can handle it the same as a
maximized view, and move it to a new output (remaining fullscreen) or,
if all outputs are disconnected, just leave it as-is.

This is helpful for a media-center use-case, where you have just one
view (e.g. Kodi) fullscreen all the time, but the TV might appear to be
disconnected if you switch it to a different source.

Tested with a couple different scenarios:

1. Single output disconnected and re-connected: view stayed fullscreen.
2. Secondary output disconnected: view stayed fullscreen but moved to
   the primary output, and the layer-shell panel on that output was
   hidden as expected. When the secondary output was re-connected, the
   view was moved back (still fullscreen) and the panel on the primary
   appeared again.

Fixes: #864
2024-08-06 19:00:47 +02:00
Consolatis
f14f006cba CI: Install libwlroots-0.18-dev for the Debian runner 2024-08-06 15:25:50 +02:00
John Lindgren
1a339f9c7e xdg: account for drag resistance in do_late_positioning()
The position where the view should be anchored can now be slightly
different from the current cursor position.

Addresses a TODO from #2009.
2024-08-06 13:51:35 +09:00
Consolatis
4bda13d870 CI: increase speed of codestyle check
by running up to nproc ones in parallel
2024-08-04 21:01:50 +02:00
tokyo4j
c202d77c2d Add resistance when dragging tiled windows
Adds a config option <snapping><dragResistance> with default value 20.
This prevents tiled/maximized windows from being unintentionally untiled.
2024-08-02 23:40:26 +02:00
Consolatis
750d37b16c multirect: remove destroy listener before freeing
Detected by `-Db_sanitize=address,undefined` for libwayland
2024-07-26 22:52:16 +02:00
Johan Malm
92db067e86 NEWS.md: update for 0.7.4 2024-07-24 18:35:46 +02:00
tokyo4j
a7024dd224 src/xdg-popup.c: take into account CSD borders for unconstraining
wlr_xdg_popup_unconstrain_from_box() takes a constraint box relative to
toplevel surface, not window.
2024-07-23 14:53:33 +02:00
tokyo4j
e15bde328d src/xdg-popup.c: choose output depending on xdg-positioner
wlr_popup->current.geometry.{x,y} are usually zero on initial commit, so
xdg-popups were always unconstrained against the output which contains
the top-left of the parent toplevel.

This commit changes xdg-popups to be unconstrained against the output
which contains the top-left of preliminary popup geometry designated by
xdg-positioner given as an argument of "get_popup" or "reposition"
requests.
2024-07-23 14:53:33 +02:00
tokyo4j
1765bf8cc2 layer-shell: stop sending configure events on surface creation
With wlroots 0.18, layer-shell's new_surface event is emitted on
zwlr_layer_shell_v1.get_layer_surface request rather than the first
commit. This change layer-shell clients like fuzzel to flicker on launch
because labwc was sending a configure event with fullscreen geometry due
to the absence of geometry hints on get_layer_surface requests.

This commit removes the code that updates the usable area from
new_surface handler, preventing unintended configure events with
fullscreen geometry.
2024-07-23 14:47:56 +02:00
Christopher Snowhill
3879f1f080 backend/drm: Implement support for renderer loss recovery
This implementation is nearly identical to Sway's, except that
it also reloads the configuration, to spur on reloading the
server-side decorations.

v2: Fix style.
v3: Add a reset to the magnifier.
v4: Oops, restructure reset handler a bit.
v5: Commit the magnifier reset immediately, before freeing the
    lost allocator and renderer.
v6: Also check for failed render pass, which may return NULL.
v7: Add a second NULL test, just in case.
2024-07-23 14:44:31 +02:00
tokyo4j
e934c7a417 src/ssd/ssd.c: fix incorrect condition in ssd_part_contains() 2024-07-23 18:02:24 +09:00
John Lindgren
a75301dae5 xdg: remove useless view_set_ssd_mode() in xdg_toplevel_new()
The desired SSD mode is not known at this point. When it is known,
kde-deco/xdg-deco will call view_set_ssd_mode() themselves.
2024-07-20 10:57:44 -04:00
John Lindgren
2b7d0e17fc xdg: update initial maximize logic for wlroots 0.18
The initial configure event is now sent explicitly by labwc rather
than by wlroots. We need to move the maximize/fullscreen logic to
the initial commit handling accordingly.

Updates #1956, fixes #1994, replaces #1995.
2024-07-20 10:57:44 -04:00
tokyo4j
2346cfd33f edges.c: fix flicker of snapped windows in nested session
Fixes: #1621
2024-07-20 08:16:12 -04:00
Christopher Snowhill
d033a2fbf6 output: allow tearing with atomic mode setting
Additionally, track errors and abandon the tearing allowance when it
cannot be set for two-seconds' worth of consecutive frames.
2024-07-20 08:09:00 -04:00
Andrew J. Hesford
14d9bbab90
xwayland: support xinitrc scripts to configure server on launch (#1963) 2024-07-20 09:40:11 +01:00
Consus
e4afa10fe4
theme: allow to set window button size (#1965)
This commit introduces new option "window.button.width". Despite the name
it currently affects both width and height.
2024-07-20 09:33:57 +01:00
tokyo4j
46ec513630 view: implement cascade placement policy
Adds following settings:
<placement>
  <policy>cascade</policy>
  <cascadeOffset x="40" y="30" />
</placement>

"Cascade" policy places a new window at the center of the screen like
"center" policy, but possibly shifts its position to bottom-right so the
new window doesn't cover existing windows.

The algorithm is copied from KWin's implementation:
df9f8f8346/src/placement.cpp (L589)

Also added some helper functions to manipulate `wlr_box`.
2024-07-20 08:59:46 +01:00
John Lindgren
3be8fe25f3 xdg: handle initially maximized xdg-shell views better
Currently, initially maximized (or fullscreen) xdg-shell views exhibit
one of two issues:

 - some (e.g. GTK and Qt apps) paint an initial frame un-maximized
   (before the "map" event) and only maximize in a later commit

 - others (e.g. foot) maximize immediately without flicker, but never
   store a valid natural size, so we end up using a fallback (640x480)

Under KWin, neither of these issues occur, so I looked into what labwc
is doing wrong. It seems that:

 - wlroots internally sends an initial configure event with a size of
   0x0 to all xdg-shell views. This requests the client to set its own
   preferred (a.k.a. natural) size.

 - For an initially maximized/fullscreen view, the initial configure
   event should contain the maximized/fullscreen size rather than 0x0.
   In labwc, this means we have to call wlr_xdg_toplevel_set_size()
   earlier, i.e. from the new_surface event. Tracing with WAYLAND_DEBUG
   shows that the initial configure event now has the correct geometry,
   matching KWin behavior. With this change, GTK and Qt apps no longer
   paint an incorrect un-maximized frame.

 - However, this means that all xdg-shell views now suffer from the same
   issue as foot, where we never receive a commit with the un-maximized
   (natural) geometry. The correct way to get the natural geometry seems
   to be to wait until we want to un-maximize, and send a configure
   event of 0x0 at that point.

Sending a configure event of 0x0 when un-maximizing is a bit annoying as
it breaks some assumptions in labwc code. In particular:

 - view->natural_geometry may now be unknown (0x0), requiring various
   wlr_box_empty() checks sprinkled around. I added these in all the
   obvious places, but there could be some code paths that I missed.

 - Positioning the newly un-maximized view within view_maximize() no
   longer works since we don't know the natural size. Instead we have to
   run the positioning logic from the surface commit handler. This
   results in some extra complexity, especially for interactive move.
   See the new do_late_positioning() function in xdg.c.

Some TODOs/FIXMEs (non-blocking in my opinion):

 - The view_wants_decorations() check is now duplicated in both the
   new_surface and map event handlers. I'm not sure if this is necessary
   but it seemed like the safest approach for now. More testing would be
   nice, particularly with various combinations of config and client SSD
   preferences.

 - Aside from the interactive move case, the "late positioning" logic
   always centers the view when un-maximizing, and does not invoke any
   of the smart placement logic. If we want to invoke smart placement
   here, I'd appreciate someone with more knowledge of that code to take
   a look and figure out how to do that correctly.
2024-07-19 22:48:39 +01:00
Jens Peters
e26ec472b2 docs: add tablet tool section 2024-07-19 22:45:41 +01:00
Jens Peters
3f210828d7 input: log tablet pad capabilities 2024-07-19 22:45:41 +01:00
Jens Peters
f4d203f0cd input: support tablet tool motion sensitivity configuration 2024-07-19 22:45:41 +01:00
Jens Peters
bcd5746a32 config: add configuration for tablet tool motion sensitivity 2024-07-19 22:45:41 +01:00
Jens Peters
96701f1e27 input: support tablet tool motion configuration 2024-07-19 22:45:41 +01:00
Jens Peters
a2f25bea1a config: add configuration for tablet tool motion 2024-07-19 22:45:41 +01:00
Jens Peters
8501a1281c input: support tablet tools with relative motion 2024-07-19 22:45:41 +01:00
Jens Peters
b663c9ea46 input: fix rotation for tilt
The transformation for relative coordinates
is different than for absolute coordinates.
2024-07-19 22:45:41 +01:00
Jens Peters
ba9de228e0 input: add relative cursor move emulation 2024-07-19 22:45:41 +01:00
John Lindgren
c9018da4c4 xwayland: set initial geometry in map_request handler
Set the initial geometry of maximized/fullscreen views before
actually mapping them, so that they can do their initial layout and
drawing with the correct geometry. This avoids visual glitches and
also avoids undesired layout changes with some apps (e.g. HomeBank).

Fixes: #1320

v2: ensure valid geometry for unmanaged->managed case
2024-07-19 22:40:43 +01:00
Johan Malm
c3ea956837 Disable pango glyph position rounding
Chase 8c5b23e592

Pango rounds glyph position and widths to nearest integer, which leads to
font dimensions jumping around when rendering with a scale, causing text
geometry to jump around when changing scale.

Disable this rounding to make the geometry stable.
2024-07-19 22:17:42 +01:00
Consolatis
c20c3991c7 ssd: make borders respect snapped state on Reconfigure
Fixes: #1862
2024-07-19 21:52:26 +01:00