]> git.mdlowis.com Git - proto/labwc.git/log
proto/labwc.git
13 months agosrc/menu: add support for scalable menu icons
Consolatis [Mon, 6 Jan 2025 06:34:16 +0000 (07:34 +0100)]
src/menu: add support for scalable menu icons

13 months agosrc/config: let icon theme name default to theme
Consolatis [Wed, 29 Jan 2025 11:25:41 +0000 (12:25 +0100)]
src/config: let icon theme name default to theme

13 months agodocs/labwc-menu: we only support a single menu.xml file
Consolatis [Mon, 27 Jan 2025 16:16:15 +0000 (17:16 +0100)]
docs/labwc-menu: we only support a single menu.xml file

13 months agoREADME.md: fix minor grammar error, add libsfdo as optional dependency
01micko [Sat, 1 Feb 2025 09:48:22 +0000 (19:48 +1000)]
README.md: fix minor grammar error, add libsfdo as optional dependency

13 months agowlr-foreign: send output_enter on initialization
tokyo4j [Mon, 27 Jan 2025 02:05:31 +0000 (11:05 +0900)]
wlr-foreign: send output_enter on initialization

This fixes a bug that output_enter events are not sent when a Slack
window running in background is re-mapped, which caused missing taskbar
items in Waybar when it's configured to show windows per output.

13 months agosurface-helpers: reduce log spam
Consolatis [Sat, 25 Jan 2025 21:14:50 +0000 (22:14 +0100)]
surface-helpers: reduce log spam

This shows up when processing out-of-surface movement on subsurfaces.

13 months agocursor.c: use subsurface as reference for out-of-surface movement
Consolatis [Sat, 25 Jan 2025 20:45:54 +0000 (21:45 +0100)]
cursor.c: use subsurface as reference for out-of-surface movement

The protocol states that the wl_pointer motion coordinates must be
relative to the focused surface (e.g. the surface that last received
a wl_pointer enter event).

Before this patch, the coordinates were relative to the toplevel
surface instead, resulting in subsurface events having the wrong
coordinates when pressing a button over a subsurface and moving
the cursor outside of that subsurface.

Fixes: #2542
13 months agoAdd <theme><fallbackAppIcon>
tokyo4j [Sun, 12 Jan 2025 07:52:37 +0000 (16:52 +0900)]
Add <theme><fallbackAppIcon>

This commit adds <theme><fallbackAppIcon> that configures the icon name
to be used when lookups for an application icon is failed. Its default
value is set as 'labwc' which shows our labwc logo.

13 months agossd: dynamically look up window icons in titlebar for output scales
tokyo4j [Sun, 12 Jan 2025 07:43:49 +0000 (16:43 +0900)]
ssd: dynamically look up window icons in titlebar for output scales

by introducing scaled_icon_buffer.

13 months agostring-helpers: add str_equal()
tokyo4j [Wed, 8 Jan 2025 06:07:06 +0000 (15:07 +0900)]
string-helpers: add str_equal()

13 months agoimg: remove padding_x from lab_img_render()
tokyo4j [Thu, 9 Jan 2025 08:20:08 +0000 (17:20 +0900)]
img: remove padding_x from lab_img_render()

padding_x in lab_img_render() was just to make sure window icons in the
titlebar doesn't get too close to adjacent buttons and it didn't felt
clean. To remove it from lab_img, this commit changes the size of window
icon buffers from (window.button.width)x(window.button.height) to
(window.button.width * 0.8)x(window.button.height) and horizontally
slide it by (window.button.width * 0.1) to keep the horizontal padding.

Note that the size of the hitbox for a window icon is kept the same and
nothing is changed from user's perspective.

13 months agoMove "#if HAVE_LIBSFDO" inside desktop-entry.h
tokyo4j [Sun, 12 Jan 2025 11:49:05 +0000 (20:49 +0900)]
Move "#if HAVE_LIBSFDO" inside desktop-entry.h

13 months agorefactor: add LAB_BS_DEFAULT in lab_button_state
tokyo4j [Mon, 13 Jan 2025 15:04:15 +0000 (00:04 +0900)]
refactor: add LAB_BS_DEFAULT in lab_button_state

13 months agodocs: fix incorrect default for window.label.text.justify
Dima Krasner [Fri, 24 Jan 2025 10:02:19 +0000 (12:02 +0200)]
docs: fix incorrect default for window.label.text.justify

13 months agoview: replace content_node with content_tree
tokyo4j [Sun, 19 Jan 2025 06:49:39 +0000 (15:49 +0900)]
view: replace content_node with content_tree

13 months agossd: fix InactiveWindow font not working
tokyo4j [Wed, 22 Jan 2025 11:56:29 +0000 (20:56 +0900)]
ssd: fix InactiveWindow font not working

13 months agoime: cleanup new_popup_surface listener when destroy
yuiiio [Sat, 18 Jan 2025 21:33:43 +0000 (06:33 +0900)]
ime: cleanup new_popup_surface listener when destroy

13 months agoxdg: cleanup request_show_window_menu listener when destroy
yuiiio [Wed, 15 Jan 2025 21:49:04 +0000 (06:49 +0900)]
xdg: cleanup request_show_window_menu listener when destroy

13 months agocursor: don't leak bound scroll events from touchpad to clients
tokyo4j [Sat, 11 Jan 2025 14:36:58 +0000 (23:36 +0900)]
cursor: don't leak bound scroll events from touchpad to clients

Prior to this commit, when we receive fine-grained scroll events from
touchpads that are bound to any mousebind, we leaked the scroll events to
the client unless the accumulated scroll delta exceeds the fixed threshold.
This was annoying for example when a user wants to ZoomIn/Out with
W-Up/Down mousebinds with a touchpad.

So this commit fixes it by not leaking the scroll events nor executing
actions when the accumulated delta doesn't exceed the threshold.

13 months agorcxml: replace 'icon' with 'menu' when libsfdo is not linked
tokyo4j [Sun, 12 Jan 2025 07:18:39 +0000 (16:18 +0900)]
rcxml: replace 'icon' with 'menu' when libsfdo is not linked

13 months agorcxml: ignore duplicated buttons in <titlebar><layout>
tokyo4j [Sun, 12 Jan 2025 07:16:16 +0000 (16:16 +0900)]
rcxml: ignore duplicated buttons in <titlebar><layout>

...rather than ignoring the whole <titlebar><layout>.

13 months agoscaled-scene-buffer: block sharing of buffers created before reconfigure
tokyo4j [Sun, 12 Jan 2025 09:18:28 +0000 (18:18 +0900)]
scaled-scene-buffer: block sharing of buffers created before reconfigure

This prevents potential bugs that buffers created by scaled_scene_buffers
before Reconfigure are reused by other newly created scaled_scene_buffers.

This is targeted for scaled_icon_buffer whose buffer creation depends on
server->sfdo.

13 months agoscaled-scene-buffer: store all the scaled_scene_buffers in a single list
tokyo4j [Sun, 12 Jan 2025 09:14:59 +0000 (18:14 +0900)]
scaled-scene-buffer: store all the scaled_scene_buffers in a single list

13 months agoseat: set repeat information for virtual keyboards
Consolatis [Fri, 10 Jan 2025 10:55:45 +0000 (11:55 +0100)]
seat: set repeat information for virtual keyboards

Fixes: #2513
13 months agokeyboard: add keyboard_get_all_modifiers()
Consolatis [Fri, 10 Jan 2025 10:02:58 +0000 (11:02 +0100)]
keyboard: add keyboard_get_all_modifiers()

And make mousebind handlers use that one.
Also remove keyboard_any_modifiers_pressed() and replace its usage
with the new function.

Without this patch we would only request the modifier state of the
keyboard group which makes mousebinds involving keyboard modifiers
break for virtual keyboards like when using wayvnc. Same story for
hiding the workspace overlay or snapping to regions.

Fixes: #2511
13 months agotheme: don't try to load "themerc"s if theme_name is NULL
Tomi Ollila [Tue, 7 Jan 2025 20:23:14 +0000 (22:23 +0200)]
theme: don't try to load "themerc"s if theme_name is NULL

theme_name is NULL when <theme><name></name>...</theme> is in rc.xml

13 months agoscaled-scene-buffer: use outputs_update signal
Consolatis [Thu, 9 Jan 2025 17:39:59 +0000 (18:39 +0100)]
scaled-scene-buffer: use outputs_update signal

This fixes an issue with buffers not updating when an output is configured
for a new scale. It also supports windows being on more than 2 outputs at
once and in general simplifies the code.

13 months agoFix typos
tinyboxvk [Thu, 9 Jan 2025 03:35:23 +0000 (23:35 -0400)]
Fix typos

Signed-off-by: tinyboxvk <13696594+tinyboxvk@users.noreply.github.com>
13 months agodesktop-entry: separate icon and app_id icon lookup
Consolatis [Tue, 7 Jan 2025 14:21:30 +0000 (15:21 +0100)]
desktop-entry: separate icon and app_id icon lookup

This patch splits desktop_entry_icon_lookup() into two separate functions
- desktop_entry_load_icon(): load a icon from the configured icon theme
- desktop_entry_load_icon_from_app_id(): load a icon name from a .desktop
  file based on the given app_id and supply it to _load_icon().

The _load_icon() function will be used in a future menu icon
implementation whereas the _load_icon_from_app_id() function is used
within the SSD titlebar window icon lookup routine.

13 months agodesktop-entry: accept uppercase icon endings
Consolatis [Mon, 6 Jan 2025 06:22:34 +0000 (07:22 +0100)]
desktop-entry: accept uppercase icon endings

13 months agostring-helpers: add str_endswith_ignore_case()
Consolatis [Mon, 6 Jan 2025 06:19:15 +0000 (07:19 +0100)]
string-helpers: add str_endswith_ignore_case()

13 months agoIME: fix stuck Ctrl when pressed Ctrl+F in Firefox with Fcitx5
tokyo4j [Mon, 6 Jan 2025 07:30:54 +0000 (16:30 +0900)]
IME: fix stuck Ctrl when pressed Ctrl+F in Firefox with Fcitx5

683f67b7 introduced another regression that the modifier state (Ctrl) is
stuck when Ctrl+F is pressed in some applications like Firefox while
Fcitx5 is running. This caused mouse scrolls to zoom in/out the UI.

Let me explain the cause in detail. When Ctrl+F is pressed, an input box
is opened in the application and Fcitx5 creates a new virtual keyboard
(VK), whose initial modifiers is empty. Then prior to 683f67b7, the
key/modifiers events flowed like this:

- The compositor detects F key-release
  - Modifiers (Ctrl pressed) are notified via _set_keyboard()
  - F key-release is forwarded to IM
- IM sends modifiers (Ctrl) back to the compositor via VK
  - **The modifiers on VK is updated (empty->Ctrl)**
  - **Modifers (Ctrl) are notified to the app**
- IM sends F key-release back to the compositor via VK
  - F key-release is notified to the app
- The compositor detects Ctrl key-release
  - Ctrl key-release is forwarded to IM
  - Modifiers (empty) are forwarded to IM
- IM sends Ctrl key-release back to the compsitor via VK
  - Ctrl key-release is notified to IM
- IM sends modifiers (empty) back to the compositor via VK
  - **The modifiers on VK is updated again (Ctrl->empty)**
  - **Modifiers (empty) are notified to the app**

Thus, the final modifiers (empty) is notified to the application as
expected. However, after 683f67b7, the key/modifiers events flowed like
this:

- The compositor detects F key-release
  - F key-release is directly notified to the app
  - The modifiers (Ctrl) is also notified to the app
- The compositor detects Ctrl key-release
  - Ctrl key-release is directly notified to the app
  - Modifiers (empty) are forwarded to IM
- IM sends modifiers (empty) back to the compositor via VK
  - **Modifier on VK is not updated (empty->empty)**
  - **The compositor ignores it**

So the final modifier (empty) is never notified to the application, which
causes stuck Ctrl modifier.

This commit fixes this by not forwarding the modifiers when it hasn't been
updated since it was forwarded previously. So after this commit, the
key/modifiers events flow like this:

- The compositor detects F key-release
  - F key-release is directly notified to the app
  - The modifiers (Ctrl) is also notified to the app
- The compositor detects Ctrl key-release
  - Ctrl key-release is directly notified to the app
  - The modifiers are directly notified to the app because the modifiers
    (empty) are the same as the last forwarded modifier (empty).

13 months agoIME: rename pressed_keys to forwarded_pressed_keys
tokyo4j [Mon, 6 Jan 2025 07:28:37 +0000 (16:28 +0900)]
IME: rename pressed_keys to forwarded_pressed_keys

13 months agocursor: fix invisible cursor on application after reconfigure
tokyo4j [Mon, 6 Jan 2025 14:49:08 +0000 (23:49 +0900)]
cursor: fix invisible cursor on application after reconfigure

On reconfigure, we should send wl_pointer.{leave,enter} events if the
cursor is on an application surface to let the application update the
cursor, but bad788cc prevented these events from being sent.

13 months agoosd: prevent preview outlines to be above OSD
tokyo4j [Mon, 6 Jan 2025 18:42:22 +0000 (03:42 +0900)]
osd: prevent preview outlines to be above OSD

86c3597 raised server->menu_tree above layer shell surfaces, but it caused
preview outlines for window switcher to be placed above the OSD because
the preview outlines are placed just above server->menu_tree.

So this commit fixes it by placing server->osd_tree above server->menu.
This also prevents layer-shell surfaces from covering the OSD.

Before (higher-first):
- preview outlines (just above menu)
- menu
- layer-shell (top/overlay/popup)
- osd

After (higher-first):
- osd
- preview outlines (just above menu)
- menu
- layer-shell (top/overlay/popup)

13 months agotheme: use 'labwc' directory
Johan Malm [Thu, 2 Jan 2025 20:40:41 +0000 (20:40 +0000)]
theme: use 'labwc' directory

as well as 'openbox-3', for example: /usr/share/themes/foo/labwc/themerc

Give 'labwc' higher precedence than 'openbox-3' if both exist.

For several reasons not all themes designed for labwc render well on
Openbox:

1. Labwc support some features like SVG/PNG icons and #rrggbbaa color
   definitions which Openbox does not.

2. Openbox generally defaults to black/white colors and will not render
   themes accurate without certain options specified in themerc. For
   example, in Openbox the following will just render as black:

       window.active.title.bg.color: #589bda

   ...because Openbox defaults the texture to "Gradient Vertical" and
   therefore either needs:

      window.active.title.bg.colorTo: #3c7cb7

   ...or remove 'Gradient' from the bg definition and just use something
   like:

      window.active.title.bg: Flat Border

Whilst none of this is a problem when using labwc, it causes problems for
setups with both Openbox and labwc because themes designed for labwc only
will now show up in obconf, lxappearance, etc causing confusion for users.

14 months agoset: prevent possible segfault when keycode 0 is released
tokyo4j [Sun, 5 Jan 2025 19:16:37 +0000 (04:16 +0900)]
set: prevent possible segfault when keycode 0 is released

lab_set_remove() didn't expect keycode 0 as the first branch
(set->values[i] == value) was taken over and over.

14 months agoscaled_{img,scene}_buffer: add architecture graph
Consolatis [Sun, 5 Jan 2025 16:28:06 +0000 (17:28 +0100)]
scaled_{img,scene}_buffer: add architecture graph

14 months agoimg: rename lab_img_cache to lab_img_data
Consolatis [Sun, 5 Jan 2025 16:26:32 +0000 (17:26 +0100)]
img: rename lab_img_cache to lab_img_data

14 months agoimg: don't abort with non-ARGB32 PNG files
tokyo4j [Fri, 3 Jan 2025 12:58:35 +0000 (21:58 +0900)]
img: don't abort with non-ARGB32 PNG files

Cairo surfaces loaded with cairo_image_surface_create_from_png() are not
always ARGB32 format.

14 months agosrc/server.c: delete a comment which was missed to erase
tokyo4j [Sat, 4 Jan 2025 08:37:52 +0000 (17:37 +0900)]
src/server.c: delete a comment which was missed to erase

14 months agoimg: apply padding around window icon only horizontally
tokyo4j [Sat, 4 Jan 2025 07:50:21 +0000 (16:50 +0900)]
img: apply padding around window icon only horizontally

16dbdc64 changed the padding around the app icon in the titlebar to be
applied both vertically and horizontally rather than only horizontally
because it was more natural from a developer's perspective, but some users
complained about the smaller icons in certain configurations.

So let's undo the change in 16dbdc64 and apply the icon padding only
horizontally for now.

We can add configurations for the icon padding (or icon size independent
from window.button.{width,height}?) later.

14 months agoimg: fix UAF on Reconfigure by refcounting
tokyo4j [Fri, 3 Jan 2025 15:05:12 +0000 (00:05 +0900)]
img: fix UAF on Reconfigure by refcounting

Before this commit, there was a use-after-free bug on Reconfigure:
- theme_finish() destroys lab_imgs for titlebar icons
- For some reason, undecorate() calls _create_buffer() in
  scaled-img-buffer.c, which calls img_render() on a destroyed lab_img.

So in this commit, the lifetime of lab_img is expanded to when the
scaled_img_buffers referencing it are all destroyed. This is achieved by
calling lab_img_copy() when setting a lab_img to scaled_img_buffer and
calling lab_img_destroy() when clearing a lab_img.

Now that scaled_img_buffer.img are always different, lab_img_equal() is
added to compare the content of scaled_img_buffer.img.

14 months agoimg: remove "theme" member from lab_img
tokyo4j [Fri, 3 Jan 2025 14:57:40 +0000 (23:57 +0900)]
img: remove "theme" member from lab_img

lab_img.theme member was referenced by "modifier" functions when drawing a
hover effect on button buffers or rounding the button buffer for corner
buttons, but this can be prone to use-after-free and was not very clean
because theme and lab_img were referencing each other.

Instead, let's just reference rc.theme in the modifier functions and
remove theme from lab_img.

14 months agomenu: support pipemenu with the toplevel <menu> element
Johan Malm [Mon, 14 Oct 2024 18:46:03 +0000 (19:46 +0100)]
menu: support pipemenu with the toplevel <menu> element

For example:

    <?xml version="1.0"?>
    <openbox_menu>
      <menu id="root-menu" label="" execute="obmenu-generator"/>
    </openbox_menu>

Fixes: #2238
Co-Authored-By: @Consolatis
14 months agoAdd default Alt-Shift-Tab keybind for PreviousWindow
tokyo4j [Tue, 31 Dec 2024 02:02:24 +0000 (11:02 +0900)]
Add default Alt-Shift-Tab keybind for PreviousWindow

14 months agoosd: make window switcher more Openbox-like in terms of key precessing
tokyo4j [Tue, 31 Dec 2024 01:17:05 +0000 (10:17 +0900)]
osd: make window switcher more Openbox-like in terms of key precessing

Before this commit, keystrokes were interpreted based on following
hard-coded rules while the window switcher is active:

  1. Up/Left arrow keys cycle the window forward.
  2. Down/Right arrow keys cycle the window backward.
  3. Other keystrokes cycle the window in the initial direction specified
     by NextWindow/PreviousWindow actions. But while Shift key is pressed,
     the direction is inverted.

...and keybind actions were never executed.

However, this lead to a counter-intuitive behavior for new, especially
pre-Openbox users. For example, in the following keybinds, after the user
activates the window switcher with Super+n, Super+p cycles the window
_forward_:

  <keybind key="W-n">
    <action name="NextWindow" />
  </keybind>
  <keybind key="W-p">
    <action name="PreviousWindow" />
  </keybind>

This is because the key 'n' is recognized just as a normal key in the
third hard-coded rule.

So this commit changes the rules to be more Openbox-like:

  1. Up/Left arrow keys cycles the window forward.
  2. Down/Right arrow keys cycles the window backward.
  3. Other keystrokes are matched against keybinds and execute their
     actions. If they include NextWindow/PreviousWindow action, it cycles
     the selected window forward/backward even while the window switcher
     is active.

14 months agoTranslation updates from weblate
Weblate [Wed, 1 Jan 2025 21:01:21 +0000 (22:01 +0100)]
Translation updates from weblate

Co-authored-by: NorwayFun <temuri.doghonadze@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ka/
Translation: Labwc/labwc

14 months agooutput: ignore wlr_output_state.mode/custom_mode except for client request
John Lindgren [Wed, 1 Jan 2025 10:18:41 +0000 (05:18 -0500)]
output: ignore wlr_output_state.mode/custom_mode except for client request

The wlr_output_state passed to the new_output signal sometimes has a
non-preferred mode set, which we were ignoring before 03be489eb973.
Ignore it again to prevent the wrong mode from being set.

14 months agooutput: add debugging output to output_test_mode()
John Lindgren [Wed, 1 Jan 2025 09:23:48 +0000 (04:23 -0500)]
output: add debugging output to output_test_mode()

14 months agoCI: add non-feature (svg, libsfdo, xwayland) build for arch
Consolatis [Tue, 31 Dec 2024 00:12:23 +0000 (01:12 +0100)]
CI: add non-feature (svg, libsfdo, xwayland) build for arch

14 months agorcxml: add core.autoEnableOutputs option
John Lindgren [Fri, 27 Dec 2024 20:13:12 +0000 (15:13 -0500)]
rcxml: add core.autoEnableOutputs option

Currently, labwc automatically enables outputs at startup and when new
outputs are connected. Make this behavior optional (but still enabled by
default).

With autoEnableOutputs disabled, tools such as kanshi can be used to
give finer-grained control of which outputs are enabled and when.

14 months agooutput: handle outputs that are enabled but not yet added
John Lindgren [Fri, 27 Dec 2024 21:05:40 +0000 (16:05 -0500)]
output: handle outputs that are enabled but not yet added

output_config_apply() currently assumes that any enabled outputs have
already been added to the wlr_output_layout. However, at startup,
wlroots will report that outputs are enabled if they were previously in
use by e.g. the Linux console - but they are not yet in the layout.

output_config_apply() never encountered this case before now because the
initial modeset was performed by another code path, but now with the new
autoEnableOutputs option (next commit), it needs to be able to handle
the initial modeset as well.

14 months agooutput: auto-select mode when enabling output by client request
John Lindgren [Sun, 20 Oct 2024 18:17:19 +0000 (14:17 -0400)]
output: auto-select mode when enabling output by client request

If e.g. kanshi requests us to enable an output but does not specify the
mode, and the output has not previously been modeset, then the width +
height + refresh rate will all be zero. In this case, we should select
the best mode just as when auto-configuring a new output.

We need to do the mode auto-selection in both the test & commit stages
for consistency, so factor out a new output_test_auto() function to help
with this.

Remove a guard against a refresh rate of zero, which was a workaround
for wlroots 0.17 and is no longer needed -- it is incompatible with mode
auto-selection since the refresh rate is zero in that case.

14 months agokeyboard: do not set numlock by default
Johan Malm [Tue, 31 Dec 2024 15:25:31 +0000 (15:25 +0000)]
keyboard: do not set numlock by default

Only force on|off if users specifically requests it in the config file.

Related-to: #2463
14 months agoMake enum three_state public
Johan Malm [Tue, 31 Dec 2024 15:21:47 +0000 (15:21 +0000)]
Make enum three_state public

14 months agokeyboard: cancel keybind_repeat on reconfigure
Consolatis [Mon, 30 Dec 2024 23:52:55 +0000 (00:52 +0100)]
keyboard: cancel keybind_repeat on reconfigure

Currently we may end up in an endless loop of Reconfigure requests
if the Reconfigure action was called by a keybind. If the reconfigure
takes too long (which may happen on slow systems with libsfdo full
debug logging for example) the reconfigure might be triggered again
and again.

To prevent that, simply cancel all keybind_repeat timers on reconfigure.

14 months agoRemove cruft related to window switcher and keyboard focus
tokyo4j [Tue, 31 Dec 2024 04:00:32 +0000 (13:00 +0900)]
Remove cruft related to window switcher and keyboard focus

This commit cleans up the comments and cruft from e45fe08.

Background:

- With e45fe08, the keyboard focus is always moved to the switched window
  on finishing window switcher, even with <focus followMouse="yes">.
  Since followMouseRequiresMovement was not implemented at that time
  (behaved like it was always "no"), e45fe08 was necessary to allow users
  users who use followMouse="yes" to move the keyboard focus with window
  switcher.
9a9e20d added followMouseRequiresMovement, but it kept the behavior
  described above even with followMouse="yes" and
  followMouseRequiresMovement="no".
398b80b accidentally invalidated e45fe08, which means the keyboard focus
  is now always moved to the window below the cursor on finishing window
  switcher with followMouse="yes" and followMouseRequiresMovement="no".

Although the invalidation was a accident, I think always setting the
keyboard focus on the window below the cursor is what users expect from
followMouse="yes" and followMouseRequiresMovement="no".

14 months agodesktop-entry: demote libsfdo error-logging
Johan Malm [Fri, 27 Dec 2024 22:19:35 +0000 (22:19 +0000)]
desktop-entry: demote libsfdo error-logging

...to WLR_INFO to avoid logging issues with .desktop files as errors, for
example:

    [sfdo-desktop] 1:1: Name is unset
    [sfdo-desktop] Failed to load /usr/share/applications/lxqt-panel.desktop
    [sfdo-desktop] 1:1: Exec is unset while DBusActivatable is unset or false
    [sfdo-desktop] Failed to load /usr/share/applications/qemu.desktop

Also make libsfdo debug/info logging depend on environment variable
LABWC_DEBUG_LIBSFDO being set to avoid disproportionately verbose logging
by default for one particular sub-system.

Add an 'ENVIRONMENT VARIABLES' section to labwc(1) to describe the above
as well as other hitherto undocumented env vars with prefix LABWC_DEBUG_.

14 months agosrc/debug.c: fix inverted string_null_or_empty() check
Consolatis [Mon, 30 Dec 2024 22:32:09 +0000 (23:32 +0100)]
src/debug.c: fix inverted string_null_or_empty() check

Reported-By: Domo via IRC
14 months agoosd: make desktop_cycle_view() private in osd.c
tokyo4j [Sun, 29 Dec 2024 19:57:39 +0000 (04:57 +0900)]
osd: make desktop_cycle_view() private in osd.c

14 months agoosd: refactor to not write server->osd_state outside osd.c
tokyo4j [Sun, 29 Dec 2024 16:05:17 +0000 (01:05 +0900)]
osd: refactor to not write server->osd_state outside osd.c

14 months agosrc/seat.c: small refactor
tokyo4j [Sun, 29 Dec 2024 15:45:43 +0000 (00:45 +0900)]
src/seat.c: small refactor

The condition server->input_mode != LAB_INPUT_STATE_PASSTHROUGH is enough
to catch when window switcher is active.

14 months agosrc/osd.c: make osd_preview_restore() private in osd.c
tokyo4j [Sun, 29 Dec 2024 15:44:12 +0000 (00:44 +0900)]
src/osd.c: make osd_preview_restore() private in osd.c

14 months agosrc/desktop.c: remove osd_review_restore() call in desktop_cycle_view()
tokyo4j [Sun, 29 Dec 2024 15:38:43 +0000 (00:38 +0900)]
src/desktop.c: remove osd_review_restore() call in desktop_cycle_view()

It was a cruft from days when we used to walk scene-nodes to get the next
view to cycle.

14 months agokeyboard: set numlock to off by default
Johan Malm [Sun, 29 Dec 2024 17:32:23 +0000 (17:32 +0000)]
keyboard: set numlock to off by default

...to avoid surprises on Acer Aspire One laptops where the numeric
keyboard does not physically exist but "overlaps" the qwerty keyboard.

Reported-by: staryvyr on IRC
Note: We do not like changing defaults, but feel that there is a good
reason for this one.

14 months agowlr-foreign-toplevel: send initial pre-map state
Consolatis [Sun, 29 Dec 2024 00:43:04 +0000 (01:43 +0100)]
wlr-foreign-toplevel: send initial pre-map state

Fixes: #2460
14 months agoproject wide: adapt to new non-NULL value of view_get_string_prop()
Consolatis [Sun, 29 Dec 2024 01:18:27 +0000 (02:18 +0100)]
project wide: adapt to new non-NULL value of view_get_string_prop()

14 months agoview: fix NULL string_prop crash
Johan Malm [Fri, 27 Dec 2024 22:37:35 +0000 (22:37 +0000)]
view: fix NULL string_prop crash

...when app_id is NULL.

Make sure view_get_string_prop() never returns NULL because it is so easy
to misuse. Same for the respective xwayland/xdg impl methods in case
anyone decides to (incorrectly) call them directly in future.

Fixes: #2453
14 months agoClear keyboard/pointer focus on Move/Resize, window switcher and menu
tokyo4j [Sat, 28 Dec 2024 15:48:55 +0000 (00:48 +0900)]
Clear keyboard/pointer focus on Move/Resize, window switcher and menu

The previous revert fixed the problem of stuck modifier keys with
keybinds in Blender, but made Firefox show its menu bar with Alt-*
keybinds. This is fundamentally inevitable due to the limitation of
wayland protocol, but at least for the default Alt-Tab keybind for
window switcher, we can mitigate this problem by clearing the keyboard
focus when the window switcher is activated. This is what KWin does, and
we decided to follow that.

So in this commit, keyboard and pointer focus are temporarily cleared
while Move/Resize, window switcher and menu interactions and restored
after them. We slightly deviate from KWin as KWin doesn't clear the
keyboard focus while Move/Resize, but it solves our existing problem
that Firefox shows its menu bar after dragging it with default Alt-Drag
mousebind, and this is what Mutter does.

We considered other solutions, but they don't work well:
1. Send wl_keyboard.{leave,enter} every time keybinds/mousebinds are
   triggered. This solves the Firefox's menu bar problem, but that
   sounds like a workaround and sending unnecessary events every time is
   not desirable.
2. Send release events for both modifiers and keys even when they are
   bound to keybinds. This is what Mutter is doing, but it looks like an
   implementation issue and violates wayland protocol.

14 months agoRevert "keyboard: include pressed modifiers in bound set"
tokyo4j [Sun, 22 Dec 2024 15:05:22 +0000 (00:05 +0900)]
Revert "keyboard: include pressed modifiers in bound set"

This reverts commit 98bf316ee6632f62ec205904d74eabd8b3e9d15b.

14 months agoRevert "keyboard: add window rule to send release-events (#2377)"
tokyo4j [Sun, 22 Dec 2024 13:04:15 +0000 (22:04 +0900)]
Revert "keyboard: add window rule to send release-events (#2377)"

This reverts commit 2f8afb2376cfa8eeb89fc5afffa869be68d3988e.

14 months agoimg: fix scaling for rendering large image in non-square rectangle
tokyo4j [Tue, 24 Dec 2024 04:39:25 +0000 (13:39 +0900)]
img: fix scaling for rendering large image in non-square rectangle

16dbdc6 caused a regression that the vscode icon (1024x1024) in the
titlebar is cut off with following configuraion:

  window.button.width: 26
  window.button.height: 16

14 months agosrc/output.c: remove output_usable_area_scaled()
tokyo4j [Mon, 23 Dec 2024 10:09:26 +0000 (19:09 +0900)]
src/output.c: remove output_usable_area_scaled()

14 months agoDon't open menu or start window switching while other server interaction
tokyo4j [Sat, 28 Dec 2024 08:03:26 +0000 (17:03 +0900)]
Don't open menu or start window switching while other server interaction

This should make the transition of the server state more predictable and
prevent potential bugs.

14 months agoCheck input_mode to see whether window switcher is active or not
tokyo4j [Sat, 28 Dec 2024 08:42:26 +0000 (17:42 +0900)]
Check input_mode to see whether window switcher is active or not

...rather than "if (server->osd_state.cycle_view){..}".

14 months agoAdd LAB_INPUT_STATE_WINDOW_SWITCHER
tokyo4j [Sat, 28 Dec 2024 07:09:05 +0000 (16:09 +0900)]
Add LAB_INPUT_STATE_WINDOW_SWITCHER

14 months agoaction: add WarpCursor action
Orfeas [Sun, 22 Dec 2024 12:48:47 +0000 (14:48 +0200)]
action: add WarpCursor action

14 months agotheme: demote padding.height warning
Johan Malm [Mon, 23 Dec 2024 21:29:46 +0000 (21:29 +0000)]
theme: demote padding.height warning

...from WLR_ERROR to WLR_INFO to avoid 'false' logging when Openbox themes
contain the padding.height settings. Whilst this option is not supported,
the visual appearance is very close to that of Openbox with common themes.

The background to this is that Labwc theme specification has diverged
slightly from that of Openbox with respect to titlebar padding to support
more contemporary looks whilst avoiding breaking changes. For full details
see commit: e16e78e7a4a6e40c8184edd7bb483b0f395482d0

Suggested-by: @Consolatis
14 months agossd: rework titlebar button rendering
tokyo4j [Thu, 28 Nov 2024 10:21:18 +0000 (19:21 +0900)]
ssd: rework titlebar button rendering

- fix that icons for normal/hovered/rounded buttons are not placed
  exactly the same position
- fix blurry window button icons in scaled outputs

This commit introduces lab_img and scaled_img_buffer and uses them for
rendering icons in the window titlebar. Now the process of rendering
button icons are split into 2 phases: loading with lab_img_load() and
creating scene-nodes for them with scaled_img_buffer_create(). This
might incur some additional overhead since we no longer preload icon
textures, but the rendering of icon only happens for the first window
as backing buffers are shared and the overhead won't be noticeable.
This commit also simplifies the process of centering icon buffer in the
button, by creating icon buffers in a fixed geometry via
lab_img_render().

14 months agonode: add node_scaled_scene_buffer_from_node
tokyo4j [Thu, 28 Nov 2024 12:34:24 +0000 (21:34 +0900)]
node: add node_scaled_scene_buffer_from_node

14 months agoext-workspace protocol integration
Consolatis [Tue, 10 Dec 2024 05:26:19 +0000 (06:26 +0100)]
ext-workspace protocol integration

14 months agoext-workspace protocol implementation
Consolatis [Mon, 18 Nov 2024 20:16:10 +0000 (21:16 +0100)]
ext-workspace protocol implementation

14 months agocursor: fix focus when menu is closed by clicking its border
tokyo4j [Thu, 19 Dec 2024 08:04:10 +0000 (17:04 +0900)]
cursor: fix focus when menu is closed by clicking its border

Before this commit, the pointer focus is cleared when a menu is closed
by clicking its border. This is because get_cursor_context() returns
type=LAB_SSD_NONE when the cursor is on the menu border and
cursor_update_common() clears the pointer focus. This commit fixes this
by replacing cursor_update_common() with cursor_update_focus(), which
calls get_cursor_context() again after the menu scene-node is hidden.

14 months agolayer: update pointer focus on popup destruction
tokyo4j [Thu, 19 Dec 2024 10:01:08 +0000 (19:01 +0900)]
layer: update pointer focus on popup destruction

Same as previous commit

14 months agoxdg-popup: update pointer focus on popup destruction
tokyo4j [Tue, 17 Dec 2024 17:13:10 +0000 (02:13 +0900)]
xdg-popup: update pointer focus on popup destruction

Before this commit, closing a popup didn't move the pointer focus to the
main toplevel until the cursor is moved.

14 months agomenu: put menu_tree above overlay layer
Johan Malm [Mon, 1 Jul 2024 20:47:19 +0000 (21:47 +0100)]
menu: put menu_tree above overlay layer

14 months agomenu: slightly slide menus opened with atCursor="no"
tokyo4j [Wed, 18 Dec 2024 16:06:48 +0000 (01:06 +0900)]
menu: slightly slide menus opened with atCursor="no"

This is reland of 2ade6a1e which was reverted with 21bd5b00, but this
prevents the x-position of the menu from being negative and slides menus
opened with Alt-Space too.

14 months agostring-helpers.c: add str_starts_with()
Johan Malm [Tue, 20 Aug 2024 16:59:46 +0000 (17:59 +0100)]
string-helpers.c: add str_starts_with()

14 months agoscaled-scene-buffer: reduce unnecessary renderings
tokyo4j [Tue, 3 Dec 2024 07:18:52 +0000 (16:18 +0900)]
scaled-scene-buffer: reduce unnecessary renderings

Prior to this commit, a backing buffer with scale 1 was always created for
a scaled_scene_buffer before showing it, and backing buffers for specific
scales were created on output_enter events.

This commit removes this redundant re-renderings by calling
wlr_scene_buffer_set_dest_size() upon scaled_scene_buffer creation just to
receive output_enter events and delaying the first rendering to the first
output_enter event.

I needed to add font_get_buffer_size() to obtain the size of a font buffer
without actually creating it.

14 months agos/xmlParseMemory/xmlReadMemory/
Johan Malm [Sun, 8 Dec 2024 17:21:11 +0000 (17:21 +0000)]
s/xmlParseMemory/xmlReadMemory/

...as xmlParseMemory() is deprecated

14 months agoIME: don't forward key-release without correspinding key-press
tokyo4j [Tue, 17 Dec 2024 03:06:05 +0000 (12:06 +0900)]
IME: don't forward key-release without correspinding key-press

After commit e2189903 in wlroots, when ctrl-f is pressed in firefox with
a IME client running, the following key-release event for "f" is not
sent, thus "f" is repeated like "ffffffffff..." in the input box of
firefox. This is because the key-release event for "f" is firstly
forwarded to the IME client and then sent via the virtual keyboard created
by the IME client while the key-press event is sent via physical
keyboard, and with e2189903, key-release events without a corresponding
key-press event on the same keyboard is not emitted to the compositor.

So this commit fixes this problem by not forwarding the key-release event
to the IME client unless the corresponding key-press event was also
forwarded.

14 months agocosmic-workspaces: remove workspace_set_hidden() calls
Consolatis [Tue, 10 Dec 2024 05:10:22 +0000 (06:10 +0100)]
cosmic-workspaces: remove workspace_set_hidden() calls

It is a concept that labwc does not support.

14 months agocosmic-workspaces: add cosmic_ prefix
Consolatis [Mon, 18 Nov 2024 19:45:11 +0000 (20:45 +0100)]
cosmic-workspaces: add cosmic_ prefix

In preperation for a future ext-workspace integration.

14 months agolabwc-config(5): describe how keys are processed
Johan Malm [Mon, 16 Dec 2024 20:13:58 +0000 (20:13 +0000)]
labwc-config(5): describe how keys are processed

...when matching against keybinds.

Copied from:

https://github.com/labwc/labwc/blob/63dc609085d42d16401e23079bb50e2f07e31de5/src/input/keyboard.c#L215-L238

14 months agocosmic-workspaces: abstract transaction-addon
Consolatis [Mon, 18 Nov 2024 17:38:42 +0000 (18:38 +0100)]
cosmic-workspaces: abstract transaction-addon

This allows to use it for a future ext-workspace implementation.
It is also more generalized so can be used for other protocol
implementation in the future in case the protocols require some
kind of transaction management.

14 months agoTranslation updates from weblate
Weblate [Sun, 15 Dec 2024 01:13:10 +0000 (02:13 +0100)]
Translation updates from weblate

Co-authored-by: vTT <vttfreebsd@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fr/
Translation: Labwc/labwc

14 months agoREADME.md: add "lightweight and box-inspired"
Johan Malm [Sat, 14 Dec 2024 21:01:24 +0000 (21:01 +0000)]
README.md: add "lightweight and box-inspired"

14 months agomenu: improve algorithm for menu placement with xdg-positioner
tokyo4j [Mon, 25 Nov 2024 21:42:08 +0000 (06:42 +0900)]
menu: improve algorithm for menu placement with xdg-positioner

This commit delegates the calculation for menu position into wlroots
utilities for xdg_positioner.

Notable functional changes are:
- Slide the menu to fit in the output when it's opened out of the output
  (e.g. top-left window menu is opened when the window is overflowing to
  the left), rather than not updating the menu at all.
- The horizontal alignment of menus is now determined based on the size of
  each (sub)menu alone rather than the total width of entire menu tree.
  This means submenus can now overlap with is parents, but this is no
  longer a problem since we recently added support for menu borders.
- Fixed that pipemenus always follow the alignment of its parent even when
  it overflows from the output.

14 months agolabwc-actions(5): add missing position option to ShowMenu
Johan Malm [Sun, 8 Dec 2024 17:24:32 +0000 (17:24 +0000)]
labwc-actions(5): add missing position option to ShowMenu