]> git.mdlowis.com Git - proto/labwc.git/log
proto/labwc.git
6 months agolabwc-menu(5): reflect use of client-send-to-menu in client menu
Johan Malm [Wed, 13 Aug 2025 20:38:40 +0000 (21:38 +0100)]
labwc-menu(5): reflect use of client-send-to-menu in client menu

6 months agomenu: fix leak in update_client_send_to_menu()
Johan Malm [Wed, 13 Aug 2025 20:37:51 +0000 (21:37 +0100)]
menu: fix leak in update_client_send_to_menu()

6 months agomenu: use client-send-to-menu as 'Workspace' submenu
Johan Malm [Wed, 13 Aug 2025 19:34:07 +0000 (20:34 +0100)]
menu: use client-send-to-menu as 'Workspace' submenu

...because that is more flexible and how it is in openbox.

I have had in mind that we should do this since the original
implementation, and #2994 just jogged my memory.

6 months agomenu: fix use-after-free at exit with sub-menu selected
John Lindgren [Fri, 15 Aug 2025 05:29:15 +0000 (01:29 -0400)]
menu: fix use-after-free at exit with sub-menu selected

Sequence of events:

- menu_finish() frees the sub-menu first
- the selection.menu of the parent menu is now dangling
- menu_finish() frees the parent menu
- menu_free() calls menu_close_root() on the parent menu
- menu_close_root() tries to close the (freed) sub-menu
- boom

Extending nullify_item_pointing_to_this_menu() avoids the crash.

6 months agoinput/cursor: fix assignment/equality mix-up
John Lindgren [Thu, 14 Aug 2025 18:35:44 +0000 (14:35 -0400)]
input/cursor: fix assignment/equality mix-up

6 months agomenu: allow overwriting submenu icon
tokyo4j [Thu, 14 Aug 2025 17:38:02 +0000 (02:38 +0900)]
menu: allow overwriting submenu icon

Allow overwriting the icon of item linking to another menu like below
(the icon for "krita" should be shown):

<openbox_menu>
  <menu id="static-menu" label="Static Menu" icon="mpv" />
  <menu id="root-menu" label="Root">
    <menu id="static-menu" icon="krita" />
  </menu>
</openbox_menu>

This commit also fixes my mistake in 17d66e5 (s/parent->icon/menu->icon/)
that showed incorrect icon in an item linking to another menu.

6 months agomenu: fix client-send-to-menu
tokyo4j [Wed, 13 Aug 2025 15:08:06 +0000 (00:08 +0900)]
menu: fix client-send-to-menu

Fixes 17d66e5

6 months agomenu: allow client-{list-combined,send-to}-menu as submenu of static menu
tokyo4j [Wed, 13 Aug 2025 14:52:24 +0000 (23:52 +0900)]
menu: allow client-{list-combined,send-to}-menu as submenu of static menu

Also, their labels are changed to "Windows" and "Send to desktop" which
are the same as Openbox.

6 months agoTranslation updates from weblate
Weblate [Mon, 11 Aug 2025 00:27:15 +0000 (02:27 +0200)]
Translation updates from weblate

Co-authored-by: Oliver Chiasson <olivierchiasson@hotmail.fr>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fr/
Translation: Labwc/labwc

6 months agodocs/menu.xml: adjust labnag example
Narrat [Tue, 12 Aug 2025 21:25:45 +0000 (23:25 +0200)]
docs/menu.xml: adjust labnag example

It was missing the respective closing tag

6 months agolabnag: return special value on timeout
Johan Malm [Sat, 9 Aug 2025 14:15:35 +0000 (15:15 +0100)]
labnag: return special value on timeout

...to avoid taking either of the <then> or <else> branches on timeout.

6 months agoosd: add null-check for output->osd_scene.tree
tokyo4j [Sat, 9 Aug 2025 10:53:10 +0000 (19:53 +0900)]
osd: add null-check for output->osd_scene.tree

`wlr_scene_node_destroy(&output->osd_scene.tree->node);` does nothing
for null pointer, but ASAN is unhappy about accessing (NULL)->node.

6 months agoaction: fix labnag button order
Johan Malm [Sat, 9 Aug 2025 09:54:06 +0000 (10:54 +0100)]
action: fix labnag button order

6 months agolabnag: fix FreeBSD signalfd() build error
Johan Malm [Fri, 8 Aug 2025 18:17:22 +0000 (19:17 +0100)]
labnag: fix FreeBSD signalfd() build error

6 months agolabwc-action(5): describe If action <prompt>
Johan Malm [Tue, 24 Jun 2025 19:44:32 +0000 (20:44 +0100)]
labwc-action(5): describe If action <prompt>

6 months agoAdd labnag
Johan Malm [Mon, 28 Apr 2025 19:38:19 +0000 (20:38 +0100)]
Add labnag

Based on swaynag (https://github.com/swaywm/sway/tree/master/swaynag)

Copied at commit:
https://github.com/swaywm/sway/commit/03483ff3707a358d935e451d39748e58c205ce8a

Contains the following modifiations:

- Some functional changes including:
  - Disable exclusive-zone by default (Written-by: @Consolatis) and add
    command line option -x|--exclusive-zone
  - Add close timeout (Written-by: @Consolatis) and -t|--timeout option
  - Use index of button (from right-to-left) for exit code
  - Disable reading from config file and remove associated --type option
- Refactoring including:
  - Use wlr_log() instead of the log.{c,h} functions
  - Use wl_list instead of sway's list.c implementation
  - In the pango wrapper functions, use glib's g_strdup_vprintf() rather
    than the original stringop.c functions
- Align with labwc coding style to pass checkpatch.pl
- Re-licenced from MIT to GPL-2.0, and add Copyright notices for original
  authors

v2

- Remove option -s|--dismiss-button and the default "X" button. To get
  such a button, "-Z X :"
- Remove options -b and -z because there is no requirement to run
  in a terminal.
- Remove *-no-terminal from options --button and --button-dismiss because
  commands are now always run directly without a terminal.

v3

- Allow -B/-Z options without action-argument
- Invert button order of -B/-Z so that `labnag -m foo -Z x -Z y -Z z`
  results in three buttons with "x" furthest to the left, and "z" on the
  right (rather than the other way around).
- Use signalfd() to prevent race conditions on SIGTERM

v4

- Limit number of stdin lines to 200 to avoid hogging CPU

Co-Authored-by: tokyo4j
6 months agobuild: refactor in preparation for man page not beginning with 'labwc-'
Johan Malm [Mon, 28 Apr 2025 19:33:50 +0000 (20:33 +0100)]
build: refactor in preparation for man page not beginning with 'labwc-'

No functional change intended.

6 months agoaction: add support for <prompt> in 'If' actions
Consolatis [Fri, 20 Dec 2024 09:14:32 +0000 (10:14 +0100)]
action: add support for <prompt> in 'If' actions

...and allow If Action without activator view.

For example:

    <action name="If">
      <prompt message="Toggle maximize?"/>
      <then>
        <action name="ToggleMaximize" />
      </then>
    </action>

Also revert the change in b9c84f9 that <else> branch is always taken when
no window is focused.

Co-Authored-by: johanmalm
Co-Authored-by: tokyo4j
6 months agoscaled-icon-buffer: prevent accidental downcasting of scale
Consolatis [Sat, 9 Aug 2025 02:48:39 +0000 (04:48 +0200)]
scaled-icon-buffer: prevent accidental downcasting of scale

This causes blurry icons on non-integer scales and triggers
an assert within cairo when using a output scale < 1.

Fixes: #2983
6 months agoime: fix segfault when IME is killed
tokyo4j [Thu, 7 Aug 2025 08:45:30 +0000 (17:45 +0900)]
ime: fix segfault when IME is killed

Fixes up e530f43.

When IME (e.g. fcitx5) is killed, relay->input_method is destroyed and
then relay->input_method->keyboard_grab is destroyed, which causes null
pointer dereference and crashes labwc.

Possible solutions are:
- Let wlroots keep emitting keyboard grab as `data` from keyboard grab's
  destroy handler just like before
- Let wlroots destroy keyboard grab before input method
- Let compositor store keyboard grab as relay->keyboard_grab

But let's just revert the change in e530f43 for now.

6 months agoforeign-toplevel: simplify and fully separate ext-foreign/wlr-foreign
John Lindgren [Fri, 8 Aug 2025 00:30:59 +0000 (20:30 -0400)]
foreign-toplevel: simplify and fully separate ext-foreign/wlr-foreign

Currently, the dependencies between foreign-toplevel[-internal],
ext-foreign, and wlr-foreign are cyclical and a bit complex.

I suggest we reorganize it into a simpler hierarchy:

  foreign-toplevel/
    -> foreign.c/h
      -> (depends on) ext-foreign.c/h
      -> (depends on) wlr-foreign.c/h

The refactored code is smaller and (IMO) easier to follow.

In detail:

- Add include/foreign-toplevel folder mirroring src/foreign-toplevel
- Split foreign-toplevel-internal.h to ext-foreign.h and wlr-foreign.h
- Eliminate ext-/wlr-foreign.c -> foreign.c reverse dependencies
  (including internal signals and foreign_request* functions)
- Make struct foreign_toplevel private to foreign.c

Lightly tested with qmpanel (which uses wlr-foreign-toplevel).

v2: reorder foreign-toplevel internal API funcs

6 months agoforeign-toplevel: disconnect internal signals from handle_handle_destroy()
John Lindgren [Thu, 7 Aug 2025 19:27:12 +0000 (15:27 -0400)]
foreign-toplevel: disconnect internal signals from handle_handle_destroy()

If the handle gets destroyed from the wlroots side before the view
is destroyed, the internal signals (emitted from the view) are not
disconnected and will assert() if invoked.

7 months agocommon/xml.c: fix memory leak in lab_xml_get_bool()
Johan Malm [Wed, 6 Aug 2025 20:05:28 +0000 (21:05 +0100)]
common/xml.c: fix memory leak in lab_xml_get_bool()

7 months agoxdg: try to keep view on the same output in timeout case
John Lindgren [Wed, 6 Aug 2025 04:30:54 +0000 (00:30 -0400)]
xdg: try to keep view on the same output in timeout case

7 months agoxdg: don't try to reposition unmapped view in timeout handler
John Lindgren [Wed, 6 Aug 2025 04:23:40 +0000 (00:23 -0400)]
xdg: don't try to reposition unmapped view in timeout handler

7 months agoime: don't use data argument in some signal handlers
tokyo4j [Sun, 6 Jul 2025 20:15:46 +0000 (05:15 +0900)]
ime: don't use data argument in some signal handlers

In wlroots 0.20, the those data argument will be just NULL.

7 months agoview: assert internal signals are disconnected before destroy
John Lindgren [Tue, 5 Aug 2025 00:55:16 +0000 (20:55 -0400)]
view: assert internal signals are disconnected before destroy

If they are not empty, then we are headed for use-after-free shortly.
An assert() failure is easier to debug than UAF, so let's fail early.

Inspired by:
https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/8f56f7ca43257cc05c7c4eb57a0f541e05cf9a79

7 months agooutput: make autoEnableOutputs=no apply only to drm outputs
John Lindgren [Tue, 5 Aug 2025 00:28:25 +0000 (20:28 -0400)]
output: make autoEnableOutputs=no apply only to drm outputs

It is not really useful for other output backends and just results
in no outputs being enabled at all. (This is mainly an annoyance for
developers normally running with drm but occasionally nested.)

7 months agomenu: refactor parser
tokyo4j [Mon, 4 Aug 2025 03:55:13 +0000 (12:55 +0900)]
menu: refactor parser

...with the same approach as rcxml.c

- `If` actions now works for menus
- `name` argument no longer have to be the first argument of <action>
- `label` argument no longer have to be the first argument of <item>

7 months agoMake append_actions() public
tokyo4j [Mon, 4 Aug 2025 03:54:29 +0000 (12:54 +0900)]
Make append_actions() public

Also rename it to append_parsed_actions()

7 months agointeractive: allow snapping to corner edges
tokyo4j [Sat, 2 Aug 2025 12:35:51 +0000 (21:35 +0900)]
interactive: allow snapping to corner edges

In addition to <snapping><range>, <snapping><cornerRange> configures the
distance from the screen corner to trigger quater window snapping.

Also, new values "up-left", "up-right", "down-left" and "down-right" are
allowed for <action name="(Toggle)SnapToEdge" direction="[value]"> and
<query tiled="[value]">.

7 months agosrc/overlay.c: minor refactor
tokyo4j [Sat, 2 Aug 2025 12:35:34 +0000 (21:35 +0900)]
src/overlay.c: minor refactor

7 months agoview: don't use bitset for VIEW_EDGE_ALL
tokyo4j [Sat, 2 Aug 2025 12:11:12 +0000 (21:11 +0900)]
view: don't use bitset for VIEW_EDGE_ALL

We will use bitset for views snapped to corner (e.g. top-left = TOP|LEFT)

7 months agoview: refactor view_edge_parse()
tokyo4j [Sat, 2 Aug 2025 12:16:40 +0000 (21:16 +0900)]
view: refactor view_edge_parse()

7 months agomenu: fix segfault with toplevel <separator>
tokyo4j [Sun, 3 Aug 2025 07:55:59 +0000 (16:55 +0900)]
menu: fix segfault with toplevel <separator>

Before this patch, labwc crashed menu.xml like this:

<openbox_menu>
  <separator />
</openbox_menu>

7 months agocommon/xml: parse CDATA as text
tokyo4j [Sun, 3 Aug 2025 07:09:18 +0000 (16:09 +0900)]
common/xml: parse CDATA as text

Before this patch, <![CDATA[xxx]]> was ignored in many cases.

For example, this didn't work:

  <core>
    <gap><![CDATA[10]]></gap>
  </core>

7 months agocommon/xml: let LAB_XML_FOR_EACH() skip first child text nodes
tokyo4j [Sat, 2 Aug 2025 15:02:02 +0000 (00:02 +0900)]
common/xml: let LAB_XML_FOR_EACH() skip first child text nodes

Before this patch, first text nodes like the spaces between <a> and <b>
below were also travered by LAB_XML_FOR_EACH():

  <a>  <b>foo</b></a>

7 months agoaction: allow if-action without activator view
tokyo4j [Fri, 1 Aug 2025 07:15:00 +0000 (16:15 +0900)]
action: allow if-action without activator view

..in preparation for If/ForEach action with <prompt>, which should be
executed whether or not any window is focused.

This patch makes <If> actions execute <else> branch if no window is
focused or hovered.

7 months agoaction.c: split actions_run()
tokyo4j [Fri, 1 Aug 2025 07:06:58 +0000 (16:06 +0900)]
action.c: split actions_run()

7 months agoNEWS.md: update notes for 0.9.1
Johan Malm [Thu, 31 Jul 2025 20:37:03 +0000 (21:37 +0100)]
NEWS.md: update notes for 0.9.1

7 months agoTranslation updates from weblate
Weblate [Sat, 2 Aug 2025 08:01:19 +0000 (10:01 +0200)]
Translation updates from weblate

Co-authored-by: Dimitrios Glentadakis <dglent@free.fr>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: 이정희 <daemul72@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/el/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ko/
Translation: Labwc/labwc

7 months agooverlay: take into account <core><gap> for region overlay
tokyo4j [Sat, 5 Jul 2025 07:07:04 +0000 (16:07 +0900)]
overlay: take into account <core><gap> for region overlay

7 months agooverlay: take into account <core><gap> for edge overlay
tokyo4j [Sat, 5 Jul 2025 07:06:38 +0000 (16:06 +0900)]
overlay: take into account <core><gap> for edge overlay

This also deduplicates get_edge_snap_box() in interactive.c and
view_get_edge_snap_box() in view.c.

7 months agocursor: fix Scroll mousebinds not inhibited with ToggleKeybinds
tokyo4j [Sat, 2 Aug 2025 11:10:09 +0000 (20:10 +0900)]
cursor: fix Scroll mousebinds not inhibited with ToggleKeybinds

fixup for 024ab280

7 months agoinclude/edges.h: remove unimplemented function
tokyo4j [Sat, 2 Aug 2025 07:25:36 +0000 (16:25 +0900)]
include/edges.h: remove unimplemented function

7 months agoTranslation updates from weblate
Weblate [Wed, 30 Jul 2025 08:01:19 +0000 (10:01 +0200)]
Translation updates from weblate

Co-authored-by: BigELK176 ≡ <BigELK176@gmail.com>
Co-authored-by: Valera <ValeraDX@yandex.ru>
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ru/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/zh_TW/
Translation: Labwc/labwc

7 months agoinclude: move a few types from labwc.h to better locations
John Lindgren [Sat, 26 Jul 2025 20:23:02 +0000 (16:23 -0400)]
include: move a few types from labwc.h to better locations

7 months agoinclude: reduce global includes in labwc.h
John Lindgren [Mon, 28 Jul 2025 05:22:10 +0000 (01:22 -0400)]
include: reduce global includes in labwc.h

7 months agoinclude: split output.h from labwc.h
John Lindgren [Sat, 26 Jul 2025 19:34:45 +0000 (15:34 -0400)]
include: split output.h from labwc.h

7 months agorcxml: simplify the logic to traverse xml tree
tokyo4j [Fri, 11 Apr 2025 19:20:02 +0000 (04:20 +0900)]
rcxml: simplify the logic to traverse xml tree

7 months agostring-helper: add str_space_only()
tokyo4j [Fri, 11 Apr 2025 20:06:08 +0000 (05:06 +0900)]
string-helper: add str_space_only()

7 months agorcxml: rewrite <tablet><map> parser
tokyo4j [Fri, 11 Apr 2025 18:21:13 +0000 (03:21 +0900)]
rcxml: rewrite <tablet><map> parser

7 months agorcxml: rewrite <theme><font> parser
tokyo4j [Fri, 11 Apr 2025 18:09:14 +0000 (03:09 +0900)]
rcxml: rewrite <theme><font> parser

7 months agorcxml: reorder functions
tokyo4j [Fri, 11 Apr 2025 17:50:05 +0000 (02:50 +0900)]
rcxml: reorder functions

7 months agorcxml: rewrite <windowRules> parser
tokyo4j [Fri, 11 Apr 2025 17:40:31 +0000 (02:40 +0900)]
rcxml: rewrite <windowRules> parser

7 months agorcxml: rewrite <windowSwitcher><fields> parser
tokyo4j [Fri, 11 Apr 2025 17:08:45 +0000 (02:08 +0900)]
rcxml: rewrite <windowSwitcher><fields> parser

7 months agorcxml: rewrite <region> parser
tokyo4j [Fri, 11 Apr 2025 16:48:11 +0000 (01:48 +0900)]
rcxml: rewrite <region> parser

7 months agorcxml: rewrite <libinput> parser
tokyo4j [Fri, 11 Apr 2025 16:40:39 +0000 (01:40 +0900)]
rcxml: rewrite <libinput> parser

7 months agorcxml: rewrite <touch> parser
tokyo4j [Fri, 11 Apr 2025 16:33:28 +0000 (01:33 +0900)]
rcxml: rewrite <touch> parser

7 months agorcxml: rewrite <margin> parser
tokyo4j [Fri, 11 Apr 2025 16:27:49 +0000 (01:27 +0900)]
rcxml: rewrite <margin> parser

7 months agorcxml: rewrite <mousebind> parser
tokyo4j [Fri, 11 Apr 2025 18:41:27 +0000 (03:41 +0900)]
rcxml: rewrite <mousebind> parser

7 months agorcxml: rewrite <keybind> parser
tokyo4j [Fri, 11 Apr 2025 18:32:37 +0000 (03:32 +0900)]
rcxml: rewrite <keybind> parser

7 months agorcxml: rewrite action parser
tokyo4j [Fri, 11 Apr 2025 15:57:03 +0000 (00:57 +0900)]
rcxml: rewrite action parser

This commit rewrites the nested action parser into append_actions() which
is used by following commits. At this point, it's not used yet and parsing
"If" action is temporarily disabled.

7 months agocommon/xml: add helpers to parse rc.xml
tokyo4j [Fri, 11 Apr 2025 11:25:12 +0000 (20:25 +0900)]
common/xml: add helpers to parse rc.xml

7 months agorcxml: convert dotted properties into nested nodes before processing
tokyo4j [Wed, 9 Apr 2025 15:43:21 +0000 (00:43 +0900)]
rcxml: convert dotted properties into nested nodes before processing

For example, the following node:

  <keybind name.action="ShowMenu" menu.action="root-menu"
            x.position.action="1" y.position.action="2" />

is converted to:

 <keybind>
   <action>
     <name>ShowMenu</name>
     <menu>root-menu</menu>
     <position>
       <x>1</x>
       <y>2</y>
     </position>
   </action>
 </keybind>

...before processing the entire xml tree. This is a preparation to prevent
breaking changes when we refactor rcxml.c to use recursion instead of
encoding nodes into dotted strings.

7 months agoCONTRIBUTING.md: add section on include order
John Lindgren [Tue, 29 Jul 2025 05:59:40 +0000 (01:59 -0400)]
CONTRIBUTING.md: add section on include order

7 months agoCONTRIBUTING.md: minor updates
John Lindgren [Tue, 29 Jul 2025 05:17:42 +0000 (01:17 -0400)]
CONTRIBUTING.md: minor updates

- style "GLib" with two capitals as in its own upstream docs
- use title-case consistently for headings
- add missing heading to table of contents
- update dead GLib documentation URL

7 months agosrc: include primary header first
John Lindgren [Mon, 28 Jul 2025 05:02:01 +0000 (01:02 -0400)]
src: include primary header first

This is a common practice in C projects, which simply enforces that
each header must compile cleanly without implicit dependencies on
other headers (see also the previous commit).

7 months agoinclude: add missing header dependencies
John Lindgren [Mon, 28 Jul 2025 05:03:22 +0000 (01:03 -0400)]
include: add missing header dependencies

Ensure that headers compile correctly regardless of include order.

7 months agoNEWS.md: update with notes on wlroots changes
Johan Malm [Mon, 28 Jul 2025 19:48:56 +0000 (20:48 +0100)]
NEWS.md: update with notes on wlroots changes

7 months agoFix some warnings from clang-tidy
tokyo4j [Mon, 28 Jul 2025 04:54:10 +0000 (13:54 +0900)]
Fix some warnings from clang-tidy

Notably this fixes a possible null pointer dereference in warp_cursor()
when output_nearest_to_cursor() returns null.

7 months agoTranslation updates from weblate
Weblate [Sat, 19 Jul 2025 18:47:42 +0000 (20:47 +0200)]
Translation updates from weblate

Co-authored-by: Abdullah Albaroty <albaroty@gmail.com>
Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
Co-authored-by: Moo <hazap@hotmail.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: kmephistoh <kanhaosmile@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ar/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/lt/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/pt/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/zh_CN/
Translation: Labwc/labwc

7 months agocursor: also toggle mousebinds with ToggleKeybinds
tokyo4j [Thu, 24 Jul 2025 02:08:03 +0000 (11:08 +0900)]
cursor: also toggle mousebinds with ToggleKeybinds

Mousebinds can still be applied when the cursor is over their decoration

7 months agoRemove seat->nr_inhibited_keybind_views
tokyo4j [Wed, 23 Jul 2025 16:18:36 +0000 (01:18 +0900)]
Remove seat->nr_inhibited_keybind_views

7 months agosrc/xdg.c: prevent interacting with un-initialized xdg toplevels after unmap
Consolatis [Sun, 27 Jul 2025 13:55:43 +0000 (15:55 +0200)]
src/xdg.c: prevent interacting with un-initialized xdg toplevels after unmap

Fixes: #2937
Fixes: #2944
Originally-Reported-By: tranzystorekk via IRC
7 months agostyle: remove newlines after wl_list_for_each_reverse()
tokyo4j [Sat, 26 Jul 2025 23:00:10 +0000 (08:00 +0900)]
style: remove newlines after wl_list_for_each_reverse()

7 months agomenu: add struct menu_parse_context to reduce static vars
John Lindgren [Sat, 19 Jul 2025 03:06:20 +0000 (23:06 -0400)]
menu: add struct menu_parse_context to reduce static vars

The lifetime of the "current_" variables (current_menu, current_item,
current_item_action) is very difficult to understand from reading the
code. It appears that e.g. current_menu could still point to a previous
menu when starting to parse a new one, with unpredictable results.

Let's use a context struct when parsing, and consistently initialize
it when beginning to build a new menu.

Lightly tested with:

- default menus (no menu.xml)
- example static menu from labwc.github.io/getting-started.html
- an added "client-list-combined-menu" sub-menu
- pipe menu generated by `labwc-menu-generator -p`

v2: style fix

7 months agocursor: prevent hi-res mice triggering scroll actions too often
tokyo4j [Mon, 21 Jul 2025 15:19:22 +0000 (00:19 +0900)]
cursor: prevent hi-res mice triggering scroll actions too often

Hi-res mice produces mulitple scroll events with `delta_discrete` != 0
during a single "click". This patch makes them trigger `Scroll` actions
only when the accumulated `delta_discrete` exceeds 120 (= 1 click).

See https://lists.freedesktop.org/archives/wayland-devel/2019-April/040377.html
for how hi-res scroll events are reported.

7 months agobuf: avoid 'new' as variable name
John Lindgren [Fri, 4 Jul 2025 04:17:18 +0000 (00:17 -0400)]
buf: avoid 'new' as variable name

It's just good practice to avoid C++ keywords, in case someone
someday wants to compile this code as C++.

7 months agosession-lock: eliminate pointless compound literal
John Lindgren [Fri, 4 Jul 2025 04:45:59 +0000 (00:45 -0400)]
session-lock: eliminate pointless compound literal

In C++, this would have caused a use-after-free. In C, the unnamed
array remains in scope longer, so it's okay, but still pointless.

7 months agosrc: put designated initializers in member order
John Lindgren [Fri, 4 Jul 2025 04:40:15 +0000 (00:40 -0400)]
src: put designated initializers in member order

Out-of-order named initializers are allowed in C (unlike in C++) but
are still surprising - I don't see a reason not to put them in order.

7 months agosrc: avoid tentative definitions of static data
John Lindgren [Fri, 4 Jul 2025 04:12:21 +0000 (00:12 -0400)]
src: avoid tentative definitions of static data

Having multiple declarations of the same static data (where one is
considered "tentative") is kind of an obscure C feature -- I didn't
even know the name of it until today. It's also forbidden in C++.

In the case of circular dependencies between static data <-> function,
the more typical pattern is to forward-declare the function, then the
data, then provide the function definition. Let's follow that pattern.

7 months agostring-helpers: remove restrict qualifier
John Lindgren [Fri, 4 Jul 2025 04:15:56 +0000 (00:15 -0400)]
string-helpers: remove restrict qualifier

'restrict' is harmful as it encourages the compiler to make dangerous
assumptions while increasing cognitive load on the human programmer.

The extra 1% (or whatever) of performance here is not worth the cost.

7 months agosrc: add braces to switch cases containing declarations
John Lindgren [Fri, 4 Jul 2025 04:42:25 +0000 (00:42 -0400)]
src: add braces to switch cases containing declarations

This limits the scope of the declarations to avoid accidents.

7 months agosrc: prefer 'if' over 'goto' where convenient
John Lindgren [Fri, 4 Jul 2025 04:44:22 +0000 (00:44 -0400)]
src: prefer 'if' over 'goto' where convenient

'goto' should not be used for normal control flow.

v2 add comment in lieu of goto label

7 months agosrc: avoid implicit int/bool -> enum conversions
John Lindgren [Fri, 4 Jul 2025 04:37:39 +0000 (00:37 -0400)]
src: avoid implicit int/bool -> enum conversions

Use the defined enum constants instead.

7 months agokeybind: pointer to string literal should be const
John Lindgren [Fri, 4 Jul 2025 04:18:53 +0000 (00:18 -0400)]
keybind: pointer to string literal should be const

Assigning to (char*) creates a mutable string literal, which was
likely not intended here and wasn't necessary.

7 months agomenu: do not modify literal string constants
John Lindgren [Fri, 4 Jul 2025 03:35:37 +0000 (23:35 -0400)]
menu: do not modify literal string constants

Mutable string literals are a "legacy" C feature best avoided.

v2: move string_truncate_at_pattern() outside fill_item()

7 months agocomments: added short description to view_edge enum
lynxy [Mon, 14 Jul 2025 21:47:42 +0000 (23:47 +0200)]
comments: added short description to view_edge enum

7 months agoactions: prevent users entering invalid direction=any value
lynxy [Wed, 2 Jul 2025 22:39:32 +0000 (00:39 +0200)]
actions: prevent users entering invalid direction=any value

7 months agoactions: added query tiled=any comparison for rc.xml simplification
lynxy [Wed, 2 Jul 2025 22:04:27 +0000 (00:04 +0200)]
actions: added query tiled=any comparison for rc.xml simplification

7 months agoimg: fix apparent double-free in img_svg_render() failure path
John Lindgren [Sun, 13 Jul 2025 01:30:26 +0000 (21:30 -0400)]
img: fix apparent double-free in img_svg_render() failure path

img_svg_render() calls g_object_unref() on the RsvgHandle in its
error path, but the handle is owned by the shared lab_img_data
struct and will be double-freed later by lab_img_destroy().

The double-free was introduced when img_svg_load() was split from
img_svg_render(). The g_object_unref() should have been removed from
img_svg_render() but was missed.

Fixes: 16dbdc64e58d66011bbf319b92de844dab0ca8d9
("ssd: rework titlebar button rendering")

7 months agoxwayland: fix swapped width/height in _NET_WM_ICON stride calculation
John Lindgren [Sun, 13 Jul 2025 01:10:59 +0000 (21:10 -0400)]
xwayland: fix swapped width/height in _NET_WM_ICON stride calculation

Probably slipped through since most window icons are square anyway.

7 months agobuild: bump version to 0.9.0
Johan Malm [Fri, 11 Jul 2025 20:50:42 +0000 (21:50 +0100)]
build: bump version to 0.9.0

7 months agoNEWS.md: update notes for 0.9.0
Johan Malm [Sun, 29 Jun 2025 21:03:18 +0000 (22:03 +0100)]
NEWS.md: update notes for 0.9.0

7 months agodocs: update package maintainer list
Consolatis [Fri, 11 Jul 2025 11:57:50 +0000 (13:57 +0200)]
docs: update package maintainer list

The Arch package is now an official Arch package with
a new maintainer.

The Github account of the Artix Linux maintainer has
been deleted.

8 months agoTranslation updates from weblate
Weblate [Sun, 6 Jul 2025 14:14:10 +0000 (16:14 +0200)]
Translation updates from weblate

Co-authored-by: Batu <bai@baturax.com>
Co-authored-by: Heimen Stoffels <vistausss@fastmail.com>
Co-authored-by: Jan Rolski <wbcwknvstb@proton.me>
Co-authored-by: NorwayFun <temuri.doghonadze@gmail.com>
Co-authored-by: Priit Jõerüüt <lxqtwlate@joeruut.com>
Co-authored-by: Roberalz <lumintnian@outlook.com>
Co-authored-by: Sa'eed M Farahani <silitonix@gmail.com>
Co-authored-by: Standreas <standreas@riseup.net>
Co-authored-by: UTUMI Hirosi <utuhiro78@yahoo.co.jp>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: bittin <bittin@reimu.nl>
Co-authored-by: therealmate <hellogaming91@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/es/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/et/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/eu/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fa/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/gl/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/hu/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/it/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ja/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ka/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/nl/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/pl/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/sv/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/tr/
Translation: Labwc/labwc

8 months agoAdded information about idle screen inhibitor.
Kyuyrii [Wed, 2 Jul 2025 21:56:17 +0000 (18:56 -0300)]
Added information about idle screen inhibitor.

8 months agoDisable all output leasing due to a wlroots UAF
Consolatis [Fri, 4 Jul 2025 22:19:33 +0000 (00:19 +0200)]
Disable all output leasing due to a wlroots UAF

8 months agoFix UAF when granting an output lease
Consolatis [Fri, 4 Jul 2025 22:15:53 +0000 (00:15 +0200)]
Fix UAF when granting an output lease

Wlroots now destroys the wlr_output when granting a lease.
So we can't iterate through the outputs in the request after
granting the lease. This is also not necessary anymore because
they are already destroyed and thus removed from the layout.