]> git.mdlowis.com Git - proto/labwc.git/log
proto/labwc.git
22 months agooverlay: s/preview/overlay/
tokyo4j [Sat, 20 Apr 2024 17:22:28 +0000 (02:22 +0900)]
overlay: s/preview/overlay/

Replace "preview" in rc.xml and themerc with "overlay" since "preview" sounds
like it shows the window content.

Breaking changes are:
- `snapping.preview.*` in themerc is now replaced with `snapping.overlay`.
- `<snapping><preview>` in rc.xml is now replaced with `<snapping><overlay>`.

22 months agoFix pid lookup for the Kill action
Consolatis [Mon, 22 Apr 2024 15:43:46 +0000 (17:43 +0200)]
Fix pid lookup for the Kill action

Before this patch, labwc would happily kill itself when the user
called the `Kill` action when any xwayland view had focus.

The reason this happened was that wlroots creates the xwayland
wayland client via socketpair() and thus a lookup of the pid
of the socket connection would return the pid of labwc itself.

This patch fixes that by implementing different pid lookup
mechanisms based on the view implementation backend.

Fixes: #1739
22 months agoadd .scd to editorconfig
Tobias Bengfort [Sat, 20 Apr 2024 09:56:23 +0000 (11:56 +0200)]
add .scd to editorconfig

22 months agoworkspaces: react to Reconfigure
tokyo4j [Wed, 17 Apr 2024 09:09:01 +0000 (18:09 +0900)]
workspaces: react to Reconfigure

Changes in `<desktops><names>` or `<desktop><number="" prefix="">` required
restarting labwc to take effect.

This commit adds `workspaces_reconfigure()` to update `server->workspaces` on
Reconfigure.

22 months agoFix some header includes detected by clangd
Hiroaki Yamamoto [Sun, 21 Apr 2024 19:58:57 +0000 (04:58 +0900)]
Fix some header includes detected by clangd

There were some missing headers like <stddef.h> for `NULL`, <wayland-util.h>
for `wl_link` and <stdbool.h> for `true`/`false`.

Also this commit fixes that `labwc.h` and `ime.h` included each other.

22 months agowindow-rules: add ignoreConfigureRequest
Consolatis [Sat, 13 Apr 2024 18:36:09 +0000 (20:36 +0200)]
window-rules: add ignoreConfigureRequest

This allows to ignore X11 client side configure requests
like positioning and resizing and can be used to fight
some X11 applications that persist to have their windows
spawn at specific places and sizes.

Fixes: #1446
22 months agoserver: refactor to avoid *g_server
Johan Malm [Sun, 21 Apr 2024 14:47:24 +0000 (15:47 +0100)]
server: refactor to avoid *g_server

No functional change intended.

22 months agowindow-rules: implement type filter
Tobias Bengfort [Fri, 19 Apr 2024 18:15:49 +0000 (20:15 +0200)]
window-rules: implement type filter

Co-Authored-By: Grigory Kirillov <txgk@bk.ru>
22 months agoIME: prevent virtual keyboard from unintentionally releasing modifiers (#1721)
Hiroaki Yamamoto [Thu, 18 Apr 2024 20:57:03 +0000 (05:57 +0900)]
IME: prevent virtual keyboard from unintentionally releasing modifiers (#1721)

When Fcitx5 is activated, it creates a virtual keyboard to send keycodes to
applications, then creates a keyboard grab to capture keycodes the user typed.

Before this commit, we set keyboard grab's modifiers to that of currently
active keyboard, which is the virtual keyboard created in the case described
above. However, since the modifiers of the virtual keyboard is empty at first,
we actually set empty modifiers, even when the user is pressing modifiers.
Then, Fcitx5 assumes no modifiers is pressed and redirect the modifier state
back to the compositor via the virtual keyboard. As a result, when the focus
is switched between windows by workspace-switcher, the workspace-switcher is
immediately terminated.

To fix this issue, with this commit, the modifier state of the currently active
keyboard is not set to the keyboard grab if the keyboard is a virtual keyboard
created by the same input-method client.

Fcitx5's commit below is also required to fix the issue.
https://github.com/fcitx/fcitx5/commit/b2924bd361680c493463d240a375b3f0948ae48d

22 months agoadd .clang-format (with a disclaimer)
John Lindgren [Thu, 18 Apr 2024 01:25:40 +0000 (21:25 -0400)]
add .clang-format (with a disclaimer)

.clang-format gets picked up nowadays by some IDEs (tested Qt Creator)
for auto-formatting aids. With the large caveat that it's not 100%
accurate to labwc's preferred coding style, I've found that this config
gets it right 90% of the time, which is enough to be helpful.

I added a prominent disclaimer comment to the top of the file to warn
people away from relying completely on clang-format. This isn't meant
to replace manual attention to formatting details (or to replace
./scripts/check) but I think it doesn't hurt.

22 months agoexclude IDE settings in .gitignore
John Lindgren [Thu, 18 Apr 2024 03:07:50 +0000 (23:07 -0400)]
exclude IDE settings in .gitignore

.cache/ is created by Visual Studio Code
*.user are files created by Qt Creator

22 months agocommon/buf: rename buf->buf to buf->data
John Lindgren [Wed, 17 Apr 2024 03:36:32 +0000 (23:36 -0400)]
common/buf: rename buf->buf to buf->data

22 months agocommon/buf: use string_null_or_empty()
John Lindgren [Wed, 17 Apr 2024 00:45:16 +0000 (20:45 -0400)]
common/buf: use string_null_or_empty()

22 months agocommon: remove buf_init(), add BUF_INIT and buf_move()
John Lindgren [Sun, 14 Apr 2024 18:20:57 +0000 (14:20 -0400)]
common: remove buf_init(), add BUF_INIT and buf_move()

Add a BUF_INIT macro, which makes it easier to initialize a struct buf
to an empty string (without a heap allocation).

Add buf_move() to move the contents of one struct buf to another (the
source is reset to BUF_INIT, analogous to C++ move-assignment).

Use buf_reset() instead of directly calling `free(s->buf)` since the
internal buf may not always be allocated by malloc() now.

22 months agotreewide: properly clear the buffer
Consolatis [Sat, 16 Mar 2024 18:03:06 +0000 (19:03 +0100)]
treewide: properly clear the buffer

Before this patch, the OSD would repeat the last buffer
content in case the new buffer content would be empty.

This was mostly happening for the `title` OSD field that is intended
to be empty when it matches the app_id / WM_CLASS of the application.
Due to only buffer.len being reset but its internal allocations being
untouched, buffer.buf would still carry the old data.

This patch fixes it by also overwriting the first byte in the buffer
allocation with '\0' via the new `buf_clear()` function.

Do the same for buf_expand_shell_variables() although that one should
have been fine before as it always writes new data to the buffer.

22 months agosession: sort directory entries in environment.d
Andrew J. Hesford [Tue, 16 Apr 2024 11:11:18 +0000 (07:11 -0400)]
session: sort directory entries in environment.d

22 months agoosd: add theme settings for window-switcher preview
tokyo4j [Mon, 15 Apr 2024 11:22:44 +0000 (20:22 +0900)]
osd: add theme settings for window-switcher preview

Adds theme settings like:
osd.window-switcher.preview.border.width: 2
osd.window-switcher.preview.border.color: #ffffff,#00a2ff,#ffffff

22 months agographic-helpers: prevent multi-rect edges from overlapping
tokyo4j [Sat, 13 Apr 2024 13:32:06 +0000 (22:32 +0900)]
graphic-helpers: prevent multi-rect edges from overlapping

Multi-rect edges overlapping is problematic with translucent colors.

22 months agooverlay: add theme settings for colors and border width
tokyo4j [Sat, 13 Apr 2024 17:26:36 +0000 (02:26 +0900)]
overlay: add theme settings for colors and border width

adds theme settings like:
snapping.overlay.[region|edge].bg.color: #8080b380
snapping.overlay.[region|edge].border.color: #ffffff,#000000,#ffffff
snapping.overlay.[region|edge].border.width: 1

22 months agooverlay: add theme setting `snapping.preview.[region|edge].fill`
tokyo4j [Sat, 13 Apr 2024 17:24:36 +0000 (02:24 +0900)]
overlay: add theme setting `snapping.preview.[region|edge].fill`

This settings allows user to choose whether to draw a filled rectangle
or an outlined rectangle as the preview for window snapping.

22 months agooverlay: add `inactivate_overlay()` as refactoring
tokyo4j [Sat, 13 Apr 2024 17:53:10 +0000 (02:53 +0900)]
overlay: add `inactivate_overlay()` as refactoring

This change brings a subtle behavioral change that region overlay is hidden
immediately when the timer for edge overlay starts.

22 months agooverlay: remove checks already done in wlroots side
tokyo4j [Tue, 9 Apr 2024 10:12:51 +0000 (19:12 +0900)]
overlay: remove checks already done in wlroots side

22 months agodoc: enhance documentation on fallback values for OSD style
tokyo4j [Sun, 14 Apr 2024 12:32:34 +0000 (21:32 +0900)]
doc: enhance documentation on fallback values for OSD style

22 months agothemerc: fix default value of `osd.bg.color`
tokyo4j [Sun, 14 Apr 2024 12:04:52 +0000 (21:04 +0900)]
themerc: fix default value of `osd.bg.color`

22 months agodoc: enhance documentation on `border.color`
tokyo4j [Sun, 14 Apr 2024 12:04:24 +0000 (21:04 +0900)]
doc: enhance documentation on `border.color`

22 months agodocs: add missing documention for the ForEach none branch
Consolatis [Sun, 14 Apr 2024 11:19:00 +0000 (13:19 +0200)]
docs: add missing documention for the ForEach none branch

22 months agosrc/action.c: add none branch to the ForEach action
nicolas3121 [Sat, 13 Apr 2024 19:24:04 +0000 (21:24 +0200)]
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
22 months agoAdd -S|--session <command> option
Johan Malm [Sat, 9 Mar 2024 17:12:54 +0000 (17:12 +0000)]
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
22 months agoserver: don't create headless backend twice
Consolatis [Sat, 13 Apr 2024 08:01:30 +0000 (10:01 +0200)]
server: don't create headless backend twice

This may happen when running with WLR_BACKENDS=headless.

Fixes: #1618
22 months agoinput: notify idle manager when emulating cursor move
Jens Peters [Fri, 12 Apr 2024 21:21:39 +0000 (23:21 +0200)]
input: notify idle manager when emulating cursor move

Looks like we forgot that one earlier.

22 months agoosd: add window-switcher custom field (#1670)
droc12345 [Wed, 10 Apr 2024 22:39:31 +0000 (17:39 -0500)]
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)
22 months agosnap: cache and ignore last-snapped edge when growing or shrinking
Andrew J. Hesford [Tue, 2 Apr 2024 19:58:50 +0000 (15:58 -0400)]
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.

22 months agoTranslation updates from weblate
Weblate [Mon, 8 Apr 2024 13:23:39 +0000 (15:23 +0200)]
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

22 months agosrc/layer.c: deal with wlroots scene graph running out of memory
Consolatis [Mon, 8 Apr 2024 15:59:39 +0000 (17:59 +0200)]
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.

22 months agosrc/ssd/ssd_part.c: ensure button is found
Consolatis [Mon, 8 Apr 2024 15:56:56 +0000 (17:56 +0200)]
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.

22 months agoCI: enable gcc static analyzer
Consolatis [Mon, 8 Apr 2024 15:32:16 +0000 (17:32 +0200)]
CI: enable gcc static analyzer

22 months agooutput: ensure we don't run into an assert() on VT switch
Consolatis [Mon, 8 Apr 2024 14:29:20 +0000 (16:29 +0200)]
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
22 months agosrc/theme.c: support inline alpha encoding like #aabbccff
Consolatis [Sun, 7 Apr 2024 15:25:40 +0000 (17:25 +0200)]
src/theme.c: support inline alpha encoding like #aabbccff

.. and mark the current `#rrggbb aaa` encoding as deprecated.

23 months agocommon/font: avoid rendering semi-transparent background twice
John Lindgren [Sun, 7 Apr 2024 07:26:16 +0000 (03:26 -0400)]
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
23 months agoosd: support percent values for window switcher width
Droc [Tue, 26 Mar 2024 10:12:19 +0000 (05:12 -0500)]
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%

23 months agodocs: 80 column lines (where possible), drop trailing whitespace
Tomi Ollila [Sun, 31 Mar 2024 18:19:59 +0000 (21:19 +0300)]
docs: 80 column lines (where possible), drop trailing whitespace

with one typofix

23 months agoUse pre-multiplied colors by default
Consolatis [Sat, 6 Apr 2024 15:46:30 +0000 (17:46 +0200)]
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
23 months agocursor: fix dnd bug
Johan Malm [Sat, 6 Apr 2024 20:46:17 +0000 (21:46 +0100)]
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
23 months agocursor: send release event to CSD client before finishing window dragging
tokyo4j [Fri, 5 Apr 2024 09:01:06 +0000 (18:01 +0900)]
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.

23 months agooverlay: add snap-to-edge overlay (PR #1652)
Hiroaki Yamamoto [Fri, 5 Apr 2024 02:35:31 +0000 (11:35 +0900)]
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.

23 months agoTranslation updates from weblate
Weblate [Wed, 27 Mar 2024 22:23:35 +0000 (23:23 +0100)]
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

23 months agocommon: validate and properly parse floats
Andrew J. Hesford [Thu, 28 Mar 2024 02:13:50 +0000 (22:13 -0400)]
common: validate and properly parse floats

Fixes: #1665.
23 months agocursor: validate double-click against SSD part type
Johan Malm [Mon, 25 Mar 2024 21:49:46 +0000 (21:49 +0000)]
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
23 months agodocs: Refer to calibration matrix
Jens Peters [Tue, 26 Mar 2024 19:21:02 +0000 (20:21 +0100)]
docs: Refer to calibration matrix

23 months agolayer: try to set keyboard focus on map
Johan Malm [Sun, 24 Mar 2024 19:31:29 +0000 (19:31 +0000)]
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
23 months agomenu: support pipe menus
Johan Malm [Tue, 31 Oct 2023 21:36:45 +0000 (21:36 +0000)]
menu: support pipe menus

See labwc-menu(5) for usage.

Co-authored-by: @Consolatis
23 months agocommon/spawn.c: add spawn_piped()
Consolatis [Mon, 18 Mar 2024 05:15:15 +0000 (06:15 +0100)]
common/spawn.c: add spawn_piped()

23 months agomenu: move already-on-selected-item check
Johan Malm [Tue, 31 Oct 2023 21:21:20 +0000 (21:21 +0000)]
menu: move already-on-selected-item check

...menu_process_item_selection() as the previous variant did not work.

23 months agomenu: minor refactor of menu_configure()
Johan Malm [Tue, 31 Oct 2023 21:13:41 +0000 (21:13 +0000)]
menu: minor refactor of menu_configure()

23 months agomenu: s/menu_open/menu_open_root/
Johan Malm [Tue, 31 Oct 2023 21:08:04 +0000 (21:08 +0000)]
menu: s/menu_open/menu_open_root/

...to be consistent with the 'close' equivalent

23 months agolabwc-config(5): clarify applicability of element/attribute (#1655)
Johan Malm [Sun, 24 Mar 2024 21:32:27 +0000 (21:32 +0000)]
labwc-config(5): clarify applicability of element/attribute (#1655)

Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
23 months agoCONTRIBUTING.md: add Gentoo overlay maintainer
Consolatis [Fri, 22 Mar 2024 20:54:11 +0000 (21:54 +0100)]
CONTRIBUTING.md: add Gentoo overlay maintainer

23 months agoNEWS.md: interim update
Johan Malm [Thu, 21 Mar 2024 21:36:17 +0000 (21:36 +0000)]
NEWS.md: interim update

23 months agorcxml: add missing check for calibrationMatrix
SnowNF [Thu, 21 Mar 2024 08:46:44 +0000 (16:46 +0800)]
rcxml: add missing check for calibrationMatrix

23 months agorcxml: improve parse calibrationMatrix
SnowNF [Wed, 20 Mar 2024 08:19:49 +0000 (16:19 +0800)]
rcxml: improve parse calibrationMatrix

23 months agodocs: fix format in calibrationMatrix section
SnowNF [Wed, 20 Mar 2024 05:09:21 +0000 (13:09 +0800)]
docs: fix format in calibrationMatrix section

23 months agodocs: fix scdoc build
SnowNF [Wed, 20 Mar 2024 04:51:54 +0000 (12:51 +0800)]
docs: fix scdoc build

23 months agodocs: add calibrationMatrix section for libinput
SnowNF [Wed, 20 Mar 2024 04:17:21 +0000 (12:17 +0800)]
docs: add calibrationMatrix section for libinput

23 months agoOptimize the code based on the suggestions
SnowNF [Wed, 20 Mar 2024 03:31:42 +0000 (11:31 +0800)]
Optimize the code based on the suggestions

23 months agolibinput: add support for touchscreen set matrix
SnowNF [Tue, 19 Mar 2024 19:32:41 +0000 (03:32 +0800)]
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.

23 months agoworkspaces.c: fix bug with RTL locales, closes #1633
01micko [Mon, 18 Mar 2024 10:58:18 +0000 (20:58 +1000)]
workspaces.c: fix bug with RTL locales, closes #1633

23 months agosrc/xdg-popup.c: unconstrain popup within usable area
tokyo4j [Wed, 13 Mar 2024 11:01:16 +0000 (20:01 +0900)]
src/xdg-popup.c: unconstrain popup within usable area

23 months agoxwayland: fix segv bug when starting game
Johan Malm [Sun, 17 Mar 2024 21:06:46 +0000 (21:06 +0000)]
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
23 months agolayer: do not focus on-demand clients in commit-handler
Johan Malm [Sat, 16 Mar 2024 20:58:00 +0000 (20:58 +0000)]
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.

23 months agolayer: do not change keyboard-focus in map-handler
Johan Malm [Sat, 9 Mar 2024 15:04:44 +0000 (15:04 +0000)]
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.

23 months agolayer: change focus better on 'none' keyboard-interactivity request
Johan Malm [Sat, 9 Mar 2024 15:03:26 +0000 (15:03 +0000)]
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).

23 months agocursor: use layer_try_set_focus() on press
Johan Malm [Sat, 9 Mar 2024 10:48:52 +0000 (10:48 +0000)]
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.

23 months agoseat: remove unecessary top/overlay check in seat_set_focus_layer()
Johan Malm [Sat, 9 Mar 2024 10:33:34 +0000 (10:33 +0000)]
seat: remove unecessary top/overlay check in seat_set_focus_layer()

Such checks should be made prior to calling the function (which they
are).

23 months agolayer: change logic for giving keyboard-interactivity
Johan Malm [Sat, 9 Mar 2024 10:31:47 +0000 (10:31 +0000)]
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.

23 months agoxwayland: exclude unfocusable views from wlr-foreign-toplevel
John Lindgren [Sun, 17 Mar 2024 20:16:24 +0000 (16:16 -0400)]
xwayland: exclude unfocusable views from wlr-foreign-toplevel

These views (notifications, floating toolbars, etc.) should not be
shown in taskbars/docks/etc. (which are the stated use-case of the
wlr-foreign-toplevel protocol).

23 months agocommon: render text buffers with opaque background
John Lindgren [Sun, 17 Mar 2024 02:20:40 +0000 (22:20 -0400)]
common: render text buffers with opaque background

After a roundabout discussion[1] with wlroots devs, it's become apparent
that subpixel text rendering (a.k.a. "ClearType") does not work properly
when rendering over a transparent background, as labwc currently does.

Basically it comes down to the fact that the color of semi-transparent
pixels (which is adjusted redder or bluer to compensate for RGB subpixel
alignment) depends somewhat on background color. When rendering over
transparency, the text engine doesn't know the intended background color
and can't adjust the pixel colors correctly.

With Pango/Cairo, the end result can range from grayscale rendering (no
subpixel rendering at all) to wrong/oversaturated colors (for example,
bright pink pixels when rendering white text on blue background).

This change solves the issue by first filling the text buffer with an
opaque background color before rendering the text over it. Currently,
this is easy since the background is always a solid color. It may be a
little more complex (but doable) if we implement gradients in future.

Note that GTK 4 (and to some degree, recent versions of Microsoft
Windows) avoid this issue by disabling subpixel rendering altogether. I
would much prefer that labwc NOT do this -- it results in noticeably
blurrier text on non-retina LCD screens, which are still common.

[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3822

23 months agoNLS: translate "Workspaces" in rcxml.c
M A [Sun, 17 Mar 2024 05:23:41 +0000 (15:23 +1000)]
NLS: translate "Workspaces" in rcxml.c

Fixes: #1630
23 months agoCI: ensure Void has a font installed
Consolatis [Sat, 16 Mar 2024 17:16:44 +0000 (18:16 +0100)]
CI: ensure Void has a font installed

Otherwise the runtime test randomly fails due to
strange pango behavior. This is a workaround for
the issue and not a permanent fix.

A full investigation into pango internals is required
to figure out why `pango_layout_get_extents()` returns
invalid data after the first call. See PR #1627 for a
testcase.

23 months agoCI: rewrite smoke test and support LABWC_RUNS env var
Consolatis [Sat, 16 Mar 2024 17:02:01 +0000 (18:02 +0100)]
CI: rewrite smoke test and support LABWC_RUNS env var

23 months agosrc/common/buf.c: enhance the buffer API
Consolatis [Sat, 16 Mar 2024 03:39:45 +0000 (04:39 +0100)]
src/common/buf.c: enhance the buffer API

There is at least one user of the buffer API that reuse a single
buffer by just resetting `buf.len` to `0`. This works as long as
the new user of the buffer actually adds something to the buffer.

However, if we don't add anything but still provide `buf.buf` to
a consumer, the old content will be re-used.

This patch thus adds two new clearing variants to the buffer API:
- `buf_clear()` which doesn't reset the internal allocations
- `buf_reset()` which does free the internal allocations

Additionally, this patch makes `buffer_add_char()` public which
allows adding single characters to an existing buffer. This will
be used in a future PR which implements custom format strings for
the OSD.

23 months agoosd: add window-switcher field content types (#1623)
droc12345 [Sat, 16 Mar 2024 15:28:37 +0000 (10:28 -0500)]
osd: add window-switcher field content types (#1623)

...`workspace`, `state`, `type_short` and `output`.

Example usage:

    <windowSwitcher allWorkspaces="yes">
      <fields>
        <field content="workspace" width="5%" />
        <field content="state" width="3%" />
        <field content="type_short" width="3%" />
        <field content="output" width="9%" />
        <field content="identifier" width="30%" />
        <field content="title" width="50%" />
      </fields>
    </windowSwitcher>

23 months agoTranslation updates from weblate
Weblate [Fri, 15 Mar 2024 16:23:30 +0000 (17:23 +0100)]
Translation updates from weblate

Co-authored-by: Hiroaki Yamamoto <hrak1529@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ja/
Translation: Labwc/labwc

23 months agoTranslation updates from weblate
Weblate [Tue, 12 Mar 2024 21:48:48 +0000 (22:48 +0100)]
Translation updates from weblate

Co-authored-by: Abdullah Albaroty <albaroty@gmail.com>
Co-authored-by: Hiroaki Yamamoto <hrak1529@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: alwanasary <baity.jannati@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ar/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/id/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ja/
Translation: Labwc/labwc

23 months agoIME: support IME popup
tokyo4j [Thu, 22 Feb 2024 18:50:55 +0000 (03:50 +0900)]
IME: support IME popup

23 months agoCI: add simple runtime test
Consolatis [Wed, 13 Mar 2024 14:26:16 +0000 (15:26 +0100)]
CI: add simple runtime test

23 months agoaction: allow client-menu to open at mouse cursor
Andrew J. Hesford [Sun, 10 Mar 2024 18:28:41 +0000 (14:28 -0400)]
action: allow client-menu to open at mouse cursor

23 months agosession: Don't close a null dir in read_environment_dir
Scarcely There [Wed, 13 Mar 2024 05:22:49 +0000 (00:22 -0500)]
session: Don't close a null dir in read_environment_dir

Closes: #1615 [via git-merge-pr]
23 months agosession: abort process_line early if line contains no key
Andrew J. Hesford [Wed, 13 Mar 2024 10:14:55 +0000 (06:14 -0400)]
session: abort process_line early if line contains no key

23 months agokeyboard: use 'us' as fallback for XKB_DEFAULT_LAYOUT
Johan Malm [Mon, 11 Mar 2024 22:04:52 +0000 (22:04 +0000)]
keyboard: use 'us' as fallback for XKB_DEFAULT_LAYOUT

...if keymap cannot be created for the provided XKB_DEFAULT_LAYOUT.

If keymap still cannot be created, exit with a helpful message to avoid
crash that is hard to understand.

Fixes: https://github.com/stefonarch/lxqt-labwc-session/issues/7
23 months agoReload cursor theme and size on reconfigure
Simon Long [Tue, 12 Mar 2024 19:53:41 +0000 (19:53 +0000)]
Reload cursor theme and size on reconfigure

Fixes: #1587
23 months agodocs/labwc-config.5: fix "environment directory" typo
Andrew J. Hesford [Tue, 12 Mar 2024 11:35:42 +0000 (07:35 -0400)]
docs/labwc-config.5: fix "environment directory" typo

23 months agoworkspaces: add ability to set prefix when using number argument
droc12345 [Mon, 11 Mar 2024 22:19:03 +0000 (17:19 -0500)]
workspaces: add ability to set prefix when using number argument

23 months agosession: process environment.d and allow empty variables
Andrew J. Hesford [Sat, 9 Mar 2024 17:03:30 +0000 (12:03 -0500)]
session: process environment.d and allow empty variables

1. All '*.env' files in an 'environment.d' directory alongside each
   potential 'environment' file will be parsed and added to the
   environment.

2. For the purposes of configuration merging, an environment definition
   exists at one level if either the 'environment' file is defined or
   its corresponding 'environment.d' contains any valid '*.env' file.

3. Variable declarations of the form "VARIABLE=", with no following
   value, will be written to the environment as empty strings.

23 months agodocs/labwc-config.5.scd: fix typo
Standreas [Mon, 11 Mar 2024 07:17:52 +0000 (08:17 +0100)]
docs/labwc-config.5.scd: fix typo

23 months agoREADME.md: add alt-space binding
Jens Peters [Sun, 10 Mar 2024 18:38:33 +0000 (19:38 +0100)]
README.md: add alt-space binding

That one was missing in the default bindings.

2 years agocursor: process layer subsurfaces in `cursor_button_press()`
Johan Malm [Thu, 7 Mar 2024 19:15:02 +0000 (19:15 +0000)]
cursor: process layer subsurfaces in `cursor_button_press()`

...to give keyboard focus to layer-shell clients if exclusive or on-demand
interactivity is set, so that menu popups can be navigated with the
keyboard. This still only works if the client is in top (or overlay)
layers. Support for bottom and background to be done as a separate patch
set.

Revert 06b19f0 to process layer-shell subsurfaces in
`cursor_button_press()`, but only when their parent layer-shell surface
has keyboard interactivity.

Fix bug in `get_cursor_context()` which resulted in layer-surfaces not
being detected correctly.

Background:

Commit 06b19f0 (issue #1131) disabled processing of layer-shell
subsurfaces in cursor_button_press() because when pressing a task in
Waybar (Gtk panel using layer-shell subsurfaces) the foreign-toplevel
minimize-raise action did not work correctly as the action logic relied on
the recipient window being activated and by clicking on the panel, the
panel itself was both surface-focusd and activated (and thus the window
de-activated).

The un-intended consequence was that by not responding to layer-subsurface
cursor buttons presses, layer-shell clients (such as panels) were not
given keyboard focus if they indeed wanted it by setting exclusive or
on-demand keyboard interactivity.

The good news is that that following @jlindgren90's refactoring (various)
the only place where we call `view_set_actived()` is in
`focus_change_notify()` in `seat.c` and we now only do it for views
(bb8f0bc).

Another side-effect (positive) of 06b19f0 was that a Waybar dnd bug was
fixed (pointer-serial-number validation failure).

Have tested with sfwbar, waybar and tint (test-panel) the following
results:
- Minimize-raise works even when on-demand keyboard interactivity is set
- Keyboard interactivity is given popup-menus (sfwbar and tint) when the
  panels are in the top layer (support for bottom will be as a separate
  patch set)
- Waybar dnd still works (even when hard-coding keyboard-interactivity)

References:
- https://github.com/labwc/labwc/commit/bb8f0bc960dca192b8579d67297c0586ec20bfe0
- https://github.com/labwc/labwc/blob/40ce95a68cf19796dd67b0527fddfdbe46181805/src/seat.c#L481-L483
- https://github.com/labwc/labwc/blob/40ce95a68cf19796dd67b0527fddfdbe46181805/src/dnd.c#L24
- https://github.com/johanmalm/tint

Fixes: #1572
2 years agoFix various typos across the codebase
Hiroaki Yamamoto [Fri, 8 Mar 2024 12:59:20 +0000 (21:59 +0900)]
Fix various typos across the codebase

2 years agoAdd optional headless fallback output
Consolatis [Thu, 7 Mar 2024 01:11:46 +0000 (02:11 +0100)]
Add optional headless fallback output

This allows configuring a headless fallback output that
is automatically created whenever there is no other output
around. It is destroyed when a new output is discovered.

It can be enabled by setting the environment variable
LABWC_FALLBACK_OUTPUT to the desired output name.

The feature benefits applications like wayvnc the most
as there is always an output available to connect to.

Co-Authored-By: Simon Long <simon@raspberrypi.com>
2 years agoview: validate move/resize request from clients
tokyo4j [Thu, 7 Mar 2024 15:53:39 +0000 (00:53 +0900)]
view: validate move/resize request from clients

Move/resize requests from xwayland views and xdg toplevels should be
ignored when the view is not pressed.

This is relevant for touchpad taps with <tapAndDrag> disabled.

When the user taps the client surface (e.g. chromium and mpv) with the
setting above, libinput sends button press & release signals so quickly
that the compositor receives move/resize request from the client AFTER
the button release signal is processed, so `interactive_finish()` is
never called.

2 years agostyle: prettify comments
tokyo4j [Thu, 7 Mar 2024 15:45:04 +0000 (00:45 +0900)]
style: prettify comments

Prettify comments formatted by clang-format at commit 77328698