Commit graph

2895 commits

Author SHA1 Message Date
Consolatis
897799da5a server: on exit, destroy backends first
This fixes a UAF caused by trying to update the xcursor in a
output destroy handler, in turn caused by destroying the backend.

Fixes: #2539
2025-02-04 19:56:36 +00:00
tokyo4j
950337b895 ssd: fix resizing on border corners and add <resize><cornerRange>
Eliminate corner extents and instead use cursor position to map SSD
borders and extents to corner contexts, with a size configurable by the
<resize><cornerRange> parameter. This simplifies extent handling,
eliminates bugs in the detection of corner context, and allows users to
expand corner targets if they wish.

Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
2025-02-04 11:13:32 -05:00
Johan Malm
9ad6e3c68c NEWS.md: start converting section 0.8.0 references
...to [#%d] format and process with rip.c
2025-02-04 06:37:00 +00:00
Johan Malm
2e10fe6f41 Add scripts/rip.c
...to extract pull-request and issue reference from NEWS.md and output
them as GH URLs.
2025-02-04 06:37:00 +00:00
Orfeas
3e9c08871f query: encapsulate parser state into a struct 2025-02-03 20:00:22 +00:00
Consolatis
ed4553fc7e src/menu: add global config for menu.showIcons 2025-02-02 15:05:37 +00:00
Consolatis
1fa4070025 src/menu: add support for scalable menu icons 2025-02-02 15:05:37 +00:00
Consolatis
060b59f7ed src/config: let icon theme name default to theme 2025-02-02 15:05:37 +00:00
Consolatis
1e2c709d6b docs/labwc-menu: we only support a single menu.xml file 2025-02-02 15:05:37 +00:00
01micko
6efdb1037f README.md: fix minor grammar error, add libsfdo as optional dependency 2025-02-01 12:36:56 +01:00
tokyo4j
9a473f1848 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.
2025-01-27 13:18:29 +01:00
Consolatis
01592d2633 surface-helpers: reduce log spam
This shows up when processing out-of-surface movement on subsurfaces.
2025-01-26 14:22:06 +01:00
Consolatis
37d745b01d 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
2025-01-26 14:22:06 +01:00
tokyo4j
26064fb8f6 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.
2025-01-26 11:46:32 +01:00
tokyo4j
dc474521ab ssd: dynamically look up window icons in titlebar for output scales
by introducing scaled_icon_buffer.
2025-01-26 11:46:32 +01:00
tokyo4j
5e29f79258 string-helpers: add str_equal() 2025-01-25 07:27:21 +09:00
tokyo4j
45f73b58a1 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.
2025-01-25 07:27:21 +09:00
tokyo4j
a0cf6bb068 Move "#if HAVE_LIBSFDO" inside desktop-entry.h 2025-01-25 07:27:21 +09:00
tokyo4j
bffdccf8dc refactor: add LAB_BS_DEFAULT in lab_button_state 2025-01-25 07:27:21 +09:00
Dima Krasner
36d6e9ef75 docs: fix incorrect default for window.label.text.justify 2025-01-24 12:57:06 +01:00
tokyo4j
4b7c502ace view: replace content_node with content_tree 2025-01-22 18:02:54 +01:00
tokyo4j
40b1f5407f ssd: fix InactiveWindow font not working 2025-01-22 17:54:48 +01:00
yuiiio
baab35c469 ime: cleanup new_popup_surface listener when destroy 2025-01-19 08:00:45 +09:00
yuiiio
f4d581ef91 xdg: cleanup request_show_window_menu listener when destroy 2025-01-16 00:08:56 +01:00
tokyo4j
08d31145fd 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.
2025-01-14 09:35:07 +09:00
tokyo4j
1a6b01a83e rcxml: replace 'icon' with 'menu' when libsfdo is not linked 2025-01-14 08:41:00 +09:00
tokyo4j
f082dd7c25 rcxml: ignore duplicated buttons in <titlebar><layout>
...rather than ignoring the whole <titlebar><layout>.
2025-01-14 08:41:00 +09:00
tokyo4j
925360ffba 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.
2025-01-13 18:24:10 +09:00
tokyo4j
c49f577c6b scaled-scene-buffer: store all the scaled_scene_buffers in a single list 2025-01-13 18:24:10 +09:00
Consolatis
138a514c90 seat: set repeat information for virtual keyboards
Fixes: #2513
2025-01-13 06:28:37 +09:00
Consolatis
0627190060 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
2025-01-13 06:28:37 +09:00
Tomi Ollila
577c24306f 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
2025-01-12 14:55:04 +09:00
Consolatis
6496773fd1 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.
2025-01-11 07:29:46 +01:00
tinyboxvk
1a6dd845a2 Fix typos
Signed-off-by: tinyboxvk <13696594+tinyboxvk@users.noreply.github.com>
2025-01-09 06:59:57 +00:00
Consolatis
4ecedcdb3b 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.
2025-01-09 00:57:06 +09:00
Consolatis
d53cf642f5 desktop-entry: accept uppercase icon endings 2025-01-09 00:57:06 +09:00
Consolatis
10c6abb36a string-helpers: add str_endswith_ignore_case() 2025-01-09 00:57:06 +09:00
tokyo4j
41aa7e1a7d 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).
2025-01-07 19:31:56 +00:00
tokyo4j
405e543faf IME: rename pressed_keys to forwarded_pressed_keys 2025-01-07 19:31:56 +00:00
tokyo4j
6f1ef10d58 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.
2025-01-06 21:05:54 +00:00
tokyo4j
773bdc3823 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)
2025-01-06 21:02:22 +00:00
Johan Malm
8d9bd2d747 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.
2025-01-06 20:15:26 +00:00
tokyo4j
cacf11fc90 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.
2025-01-06 14:50:14 +09:00
Consolatis
b58f8dab21 scaled_{img,scene}_buffer: add architecture graph 2025-01-06 04:39:09 +01:00
Consolatis
5d287ebda4 img: rename lab_img_cache to lab_img_data 2025-01-06 04:39:09 +01:00
tokyo4j
7364de2ac5 img: don't abort with non-ARGB32 PNG files
Cairo surfaces loaded with cairo_image_surface_create_from_png() are not
always ARGB32 format.
2025-01-06 06:38:35 +09:00
tokyo4j
a1e2e19a8f src/server.c: delete a comment which was missed to erase 2025-01-04 17:42:44 +09:00
tokyo4j
6feb6589ea 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.
2025-01-04 08:32:02 +00:00
tokyo4j
70fb713874 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.
2025-01-04 09:10:02 +01:00
tokyo4j
90a8c3e793 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.
2025-01-04 09:10:02 +01:00