]> git.mdlowis.com Git - proto/labwc.git/log
proto/labwc.git
21 months agoinput: expose general cursor motion and button functions
Jens Peters [Sat, 20 Apr 2024 09:33:04 +0000 (11:33 +0200)]
input: expose general cursor motion and button functions

Separate the general logic from the pointer notifications
to allow reuse of those function for other (e.g. tablet)
input sources.

21 months agoAdd action UnMaximize
Johan Malm [Sun, 19 May 2024 17:10:44 +0000 (18:10 +0100)]
Add action UnMaximize

Suggested-by: @Vladimir-csp
Fixes: #1825
21 months agosrc/tearing.c: remove listeners on destroy
Consolatis [Mon, 27 May 2024 14:27:35 +0000 (16:27 +0200)]
src/tearing.c: remove listeners on destroy

21 months agoForEach: initialize view query window_type correctly
Consolatis [Mon, 27 May 2024 17:55:16 +0000 (19:55 +0200)]
ForEach: initialize view query window_type correctly

Before this patch, the window type would be checked even if
not actually requested to do so.

Fixes: #1852
21 months agodecorations: fix handling of SSD/non-SSD windows
Tobias Bengfort [Thu, 23 May 2024 04:53:13 +0000 (06:53 +0200)]
decorations: fix handling of SSD/non-SSD windows

Fixup 41a3b6884630eb3299aa66c2152f1b639242999e

Fixes #1841

21 months agoREADME.md: simplify video link table
Johan Malm [Fri, 24 May 2024 20:11:14 +0000 (21:11 +0100)]
README.md: simplify video link table

21 months agoREADME.md: add link to release video
Johan Malm [Fri, 24 May 2024 19:50:26 +0000 (20:50 +0100)]
README.md: add link to release video

21 months agosrc/config/rcxml.c: ensure parent action is available
Consolatis [Wed, 22 May 2024 01:36:33 +0000 (03:36 +0200)]
src/config/rcxml.c: ensure parent action is available

Before this patch, having a branch or query with an invalid or
missing parent action would trigger an assert when trying to
access the parent. This patch ensures that we bail out instead.

Reported-by: fuyukai via IRC (thanks)
21 months agoReplace `_` with `-` in source file names
tokyo4j [Wed, 22 May 2024 00:56:16 +0000 (09:56 +0900)]
Replace `_` with `-` in source file names

21 months agomagnifier: fix high CPU usage even with magnifier disabled
tokyo4j [Mon, 20 May 2024 11:36:30 +0000 (20:36 +0900)]
magnifier: fix high CPU usage even with magnifier disabled

Fixes the high CPU usage issue reported by @droc12345.

Changing `last_mag != is_magnify_on()` to `last_mag == is_magnify_on()`
works fine, but this check isn't needed in the first place because
magnifier state changes call `wlr_output_schedule_frame()`, which sets
`wlr_output->needs_frame`.

Also added a FIXME comment regarding the performance issue when the
magnifier is enabled.

21 months agodoc: fix inconsistent wording
tokyo4j [Tue, 21 May 2024 11:37:38 +0000 (20:37 +0900)]
doc: fix inconsistent wording

Fixup for 34290ef6

21 months agoIME: support multiple IME popups
tokyo4j [Thu, 16 May 2024 05:57:31 +0000 (14:57 +0900)]
IME: support multiple IME popups

We didn't support multiple IME popups since input-method-v2 protocol
has no way to position them individually, but we should support it to
provide IME developers with more programming flexibility.

21 months agoUpdate consumed_by_frame_context for LAB_SSD_ALL
Simon Long [Thu, 2 May 2024 10:00:23 +0000 (11:00 +0100)]
Update consumed_by_frame_context for LAB_SSD_ALL

21 months agoDocumentation
Simon Long [Wed, 1 May 2024 10:30:55 +0000 (11:30 +0100)]
Documentation

21 months agoAdd All context for mouse events
Simon Long [Wed, 1 May 2024 06:28:17 +0000 (07:28 +0100)]
Add All context for mouse events

21 months agoTranslation updates from weblate
Weblate [Thu, 16 May 2024 04:30:31 +0000 (06:30 +0200)]
Translation updates from weblate

Co-authored-by: tark1998 <tark1998@gmail.com>
21 months agoinput: ignore not supported tablet tools
Jens Peters [Tue, 7 May 2024 17:35:44 +0000 (19:35 +0200)]
input: ignore not supported tablet tools

We currently only support cursor emulation
for absolute motion, thus ignore tools/pens
that use relative motion.

Add a log statement on proximity-in to give
some feedback.

21 months agoinput: remove tablet/pad signal listeners on destroy
Jens Peters [Thu, 11 Apr 2024 21:47:10 +0000 (23:47 +0200)]
input: remove tablet/pad signal listeners on destroy

We should remove those when destroying a tablet
or a tablet pad.

Also rename 'tablet' to 'pad' in 'tablet_pad' for better
readability and consistency.

21 months agoseat: announce pointer capability for tablet tool
Jens Peters [Fri, 26 Apr 2024 15:27:36 +0000 (17:27 +0200)]
seat: announce pointer capability for tablet tool

We use pointer focus for the tablet tool, so we
should also use this capability. There is no
dedicated tablet tool capability.

21 months agodecorations: add SetDecorations action
Tobias Bengfort [Sat, 20 Apr 2024 04:29:51 +0000 (06:29 +0200)]
decorations: add SetDecorations action

21 months agodecorations: make has_ssd public
Tobias Bengfort [Fri, 19 Apr 2024 11:35:16 +0000 (13:35 +0200)]
decorations: make has_ssd public

21 months agodecorations: refactor view_set_decorations
Tobias Bengfort [Thu, 18 Apr 2024 07:46:36 +0000 (09:46 +0200)]
decorations: refactor view_set_decorations

21 months agoDeprecate MoveToCursor
Johan Malm [Sun, 19 May 2024 15:50:53 +0000 (16:50 +0100)]
Deprecate MoveToCursor

Use <action name="AutoPlace" policy="cursor"/> instead.

Related-to: #1785
Suggested-by: @tokyo4j
21 months agosrc/main: delay startup of applications until event loop is ready
Consolatis [Sat, 4 May 2024 20:17:24 +0000 (22:17 +0200)]
src/main: delay startup of applications until event loop is ready

This mostly allows for using scripts that trigger a labwc SIGHUP
to work as expected. Before this patch, there was a race between
the event loop starting up and the autostart scripts executing.

One example of such a use-case is dynamically setting the keyboard
layout or cursor theme via environment variable based on feedback
from a dbus service like discussed in #1588.

21 months agoaction: allow configurable policy in AutoPlace action
Andrew J. Hesford [Tue, 7 May 2024 13:46:05 +0000 (09:46 -0400)]
action: allow configurable policy in AutoPlace action

Closes: #1784.
21 months agoSendToDesktop: ensure we focus the topmost view with follow=no
Consolatis [Sat, 18 May 2024 17:01:02 +0000 (19:01 +0200)]
SendToDesktop: ensure we focus the topmost view with follow=no

Fixes: #1800
21 months agoquery: fix crash on missing identifier/title
Tobias Bengfort [Sat, 20 Apr 2024 07:27:42 +0000 (09:27 +0200)]
query: fix crash on missing identifier/title

21 months agoquery: reuse query logic for window rules
Tobias Bengfort [Sat, 20 Apr 2024 05:58:08 +0000 (07:58 +0200)]
query: reuse query logic for window rules

21 months agoquery: add window type filter for if-actions
Tobias Bengfort [Sat, 20 Apr 2024 05:57:35 +0000 (07:57 +0200)]
query: add window type filter for if-actions

21 months agomagnifier: minor refactor
tokyo4j [Thu, 16 May 2024 00:35:47 +0000 (09:35 +0900)]
magnifier: minor refactor

21 months agoAdd screen magnifier
Simon Long [Wed, 15 May 2024 22:07:23 +0000 (23:07 +0100)]
Add screen magnifier

This adds a screen magnifier which can be controlled with the
`ZoomIn` / `ZoomOut` and `ToggleMagnify` actions.

It scales up part of the rendered framebuffer so the magnification
may end up looking blurry depending on the magnification scale.

PR #1774

21 months agoseat: prevent xwayland from using incorrect keymap (#1816)
Hiroaki Yamamoto [Tue, 14 May 2024 20:15:28 +0000 (05:15 +0900)]
seat: prevent xwayland from using incorrect keymap (#1816)

With commit cafdcd8e, the keyboard from the keyboard group is set to the
seat when the active keyboard is destroyed, but this broke `wtype`
against XWayland surfaces. This is likely because XWayland caches
keycodes from the compositor and convert them with the last keymap
received from the compositor. So when we run `wtype a` over a XWayland
surface, the keycode for `a` is cached by XWayland, the keymap from the
keyboard group is sent to XWayland, then Xwayland converts the keycode
using the keymap from the keyboard group, not the one `wtype` set.

This commit fixes this by setting the keyboard from the keyboard group
to the seat when the keyboard focus is moved to a surface, not when the
active keyboard is destroyed.

21 months agokeybind: allow keybinding "-"
Chloé Vulquin [Mon, 13 May 2024 20:56:25 +0000 (22:56 +0200)]
keybind: allow keybinding "-"

Updates #1811

21 months agodesktop: show/hide `top` layer more smartly
tokyo4j [Mon, 13 May 2024 01:18:28 +0000 (10:18 +0900)]
desktop: show/hide `top` layer more smartly

Before this commit, `top` layers were hidden whenever there is a
fullscreen window in the corresponding output.

With this commit, `top` layers are hidden only when there is a fullscreen
window without other windows above it in the corresponding output.

A caveat is that `bottom` layer is still always hidden by a fullscreen
window.

21 months agoCI: add atof() to banned list
Consolatis [Mon, 13 May 2024 08:56:30 +0000 (10:56 +0200)]
CI: add atof() to banned list

21 months agobuild: bump version to 0.7.2
Johan Malm [Fri, 10 May 2024 20:09:29 +0000 (21:09 +0100)]
build: bump version to 0.7.2

21 months agoNEWS.md: update for 0.7.2
Johan Malm [Sun, 5 May 2024 21:06:36 +0000 (22:06 +0100)]
NEWS.md: update for 0.7.2

22 months agoseat: prevent Chromium from crashing when active keyboard is gone
tokyo4j [Mon, 6 May 2024 14:53:18 +0000 (23:53 +0900)]
seat: prevent Chromium from crashing when active keyboard is gone

Chromium (and slurp) expect wl_keyboard.keymap event to be sent before
wl_keyboard.modifiers event. Normally, wl_keyboard.keymap event is sent
on the client first obtains wl_keyboard with wl_seat.get_keyboard
request.
However, after the active (especially virtual) keyboard is destroyed,
wlroots doesn't respond to wl_seat.get_keyboard request with
wl_keyboard.keymap event since there's no active keyboard on the seat.

Therefore, if we run commands like "sleep 2; wtype hello; chromium", the
active keyboard is destroyed when wtype finishes and
wl_keyboard.modifiers event is sent to Chromium when Chromium first maps
the surface and the keyboard focus is moved to it, then Chromium crashes.

With slurp, fcitx5 and multi-monitor setup, a similar thing happens.
When slurp first creates the layer-shell surfaces, the focus moves to it
(without wl_keyboard.enter though), and fcitx5 is transiently deactivated
and it destroys the virtual keyboard. Then when slurp maps those
surfaces, the focus moves between them again and wl_keyboard.modifiers
event is sent, thus slurp crashes.

So with this commit, when the active keyboard on the seat is destroyed,
the keyboard from the keyboard group is set to the seat instead so
wlroots can respond to wl_seat.get_keyboard request with
wl_keyboard.keymap.

22 months agoview: fix top-layer not showing when there's a minimized full-screen view
Franz Berger [Tue, 7 May 2024 22:25:44 +0000 (00:25 +0200)]
view: fix top-layer not showing when there's a minimized full-screen view

22 months agorc.xml.all: s/y/height/ in WindowRule ReSizeTo comment
01micko [Wed, 8 May 2024 04:18:03 +0000 (14:18 +1000)]
rc.xml.all: s/y/height/ in WindowRule ReSizeTo comment

22 months agoosd: prevent handling cursor actions in preview mode
Consolatis [Fri, 29 Mar 2024 01:53:53 +0000 (02:53 +0100)]
osd: prevent handling cursor actions in preview mode

Fixes: #1640
Co-Authored-By: tokyo4j <hrak1529@gmail.com>
22 months agoxwayland: prevent shaded views from getting mouse events
Consolatis [Sat, 4 May 2024 21:10:45 +0000 (23:10 +0200)]
xwayland: prevent shaded views from getting mouse events

Fixes: #1753
22 months agomenu: reset parser state in `menu_finish()`
tokyo4j [Sun, 5 May 2024 09:41:10 +0000 (18:41 +0900)]
menu: reset parser state in `menu_finish()`

This fixes use-after-free in `fill_item()` on Reconfigure with
invalid `menu.xml` like below:

<openbox_menu>
  <menu id="root-menu">
    <item id="rofi-run" label="Run command">
      <action name="Execute" command="rofi-run" />
    </item>
  </menu>
</openbox_menu>

22 months agocursor: reload cursor on Reconfigure
Consolatis [Fri, 3 May 2024 12:18:43 +0000 (14:18 +0200)]
cursor: reload cursor on Reconfigure

This gives instant feedback when changing cursor theme or size.
It only works for server side cursors or clients using the
cursor-shape protocol.

Fixes: #1619
22 months agocursor: implement <menu><ignoreButtonReleasePeriod>
tokyo4j [Fri, 26 Apr 2024 00:03:17 +0000 (09:03 +0900)]
cursor: implement <menu><ignoreButtonReleasePeriod>

Addresses UX degradation introduced by commit 1d3ed457.

This prevents clicks with small movement with the intention of opening
the menu from unexpectedly closing the menu or selecting a menu item.

22 months agodocs: refer labwc-actions(5), not labwc-action(5)
Tomi Ollila [Mon, 29 Apr 2024 20:51:52 +0000 (23:51 +0300)]
docs: refer labwc-actions(5), not labwc-action(5)

22 months agoview: update top layer visibility on map
tokyo4j [Mon, 29 Apr 2024 08:59:12 +0000 (17:59 +0900)]
view: update top layer visibility on map

Steam's Big Picture Mode window requests fullscreen before mapping.

22 months agossd: don't update ssd if view width is too small
tokyo4j [Sat, 27 Apr 2024 09:15:53 +0000 (18:15 +0900)]
ssd: don't update ssd if view width is too small

Clients can ignore the requsted geometry and negative widths could be
passed to `wlr_scene_rect_set_size()` in `ssd_titlebar_update()` or in
`ssd_border_update()`.

22 months agoview: set LAB_MIN_VIEW_WIDTH equal to total width of buttons
tokyo4j [Fri, 26 Apr 2024 11:08:08 +0000 (20:08 +0900)]
view: set LAB_MIN_VIEW_WIDTH equal to total width of buttons

This fixes pixman error due to a negative width passed to
`wlr_scene_rect_set_size()` in `ssd_titlebar_update()`.

22 months ago.editorconfig: set max_line_length=80 for *.md
Johan Malm [Mon, 22 Apr 2024 19:28:29 +0000 (20:28 +0100)]
.editorconfig: set max_line_length=80 for *.md

22 months ago.editorconfig: set max_line_length=74 for commit-messages
Johan Malm [Mon, 22 Apr 2024 19:18:17 +0000 (20:18 +0100)]
.editorconfig: set max_line_length=74 for commit-messages

...so that "git log" shows things nicely even when it is indented.

22 months agodocs: Fixed some typos, 80 column lines (where possible)
Tomi Ollila [Tue, 23 Apr 2024 18:39:38 +0000 (21:39 +0300)]
docs: Fixed some typos, 80 column lines (where possible)

22 months agoTranslation updates from weblate
Weblate [Sat, 20 Apr 2024 15:23:43 +0000 (17:23 +0200)]
Translation updates from weblate

Co-authored-by: Jouni Järvinen <jounijarvis@gmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: Yannis Drougas <drougas@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/el/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fi/
Translation: Labwc/labwc

22 months agocursor: do action/close menu in successive press & release
tokyo4j [Wed, 24 Apr 2024 09:46:30 +0000 (18:46 +0900)]
cursor: do action/close menu in successive press & release

In OpenBox, when cursor button is pressed to open menu, a subsequent
cursor button release can perform actions or close the menu.
This commit makes labwc follow that behavior.

Fixes: #1750
22 months agoNEWS.md: fix typos
Standreas [Tue, 23 Apr 2024 12:30:21 +0000 (14:30 +0200)]
NEWS.md: fix typos

Closes: #1748 [via git-merge-pr]
22 months agoNEWS.md: interim update
Johan Malm [Mon, 22 Apr 2024 19:10:40 +0000 (20:10 +0100)]
NEWS.md: interim update

22 months agossd: add window drop-shadows (#1648)
David Turner [Mon, 22 Apr 2024 18:27:53 +0000 (19:27 +0100)]
ssd: add window drop-shadows (#1648)

Add optional drop-shadows to windows using server-side decoration.
Shadows can be enabled/disabled rc.xml and their appearance configured
in themerc.  The default is no shadows to preserve current behaviour.

The shadows are drawn in fixed corner and edge buffers shared between
all windows, the edges are scaled to size depending on the size of each
window.  Two sets of buffers are used to give the different appearances
for active and inactive windows.  I use separate corner/edge buffers for
a few reasons:

- It avoids needing to store a separate large shadow buffer per window
- It avoids needing to redraw the shadows when the window is being
  resized
- Compositing the shadows onto the desktop should be faster as there are
  overall fewer pixels to blend, and scaling up the edge buffers only
  requires reading a tiny buffer which is then replicated.

22 months agooverlay: allow to draw both/either of filled/outlined rectangle
tokyo4j [Sat, 20 Apr 2024 17:30:31 +0000 (02:30 +0900)]
overlay: allow to draw both/either of filled/outlined rectangle

Filled/outlined rectangles shown as snapping overlay are now enabled/disabled
independently with `snapping.overlay.[region|edge].bg.enabled` and
`snapping.overlay.[region|edge].border.enabled`.

To keep the default behavior, `*.bg.enabled` is yes and `*.border.enabled` is
no for hardware-based renderers, while `*.bg.enabled` is no and
`*.border.enabled` is yes for software-based (pixman) renderer.

Users can now use a filled rectangle as an overlay even with pixman renderer.
However, this may severely impact performance when used with translucent
`snapping.overlay.[region|edge].bg.color`.

This commit includes a refactor to use substruct `theme_snapping_overlay`
inside `theme` in order to pass it to `create_overlay_rect()` in a cleaner way.

Breaking changes is:
- `snapping.overlay.[region|edge].fill` is now removed.

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