Commit graph

114 commits

Author SHA1 Message Date
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
tokyo4j
23b96ad2a6 Replace _ with - in source file names 2024-05-22 07:10:51 +01:00
Jens Peters
b6e439a5cc seat: announce pointer capability for tablet tool
We use pointer focus for the tablet tool, so we
should also use this capability. There is no
dedicated tablet tool capability.
2024-05-19 21:21:52 +01:00
Hiroaki Yamamoto
ad15c0474d
seat: prevent xwayland from using incorrect keymap (#1816)
With commit cafdcd8e, the keyboard from the keyboard group is set to the
seat when the active keyboard is destroyed, but this broke `wtype`
against XWayland surfaces. This is likely because XWayland caches
keycodes from the compositor and convert them with the last keymap
received from the compositor. So when we run `wtype a` over a XWayland
surface, the keycode for `a` is cached by XWayland, the keymap from the
keyboard group is sent to XWayland, then Xwayland converts the keycode
using the keymap from the keyboard group, not the one `wtype` set.

This commit fixes this by setting the keyboard from the keyboard group
to the seat when the keyboard focus is moved to a surface, not when the
active keyboard is destroyed.
2024-05-14 21:15:28 +01:00
tokyo4j
cafdcd8e19 seat: prevent Chromium from crashing when active keyboard is gone
Chromium (and slurp) expect wl_keyboard.keymap event to be sent before
wl_keyboard.modifiers event. Normally, wl_keyboard.keymap event is sent
on the client first obtains wl_keyboard with wl_seat.get_keyboard
request.
However, after the active (especially virtual) keyboard is destroyed,
wlroots doesn't respond to wl_seat.get_keyboard request with
wl_keyboard.keymap event since there's no active keyboard on the seat.

Therefore, if we run commands like "sleep 2; wtype hello; chromium", the
active keyboard is destroyed when wtype finishes and
wl_keyboard.modifiers event is sent to Chromium when Chromium first maps
the surface and the keyboard focus is moved to it, then Chromium crashes.

With slurp, fcitx5 and multi-monitor setup, a similar thing happens.
When slurp first creates the layer-shell surfaces, the focus moves to it
(without wl_keyboard.enter though), and fcitx5 is transiently deactivated
and it destroys the virtual keyboard. Then when slurp maps those
surfaces, the focus moves between them again and wl_keyboard.modifiers
event is sent, thus slurp crashes.

So with this commit, when the active keyboard on the seat is destroyed,
the keyboard from the keyboard group is set to the seat instead so
wlroots can respond to wl_seat.get_keyboard request with
wl_keyboard.keymap.
2024-05-08 20:39:09 +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
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
tokyo4j
50fd65416f overlay: add theme setting snapping.preview.[region|edge].fill
This settings allows user to choose whether to draw a filled rectangle
or an outlined rectangle as the preview for window snapping.
2024-04-15 12:33:40 +02:00
SnowNF
fb921ab431 Optimize the code based on the suggestions 2024-03-20 22:52:19 +00:00
SnowNF
bd4d92bad8 libinput: add support for touchscreen set matrix
My android pad emit a strange touch input from libinput, need to rotate it in 270 degree clockwise to fix.
2024-03-20 22:52:19 +00:00
Johan Malm
045dd8a378 seat: remove unecessary top/overlay check in seat_set_focus_layer()
Such checks should be made prior to calling the function (which they
are).
2024-03-17 21:18:47 +00:00
Johan Malm
5cb3583108 keyboard: use 'us' as fallback for XKB_DEFAULT_LAYOUT
...if keymap cannot be created for the provided XKB_DEFAULT_LAYOUT.

If keymap still cannot be created, exit with a helpful message to avoid
crash that is hard to understand.

Fixes: https://github.com/stefonarch/lxqt-labwc-session/issues/7
2024-03-12 20:59:39 +00:00
Simon Long
1e1e90d0bb
Reload cursor theme and size on reconfigure
Fixes: #1587
2024-03-12 20:53:41 +01:00
Hiroaki Yamamoto
be37f9a564
Fix various typos across the codebase 2024-03-08 13:59:20 +01:00
John Lindgren
bb8f0bc960 seat: don't deactivate view for any non-view surface
Now we now longer gray-out the active window when opening a focusable
popup menu (e.g. the applications menu from an XWayland panel). This
matches Openbox behavior.
2024-03-05 20:51:32 +00:00
tokyo4j
334cd09106 IME: support input method 2024-03-05 20:28:15 +00:00
Sachin Bhat
6fb06c54c2 config: support libinput sendEventsMode
This allows to enable / disable libinput devices.

Co-Authored-By: @Consolatis
2024-02-24 21:36:53 +01:00
Jens Peters
9456b50983 seat: fix configure condition for click method
Exclude none (zero) from the bitmask test , otherwise
the bitmask test is always true when click method is
configured to 'none' and as a result the configuration
will be skipped.
2024-02-24 20:39:54 +01:00
Marvin Dostal
8be9c38460
Add click method libinput option (#1416)
<libinput>
  <device>
    <clickMethod>none|buttonAreas|clickfinger</clickMethod>
  </device>
</libinput>
2024-02-21 17:19:48 +00:00
Consolatis
a5c6b2f83d Prevent 'unused variable' warnings when compiled without asserts 2024-02-10 19:22:12 +01:00
Consolatis
e9552fb661 src/seat.c: provide NULL fallback for output name
This fixes a warning when doing a release build.
2024-02-10 19:22:12 +01:00
Jens Peters
1d4961650f seat: re-map pointer to output on reconfigure
Makes testing easier, also consistent with other
devices types on reconfigure.
2024-01-22 21:50:18 +00:00
Jens Peters
19cab55092 seat: get output name from touch config for current device
The output name attached to the touch device has
still priority.
2024-01-22 21:50:18 +00:00
Jens Peters
2c3ab16f39 config: parse multiple touch configurations
Also temporary disable touch output mapping.
Will be restored later.
2024-01-22 21:50:18 +00:00
Simon Long
8c9be2f0d1 keyboard: set keyboard layout on reconfigure
If keyboard-layout-per-toplevel-window is used, reset the group (index)
for each window on --reconfigure whenever the keymap has changed.

Refactor to use a common configure function for reconfigure and
keyboard-group creation.

Co-authored-by: @johanmalm

Fixes #1407
2024-01-19 18:59:14 +00:00
Jens Peters
6d6f243ff5 seat: re-map pointer to output on output change 2024-01-13 22:18:20 +00:00
Jens Peters
f5f5a7b036 seat: configure libinput for touch on reconfigure 2024-01-13 22:18:20 +00:00
Jens Peters
ffc4b0fdee seat: remove not needed device type test
The device type is already validated in the calling
function.
2024-01-13 22:18:20 +00:00
Jens Peters
516423f9ba seat: re-map touch to output on output change 2024-01-13 22:18:20 +00:00
Jens Peters
0eb1ae4d66 seat: re-map touch to output on reconfigure 2024-01-13 22:18:20 +00:00
Jens Peters
21cf3071e3 seat: map touch to configured output name
The output name linked to the touch device
has preference when set. This happens when
the compositor runs in nested mode.
2024-01-13 22:18:20 +00:00
Jens Peters
17e15ed987 seat: re-map tablet to output on output change 2024-01-10 21:10:11 +00:00
Jens Peters
8de5d7e653 seat: re-map tablet to output on reconfigure 2024-01-10 21:10:11 +00:00
Jens Peters
354c5cf967 seat: map tablet to output on init 2024-01-10 21:10:11 +00:00
Jens Peters
80075df0b7 seat: extract function 2024-01-10 21:10:11 +00:00
Jens Peters
cef2214023 seat: change order
More in line with other functions.
2024-01-10 21:10:11 +00:00
Jens Peters
c2687d9281 input: add tablet pad setup and button handler
Split pad initialization from tablet initialization to
avoid conflicting handler names.
Also reuse 'get_mapped_button'.
2024-01-02 21:28:42 +00:00
Johan Malm
af5d80a583 config: s/enum device_type/enum lab_libinput_device_type/ 2024-01-01 22:04:21 +00:00
Johan Malm
673c745cff config: prefix enums with LAB_LIBINPUT_DEVICE_ 2024-01-01 22:04:21 +00:00
Johan Malm
a7f8eef163 seat: refactor obtaining libinput category for device
No functional change intended.
2024-01-01 22:04:21 +00:00
Johan Malm
94cec51d9f config: use wl_list_append() for libinput categories
...to make it more intuitive.

Also, do not check for existance of name when type==DEFAULT because name
will only exist when type==NONE.
2024-01-01 22:04:21 +00:00
Jens Peters
20bba35570 input: rename drawing_tablet to tablet 2023-12-29 20:22:46 +00:00
Jared Baur
6faee17d20 Add touchpad device type
It is nice to have finer granularity for device types to allow for
configurations such as using `naturalScroll` on touchpads, but not on
regular pointer devices such as mice.
2023-12-29 08:08:32 +00:00
Jens Peters
605f9e9181 seat: initialize tablet tool or pad
Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
2023-12-27 11:09:26 +00:00
Johan Malm
6a2a52c0ad seat: do not update active_view on layer-shell keyboard focus
...because layer-shell clients are not views and we want to be able to
use foreign-toplevel protocol on the active view even if a client such as
a panel has taken keyboard focus.

Written-by: @Consolatis

Fixes: #1336
2023-12-19 20:34:07 +00:00
Johan Malm
3a959cc74b s/focused_view/active_view/ 2023-12-19 20:34:07 +00:00
Consolatis
797e743c8a Move input handler init() and finish() functions to input/input.c 2023-10-30 21:14:04 +00:00
Consolatis
b359b1560c Move keyboard functions into input/keyboard.h 2023-10-30 21:14:04 +00:00
Consolatis
5e1562fae6 Make touch depend on cursor to prevent racing 2023-10-30 21:14:04 +00:00
Consolatis
67a8ae8561 Move input related source files into src/input/ 2023-10-30 21:14:04 +00:00