Commit graph

878 commits

Author SHA1 Message Date
tokyo4j
5e422a0bc2 action: fix menu position with "x"/"y" arguments in multi-monitor setup
Prior to this commit, output-relative coordinate was passed to
menu_open_root() as the menu position when it's designated via "x"/"y"
arguments in ShowMenu action, so menu can be misplaced to the output other
than the one in which the cursor is in.
2024-12-08 17:00:03 +00:00
Johan Malm
8e3d5784a3 docs: simplify description of shell wildcard patterns
...to align with glob(7) language

Reported-by: @vyivel
2024-12-01 20:17:04 +01:00
tokyo4j
4502d58eec buffer: remove buffer->cairo
It's more common for cairo_t to have a temporary lifetime and it will
prevent accidentally reusing its previous state.
2024-11-28 18:56:03 +09:00
tokyo4j
c48324975d buffer: always set buffer->{cairo,surface} for simplification 2024-11-28 18:56:03 +09:00
Johan Malm
2f8afb2376
keyboard: add window rule to send release-events (#2377)
...of modifiers which are part of keybinds. This supports clients (for
example blender) that want to see modifier-release-events even if they are
part of a keybinds.

Most clients (including those using Qt and GTK) are setup to not see these
modifier release events and actually misbehave if they do.  For example
Firefox shows the menu bar if alt is pressed and then released, whereas if
only pressed (because the release is absorbed) nothing happens. So, if
Firefox saw bound modifier-release-events it would show the menu bar every
time the window-switcher is used with alt-tab.

    <windowRules>
      <windowRule identifier="blender" wantAbsorbedModifierReleaseEvents="yes"/>
    </windowRules>

Issue #1507
2024-11-26 20:02:36 +00:00
tokyo4j
da418f9720 menu: support borders
This commit adds following theme configurations:

  menu.border.width: 1
  menu.border.color: #aaaaaa
2024-11-25 19:41:07 +00: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
Consolatis
e274c588c0 view: add view_for_each_reverse() macro 2024-11-25 19:21:43 +00:00
tokyo4j
c893878aca scaled-scene-buffer: implement buffer sharing mechanism
Implementers can define impl->equal() which compares two
scaled-scene-buffers so that buffers are not allocated for visually
duplicated scaled-scene-buffers.

Currently this mechanism isn't applied for scaled-font-buffers since we
haven't defined impl->equal() for it.
2024-11-21 20:31:41 +00:00
tokyo4j
f071431266 common/list: add WL_LIST_INIT() macro 2024-11-21 20:31:41 +00:00
Jens Peters
7b5c76d573
osd: add desktop entry name option
Looks desktop entry name up from libsfdo.
2024-11-19 18:36:54 +01:00
Jens Peters
57aee700f7
sfdo: add sfdo_desktop_entry_name_lookup() 2024-11-19 18:36:54 +01:00
Jens Peters
f69576f8a6
icon-loader: rename to desktop-entry
Also rename `struct icon_loader` to `struct sfdo`.
2024-11-19 18:36:08 +01:00
Consolatis
a4204d3335 common/mem.h: introduce xstrdup_replace() 2024-11-16 22:13:17 +00:00
Consolatis
6754801052 rcxml.c: fix mem leak when deduplicating keybinds
Before this patch `keybind->keysyms` wasn't free'd when
- deduplicating keybinds
- removing keybinds due to empty action list

This patch creates a shared `keybind_destroy()` helper
which gets used in all cases where a keybind is destroyed.
2024-11-16 22:13:17 +00:00
tokyo4j
7651531632 menu: refactor in preparation for richer menu design
This commit separates the process of creating scene-trees of the menu
items into `{item,separator,title}_create_scene()`. This will make it
easier to draw richer menu designs like borders, paddings and rounded
corners.
2024-11-13 20:08:15 +00:00
tokyo4j
9580caf8f8 theme: rename title_height to titlebar_height
Also removed the redundant initialization of title_height in
theme_builtin().
2024-11-12 17:25:39 +00:00
tokyo4j
1639919889 theme: rename menu_item_padding to menu_items_padding 2024-11-12 17:25:39 +00:00
tokyo4j
d916a78aca theme: move some variables into theme->window
For example, variables:
  `theme->window_inactive_border_color`
  `theme->window_active_border_color`
are converted to:
  `theme->window[THEME_INACTIVE].border_color`
  `theme->window[THEME_ACTIVE].border_color`
2024-11-12 17:25:39 +00:00
tokyo4j
720ae1fc87 theme: reorder theme entries in documentation and codebase 2024-11-12 17:25:39 +00:00
tokyo4j
3f2cc1b29f osd: fix memory leak of output->osd_buffer 2024-11-12 16:21:06 +09:00
Jens Peters
8a5608a3af input: add hold-begin/-end gestures 2024-11-11 15:06:25 +01:00
Jens Peters
fc774d0071 input: hide cursor when using touch input
Hide the cursor on touch input and keep the cursur invisible
until pointer or tablet input.
2024-11-10 17:08:38 +09:00
Jens Peters
d1cde3c435 input: close xdg-popups on touch down
Taken over and now shared from the tablet implementation.
2024-11-10 17:08:38 +09:00
Consolatis
d6a48ab7a7 foreign-toplevel: add ext-toplevel-list support 2024-11-09 20:06:19 +00:00
Consolatis
2a825008c6 foreign-toplevel: create generic abstraction 2024-11-09 20:06:19 +00:00
Consolatis
5e1f91c9d1 view: add state change signals 2024-11-09 20:06:19 +00:00
Ricardo Steijn
8f940358e4
tearing: avoid permanent disable due to rejected commits (#2295)
Currently, the cursor plane does not allow async page flips which causes tearing page flips to be rejected if the cursor was moved.

However, in games where no cursor image is present, the async page flips can still work as expected.

Instead of permanently disabling tearing after too many failures, test the output state first before each frame to see if we can commit with tearing_page_flip set to true.
2024-11-03 21:05:46 +00:00
Andrew J. Hesford
2b877d2293 config/rcxml.c: fix parsing of three-state query parameters 2024-10-30 21:53:23 -04:00
Orfeas
96da82c085 query: support additional conditions for matching clients
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>

Closes: #2245.
2024-10-30 14:30:26 -04:00
John Lindgren
7912665b0f output: remove ported wlr_output functions
We have several wlr_output_* functions which are just wrappers around
corresponding wlr_output_state_* functions and don't actually touch the
wlr_output itself. These probably made some sense historically, but IMHO
they are just confusing now. So remove them and call wlr_output_state_*
directly.

Rename wlr_output_commit() (still useful) to output_state_commit().
2024-10-29 21:39:19 +00:00
Simon Long
45a9bd95e7
Add mouse emulation for touch devices (#2277) 2024-10-29 19:22:01 +00:00
Tomi Ollila
ad2d24fb42 menu: use "MenuHeader" font height in separators with label 2024-10-28 19:06:32 +00:00
Johan Malm
e912964f73 menu: fix UAF in client-list-combined-menu after window destruction
Update client-list-combined-menu when a window is destroyed to avoid
SEGFAULT when selecting an that window entry in it.
2024-10-24 20:52:17 +01:00
tokyo4j
7cc79edd62 cursor: fix button release events sometimes not being sent
When `wlr_seat_pointer_notify_button()` is called on a button press event,
that funtion must also be called on the subsequent button release event
because otherwise wlroots thinks the button is kept pressed and it
causes issues with validating DnD requests from clients, where only one
button must be pressed. This was the case when a CSD client opens a
client-menu via `show_window_menu` request after pressing its window with
the right button because we were always not notifying button release
events while a menu is open.

So let's keep track of bound (pressed but not notified) buttons and notify
button release events only when the button is not bound, like we are doing
for key-state.
2024-10-13 20:45:16 +01:00
tokyo4j
e0848da70d key-state.c: generalize set operations 2024-10-13 20:45:16 +01:00
Jens Peters
c4aa3fe3e6 server: add dmabuf feedback
Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
2024-10-13 13:54:34 +01:00
tokyo4j
fe6b3c1c35 theme: replace *.hover.bg.shape with *.hover.bg.corner-radius 2024-10-13 12:31:51 +01:00
Johan Malm
e16e78e7a4 theme: add window.titlebar.padding.{width,height}
...to replace padding.{width,height} to minimize breaking changes with the
visual appearance of the titlebar.

With the diverging labwc specification for the titlebar (listed below)
we have to choose between (a) not supporting the padding.{width,height}
option which exist in many extant Openbox themes to keep titlebar height
(almost) the same; or (b) making the allocated button areas much smaller
and not keeping the default hover going all the way to the edges. All in
all it just seems a lot simpler and cleaner to break this link to the
openbox spec.

Examples of previous change driving the requirement for this change:

- SVG and PNG support which often results in large icons with hover
  effects.
- Theme option window.button.{height,width}
- Larger default areas for icons (26x26)

In way of an example, Numix theme sets a padding.height of 6 which would
have resulted in a titlebar 12px taller without this change.
2024-10-08 20:04:05 +01:00
Johan Malm
0aa4cfe32d theme: add window.button.height
window.button.{height,width} determine the space allocated for buttons.
Buttons can be smaller than this size and will then just be center aligned
within the allocated space. However, buttons will be clamped at this size
to prevent them from going outside of the allocated space.
2024-10-08 20:04:05 +01:00
John Lindgren
36f754e662 icon-loader: update PNG and XPM loaders to use new buffer helper 2024-10-06 22:38:03 -04:00
John Lindgren
2e9b5886ce buffer: add buffer_convert_cairo_surface_for_icon()
Which handles:
 - conversion from other pixel formats to ARGB32
 - setting the logical size to the desired display size
 - downscaling very large images using CAIRO_FILTER_GOOD
2024-10-06 22:30:46 -04:00
John Lindgren
22e50aa4e2 common/box: add box_fit_within()
Factor out common math from ssd's get_scale_box() for use elsewhere.
2024-10-06 21:30:33 -04:00
John Lindgren
465aac5514 ssd: respect logical size when displaying window icon
get_scale_box() was using the raw pixel size of the icon buffer for
layout, which caused the icon to be incorrectly scaled up if the buffer
scale was >1.
2024-10-06 21:29:40 -04:00
John Lindgren
ddfaae98ad icon-loader: load SVG icons at max scale of any usable output
- Add a new function to get the maximum scale of all usable outputs
- Pass the maximum output scale through to img_svg_load(), which
  ultimately calls cairo_surface_set_device_scale() before rendering
2024-10-06 21:24:34 -04:00
John Lindgren
d2b161bdf8 buffer: reduce unnecessary painting to new cairo surfaces
Add buffer_adopt_cairo_surface(), which allows wrapping an existing
cairo image surface in a struct lab_data_buffer. This is useful when
loading PNGs since most will be loaded as ARGB32 already.

Fix a memory leak in the non-ARGB32 PNG case, where we do still need to
paint to a new image surface -- we were leaking the original surface.

Eliminate an unnecessary temporary image surface in SVG loading and just
render the SVG to the image surface held by the lab_data_buffer.

I also cleaned up and clarified the buffer API a bit:

- Add a pointer to the held cairo_surface_t (so we can still access it
  if there is no cairo_t).
- Remove the free_on_destroy bool (it was always true).
- Rename unscaled_width/height to logical_width/height and add an
  explanatory comment. It was unclear what "unscaled" meant.
- Rename buffer_create_wrap() to buffer_create_from_data().

This is laying groundwork for some more icon fixes I am working on
(making sure icons are loaded and rendered at the correct scale).
2024-10-06 16:51:14 +01:00
tokyo4j
c2a3a354db theme: refine the management of corner buttons
- The builtin hover effect is now unrounded when the window is tiled.
- All the corner button icons including ones provided by the user are
  now rounded when the window is not tiled.
- Fixed the bug that the window menu button as a fallback of the window
  icon is not correctly rounded.
2024-10-05 20:53:51 +01:00
Johan Malm
d18e67eea8
Merge pull request #2030 from Consolatis/wip/cosmic_workspaces
Initial implementation of cosmic-workspace-unstable-v1
2024-10-01 21:31:04 +01:00
tokyo4j
1557cb774f cursor: prevent Drag mousebinds from running without button press
For `Drag` mousebinds, `pressed_in_context` is set by
`cursor_process_button_press()` and cleared by `cursor_process_motion()`
which runs actions bound to them. However, when `cursor_process_motion()`
is called while interactive move/resize, it doesn't clear
`pressed_in_context` due to the early-return and the `Drag` mousebinds are
unexpectedly executed on another call to `cursor_process_motion()` after
the interactive move/resize is finished by button release, even when the
button is not pressed.

So this commit fixes it by always clearing `pressed_in_context` on button
releases.
2024-10-01 21:26:19 +01:00
John Lindgren
452f45cd3d xdg: try to handle slow un-maximize with empty natural geometry better
In the case of an initially-maximized view which is taking a long time
to un-maximize (seen for example with Thunderbird on slow machines), we
may end up in handle_configure_timeout() with an empty pending geometry.
In that case we have no great options (we can't center the view since we
don't know the un-maximized size yet), so set a fallback position.

v2: check wlr_box_empty() before comparing pending and current

Fixes: #2191
2024-10-01 21:22:00 +01:00