Commit graph

1441 commits

Author SHA1 Message Date
Consolatis
c4b85041ba CI: Add Debian testing 2022-09-23 22:12:20 +02:00
Johan Malm
d424514e24 Fix minor coding-style violations
...based on https://github.com/johanmalm/checkpatch.pl
2022-09-22 22:39:44 +01:00
Johan Malm
439cf4f848 CONTRIBUTING.md: improve all sections
...including guidelines on:

- the use of glib
- the use of GNU C extensions
- what commit messages should look like
- coding-style
2022-09-22 22:35:09 +01:00
Consolatis
2c83a5fcb8 cursor: Prevent setting cursor icon on drag
Partly fixes #549
2022-09-21 21:55:28 +01:00
Johan Malm
76d8982d3e
Merge pull request #438 from johanmalm/fix/repeat
Revert "keyboard: cancel repeat when handling key-bind" and
only pass on pressed+sent keycodes to surfaces on keyboard-focus.
2022-09-21 21:35:06 +01:00
Johan Malm
de99a8ba33 seat: only pass on sent keys on surface-focus
Key events associated with keybindings (both pressed and released) are not
sent to clients. When using wlr_seat_keyboard_notify_enter() it it
therefore important not to send the keycodes of _all_ pressed keys, but
only those that were actually _sent_ to clients (that is, those that were
not bound).

This approach is consistent with sway's implementation in input/seat.c
cffb006feb/sway/input/seat.c (L173-L175)

Fixes issue #510
2022-09-21 21:25:13 +01:00
Johan Malm
4108313f96 src/keyboard.c: register keys before inhibit check
Call key_state_set_pressed() before checking
seat->active_client_while_inhibited to avoid missing release events for
clients using the inhibit protocol (for example swaylock).
2022-09-21 21:25:13 +01:00
Johan Malm
20c4ffa539 src/keyboard.c: do not end window-cycling on modifier release only
If a user lets go of the modifier (e.g. alt) before the 'normal' key (e.g.
tab) when window-cycling, we do not end the cycling until both keys have
been released.  If we end the window-cycling on release of the modifier
only, some XWayland clients such as hexchat realise that tab is pressed
(even though we did not forward the event) and because we absorb the
equivalent release event it gets stuck on repeat.

Just to clarify the position here: Issue #176 describes a behaviour
whereby dmenu gets stuck on repeat after being launched with a keybind.
This patch does not resolve that issue but reflects that in Wayland, the
client is responsible for implementing "key repeat".

Changing the key repeat rate/delay in (labwc/labwc@e62bb51) was dirty fix
that need should never have been made.
2022-09-21 21:25:13 +01:00
John Lindgren
7233495c3a output: Call do_output_layout_change() at end of new_output_notify().
This fixes an issue with the wlr_output_cursor not being properly
initialized on new outputs, because wlr_output_layout.events.change
is triggered too soon, before the wlr_output_cursor exists.
2022-09-21 07:33:00 +02:00
Consolatis
dcedfee5d1 src/menu.c: Clamp separator width
Reported-by: @Flrian
2022-09-20 21:06:31 +01:00
Johan Malm
ffb2efe733 src/keyboard.c: reflow comment to shorten line 2022-09-20 20:52:48 +01:00
Johan Malm
e1467b9aac src/keyboard.c: stored handled keys as bound when window-cycling
...and changing TTY
2022-09-20 20:52:48 +01:00
Johan Malm
a363f73e02 Revert "keyboard: cancel repeat when handling key-bind"
This reverts commit e62bb51bfb.

Fixes #510
2022-09-20 20:52:48 +01:00
Consolatis
87fe6878a3
Merge pull request #552 from jlindgren90/xmalloc
common: Add more friendly memory utilities
2022-09-19 05:43:55 +02:00
John Lindgren
8f585362c1 common: Expand comment for znew/znew_n() 2022-09-18 17:30:53 -04:00
John Lindgren
a54d378e6c common: Add znew/znew_n() macros 2022-09-18 15:25:19 -04:00
John Lindgren
898a583522 keyboard: Fix SIGSEGV that showed up in out-of-memory fuzzing
Stack trace:

    #0  xkb_keymap_ref (keymap=keymap@entry=0x0) at ../libxkbcommon/src/keymap.c:61
    #1  0x00007f53a344ab99 in wlr_keyboard_set_keymap (kb=kb@entry=0x5571af8cb9a0, keymap=keymap@entry=0x0)
        at ../types/wlr_keyboard.c:174
    #2  0x00005571ade057e0 in keyboard_init (seat=0x7ffca0389680) at ../src/keyboard.c:229
    #3  seat_init (server=0x7ffca0389570) at ../src/seat.c:307
    #4  server_init (server=0x7ffca0389570) at ../src/server.c:308
2022-09-18 06:05:16 +02:00
John Lindgren
da57483961 action: Fix warning about freeing a (const char *) 2022-09-17 10:57:30 -04:00
John Lindgren
cb40cdc36c common: Add additional memory utilities (xzalloc() etc.) 2022-09-17 10:57:30 -04:00
John Lindgren
b89f7bfc0d action: Allow explicit None action without warning 2022-09-16 22:06:29 +01:00
Consolatis
e30fce6c34 cursor: Use enum for server set cursor names
This mainly prevents having to use strcmp() on every mouse move.
2022-09-16 21:30:40 +01:00
Consolatis
f491942858 cursor: Move cursor specific function definitions into cursor.h 2022-09-16 21:30:40 +01:00
John Lindgren
a3fbb52bb0 seat: Fix use-after-free in touch_finish() 2022-09-16 21:41:38 +02:00
John Lindgren
086a887058 keyboard: Fix use-after-free in keyboard_finish() 2022-09-16 21:41:38 +02:00
John Lindgren
bbc6c6bb94 action: Select resize edges for Resize triggered by keybind 2022-09-16 01:42:04 +02:00
John Lindgren
f112fb636e cursor: Split out cursor_button_press() and cursor_button_release() 2022-09-16 01:36:07 +02:00
Johan Malm
84e64b9ce3 config: s/OSD/OnScreenDisplay/ in <theme><font place="OSD">
...to comply with Openbox 3.6 spec [1]

"OSD" is still honoured to maintain backward compatibility.

[1]: http://openbox.org/wiki/Help:Configuration#Theme
2022-09-16 01:15:11 +02:00
John Lindgren
07a83c19f0 config: Add support for font slant and weight 2022-09-15 21:48:05 +01:00
John Lindgren
1fafb89cba cursor: Store view + resize edges for move/resize in press event
v2: Restore previous behavior for keybinds
2022-09-15 06:13:27 +02:00
John Lindgren
429c388333 cursor: Add struct cursor_context and clean up code
v2:
 - Add surface to cursor_context, rename c -> ctx
 - Factor out determine_resize_edges()
2022-09-15 03:12:38 +02:00
Consolatis
89890b6be9
Merge pull request #533 from jlindgren90/fix-gtk-menus
cursor: Fix GTK3 menus when keeping the button pressed
2022-09-14 06:03:17 +02:00
John Lindgren
e18f7a32ba cursor: Allow leave/enter events within the same XDG toplevel
Attempting to open a GTK3 menu and activate a menu item in it,
using a single mouse motion (press-move-release), was broken due
to GTK apparently expecting to receive leave/enter events when the
cursor enters the menu (XDG popup).

To fix the issue, allow leave/enter events when the cursor is
moved between an XDG toplevel and popups of the same.

v2:
 - Use (struct view *) as proxy for toplevel in comparisons
 - Update seat->pressed.surface when entering/leaving popups
v3:
 - Go back to using get_toplevel() rather than (struct view *)
2022-09-13 15:57:20 -04:00
John Lindgren
a8fbe1aac2 xdg-popup: Check for NULL from wlr_xdg_surface_from_wlr_surface()
Also eliminate struct view_child and replace it with a simple
(struct view *)parent_view field.
2022-09-13 15:57:20 -04:00
John Lindgren
b8c3fdaef9 seat: Listen for destroy signal of pressed.surface 2022-09-13 15:57:20 -04:00
Consolatis
c8ddb0143c
Merge pull request #540 from jlindgren90/cursor-fixes
cursor: Factor out cursor_update_common() and fix some glitches
2022-09-13 20:55:32 +02:00
John Lindgren
6c6e406507 cursor: Factor out cursor_update_common() and fix some glitches
Fix a couple of glitches seen when exiting interactive move/resize:

 - Cursor briefly set to left_ptr rather than the correct cursor image
 - Cursor not updated if the view being moved/resized is destroyed

Also make sure to exit interactive mode if the view is going fullscreen
(labwc gets very confused otherwise).

Code changes in detail:

 - Factor out set_server_cursor() which will set the correct cursor
   image for non-client areas (either XCURSOR_DEFAULT or one of the
   resize cursors).
 - Unify the logic from cursor_rebase() and process_cursor_motion by
   factoring out cursor_update_common().  This corrects some logic
   discrepancies between the two, which should be a good thing(TM).
 - Remove the extra cursor_set(XCURSOR_DEFAULT) from interactive_end()
   and instead rely on cursor_update_focus() to do the right thing.
 - Simplify cursor_button() by just calling interactive_end() when we
   want to exit interactive mode.
 - Call cursor_update_focus() from view_destroy() if the view had mouse
   focus or was being interactively moved/resized.

v2: Eliminate force_reenter parameters and figure out automatically
    when we need to re-enter the surface.
v3: Rename wlseat -> wlr_seat.
v4: Simplify client/server cursor logic.
2022-09-13 13:29:36 -04:00
Johan Malm
4ba59f7074 rcxml.c: enable tap be default on non-touch devices
Some trackpads do not honour tap if we only enable it on touch-devices.
2022-09-11 21:26:32 +01:00
Consolatis
baf555edd0 cursor: Handle missing cursor theme
Temporary fix for #246

This should be reverted once wlroots MR !3651 is merged.
2022-09-11 21:20:00 +01:00
Consolatis
9b02021207 cursor: Don't load cursor theme in server_init()
We are already doing that in seat_init() -> cursor_init()
2022-09-11 21:20:00 +01:00
Consolatis
0deaeceb72 cursor: Prevent setting the same cursor image twice
Possibly fixes #512

Reported-by: @Flrian
2022-09-11 13:30:10 +01:00
Consolatis
7af74c88a8 cursor: Prevent resetting cursor icon during Move or Resize
Reported-by: @Flrian
2022-09-11 13:24:27 +01:00
Consolatis
c0f0e0c46e cursor: Allow re-enter for cursor_update_focus()
This allows forcing an application to re-set their desired cursor image.
2022-09-11 13:24:27 +01:00
Johan Malm
1483158b26
Merge pull request #531 from jlindgren90/titlebar-fixes
Titlebar fixes
2022-09-09 21:35:30 +01:00
John Lindgren
48fde32e62 ssd: Make ssd_get_part_type() work for corner buttons
Corner buttons (WINDOW_MENU and CLOSE) are one more level down in
the scene-tree (see add_scene_button_corner() in ssd_part.c).

This fixes a minor issue where, when right-clicking on the CLOSE
button, the client-menu would be displayed in the wrong location.
2022-09-09 15:23:13 -04:00
John Lindgren
ebd0a5d526 config: Redefine Title context to include blank areas of Titlebar
... and use Title for the Drag (Move) and DoubleClick (Maximize)
titlebar actions, which are unexpected when the cursor is over one
of the window buttons.
2022-09-09 15:23:13 -04:00
Johan Malm
62e9bb7236
Merge pull request #523 from jlindgren90/unmanaged-cursor-focus
cursor: Update focus when unmanaged surfaces are mapped/unmapped
2022-09-09 15:48:14 +01:00
Johan Malm
f47de15f98
Merge pull request #526 from Consolatis/issue/317_gimp_remap
xwayland: Keep view->xwayland_surface and view->surface in sync
2022-09-09 15:32:14 +01:00
John Lindgren
d5e2728c7f interactive: Don't write to view->x/y/w/h directly
Otherwise, the scene-graph isn't updated when calling
view->impl->configure(), and the view ends up in a weird
half-maximized state.
2022-09-08 20:08:03 -04:00
Consolatis
2bbd882df9 cursor: Update cursor focus on scroll events 2022-09-08 01:32:22 +02:00
Consolatis
f057235a1f cursor: Make cursor_rebase() private
Also allow to re-use node, surface, sx and sy.
2022-09-08 01:32:22 +02:00