diff --git a/include/hikari/keyboard.h b/include/hikari/keyboard.h index f17235e..3b18786 100644 --- a/include/hikari/keyboard.h +++ b/include/hikari/keyboard.h @@ -6,6 +6,7 @@ #include #include +#include #include #include diff --git a/include/hikari/switch.h b/include/hikari/switch.h index 39896ee..b1467ad 100644 --- a/include/hikari/switch.h +++ b/include/hikari/switch.h @@ -2,6 +2,7 @@ #define HIKARI_SWITCH_H #include +#include struct hikari_action; struct hikari_switch_config; diff --git a/protocol/wlr-layer-shell-unstable-v1.xml b/protocol/wlr-layer-shell-unstable-v1.xml index adc6a17..d62fd51 100644 --- a/protocol/wlr-layer-shell-unstable-v1.xml +++ b/protocol/wlr-layer-shell-unstable-v1.xml @@ -25,7 +25,7 @@ THIS SOFTWARE. - + Clients can use this interface to assign the surface_layer role to wl_surfaces. Such surfaces are assigned to a "layer" of the output and @@ -47,6 +47,12 @@ or manipulate a buffer prior to the first layer_surface.configure call must also be treated as errors. + After creating a layer_surface object and setting it up, the client + must perform an initial commit without any buffer attached. + The compositor will reply with a layer_surface.configure event. + The client must acknowledge it and is then allowed to attach a buffer + to map the surface. + You may pass NULL for output to allow the compositor to decide which output to use. Generally this will be the one that the user most recently interacted with. @@ -82,9 +88,19 @@ + + + + + + This request indicates that the client will not use the layer_shell + object any more. Objects that have been created through this instance + are not affected. + + - + An interface that may be implemented by a wl_surface, for surfaces that are designed to be rendered as a layer of a stacked desktop-like @@ -93,6 +109,14 @@ Layer surface state (layer, size, anchor, exclusive zone, margin, interactivity) is double-buffered, and will be applied at the time wl_surface.commit of the corresponding wl_surface is called. + + Attaching a null buffer to a layer surface unmaps it. + + Unmapping a layer_surface means that the surface cannot be shown by the + compositor until it is explicitly mapped again. The layer_surface + returns to the state it had right after layer_shell.get_layer_surface. + The client can re-map the surface by performing a commit without any + buffer attached, waiting for a configure event and handling it as usual. @@ -179,21 +203,85 @@ + + + Types of keyboard interaction possible for layer shell surfaces. The + rationale for this is twofold: (1) some applications are not interested + in keyboard events and not allowing them to be focused can improve the + desktop experience; (2) some applications will want to take exclusive + keyboard focus. + + + + + This value indicates that this surface is not interested in keyboard + events and the compositor should never assign it the keyboard focus. + + This is the default value, set for newly created layer shell surfaces. + + This is useful for e.g. desktop widgets that display information or + only have interaction with non-keyboard input devices. + + + + + Request exclusive keyboard focus if this surface is above the shell surface layer. + + For the top and overlay layers, the seat will always give + exclusive keyboard focus to the top-most layer which has keyboard + interactivity set to exclusive. If this layer contains multiple + surfaces with keyboard interactivity set to exclusive, the compositor + determines the one receiving keyboard events in an implementation- + defined manner. In this case, no guarantee is made when this surface + will receive keyboard focus (if ever). + + For the bottom and background layers, the compositor is allowed to use + normal focus semantics. + + This setting is mainly intended for applications that need to ensure + they receive all keyboard events, such as a lock screen or a password + prompt. + + + + + This requests the compositor to allow this surface to be focused and + unfocused by the user in an implementation-defined manner. The user + should be able to unfocus this surface even regardless of the layer + it is on. + + Typically, the compositor will want to use its normal mechanism to + manage keyboard focus between layer shell surfaces with this setting + and regular toplevels on the desktop layer (e.g. click to focus). + Nevertheless, it is possible for a compositor to require a special + interaction to focus or unfocus layer shell surfaces (e.g. requiring + a click even if focus follows the mouse normally, or providing a + keybinding to switch focus between layers). + + This setting is mainly intended for desktop shell components (e.g. + panels) that allow keyboard interaction. Using this option can allow + implementing a desktop shell that can be fully usable without the + mouse. + + + + - Set to 1 to request that the seat send keyboard events to this layer - surface. For layers below the shell surface layer, the seat will use - normal focus semantics. For layers above the shell surface layers, the - seat will always give exclusive keyboard focus to the top-most layer - which has keyboard interactivity set to true. + Set how keyboard events are delivered to this surface. By default, + layer shell surfaces do not receive keyboard events; this request can + be used to change this. + + This setting is inherited by child surfaces set by the get_popup + request. Layer surfaces receive pointer, touch, and tablet events normally. If you do not want to receive them, set the input region on your surface to an empty region. - Events is double-buffered, see wl_surface.commit. + Keyboard interactivity is double-buffered, see wl_surface.commit. - + @@ -278,6 +366,7 @@ + @@ -295,7 +384,7 @@ Layer is double-buffered, see wl_surface.commit. - + diff --git a/src/configuration.c b/src/configuration.c index 39170d5..9ede62b 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/src/dnd_mode.c b/src/dnd_mode.c index 153ddd9..298d473 100644 --- a/src/dnd_mode.c +++ b/src/dnd_mode.c @@ -22,7 +22,7 @@ static void key_handler( struct hikari_keyboard *keyboard, struct wlr_event_keyboard_key *event) { - if (event->state == WLR_KEY_RELEASED) { + if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { hikari_server_enter_normal_mode(NULL); } } diff --git a/src/group_assign_mode.c b/src/group_assign_mode.c index 619eb5b..893dc9f 100644 --- a/src/group_assign_mode.c +++ b/src/group_assign_mode.c @@ -253,7 +253,7 @@ static void key_handler( struct hikari_keyboard *keyboard, struct wlr_event_keyboard_key *event) { - if (event->state == WLR_KEY_PRESSED) { + if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { uint32_t keycode = event->keycode + 8; hikari_keyboard_for_keysym(keyboard, keycode, handle_keysym); } diff --git a/src/input_grab_mode.c b/src/input_grab_mode.c index 1f767b2..69f23b2 100644 --- a/src/input_grab_mode.c +++ b/src/input_grab_mode.c @@ -50,7 +50,7 @@ key_handler( struct hikari_keyboard *keyboard, struct wlr_event_keyboard_key *event) { struct hikari_workspace *workspace = hikari_server.workspace; - if (event->state == WLR_KEY_PRESSED) { + if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { uint32_t modifiers = hikari_server.keyboard_state.modifiers; struct hikari_binding_group *bindings = &keyboard->bindings[modifiers]; diff --git a/src/layout_select_mode.c b/src/layout_select_mode.c index c400d4d..505b4ab 100644 --- a/src/layout_select_mode.c +++ b/src/layout_select_mode.c @@ -59,7 +59,7 @@ static void key_handler( struct hikari_keyboard *keyboard, struct wlr_event_keyboard_key *event) { - if (event->state == WLR_KEY_PRESSED) { + if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { apply_layout(hikari_configuration, event, keyboard); } } diff --git a/src/lock_mode.c b/src/lock_mode.c index 6c2bc6e..5b0b00b 100644 --- a/src/lock_mode.c +++ b/src/lock_mode.c @@ -177,7 +177,7 @@ key_handler( { struct hikari_lock_mode *mode = get_mode(); - if (event->state == WLR_KEY_PRESSED) { + if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { const xkb_keysym_t *syms; uint32_t keycode = event->keycode + 8; uint32_t codepoint; diff --git a/src/mark_assign_mode.c b/src/mark_assign_mode.c index 1c5ce8f..d159fba 100644 --- a/src/mark_assign_mode.c +++ b/src/mark_assign_mode.c @@ -161,7 +161,7 @@ static void key_handler( struct hikari_keyboard *keyboard, struct wlr_event_keyboard_key *event) { - if (event->state == WLR_KEY_PRESSED) { + if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { assign_mark(event, keyboard); } } diff --git a/src/mark_select_mode.c b/src/mark_select_mode.c index 3299c0b..ec1c6dd 100644 --- a/src/mark_select_mode.c +++ b/src/mark_select_mode.c @@ -37,7 +37,7 @@ key_handler( { struct hikari_workspace *workspace = hikari_server.workspace; - if (event->state == WLR_KEY_PRESSED) { + if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { mark_select(workspace, event, keyboard); } } diff --git a/src/move_mode.c b/src/move_mode.c index b48bf26..78d791d 100644 --- a/src/move_mode.c +++ b/src/move_mode.c @@ -32,7 +32,7 @@ static void key_handler( struct hikari_keyboard *keyboard, struct wlr_event_keyboard_key *event) { - if (event->state == WLR_KEY_RELEASED) { + if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { hikari_server_enter_normal_mode(NULL); } } diff --git a/src/normal_mode.c b/src/normal_mode.c index 13af457..e2eb096 100644 --- a/src/normal_mode.c +++ b/src/normal_mode.c @@ -319,7 +319,7 @@ key_handler( return; } - if (event->state == WLR_KEY_PRESSED) { + if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { uint32_t modifiers = hikari_server.keyboard_state.modifiers; struct hikari_binding_group *bindings = &keyboard->bindings[modifiers]; diff --git a/src/resize_mode.c b/src/resize_mode.c index 20a86c9..e5ac9c9 100644 --- a/src/resize_mode.c +++ b/src/resize_mode.c @@ -32,7 +32,7 @@ static void key_handler( struct hikari_keyboard *keyboard, struct wlr_event_keyboard_key *event) { - if (event->state == WLR_KEY_RELEASED) { + if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) { hikari_server_enter_normal_mode(NULL); } } diff --git a/src/server.c b/src/server.c index e5f3b56..51857c3 100644 --- a/src/server.c +++ b/src/server.c @@ -753,7 +753,7 @@ hikari_server_prepare_privileged(void) goto done; } - server->backend = wlr_backend_autocreate(server->display, NULL); + server->backend = wlr_backend_autocreate(server->display); if (server->backend == NULL) { fprintf(stderr, "error: could not create backend\n"); goto done; diff --git a/src/sheet_assign_mode.c b/src/sheet_assign_mode.c index 7a8c4fe..e3afa0e 100644 --- a/src/sheet_assign_mode.c +++ b/src/sheet_assign_mode.c @@ -166,7 +166,7 @@ static void key_handler( struct hikari_keyboard *keyboard, struct wlr_event_keyboard_key *event) { - if (event->state == WLR_KEY_PRESSED) { + if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { uint32_t keycode = event->keycode + 8; hikari_keyboard_for_keysym(keyboard, keycode, handle_keysym); }