Commit graph

141 commits

Author SHA1 Message Date
tokyo4j
5bcc03db05 Revert "keyboard: add window rule to send release-events (#2377)"
This reverts commit 2f8afb2376.
2024-12-29 16:27:34 +09:00
tokyo4j
5d3ce3e190 Check input_mode to see whether window switcher is active or not
...rather than "if (server->osd_state.cycle_view){..}".
2024-12-28 21:28:22 +00:00
tokyo4j
b2a45ac8af cursor: fix focus when menu is closed by clicking its border
Before this commit, the pointer focus is cleared when a menu is closed
by clicking its border. This is because get_cursor_context() returns
type=LAB_SSD_NONE when the cursor is on the menu border and
cursor_update_common() clears the pointer focus. This commit fixes this
by replacing cursor_update_common() with cursor_update_focus(), which
calls get_cursor_context() again after the menu scene-node is hidden.
2024-12-20 00:43:06 +09:00
tokyo4j
683f67b761 IME: don't forward key-release without correspinding key-press
After commit e2189903 in wlroots, when ctrl-f is pressed in firefox with
a IME client running, the following key-release event for "f" is not
sent, thus "f" is repeated like "ffffffffff..." in the input box of
firefox. This is because the key-release event for "f" is firstly
forwarded to the IME client and then sent via the virtual keyboard created
by the IME client while the key-press event is sent via physical
keyboard, and with e2189903, key-release events without a corresponding
key-press event on the same keyboard is not emitted to the compositor.

So this commit fixes this problem by not forwarding the key-release event
to the IME client unless the corresponding key-press event was also
forwarded.
2024-12-17 16:38:09 +09:00
tokyo4j
daae379433 view: s/scene_node/content_node/ 2024-12-14 12:03:58 +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
Jens Peters
8a5608a3af input: add hold-begin/-end gestures 2024-11-11 15:06:25 +01:00
Jens Peters
7195d7793c input: ensure visible cursor on gestures 2024-11-11 15:06:25 +01:00
Jens Peters
8d99450fc9 input: notify idle-manager on gestures 2024-11-11 15:06:25 +01:00
Jens Peters
37b4e17788 input: use CONNECT_SIGNAL macro 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
Jens Peters
7e0cd8ee5a input: move notify-idle-manager to tablet/touch handlers
Move them away from the cursor emulate functions. This
avoid calling them twice for touch motion.

Also notify idle manager on touch down/up.
2024-11-10 17:08:38 +09:00
Jens Peters
eed972cef1 input: clear pointer focus on touch input
Otherwise the pointer focus could interfere with touch input, like
showing hover effect on unexpected locations.
2024-11-10 17:08:38 +09:00
Jens Peters
3dbd5f30fc input: move touch only with one touch point
In other words, do not move the cursor when more than
one finger is down.
2024-11-10 17:08:38 +09:00
Jens Peters
a3d8688c17 input: warp cursor to touch coordinates
This makes the behavior consistent with non-touch
capable surfaces and the desktop.
2024-11-10 17:08:38 +09:00
Simon Long
45a9bd95e7
Add mouse emulation for touch devices (#2277) 2024-10-29 19:22:01 +00:00
Johan Malm
3b00aabd93 keyboard: broadcast modifiers
...to all clients rather than just the one with keyboard focus on keyboard
enter/create, modifer press/release and wlr_seat_set_keyboard().

This enables:

- Clients such as panels to display the current keyboard layout without
  introducing new wayland protocols or other IPC.

- Unfocused xdg-shell clients to understand button press with keyboard
  modifiers for example Ctrl+click.

The keymap is forwarded to all clients in wlr_seat_set_keyboard(). When a
keymap contains multiple layouts, the selection is made via modifiers,
which previously were only sent to the client with keyboard focus.

Tested with: https://github.com/johanmalm/keyboard-layout

Ref: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4496

Fixes: #2271
2024-10-28 19:11:45 +00:00
Jens Peters
e67fda50cf input: add comments about tablet mouse emulation 2024-10-20 21:51:02 +01:00
Johan Malm
c237ffa667
cursor: guard against NULL dereference (#2250)
...in apply_constraint()

Reported-by: Blackb|rd
2024-10-19 19:44:50 +01:00
Hiroaki Yamamoto
a567b4dc3b
cursor: send a frame event after emulated button events (#2244)
This fixes the issue that emulated tablet/touchscreen button events
sometimes don't take effect on applications immediately.
2024-10-17 20:12:15 +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
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
tokyo4j
25f5cdd3a6 Refactor the logic of placing client-menu with ShowMenu action
Before this commit, we assumed `ShowMenu` action is not bound to any
buttons other than window menu button and always place the client-menu
under the window-menu button when atCursor="no". Also, it was going to be
difficult to distinguish whether the action is executed from the window
menu button or the window icon, which will be added soon.

This commit fixes it to open the menu under the actually-clicked button by
passing `cursor_context` to `actions_run()`, with some refactoring:
- `seat->pressed.resize_edges` is removed and it's calculated from the
  cursor position and `seat->pressed.type` just before running Resize
  action. This slightly changes the existing logic to determine the
  resizing edges with Alt-Right + Drag mousebinding, but
  `seat->pressed.type` is still stored on button press so it doesn't bring
  back the issue #543.
- `seat->pressed.toplevel` is removed and `get_toplevel()` in
  `update_pressed_surface()` may be called more often, but its overhead
  will be negligible.
2024-09-21 18:07:34 +01:00
Andrew J. Hesford
b34f2c9d85 Revert "src/interactive.c: don't unshade when view is un-tiled by dragging"
When labwc un-tiles views, it generally changes their size, which sends
a configure request to the client. However, because the view has been
disabled in the wlroots scene, it will not receive and process the
configure when labwc expects. Instead, the handling will be deferred
until the user unshades the view at some arbitrary time in the future,
resulting in labwc registering complains like

    [../src/xdg.c:239] client did not respond to configure request in 100 ms

Furthermore, the reconfigure will still generally produce flicker (as
the view opens in its tiled size and then jumps to its natural
geometry). Because skipping the unshade might cause client problems and
doesn't eliminate the problem it sought to resolve, let's revert this.

This reverts commit 2e19bd4d5b.
2024-08-28 08:24:26 -04:00
tokyo4j
1f1bdad087 interactive: allow moving horizontally/vertically maximized window
Applies drag resistance unidirectionally for horizontally/vertically
maximized windows, allowing them to be dragged without being untiled
immediately. When the distance of cursor movement orthogonal to the
maximized direction exceeds <resistance><unMaximizeThreshold>.

While dragging a horizontally/vertically maximized window, edge/region
snapping is disabled to prevent unintentional snapping and overlays.

This commit also includes some refactoring to simplify the logic.
2024-08-26 20:30:22 +02:00
tokyo4j
b667107d1a input: move <scrollFactor> to <libinput> section
This allows per-device configuration of scroll factor (e.g. setting
different scroll factors for mice and touchpads).
2024-08-23 16:20:56 +09:00
Jens Peters
00512d055f input: ensure that our own tablet structs are created 2024-08-13 18:40:34 +02:00
Jens Peters
dd0cee02a4 input: move cursor event listeners from tablet to seat
Otherwise we would subscribe multiple times to the
same event when having multiple tablets.
2024-08-13 18:40:34 +02:00
Jens Peters
538eb3ee83 input: use CONNECT_SIGNAL macro 2024-08-13 18:40:34 +02:00
Johan Malm
72df8fe73c keyboard: fix bug with empty XKB_DEFAULT_LAYOUT
With XKB_DEFAULT_LAYOUT= (set to empty rather than unset) the keyboard
just does not work.

Ref: https://github.com/labwc/labwc-tweaks/issues/89
2024-08-08 21:35:06 +02:00
Jens Peters
f20b2c7632 input: apply tablet rotation before area transformation
This makes the behavior consistent with auto-rotation
as a result of output mapping.
2024-08-08 20:27:06 +01:00
Jens Peters
060626e9c7 input: subscribe to tablet tool events from cursor
Contrary to the raw tablet events, the cursor events transform
the coordinates based on a mapped output orientation.
Otherwise those events are the same.
2024-08-08 20:27:06 +01:00
tokyo4j
670cc0f511 Rename <snapping><dragResistance> to <resistance><unSnapThreshold>
As we already have <resistance><{screen,window}EdgeStrength>,
<resistance> will be a better place for this setting.
2024-08-08 09:49:53 +09:00
Tobias Bengfort
116382fd89 keybind: implement allowWhenLocked
fixes #2034

see bc258a3be2/sway/sway.5.scd (L409)
2024-08-06 19:15:06 +02:00
tokyo4j
c202d77c2d Add resistance when dragging tiled windows
Adds a config option <snapping><dragResistance> with default value 20.
This prevents tiled/maximized windows from being unintentionally untiled.
2024-08-02 23:40:26 +02:00
Jens Peters
3f210828d7 input: log tablet pad capabilities 2024-07-19 22:45:41 +01:00
Jens Peters
f4d203f0cd input: support tablet tool motion sensitivity configuration 2024-07-19 22:45:41 +01:00
Jens Peters
96701f1e27 input: support tablet tool motion configuration 2024-07-19 22:45:41 +01:00
Jens Peters
a2f25bea1a config: add configuration for tablet tool motion 2024-07-19 22:45:41 +01:00
Jens Peters
8501a1281c input: support tablet tools with relative motion 2024-07-19 22:45:41 +01:00
Jens Peters
b663c9ea46 input: fix rotation for tilt
The transformation for relative coordinates
is different than for absolute coordinates.
2024-07-19 22:45:41 +01:00
Jens Peters
ba9de228e0 input: add relative cursor move emulation 2024-07-19 22:45:41 +01:00
Consolatis
5c6e1ed878 chase: use wayland pointer enums rather than wlr ones
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4575
2024-07-17 21:28:59 +01:00
Consolatis
0d354519e8 chase: relative axis direction
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4003
2024-07-17 21:28:59 +01:00
Consolatis
3e614814fe chase: input inhibit removal
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4440
2024-07-17 21:28:59 +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
Jens Peters
1495708095 input: test if tablet device is a libinput device
Otherwise we might end with a failed assertion if the
tablet or pad isn't a libinput device.

Fixes https://github.com/labwc/labwc/issues/1916
2024-06-18 22:14:40 +01:00
Simon Long
2573162a4f Use existing reset_keybind function 2024-06-15 21:22:58 +01:00