Commit graph

3116 commits

Author SHA1 Message Date
John Lindgren
02df0a15d7 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
2025-08-07 23:27:04 -04:00
John Lindgren
55b495f398 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.
2025-08-07 23:27:04 -04:00
Johan Malm
d87ef7568a common/xml.c: fix memory leak in lab_xml_get_bool() 2025-08-06 21:11:42 +01:00
John Lindgren
508df093c4 xdg: try to keep view on the same output in timeout case 2025-08-06 18:14:24 +09:00
John Lindgren
9557091a1a xdg: don't try to reposition unmapped view in timeout handler 2025-08-06 18:14:24 +09:00
tokyo4j
e530f43708 ime: don't use data argument in some signal handlers
In wlroots 0.20, the those data argument will be just NULL.
2025-08-05 11:43:09 +09:00
John Lindgren
2547f96984 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:
8f56f7ca43
2025-08-05 04:20:57 +02:00
John Lindgren
bc34461977 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.)
2025-08-05 04:18:43 +02:00
tokyo4j
17d66e5603 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>
2025-08-04 21:41:14 +01:00
tokyo4j
bfaab101af Make append_actions() public
Also rename it to append_parsed_actions()
2025-08-04 21:41:14 +01:00
tokyo4j
2f183cdcb6 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]">.
2025-08-04 21:24:12 +01:00
tokyo4j
b0ff2911b6 src/overlay.c: minor refactor 2025-08-04 21:24:12 +01:00
tokyo4j
6441bd58f3 view: don't use bitset for VIEW_EDGE_ALL
We will use bitset for views snapped to corner (e.g. top-left = TOP|LEFT)
2025-08-04 21:24:12 +01:00
tokyo4j
4b0ac0234c view: refactor view_edge_parse() 2025-08-04 21:24:12 +01:00
tokyo4j
03004cf44b menu: fix segfault with toplevel <separator>
Before this patch, labwc crashed menu.xml like this:

<openbox_menu>
  <separator />
</openbox_menu>
2025-08-03 15:07:35 +01:00
tokyo4j
00ed40454d 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>
2025-08-03 15:05:53 +01:00
tokyo4j
5a50d87ee2 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>
2025-08-03 15:05:53 +01:00
tokyo4j
b9c84f9c38 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.
2025-08-02 13:19:35 +01:00
tokyo4j
15e3c32b5b action.c: split actions_run() 2025-08-02 13:19:35 +01:00
Johan Malm
6c50a62817 NEWS.md: update notes for 0.9.1 2025-08-02 12:45:11 +01:00
Weblate
9fe1509e33 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
2025-08-02 12:32:17 +01:00
tokyo4j
6e7c4a181e overlay: take into account <core><gap> for region overlay 2025-08-02 12:31:16 +01:00
tokyo4j
38e57891b5 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.
2025-08-02 12:31:16 +01:00
tokyo4j
ca8d98e80f cursor: fix Scroll mousebinds not inhibited with ToggleKeybinds
fixup for 024ab280
2025-08-02 12:27:26 +01:00
tokyo4j
d5c03ab7fb include/edges.h: remove unimplemented function 2025-08-02 16:40:04 +09:00
Weblate
b966a1ed73 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
2025-07-30 21:05:19 +01:00
John Lindgren
2e6b30eb50 include: move a few types from labwc.h to better locations 2025-07-30 21:04:31 +01:00
John Lindgren
e1475a1e47 include: reduce global includes in labwc.h 2025-07-30 21:04:31 +01:00
John Lindgren
e21fc065c4 include: split output.h from labwc.h 2025-07-30 21:04:31 +01:00
tokyo4j
2f414a438b rcxml: simplify the logic to traverse xml tree 2025-07-30 20:36:27 +01:00
tokyo4j
ad970544e1 string-helper: add str_space_only() 2025-07-30 20:36:27 +01:00
tokyo4j
67f36d9e13 rcxml: rewrite <tablet><map> parser 2025-07-30 20:36:27 +01:00
tokyo4j
619cae67fa rcxml: rewrite <theme><font> parser 2025-07-30 20:36:27 +01:00
tokyo4j
a865cc0777 rcxml: reorder functions 2025-07-30 20:36:27 +01:00
tokyo4j
ba00f57dad rcxml: rewrite <windowRules> parser 2025-07-30 20:36:27 +01:00
tokyo4j
936c5f6df1 rcxml: rewrite <windowSwitcher><fields> parser 2025-07-30 20:36:27 +01:00
tokyo4j
73dd3b8de1 rcxml: rewrite <region> parser 2025-07-30 20:36:27 +01:00
tokyo4j
a0d2e6a64b rcxml: rewrite <libinput> parser 2025-07-30 20:36:27 +01:00
tokyo4j
7adbfe88aa rcxml: rewrite <touch> parser 2025-07-30 20:36:27 +01:00
tokyo4j
8ae2d72cef rcxml: rewrite <margin> parser 2025-07-30 20:36:27 +01:00
tokyo4j
be31df097c rcxml: rewrite <mousebind> parser 2025-07-30 20:36:27 +01:00
tokyo4j
433168457f rcxml: rewrite <keybind> parser 2025-07-30 20:36:27 +01:00
tokyo4j
9462457cc2 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.
2025-07-30 20:36:27 +01:00
tokyo4j
8881841098 common/xml: add helpers to parse rc.xml 2025-07-30 20:36:27 +01:00
tokyo4j
503af10505 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.
2025-07-30 20:36:27 +01:00
John Lindgren
330c55e1b2 CONTRIBUTING.md: add section on include order 2025-07-29 21:51:56 +01:00
John Lindgren
0d396f84a7 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
2025-07-29 21:51:56 +01:00
John Lindgren
31d42b50e2 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).
2025-07-29 21:51:56 +01:00
John Lindgren
c9b576982d include: add missing header dependencies
Ensure that headers compile correctly regardless of include order.
2025-07-29 21:51:56 +01:00
Johan Malm
69b9122194 NEWS.md: update with notes on wlroots changes 2025-07-29 21:06:21 +01:00