]> git.mdlowis.com Git - proto/labwc.git/log
proto/labwc.git
11 months agoproject wide: clean up event listeners on shutdown
Consolatis [Sat, 8 Feb 2025 14:48:50 +0000 (15:48 +0100)]
project wide: clean up event listeners on shutdown

This ensures all event listeners are removed before the emitting
wlroots object is being destroyed. This will be enforced with asserts
in wlroots 0.19 but there is no reason to not do it right now either.

This change in wlroots 0.19 is implemented via commit
8f56f7ca43257cc05c7c4eb57a0f541e05cf9a79
"Assert (almost all) signals have no attached listeners on destroy"

11 months agoMerge pull request #2598 from tokyo4j/refactor-magnifier
Hiroaki Yamamoto [Thu, 13 Mar 2025 06:20:34 +0000 (15:20 +0900)]
Merge pull request #2598 from tokyo4j/refactor-magnifier

magnifier: refactor

11 months agomenu: show app icons in client-list-combined-menu
tokyo4j [Tue, 11 Mar 2025 19:04:50 +0000 (04:04 +0900)]
menu: show app icons in client-list-combined-menu

11 months agomenu: dynamically generate top-level pipemenus
tokyo4j [Mon, 10 Mar 2025 07:52:52 +0000 (16:52 +0900)]
menu: dynamically generate top-level pipemenus

This eliminates code duplications and aligns the behavior of top-level
pipemenus with sub-pipemenus.

11 months agomenu: don't fill default items in empty menus
tokyo4j [Mon, 10 Mar 2025 07:49:35 +0000 (16:49 +0900)]
menu: don't fill default items in empty menus

This is needed to prevent pipemenus which usually contains no items
from being filled with default items in follow-up commits.

11 months agomenu: use item->parent->id for client-list-combined-menu
tokyo4j [Mon, 10 Mar 2025 07:26:46 +0000 (16:26 +0900)]
menu: use item->parent->id for client-list-combined-menu

...instead of item->id.

11 months agomenu: lazily generate menu scenes
tokyo4j [Sun, 9 Mar 2025 15:00:39 +0000 (00:00 +0900)]
menu: lazily generate menu scenes

This removes the need to call update_client_list_combined_menu()
and update_client_send_to_menu() every time a root menu is opened.

This commit also fixed the incorrect menu position with following
configuration:
  <menu id="foo" label="foo">
    <item label="aaaaaa"/>
    <item label="bbbbbb"/>
  </menu>
  <menu id="root-menu">
    <menu id="foo" />
    <menu id="foo" />
  </menu>

11 months agomenu: assert server->menu_current != NULL in menu_close_root()
tokyo4j [Sun, 9 Mar 2025 15:00:19 +0000 (00:00 +0900)]
menu: assert server->menu_current != NULL in menu_close_root()

11 months agomenu: s/menu_configure/menu_reposition/
tokyo4j [Sun, 9 Mar 2025 14:57:58 +0000 (23:57 +0900)]
menu: s/menu_configure/menu_reposition/

11 months agomenu: remove menu_free_from()
tokyo4j [Sun, 9 Mar 2025 14:54:56 +0000 (23:54 +0900)]
menu: remove menu_free_from()

11 months agoaction: allow only Previous/NextWindow action while window switching
tokyo4j [Sun, 9 Mar 2025 16:56:09 +0000 (01:56 +0900)]
action: allow only Previous/NextWindow action while window switching

This commit prevents some actions like SendToDesktop from being executed
while window switching, which may mess up our scene-graph.

11 months agodesktop: harden window stacking order while window switching
tokyo4j [Mon, 24 Feb 2025 12:40:46 +0000 (21:40 +0900)]
desktop: harden window stacking order while window switching

This commit moves the check against server->input_mode from the callers
of desktop_focus_view() into desktop_focus_view() itself. This
eliminates code duplications and makes it harder to mess up the window
stacking order while window switching.

I also added the same check in view_minimize() so that minimize requests
from panels never messes up the window stacking order (I think only this
should be described in the release note).

11 months agoosd: don't update cursor while window switching
tokyo4j [Sat, 22 Feb 2025 11:38:59 +0000 (20:38 +0900)]
osd: don't update cursor while window switching

cursor_update_focus() is no-op while server->input_mode is set. So we
should only call cursor_update_focus() at the beginning/end of window
switching.

11 months agoconfig: honor no content <desktops><prefix> node
Johan Malm [Fri, 28 Feb 2025 16:01:07 +0000 (16:01 +0000)]
config: honor no content <desktops><prefix> node

...because users need a way to override the default "Workspace".

Fixes: #2601
11 months agoconfig: increase default <snapping><range> to 10
Johan Malm [Tue, 4 Mar 2025 21:14:41 +0000 (21:14 +0000)]
config: increase default <snapping><range> to 10

...to make it easier to snap windows on the edge between two monitors.

Fixes: #2602
12 months agocall selected actions with keypad enter
zeussuse [Thu, 6 Mar 2025 21:00:50 +0000 (21:00 +0000)]
call selected actions with keypad enter

12 months agoREADME.md: add link to release video
Johan Malm [Mon, 3 Mar 2025 21:36:22 +0000 (21:36 +0000)]
README.md: add link to release video

12 months agomagnifier: refactor magnifier_draw()
tokyo4j [Sat, 22 Feb 2025 09:13:11 +0000 (18:13 +0900)]
magnifier: refactor magnifier_draw()

12 months agossd-titlebar: show fallback icon when no app_id is set
tokyo4j [Sun, 23 Feb 2025 17:22:30 +0000 (02:22 +0900)]
ssd-titlebar: show fallback icon when no app_id is set

Before this commit, nothing was rendered in window icon button if the
application doesn't set its app_id (e.g. nested kwin_wayland). This was my
oversight in dc474521.

This commit makes sure fallback icon (set via <theme><fallbackAppIcon>)
by removing ssd->state.app_id and the early-return in
ssd_update_window_icon(). This doesn't affect performance because
scaled_icon_buffer caches app_id and scaled_icon_buffer_set_app_id() does
nothing when a duplicated app_id is passed.

12 months agomagnifier: make sure magnifier scale is bigger than 1.0
tokyo4j [Sun, 23 Feb 2025 05:05:45 +0000 (14:05 +0900)]
magnifier: make sure magnifier scale is bigger than 1.0

12 months agomagnifier: use wlr_output.swapchain.format
tokyo4j [Sat, 22 Feb 2025 08:33:48 +0000 (17:33 +0900)]
magnifier: use wlr_output.swapchain.format

12 months agomagnifier: rename some functions
tokyo4j [Sat, 22 Feb 2025 06:21:32 +0000 (15:21 +0900)]
magnifier: rename some functions

12 months agobox: add box_to_fbox()
tokyo4j [Sat, 22 Feb 2025 06:20:53 +0000 (15:20 +0900)]
box: add box_to_fbox()

12 months agoCI: chase wlroots package rename on FreeBSD
Jan Beich [Thu, 20 Feb 2025 01:12:03 +0000 (02:12 +0100)]
CI: chase wlroots package rename on FreeBSD

https://github.com/freebsd/freebsd-ports/commit/2cb7175c921d

12 months agobuild: bump version to 0.8.3
Johan Malm [Fri, 21 Feb 2025 20:20:45 +0000 (20:20 +0000)]
build: bump version to 0.8.3

12 months agoNEWS.md: fix minor grammatical error
Johan Malm [Fri, 21 Feb 2025 20:08:59 +0000 (20:08 +0000)]
NEWS.md: fix minor grammatical error

12 months agoNEWS.md: update notes for 0.8.3
Johan Malm [Fri, 21 Feb 2025 19:57:12 +0000 (19:57 +0000)]
NEWS.md: update notes for 0.8.3

12 months agoNEWS.md convert refs to [#%d] format
Johan Malm [Tue, 18 Feb 2025 21:50:46 +0000 (21:50 +0000)]
NEWS.md convert refs to [#%d] format

12 months agoNEWS.md: interim update
Johan Malm [Tue, 4 Feb 2025 06:43:23 +0000 (06:43 +0000)]
NEWS.md: interim update

12 months agocursor: don't un-minimize previewed window while window switching
tokyo4j [Mon, 17 Feb 2025 14:47:07 +0000 (23:47 +0900)]
cursor: don't un-minimize previewed window while window switching

This commit restores the check removed in 7a6ecca.

Without the check, if followMouse="yes" and
followMouseRequiresMovement="no", osd_update() => cursor_update_focus() =>
desktop_focus_view() unexpectedly un-minimizes the window on cursor even
when the window is just a preview of window switcher. This caused some
strange behavior that a minimized window selected with window switcher is
immediately hidden after finishing window switching.

12 months agoosd: prevent preview outlines from overlapping OSD in first output
tokyo4j [Sun, 16 Feb 2025 16:50:55 +0000 (01:50 +0900)]
osd: prevent preview outlines from overlapping OSD in first output

Following code didn't consider multi-monitor setup:

  wlr_scene_node_raise_to_top(&server->menu_tree->node);
  wlr_scene_node_raise_to_top(&output->osd_tree->node);

...because when executed twice, server->menu_tree is raised above
output->osd_tree for the first output. This resulted in a scene tree like
(higher to lower):

- output->osd_tree (for 2nd output)
- output->server->osd_state.preview_outline (placed just above menu_tree)
- sever->menu_tree
- output->osd_tree (for 1st output)

So the previous outline for window switcher is placed above the OSD in the
first output.

12 months agooutput: early return on wlopm if requested state is already set
Consolatis [Thu, 13 Feb 2025 15:28:17 +0000 (16:28 +0100)]
output: early return on wlopm if requested state is already set

This prevents a unnecessary output commit without buffer,
showing up as black flash when repeatedly calling wlopm --on.

12 months agooutput: set custom output mode on wlopm --on
Consolatis [Wed, 12 Feb 2025 16:04:13 +0000 (17:04 +0100)]
output: set custom output mode on wlopm --on

This works around a wlroots issue:
https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3946

Fixes: #2576
12 months agosrc/layers: handle unmap without any outputs left
Consolatis [Wed, 12 Feb 2025 14:14:16 +0000 (15:14 +0100)]
src/layers: handle unmap without any outputs left

12 months agosrc/overlay.c: clean up timer on exit
Consolatis [Mon, 10 Feb 2025 23:39:36 +0000 (00:39 +0100)]
src/overlay.c: clean up timer on exit

12 months agodocs: labwc-config.5.scd: dedent windowSwitcher content lists
Tomi Ollila [Tue, 11 Feb 2025 06:14:07 +0000 (08:14 +0200)]
docs: labwc-config.5.scd: dedent windowSwitcher content lists

fits better on 80-column terminal and is more consistent in style

12 months agodocs: trailing space, 1 tab to spaces, labwc-theme.5.scd to fit 80 cols
Tomi Ollila [Sat, 8 Feb 2025 14:26:47 +0000 (16:26 +0200)]
docs: trailing space, 1 tab to spaces, labwc-theme.5.scd to fit 80 cols

12 months agoCI: fix Debian build, wlroots package got renamed
Consolatis [Fri, 7 Feb 2025 17:01:27 +0000 (18:01 +0100)]
CI: fix Debian build, wlroots package got renamed

Also disable it for now because we can just use the shipped version
of libwlroots-0.18-dev rather than needing to build it ourselves.

12 months agomenu: remove ShowMenu action from menu items
tokyo4j [Fri, 7 Feb 2025 16:32:35 +0000 (01:32 +0900)]
menu: remove ShowMenu action from menu items

Previous commits fixed some unexpected behaviors when ShowMenu action is
executed from menu items, but that was still prone to bugs because when
calling actions_run(), we allow an inconsistent state where all menus are
closed but pipemenus must not be destroyed.

So this commit simply removes ShowMenu actions from menu items on
initialization.

12 months agomenu: assert no menu is opened in menu_open_root()
tokyo4j [Sat, 18 Jan 2025 04:09:47 +0000 (13:09 +0900)]
menu: assert no menu is opened in menu_open_root()

66a3beb added an early-return when the menu is opened, so we can guarantee
that no menu is opened there.

12 months agomenu: fix unexpected behavior when a menu is opened from another menu
tokyo4j [Fri, 24 Jan 2025 00:57:17 +0000 (09:57 +0900)]
menu: fix unexpected behavior when a menu is opened from another menu

server->menu_current should be cleared before calling actions_run() as
it may internally call menu_open_root(). Clearing it after actions_run()
leads to an inconsistent state where a menu is opened but
server->menu_current is NULL. It even lead to a segfault when the item
opening another menu is contained in a pipemenu, because
menu_open_root() calls destroy_pipemenu() when server->menu_current is
set, which makes accessing item->actions a UAF.

12 months agoTranslation updates from weblate
Weblate [Tue, 4 Feb 2025 21:01:18 +0000 (22:01 +0100)]
Translation updates from weblate

Co-authored-by: EggSupernova <leomelo34@protonmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/pt_BR/
Translation: Labwc/labwc

13 months agoREADME.md#Integration: add xfce4-panel
01micko [Wed, 5 Feb 2025 11:23:35 +0000 (21:23 +1000)]
README.md#Integration: add xfce4-panel

inspired by https://forums.bunsenlabs.org/viewtopic.php?pid=141053#p141053

13 months agodocs/rc.xml.all: correct description of resize.cornerRange
Andrew J. Hesford [Tue, 4 Feb 2025 23:44:08 +0000 (18:44 -0500)]
docs/rc.xml.all: correct description of resize.cornerRange

13 months agossd: make sizes of invisible SSD extents configurable
Andrew J. Hesford [Fri, 17 Jan 2025 16:07:07 +0000 (11:07 -0500)]
ssd: make sizes of invisible SSD extents configurable

13 months agoCI: restrict build jobs to code changes
Consolatis [Tue, 4 Feb 2025 21:10:59 +0000 (22:10 +0100)]
CI: restrict build jobs to code changes

13 months agoaction.c: add SSD margin to MoveTo coordinates
Consolatis [Tue, 4 Feb 2025 20:47:24 +0000 (21:47 +0100)]
action.c: add SSD margin to MoveTo coordinates

Fixes: #2469
13 months agoserver: on exit, destroy backends first
Consolatis [Tue, 4 Feb 2025 14:09:45 +0000 (15:09 +0100)]
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
13 months agossd: fix resizing on border corners and add <resize><cornerRange>
tokyo4j [Sat, 1 Feb 2025 05:51:47 +0000 (14:51 +0900)]
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>
13 months agoNEWS.md: start converting section 0.8.0 references
Johan Malm [Mon, 3 Feb 2025 20:16:21 +0000 (20:16 +0000)]
NEWS.md: start converting section 0.8.0 references

...to [#%d] format and process with rip.c

13 months agoAdd scripts/rip.c
Johan Malm [Mon, 3 Feb 2025 20:14:07 +0000 (20:14 +0000)]
Add scripts/rip.c

...to extract pull-request and issue reference from NEWS.md and output
them as GH URLs.

13 months agoquery: encapsulate parser state into a struct
Orfeas [Sun, 12 Jan 2025 11:43:39 +0000 (13:43 +0200)]
query: encapsulate parser state into a struct

13 months agosrc/menu: add global config for menu.showIcons
Consolatis [Mon, 27 Jan 2025 16:19:20 +0000 (17:19 +0100)]
src/menu: add global config for menu.showIcons

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.