Commit graph

1274 commits

Author SHA1 Message Date
Johan Malm
b4b3e1b28d checkpatch: import checkpatch.pl from Linux kernel
https://raw.githubusercontent.com/torvalds/linux/4ce9f970457899defdf68e26e0502c7245002eb3/scripts/checkpatch.pl
2022-11-03 19:20:23 +00:00
Consolatis
1aeae4b57e Chase wlroots: output test assert
This fixes an assert on output test when
running with the headless backend.

To update the wlroots subproject use
meson subprojects update wlroots

Chases wlroots 05454618cd2d49fb3a5f0c560b0d2c455cf32467
xwayland: split headers

Fixes #605
2022-11-03 18:02:07 +00:00
John Lindgren
3b55b31070 keyboard: Implement key repeat for keybindings
It seems that every Wayland client is expected to implement its own
key-repeat logic, rather than doing it server-side as in X11.  This
means that labwc also has to implement its own key-repeat logic for
compositor keybindings.

This is a very simplistic timer-based implementation.  It doesn't
attempt to synthesize accurate timestamps, and may lag depending
on system load, but it appears to get the job done.

v2: Use server->wl_event_loop
v3: Comments and formatting
2022-11-02 21:52:33 +00:00
John Lindgren
b163045fa9 key-state: Prevent array overflow
- Prevent adding the same keycode more than once
- Prevent adding more keycodes than MAX_PRESSED_KEYS
2022-11-02 21:52:33 +00:00
Consolatis
ec8bc6e2d6 src/menu/menu.c: Add comments 2022-11-01 17:54:02 +01:00
Johan Malm
8909afcd7c README: add link to pre-0.6.0 video 2022-10-31 21:45:09 +00:00
Johan Malm
cce2fffa1d rcxml.c: combine common code in fill_{key,mouse}bind() 2022-10-30 18:26:45 +00:00
Johan Malm
e9c3080f76 rcxml.c: support 'to.action' in mousebind
...in support to specifying 'left', 'right' and so on with actions
GoToDesktop and SendToDesktop.

For example:

    <mouse>
      <default/>
      <context name="Desktop">
        <mousebind button="Up" action="Scroll">
          <action name="GoToDesktop" to="left"/>
        </mousebind>
        <mousebind button="Down" action="Scroll">
          <action name="GoToDesktop" to="right"/>
        </mousebind>
      </context>
    </mouse>
2022-10-30 18:26:45 +00:00
John Lindgren
5fb18a7016 xwayland: Hide unmanaged nodes on unmap()
Since xwayland commit 9e4b7948df5a9a67632bb606150ec171b5519672
there is a one-second delay between XWayland surfaces being
unmapped and destroyed.  This revealed that we were not actually
handling the unmap() signal correctly for unmanaged surfaces.
2022-10-27 15:03:13 -04:00
Consolatis
deb658b672 cursor: Restore drag icon after the move to scene-graph
Also move everything DnD related to src/dnd.c
2022-10-17 21:22:12 +01:00
Johan Malm
3e1a800c14 Add --exit and --reconfigure 2022-10-15 00:19:18 +02:00
Johan Malm
8c139e4185 Add long command line options 2022-10-15 00:19:18 +02:00
Johan Malm
ee00a897a4 server: do not set WAYLAND_DISPLAY twice 2022-10-15 00:19:18 +02:00
Johan Malm
22aa31cb7f labwc(1): describe SIGTERM and SIGHUP 2022-10-15 00:19:18 +02:00
Johan Malm
2c06b902f4 Set environment variable LABWC_PID
...to the pid of the compositor so that SIGHUP and SIGTERM can be sent to
specific instances using `kill -s <signal> <pid>` rather than
`killall -s <signal> labwc`

Issue #573
2022-10-15 00:19:18 +02:00
Johan Malm
3d8f528266 build: simplify protocol paths
No need for arrays here.

swaywm/sway@04f8a65
2022-10-15 00:09:21 +02:00
John Lindgren
cd970945f4 cursor: Call wlr_seat_pointer_notify_clear_focus() only if needed
@Consolatis determined that apparently the extra "clear focus"
event confuses the drag source during drag-and-drop.

Fixes drag-and-drop of files into folders within the same Thunar
window.
2022-10-14 21:56:34 +01:00
01micko
cfdf60b1da Chase wlroots: unreadable displays
This fixes an issue of unreadable displays in some
multiple output configurations.

To update the wlroots subproject use
meson subprojects update wlroots

Chases wlroots 694e9bbb9d7114f39311d93e885e010606a88dae
backend/drm: allocate connector CRTC on lease creation

Fixes #583
2022-10-08 01:27:56 +02:00
Johan Malm
54b34e5bd7 CONTRIBUTING.md: describe coding style more accurately
- Clarify the coding style relative to Linux kernel and Devault rules
- Add g_pattern_match_simple() example
- Add namespace advice and preference
- Elaborate on preferred header documentation style.
- Add table of contents
- Simplify API section and add wl_list_append()
2022-10-05 20:16:06 +01:00
Consolatis
89ad0b808f s/wl_list_insert(list.prev...)/wl_list_append(list...)/ 2022-10-05 19:50:36 +01:00
Johan Malm
042af48925 common: add wl_list_append() 2022-10-05 19:50:36 +01:00
Johan Malm
cc5d364f0f NEWS.md: update notes on 0.6.0 2022-09-30 07:23:09 +01:00
Consolatis
2aa00d9ab2 CI: Switch Void mirror to repo-ci.voidlinux.org 2022-09-30 05:31:03 +02:00
Consolatis
d15f30057e Chase wlroots: output cursor
To update the wlroots subproject use
meson subprojects update wlroots

Chases wlroots 68c8cef38edafa5e52532e0b43a4888554168361
cursor: Don't warp to (0,0) when last output is disconnected

Fixes #561
2022-09-29 14:10:21 +02:00
Consolatis
d0fd7b42df CI: FreeBSD switch from 'quarterly' to 'latest'
Latest wlroots requires libdrm-2.4.113 but 'quarterly' only
provides libdrm-2.4.112. Switch to 'latest' to fix this.
2022-09-29 14:10:21 +02:00
Consolatis
92976f30d0 src/osd.c: Ensure destroying views are not used as preview anchors 2022-09-27 17:35:10 +01:00
Consolatis
c83c1beace src/osd.c: Prevent showing invalid windows
This might happen when closing the last
application "to tray" like VLC, Discord or Steam.

Reported-by: @Flrian
2022-09-27 17:35:10 +01:00
Johan Malm
f2277c37c3 keyboard: put modifier/key listeners in keyboard struct
...so that it can be determined what wlr_keyboard events come from.

This is required to manage virtual keyboards alongside the keyboard_group
of physical keyboards.
2022-09-27 17:31:00 +01:00
Joshua Ashton
76d5fb1dda seat: implement virtual keyboard protocol 2022-09-27 17:31:00 +01:00
Joshua Ashton
4b8d0ba4b2 seat: implement virtual pointer protocol 2022-09-27 17:31:00 +01:00
Joshua Ashton
065b015fbb seat: add seat_add_device helper 2022-09-27 17:31:00 +01:00
Joshua Ashton
d7d11a079a seat: add seat_update_capabilities helper 2022-09-27 17:31:00 +01:00
Johan Malm
d83c58919f view: no gap for top/left align big window
On initial positioning of toplevel windows we call view_center().
During the centering process, if it turns out that the view is larger than
the output usable-area then we just top/left align it with no gap.

Relates to the gap aspect of issue #403

Reported-by: @Flrian
2022-09-27 17:26:51 +01:00
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