Commit graph

2237 commits

Author SHA1 Message Date
tokyo4j
dfcaee4c99 doc: enhance documentation on border.color 2024-04-14 14:44:43 +01:00
Consolatis
1f39f17be1 docs: add missing documention for the ForEach none branch 2024-04-14 13:27:18 +02:00
nicolas3121
76bdaac4dc src/action.c: add none branch to the ForEach action
This allows implementing a run_or_raise behavior. For an example see
https://github.com/labwc/labwc/pull/1710#issuecomment-2054002641

Fixes: #1298
2024-04-14 13:14:43 +02:00
Johan Malm
c841a25acf Add -S|--session <command> option
...to start <command> on startup and to terminate the compositor when
<command> exits.

This is useful for session management as it allows the session client (for
example `lxqt-session`) to terminate labwc - be exiting itself.

Under X, xinit starts the server and keeps it alive for as long as
lxqt-session runs. Thus either the session client starts the Window
Manager, or the Window Manager can be launched independently first.  On
Wayland, the Compositor is both Display Server and Window Manager, so the
described session management mechanisms do not work because the Compositor
needs to be running before the session can function.

As some session clients support both X11 and Wayland, this command line
option avoids re-writes and fragmentation.

Co-authored-by: @Consolatis
2024-04-14 13:05:25 +02:00
Consolatis
55138dbe0e server: don't create headless backend twice
This may happen when running with WLR_BACKENDS=headless.

Fixes: #1618
2024-04-13 19:38:51 +01:00
Jens Peters
42c09eeef8 input: notify idle manager when emulating cursor move
Looks like we forgot that one earlier.
2024-04-12 23:31:40 +02:00
droc12345
d672765ea7
osd: add window-switcher custom field (#1670)
Add custom field with subset of printf style formatting
to replace the original field formats.

Example:

    <windowSwitcher preview="no" outlines="no" allWorkspaces="yes">
      <fields>
        <field content="custom" format="foobar %b %3s %-10o %-20W %-10i%t" width="100%" />
      </fields>
    </windowSwitcher>

Mono space font recommended. May need OSD width adjusted

Co-authored-by: @Consolatis (based on work done by them)
2024-04-10 23:39:31 +01:00
Andrew J. Hesford
2bf285a2c6 snap: cache and ignore last-snapped edge when growing or shrinking
When growing or shrinking a view by snapping to an edge, a client may
ignore the requested size and instead keep its original size or
substitute a different (possibly constrained) size. In this case, the
view may not actually contact the snapped edge, and a subsequent snap
attempt will just keep re-trying (and failing) to contact the same ege.

To mitigate this, remember the last-snapped view, snapping direction and
offset of the snapping edge in snap.c; when re-attempting a snap for the
same view in the same direction, ignore the edge that was last "hit", to
allow snapping to progress beyond the problematic edge.
2024-04-10 23:30:28 +01:00
Weblate
9de487cecf Translation updates from weblate
Co-authored-by: Jouni Järvinen <jounijarvis@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fi/
Translation: Labwc/labwc
2024-04-10 23:27:46 +01:00
Consolatis
c80b55eb69 src/layer.c: deal with wlroots scene graph running out of memory
This fixes an issue detected by the static analyzer.

Rather than setting up the new popup as usual return
a wayland error to the client and destroy the popup.
2024-04-10 08:14:59 +02:00
Consolatis
59c95ceb26 src/ssd/ssd_part.c: ensure button is found
This fixes an issue detected by the static analyzer.
It currently is not a real bug but it could become
one in the future if `add_toggled_icon()` is called
before `add_scene_button()`.

Rather than having `add_toggled_icon()` go through
the list, find the root button and then fetch its
node descriptor just supply the button as argument.
2024-04-10 08:14:59 +02:00
Consolatis
b959e23d6d CI: enable gcc static analyzer 2024-04-10 08:14:59 +02:00
Consolatis
c9de358075 output: ensure we don't run into an assert() on VT switch
Also reduce log spam from failed output commits that
can happen for various reasons outside of our control.

Fixes: #1667
2024-04-08 21:14:47 +01:00
Consolatis
2c2341530b src/theme.c: support inline alpha encoding like #aabbccff
.. and mark the current `#rrggbb aaa` encoding as deprecated.
2024-04-08 21:05:05 +01:00
John Lindgren
45c60de263 common/font: avoid rendering semi-transparent background twice
Fill with the background color first only if the background color is
opaque. This is necessary for subpixel rendering to work properly (it
does not work on top of transparency).

However, if the background color is not opaque, leave the buffer
unfilled (completely transparent) since the background is already
rendered by the scene element underneath. In this case we have to
disable subpixel rendering.

v2: use 0.999 alpha cutoff and fix CodeStyleCheck

Fixes: (the rest of) #1684
2024-04-08 09:55:37 -04:00
Droc
eb5e855b69 osd: support percent values for window switcher width
Add ability to set width with percentage of monitor instead of just pixels.
With this the OSD sizes itself properly on both my 4k and 2k monitors.

example: 50% or 75% instead of 600, max 100%
2024-04-08 15:44:53 +02:00
Tomi Ollila
6e7f1b430f docs: 80 column lines (where possible), drop trailing whitespace
with one typofix
2024-04-07 21:54:42 +02:00
Consolatis
c35ba02ffa Use pre-multiplied colors by default
wlr_scene_rects expect their color to be pre-multiplied
while cairo_set_source_rgba() expects them to not be
pre-multiplied. With this patch we now use premultiplied
colors internally by default and then reverse it when
setting cairo colors.

This ensures the titlebar uses a consistent color in case
it was defined with some transparency by the user.

Fixes: #1684
2024-04-06 22:54:09 +02:00
Johan Malm
33859138cf cursor: fix dnd bug
...where dnd does not finish properly on cursor-button-release if there
is no surface under the cursor such as on the desktop when no background
client is running.

Written-by: @tokyo4j

Fixes: #1673
2024-04-06 21:50:12 +01:00
tokyo4j
da9456881d cursor: send release event to CSD client before finishing window dragging
This fixes that, when a CSD window is dragged into below waybar and the cursor
button is released, the cursor focus is moved from the CSD window to waybar and
a release event is sent to waybar, not original CSD window.
2024-04-05 11:37:52 +02:00
Hiroaki Yamamoto
5cc0757390
overlay: add snap-to-edge overlay (PR #1652)
...and unify region overlay and snap-to-edge overlay into overlay.c.

Snap-to-edge overlay is delayed for 500ms to prevent flickering when
the view is dragged from an output to another (demo in discussion labwc#1613).

This also fixes a bug that region overlay is not shown when a modifier
key is re-pressed.
2024-04-05 04:35:31 +02:00
Weblate
67669dcf1e Translation updates from weblate
Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
Co-authored-by: Roberalz <lumintnian@outlook.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: rico542 <rico@alwaysdata.net>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/es/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/eu/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fr/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/gl/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/pt/
Translation: Labwc/labwc
2024-04-03 20:07:13 +01:00
Andrew J. Hesford
a457542fb1 common: validate and properly parse floats
Fixes: #1665.
2024-04-02 10:37:50 -04:00
Johan Malm
d68376f2ac cursor: validate double-click against SSD part type
...because click on different parts of a client should not be
interpreted as a double click.

Previously only cursor-button and view were validated to be the same
between clicks. This resulted in, for example a click on the client
surface itself quickly followed by a click on the SSD titlebar being
interpreted as a double-click on the titlebar.

Fixes: #1657
2024-03-28 06:00:06 +01:00
Jens Peters
21cad7d1a7 docs: Refer to calibration matrix 2024-03-26 19:28:53 +00:00
Johan Malm
4fc6bce3ea layer: try to set keyboard focus on map
...for the following reasons:

1. We interpret 'normal input-focus semantics' for clients with on-demand
   keyboard interactivity to means that a surface receives input focus on
   cursor-button-press AND on map (the latter previously missing), just
   like a normal window would. In this regard, we do not differentiate
   between layers.

2. Most layer-surfaces set the keyboard interactivity at a similar time to
   their first (and normally only) map, so the absence of an explicit
   attempt to focus on map does not make a difference. However, for a
   long-running layer-shell client (such as lxqt-runner) which sets the
   interactivity on launch and then maps/unmaps many times throughout its
   lifetime, a specific focus-attempt is required on map to avoid the
   client itself having to keep resetting its interactivity to grab the
   keyboard on map.

3. Compositors like sway and river process focus (for clients with
   keyboard-interactivity)  in their map-handlers, so this makes for a
   common approach.

Fixes: #1653
2024-03-24 23:00:13 +01:00
Johan Malm
f3b68b8fb5 menu: support pipe menus
See labwc-menu(5) for usage.

Co-authored-by: @Consolatis
2024-03-24 21:44:16 +00:00
Consolatis
e5488fefcb common/spawn.c: add spawn_piped() 2024-03-24 21:44:16 +00:00
Johan Malm
0671a3bfd3 menu: move already-on-selected-item check
...menu_process_item_selection() as the previous variant did not work.
2024-03-24 21:44:16 +00:00
Johan Malm
38a60b04d9 menu: minor refactor of menu_configure() 2024-03-24 21:44:16 +00:00
Johan Malm
138979c506 menu: s/menu_open/menu_open_root/
...to be consistent with the 'close' equivalent
2024-03-24 21:44:16 +00:00
Johan Malm
e79bbd3022
labwc-config(5): clarify applicability of element/attribute (#1655)
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
2024-03-24 21:32:27 +00:00
Consolatis
11b6836a38 CONTRIBUTING.md: add Gentoo overlay maintainer 2024-03-22 21:01:08 +00:00
Johan Malm
70e44afc7a NEWS.md: interim update 2024-03-22 18:19:00 +00:00
SnowNF
fe9af393b4 rcxml: add missing check for calibrationMatrix 2024-03-21 22:07:33 +00:00
SnowNF
91e3dc10e4 rcxml: improve parse calibrationMatrix 2024-03-20 22:52:19 +00:00
SnowNF
0e7c726be5 docs: fix format in calibrationMatrix section 2024-03-20 22:52:19 +00:00
SnowNF
6c8060ce14 docs: fix scdoc build 2024-03-20 22:52:19 +00:00
SnowNF
e311ff6466 docs: add calibrationMatrix section for libinput 2024-03-20 22:52:19 +00:00
SnowNF
fb921ab431 Optimize the code based on the suggestions 2024-03-20 22:52:19 +00:00
SnowNF
bd4d92bad8 libinput: add support for touchscreen set matrix
My android pad emit a strange touch input from libinput, need to rotate it in 270 degree clockwise to fix.
2024-03-20 22:52:19 +00:00
01micko
8b8652e2b3 workspaces.c: fix bug with RTL locales, closes #1633 2024-03-19 22:09:36 +00:00
tokyo4j
a3144cc5ea src/xdg-popup.c: unconstrain popup within usable area 2024-03-19 10:20:03 +01:00
Johan Malm
9d51107166 xwayland: fix segv bug when starting game
...for example `Fall Guys`. It is believed to be caused by setting
override-redirect on an xwayland-surface with a child window, thus
breaking the way root-toplevels are obtained.

```
    (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0)
    at pthread_kill.c:44
    at pthread_kill.c:78
    (fmt=0x7739d9f9bb68 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5a76573f9222 "root", file=file@entry=0x5a76573f9606 "../labwc/src/view.c", line=line@entry=2013, function=function@entry=0x5a7657400320 <__PRETTY_FUNCTION__.14> "view_move_to_front") at assert.c:94
    (assertion=assertion@entry=0x5a76573f9222 "root", file=file@entry=0x5a76573f9606 "../labwc/src/view.c", line=line@entry=2013, function=function@entry=0x5a7657400320 <__PRETTY_FUNCTION__.14> "view_move_to_front") at assert.c:103
    at ../labwc/src/view.c:2013
    at ../labwc/src/view-impl-common.c:30
    at ../labwc/src/xwayland.c:677
    at ../wayland-1.22.0/src/wayland-server.c:2241
    (signal=signal@entry=0x5a7659025160, data=data@entry=0x5a7659024e90)
    at ../wayland-1.22.0/src/wayland-server.c:2241
    at ../subprojects/wlroots/types/wlr_compositor.c:493
    (cif=cif@entry=0x7ffc74d32530, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=closure@entry=0x0) at ../src/x86/ffi64.c:673
    (cif=cif@entry=0x7ffc74d32530, fn=<optimized out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7ffc74d32600) at ../src/x86/ffi64.c:710
    (closure=closure@entry=0x5a7658f5adc0, target=<optimized out>,
    target@entry=0x5a7659025240, opcode=opcode@entry=6, data=<optimized out>,
    data@entry=0x5a7658609820, flags=2) at ../wayland-1.22.0/src/connection.c:1025
    (fd=<optimized out>, mask=<optimized out>, data=<optimized out>)
    at ../wayland-1.22.0/src/wayland-server.c:438
    (loop=0x5a7657816e60, timeout=timeout@entry=-1)
    at ../wayland-1.22.0/src/event-loop.c:1027
    at ../wayland-1.22.0/src/wayland-server.c:1493
    at ../labwc/src/main.c:179
```

Reported-by: @kode54
2024-03-17 22:28:59 +01:00
Johan Malm
6990ff713b layer: do not focus on-demand clients in commit-handler
...because we should only try to focus them as part of normal input
handling semantics, for example when receiving a cursor-button-press.
2024-03-17 21:18:47 +00:00
Johan Malm
e67e8d6ed0 layer: do not change keyboard-focus in map-handler
If a client wants keyboard-interactivity this will be processed in the
commit handler.

Remove duplicate (and incorrect) requrests for focus.
2024-03-17 21:18:47 +00:00
Johan Malm
cb361fbb55 layer: change focus better on 'none' keyboard-interactivity request
...and on unmap.

Add `try_to_focus_next_layer_or_toplevel()` which does the following
(in order of precedence):

- Give focus to last added overlay/top layer-shell client with exclusive
  interactivity on the output nearest the pointer (normally the one where
  the users is currently working). The reason for not considering clients
  on all outputs is that giving focus to a client on another output may be
  confusing to the user.

- Give focus to topmost toplevel if one exists (this was done previously
  anyway).
2024-03-17 21:18:47 +00:00
Johan Malm
06bf71162e cursor: use layer_try_set_focus() on press
This means that the logic described in 2ff026b will be used when a
layer-surface is pressed on with a cursor button. For example, a surface
with on-demand keyboard interactivity will not steal focus from a client
with exclusive keyboard interactivity.
2024-03-17 21:18:47 +00:00
Johan Malm
045dd8a378 seat: remove unecessary top/overlay check in seat_set_focus_layer()
Such checks should be made prior to calling the function (which they
are).
2024-03-17 21:18:47 +00:00
Johan Malm
36058a63e2 layer: change logic for giving keyboard-interactivity
Use the following logic:
 - Exclusive: Grant regardless of layer (previously it was only given if
   in top or overlay layers) AND grant if in the same or higher layer
   (nearer overlay) compared with other clients with exclusive
   interactivity.
 - On-demand: Grant only if no other layer-shell client has exclusive
   keyboard interactivity. Previously it was treated the same as
   exclusive.
 - None: Unset focus if the commit associated with the 'none' came from
   the currently focused layer. Previously it was just unset regardless.
2024-03-17 21:18:47 +00:00