Commit graph

776 commits

Author SHA1 Message Date
Consolatis
7de2a9f86a src/menu: prevent delayed pipe menu response on item destroy (#2094)
Without this patch we would happily access `pipe_ctx->item`
members even if the item had been destroyed in the meantime.
2024-08-20 17:20:30 +01:00
Consolatis
88a67d586c magnifier: disable direct scanout when active
Fixes: #1980
2024-07-17 22:50:11 +02:00
tokyo4j
6bc93cf468 session-lock: restore focused view on unlock
Before this commit, the topmost view is focused on unlock. This commit
changes it to remember the focused view on lock then restore it on
unlock.
2024-07-07 15:48:32 +09:00
tokyo4j
11f02075c2 session-lock: refactor
No changes in logic.
2024-07-07 15:48:32 +09:00
Andrew J. Hesford
9153c22dab xwayland: allow persistence
Closes: #1958.
2024-07-04 05:19:19 +02:00
John Lindgren
a98f2635ea xdg: support xdg-shell v3 with popup repositioning
See https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514
which added support on the wlroots side.

We now re-run popup positioning (for both xdg-shell and layer-shell
popups) when the "reposition" event is received. This allows popups that
change size (such as qmpanel's applications menu) to be positioned
correctly.

xdg-shell v3 also gives the compositor some additional "hints" for popup
positioning (reactive, parent_size, and parent_configure_serial) which
are available but we don't make use of currently.
2024-07-01 20:16:31 +01:00
Consolatis
45b197b8a4 magnifier: fix flickering on simultaneous gamma changes
Gamma changes take another code path and thus did not
render the magnifier. This patch consalidates both
code paths and therefore also renders the magnifier on
gamma changes.

Fixes: #1905
2024-06-29 23:36:41 +02:00
Jens Peters
3b605b0142 ssd: set squared corners for tiled views conditionally
Respect the snapping settings for notify-client.
2024-06-27 22:29:11 +01:00
Jens Peters
98347e454e ssd: show squared corners when the view is tiled 2024-06-27 22:29:11 +01:00
droc12345
f2755a4e2e
action: remember initial direction of PreviousView
...when cycling windows. Also make the toggling of direction when shift
is pressed relative to the initial direction. For example if W-j is
bound to PreviousWindow, subsequent key presses will continue to
cycle backwards unless shift if pressed.

Add documentation for using shift/arrow keys in Next/Previous
2024-06-26 22:03:56 +01:00
Simon Long
2573162a4f Use existing reset_keybind function 2024-06-15 21:22:58 +01:00
Simon Long
e6c239e783 Move extern to h file 2024-06-15 21:22:58 +01:00
tokyo4j
bb1d0b4352 Implement <resize><drawContents>
<resize><drawContents>[yes|no] configures whether to let the clients
redraw its window content content while resizing.

When <resize><drawContents> is set to no, a multi-rect is shown to
indicate the geometry of the resized window.
2024-06-15 21:17:01 +01:00
Jens Peters
3c0cea92f2 input: support tablet-v2 pad notifications 2024-06-13 21:23:37 +01:00
Jens Peters
61e5e0e4d9 input: track tablets and tablet-pads at seat 2024-06-13 21:23:37 +01:00
Consolatis
067c59e526 xwayland: reset cursor image on cursor theme reload
As wlr_xwayland caches the pixel data when not yet started
up due to the delayed lazy startup approach, we do have to
re-set the xwayland cursor image when reloading the cursor
theme. Otherwise the first X11 client connected will cause
the xwayland server to use the cached (and destroyed) pixel
data.

To reproduce:
- Compile with b_sanitize=address,undefined
- Start labwc (nothing in autostart that could create
  a X11 connection, e.g. no GTK or X11 application)
- Reconfigure
- Start some X11 client
2024-06-11 21:40:06 +01:00
Simon Long
84c222a84f Add onRelease option to <keybind>
...to make keybind actions fire on the release event rather then when the
key is first pressed. This is useful for binding actions to modifier keys
only. The most likely use-case for this is the binding of a Super key to a
menu, for example:

    <keybind key="Super_L" onRelease="yes">
      <action name="Execute" command="rofi -show drun"/>
    </keybind>

If another keybind is issued between the press and release, the on-release
keybind is cancelled.

Co-authored-by: @johanmalm
2024-06-09 21:15:58 +01:00
Jens Peters
f6c91c8d13 input: always notify all tablet axis
Notify all axis based on the capabilities of the
tablet tool. At least GTK applications expect
this for e.g. smooth pressure or distance events.
2024-06-08 22:33:00 +01:00
Jens Peters
ebe81ac591 input: extract function 2024-06-08 22:33:00 +01:00
Jens Peters
2388f37cc7 input: prevent cursor notifications from pointer and tablet tool
... at the same time. Omit cursor notifications from
a pointer when a tablet tool (stylus/pen) is in
proximity. We expect to get cursor notifications
from the tablet tool instead.
2024-05-31 16:59:43 +02:00
tokyo4j
d00711bc45 session-lock: allow client to update cursor shape 2024-05-31 11:21:29 +09:00
tokyo4j
a39c8afc10 session-lock: refactor
- Replaced `session_lock` with `session_lock_manager` which is
  persistent throughout the session.
- Replaced `session_lock->abandoned` with `session_lock_manager->locked`.
  Old `session_lock->abandoned` is equal to
  `!session_lock_manager->lock && session_lock_manager->locked`.
- Eliminated the use of global variables in `session-lock.c`.
- Changed some function names.
2024-05-31 11:21:29 +09:00
Yuri Nesterov
65f7499f1c wayland: add support for security-context-v1 2024-05-29 22:28:06 +01:00
Jens Peters
6d05bed883 config: add option for forcing mouse emulation
Default is off. Also allow switching with reconfigure.
2024-05-27 22:40:50 +02:00
Jens Peters
fb57d61f35 input: add tablet-v2 notifications for axis and buttons
Similar like touch, this is guarded by checking if
a surface accepts the tablet protocol. Also reuse
common cursor logic.

Intialize tablet tools on proximity.
Notify idle manager about activity on events.
2024-05-27 22:40:50 +02:00
Jens Peters
abfa100b38 input: add tablet tool setup 2024-05-27 22:40:50 +02:00
Jens Peters
9c219564be server: create tablet-v2-manager 2024-05-27 22:40:50 +02:00
Jens Peters
634a2beb31 input: expose general cursor motion and button functions
Separate the general logic from the pointer notifications
to allow reuse of those function for other (e.g. tablet)
input sources.
2024-05-27 22:40:50 +02:00
Consolatis
6f3f2aae27 ForEach: initialize view query window_type correctly
Before this patch, the window type would be checked even if
not actually requested to do so.

Fixes: #1852
2024-05-27 19:59:06 +01:00
tokyo4j
23b96ad2a6 Replace _ with - in source file names 2024-05-22 07:10:51 +01:00
tokyo4j
2f1fcb4468 IME: support multiple IME popups
We didn't support multiple IME popups since input-method-v2 protocol
has no way to position them individually, but we should support it to
provide IME developers with more programming flexibility.
2024-05-20 09:35:26 +09:00
Simon Long
ed1b631492 Add All context for mouse events 2024-05-19 22:17:04 +01:00
Jens Peters
f8a7d18cf0 input: ignore not supported tablet tools
We currently only support cursor emulation
for absolute motion, thus ignore tools/pens
that use relative motion.

Add a log statement on proximity-in to give
some feedback.
2024-05-19 21:21:52 +01:00
Tobias Bengfort
41a3b68846 decorations: add SetDecorations action 2024-05-19 19:03:42 +01:00
Tobias Bengfort
e2590f10fd decorations: make has_ssd public 2024-05-19 19:03:42 +01:00
Tobias Bengfort
a0debda142 decorations: refactor view_set_decorations 2024-05-19 19:03:42 +01:00
Andrew J. Hesford
89589f17c4 action: allow configurable policy in AutoPlace action
Closes: #1784.
2024-05-19 17:32:52 +01:00
Tobias Bengfort
7bc3cae91a query: add window type filter for if-actions 2024-05-18 20:04:08 +01:00
tokyo4j
b9b870cfa7 magnifier: minor refactor 2024-05-16 11:33:53 +02:00
Simon Long
8ba066a1a5
Add screen magnifier
This adds a screen magnifier which can be controlled with the
`ZoomIn` / `ZoomOut` and `ToggleMagnify` actions.

It scales up part of the rendered framebuffer so the magnification
may end up looking blurry depending on the magnification scale.

PR #1774
2024-05-16 00:07:23 +02:00
Consolatis
c4d12bf5d9 xwayland: prevent shaded views from getting mouse events
Fixes: #1753
2024-05-05 21:04:55 +01:00
Consolatis
8d4f295440 cursor: reload cursor on Reconfigure
This gives instant feedback when changing cursor theme or size.
It only works for server side cursors or clients using the
cursor-shape protocol.

Fixes: #1619
2024-05-04 21:28:10 +01:00
tokyo4j
4b6efb7307 cursor: implement <menu><ignoreButtonReleasePeriod>
Addresses UX degradation introduced by commit 1d3ed457.

This prevents clicks with small movement with the intention of opening
the menu from unexpectedly closing the menu or selecting a menu item.
2024-05-01 19:08:07 +09:00
tokyo4j
c224e1e05a view: set LAB_MIN_VIEW_WIDTH equal to total width of buttons
This fixes pixman error due to a negative width passed to
`wlr_scene_rect_set_size()` in `ssd_titlebar_update()`.
2024-04-28 10:20:24 +02:00
David Turner
ce0d2c2966
ssd: add window drop-shadows (#1648)
Add optional drop-shadows to windows using server-side decoration.
Shadows can be enabled/disabled rc.xml and their appearance configured
in themerc.  The default is no shadows to preserve current behaviour.

The shadows are drawn in fixed corner and edge buffers shared between
all windows, the edges are scaled to size depending on the size of each
window.  Two sets of buffers are used to give the different appearances
for active and inactive windows.  I use separate corner/edge buffers for
a few reasons:

- It avoids needing to store a separate large shadow buffer per window
- It avoids needing to redraw the shadows when the window is being
  resized
- Compositing the shadows onto the desktop should be faster as there are
  overall fewer pixels to blend, and scaling up the edge buffers only
  requires reading a tiny buffer which is then replicated.
2024-04-22 19:27:53 +01:00
tokyo4j
b0ba585ff8 overlay: allow to draw both/either of filled/outlined rectangle
Filled/outlined rectangles shown as snapping overlay are now enabled/disabled
independently with `snapping.overlay.[region|edge].bg.enabled` and
`snapping.overlay.[region|edge].border.enabled`.

To keep the default behavior, `*.bg.enabled` is yes and `*.border.enabled` is
no for hardware-based renderers, while `*.bg.enabled` is no and
`*.border.enabled` is yes for software-based (pixman) renderer.

Users can now use a filled rectangle as an overlay even with pixman renderer.
However, this may severely impact performance when used with translucent
`snapping.overlay.[region|edge].bg.color`.

This commit includes a refactor to use substruct `theme_snapping_overlay`
inside `theme` in order to pass it to `create_overlay_rect()` in a cleaner way.

Breaking changes is:
- `snapping.overlay.[region|edge].fill` is now removed.
2024-04-22 19:22:23 +01:00
tokyo4j
34290ef629 overlay: s/preview/overlay/
Replace "preview" in rc.xml and themerc with "overlay" since "preview" sounds
like it shows the window content.

Breaking changes are:
- `snapping.preview.*` in themerc is now replaced with `snapping.overlay`.
- `<snapping><preview>` in rc.xml is now replaced with `<snapping><overlay>`.
2024-04-22 19:22:23 +01:00
Consolatis
3f10857496 Fix pid lookup for the Kill action
Before this patch, labwc would happily kill itself when the user
called the `Kill` action when any xwayland view had focus.

The reason this happened was that wlroots creates the xwayland
wayland client via socketpair() and thus a lookup of the pid
of the socket connection would return the pid of labwc itself.

This patch fixes that by implementing different pid lookup
mechanisms based on the view implementation backend.

Fixes: #1739
2024-04-22 19:11:57 +01:00
tokyo4j
bc0174d849 workspaces: react to Reconfigure
Changes in `<desktops><names>` or `<desktop><number="" prefix="">` required
restarting labwc to take effect.

This commit adds `workspaces_reconfigure()` to update `server->workspaces` on
Reconfigure.
2024-04-22 05:44:52 +09:00
Hiroaki Yamamoto
d64e3915a3
Fix some header includes detected by clangd
There were some missing headers like <stddef.h> for `NULL`, <wayland-util.h>
for `wl_link` and <stdbool.h> for `true`/`false`.

Also this commit fixes that `labwc.h` and `ime.h` included each other.
2024-04-21 21:58:57 +02:00