Commit graph

32 commits

Author SHA1 Message Date
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
tokyo4j
97ce4131bb Replace scaled_rect_buffer with lab_scene_rect
This fixes the gap between menu items and the menu border in an output
with a fractional scale due to the semantic gap between cairo and
wlroots's position-independent scene renderer.
2025-06-10 06:03:03 +09:00
tokyo4j
ffd400503e Replace multi_rect with lab_scene_rect
lab_scene_rect accepts the arbitrary number of borders and a background
color.
2025-06-10 06:03:03 +09: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
16dbdc64e5 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().
2024-12-23 18:11:32 +09:00
tokyo4j
12cae9c7ee Add scaled_rect_buffer
scaled_rect_buffer is an implementation of scaled_scene_buffer and shows
an auto-scaling bordered rectangle. This is intended for menu borders,
but can be also useful for other elements like window switcher items.

We will support rounded corners for scaled_rect_buffer in the future.
2024-11-25 19:41:07 +00:00
tokyo4j
e0848da70d key-state.c: generalize set operations 2024-10-13 20:45:16 +01:00
Orfeas
dda47a5e14 action: make "FocusOutput" behave like "MoveToOutput" 2024-08-24 14:59:42 -04:00
tokyo4j
46ec513630 view: implement cascade placement policy
Adds following settings:
<placement>
  <policy>cascade</policy>
  <cascadeOffset x="40" y="30" />
</placement>

"Cascade" policy places a new window at the center of the screen like
"center" policy, but possibly shifts its position to bottom-right so the
new window doesn't cover existing windows.

The algorithm is copied from KWin's implementation:
df9f8f8346/src/placement.cpp (L589)

Also added some helper functions to manipulate `wlr_box`.
2024-07-20 08:59:46 +01:00
tokyo4j
23b96ad2a6 Replace _ with - in source file names 2024-05-22 07:10:51 +01:00
Andrew J. Hesford
a457542fb1 common: validate and properly parse floats
Fixes: #1665.
2024-04-02 10:37:50 -04:00
Johan Malm
a5fcbfaf72 cursor: process layer subsurfaces in cursor_button_press()
...to give keyboard focus to layer-shell clients if exclusive or on-demand
interactivity is set, so that menu popups can be navigated with the
keyboard. This still only works if the client is in top (or overlay)
layers. Support for bottom and background to be done as a separate patch
set.

Revert 06b19f0 to process layer-shell subsurfaces in
`cursor_button_press()`, but only when their parent layer-shell surface
has keyboard interactivity.

Fix bug in `get_cursor_context()` which resulted in layer-surfaces not
being detected correctly.

Background:

Commit 06b19f0 (issue #1131) disabled processing of layer-shell
subsurfaces in cursor_button_press() because when pressing a task in
Waybar (Gtk panel using layer-shell subsurfaces) the foreign-toplevel
minimize-raise action did not work correctly as the action logic relied on
the recipient window being activated and by clicking on the panel, the
panel itself was both surface-focusd and activated (and thus the window
de-activated).

The un-intended consequence was that by not responding to layer-subsurface
cursor buttons presses, layer-shell clients (such as panels) were not
given keyboard focus if they indeed wanted it by setting exclusive or
on-demand keyboard interactivity.

The good news is that that following @jlindgren90's refactoring (various)
the only place where we call `view_set_actived()` is in
`focus_change_notify()` in `seat.c` and we now only do it for views
(bb8f0bc).

Another side-effect (positive) of 06b19f0 was that a Waybar dnd bug was
fixed (pointer-serial-number validation failure).

Have tested with sfwbar, waybar and tint (test-panel) the following
results:
- Minimize-raise works even when on-demand keyboard interactivity is set
- Keyboard interactivity is given popup-menus (sfwbar and tint) when the
  panels are in the top layer (support for bottom will be as a separate
  patch set)
- Waybar dnd still works (even when hard-coding keyboard-interactivity)

References:
- bb8f0bc960
- 40ce95a68c/src/seat.c (L481-L483)
- 40ce95a68c/src/dnd.c (L24)
- https://github.com/johanmalm/tint

Fixes: #1572
2024-03-09 00:44:19 +01:00
Johan Malm
a386133068 common/file-helpers.c: share file_exists() to reduce duplication 2023-09-17 19:26:41 +01:00
Johan Malm
71f5ac8323 Add common/match.c with match_glob() from theme.c
...and make it fully case-insensitive in preparation for window-rules.
2023-05-04 22:09:55 +01:00
Johan Malm
fa50149525 common/parse-bool.c: make parse_bool() generic
...to avoid multiple versions of a boolean-parser.

- Optionally take a default value
- Return -1 on error
- Rename get-bool.c to parse-bool.c
2023-04-26 15:11:31 +01:00
Johan Malm
bdf6e13881 Move get_bool() to src/common/
...in preparation for sharing it more widely
2023-03-26 19:52:50 +02:00
John Lindgren
cb40cdc36c common: Add additional memory utilities (xzalloc() etc.) 2022-09-17 10:57:30 -04:00
Consolatis
8c8583ef94 common/graphic-helpers: Add multi_rect 2022-08-20 22:16:52 +01:00
Joshua Ashton
6c2bbb42ea common: Add helpers for raising/lowering FD limit
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2022-07-17 00:59:23 +00:00
Consolatis
5d79911244 Add scaled_font_buffer implementation 2022-06-14 22:03:08 +01:00
Consolatis
c3f07aacf0 Add abstract scaled_scene_buffer implementation 2022-06-14 22:03:08 +01:00
Consolatis
5862b65f89 Convert SSD to scene nodes 2022-02-23 21:47:01 +00:00
Johan Malm
82e47ac1f5 Remove src/common/log.c
Use wlr_log() instead
2021-07-23 21:15:55 +01:00
Johan Malm
9f61a819fc Add zfree 2021-02-21 21:59:53 +00:00
Johan Malm
9eac349046 rc.xml: move nodename() to nodename.c 2021-02-16 21:04:49 +00:00
Johan Malm
7e55e2cd09 Add string-helpers.c 2020-10-09 19:46:59 +01:00
Johan Malm
2a17df0f8b Add log.c with info() and warn() 2020-08-12 19:37:44 +01:00
Johan Malm
f003abf608 Simplify and merge {config,theme}-dir.c 2020-08-10 17:24:17 +01:00
Johan Malm
6627a47305 s/xbm_read_file()/grab_file/() 2020-08-06 15:01:08 +01:00
Johan Malm
2297e43cc0 Base rc.title_height on font vertical extents 2020-08-05 20:14:17 +01:00
Johan Malm
158f42d1e8 src/rcxml.c: parse <keybind> 2020-06-19 22:00:22 +01:00
Johan Malm
bc51e0ad2f src/config/rcxml.c: parse xml from buffer
Avoid unit tests writing to/from files by using xmlParseMemory() instead
of xmlReadFile().
2020-06-09 21:40:46 +01:00