mirror of
https://github.com/labwc/labwc.git
synced 2026-03-07 04:33:54 -05:00
chase: input inhibit removal
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4440
This commit is contained in:
parent
d1fbb3c7cc
commit
3e614814fe
6 changed files with 5 additions and 107 deletions
|
|
@ -164,7 +164,6 @@ struct seat {
|
||||||
/* Used to prevent region snapping when starting a move with A-Left */
|
/* Used to prevent region snapping when starting a move with A-Left */
|
||||||
bool region_prevent_snap;
|
bool region_prevent_snap;
|
||||||
|
|
||||||
struct wl_client *active_client_while_inhibited;
|
|
||||||
struct wl_list inputs;
|
struct wl_list inputs;
|
||||||
struct wl_listener new_input;
|
struct wl_listener new_input;
|
||||||
struct wl_listener focus_change;
|
struct wl_listener focus_change;
|
||||||
|
|
@ -242,10 +241,6 @@ struct server {
|
||||||
struct wl_listener xwayland_new_surface;
|
struct wl_listener xwayland_new_surface;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct wlr_input_inhibit_manager *input_inhibit;
|
|
||||||
struct wl_listener input_inhibit_activate;
|
|
||||||
struct wl_listener input_inhibit_deactivate;
|
|
||||||
|
|
||||||
struct wlr_xdg_activation_v1 *xdg_activation;
|
struct wlr_xdg_activation_v1 *xdg_activation;
|
||||||
struct wl_listener xdg_activation_request;
|
struct wl_listener xdg_activation_request;
|
||||||
struct wl_listener xdg_activation_new_token;
|
struct wl_listener xdg_activation_new_token;
|
||||||
|
|
@ -430,7 +425,7 @@ void foreign_toplevel_update_outputs(struct view *view);
|
||||||
* - optionally raise above other views
|
* - optionally raise above other views
|
||||||
*
|
*
|
||||||
* It's okay to call this function even if the view isn't mapped or the
|
* It's okay to call this function even if the view isn't mapped or the
|
||||||
* session is locked/input is inhibited; it will simply do nothing.
|
* session is locked; it will simply do nothing.
|
||||||
*/
|
*/
|
||||||
void desktop_focus_view(struct view *view, bool raise);
|
void desktop_focus_view(struct view *view, bool raise);
|
||||||
|
|
||||||
|
|
@ -514,13 +509,6 @@ void server_init(struct server *server);
|
||||||
void server_start(struct server *server);
|
void server_start(struct server *server);
|
||||||
void server_finish(struct server *server);
|
void server_finish(struct server *server);
|
||||||
|
|
||||||
/*
|
|
||||||
* wlroots "input inhibitor" extension (required for swaylock) blocks
|
|
||||||
* any client other than the requesting client from receiving events
|
|
||||||
*/
|
|
||||||
bool input_inhibit_blocks_surface(struct seat *seat,
|
|
||||||
struct wl_resource *resource);
|
|
||||||
|
|
||||||
void create_constraint(struct wl_listener *listener, void *data);
|
void create_constraint(struct wl_listener *listener, void *data);
|
||||||
void constrain_cursor(struct server *server, struct wlr_pointer_constraint_v1
|
void constrain_cursor(struct server *server, struct wlr_pointer_constraint_v1
|
||||||
*constraint);
|
*constraint);
|
||||||
|
|
|
||||||
|
|
@ -358,15 +358,6 @@ cursor_update_image(struct seat *seat)
|
||||||
cursor_names[cursor]);
|
cursor_names[cursor]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
input_inhibit_blocks_surface(struct seat *seat, struct wl_resource *resource)
|
|
||||||
{
|
|
||||||
struct wl_client *inhibiting_client =
|
|
||||||
seat->active_client_while_inhibited;
|
|
||||||
return inhibiting_client
|
|
||||||
&& inhibiting_client != wl_resource_get_client(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
update_pressed_surface(struct seat *seat, struct cursor_context *ctx)
|
update_pressed_surface(struct seat *seat, struct cursor_context *ctx)
|
||||||
{
|
{
|
||||||
|
|
@ -472,8 +463,7 @@ cursor_update_common(struct server *server, struct cursor_context *ctx,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->surface && !input_inhibit_blocks_surface(seat,
|
if (ctx->surface) {
|
||||||
ctx->surface->resource)) {
|
|
||||||
/*
|
/*
|
||||||
* Cursor is over an input-enabled client surface. The
|
* Cursor is over an input-enabled client surface. The
|
||||||
* cursor image will be set by request_cursor_notify()
|
* cursor image will be set by request_cursor_notify()
|
||||||
|
|
|
||||||
|
|
@ -457,8 +457,7 @@ handle_compositor_keybindings(struct keyboard *keyboard,
|
||||||
if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
||||||
if (cur_keybind && cur_keybind->on_release) {
|
if (cur_keybind && cur_keybind->on_release) {
|
||||||
key_state_bound_key_remove(event->keycode);
|
key_state_bound_key_remove(event->keycode);
|
||||||
if (seat->server->session_lock_manager->locked
|
if (seat->server->session_lock_manager->locked) {
|
||||||
|| seat->active_client_while_inhibited) {
|
|
||||||
cur_keybind = NULL;
|
cur_keybind = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -476,13 +475,10 @@ handle_compositor_keybindings(struct keyboard *keyboard,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ignore labwc keybindings if input is inhibited
|
* Ignore labwc keybindings if the session is locked.
|
||||||
* It's important to do this after key_state_set_pressed() to ensure
|
* It's important to do this after key_state_set_pressed() to ensure
|
||||||
* _all_ key press/releases are registered
|
* _all_ key press/releases are registered
|
||||||
*/
|
*/
|
||||||
if (seat->active_client_while_inhibited) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (seat->server->session_lock_manager->locked) {
|
if (seat->server->session_lock_manager->locked) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -637,11 +637,6 @@ seat_focus(struct seat *seat, struct wlr_surface *surface, bool is_lock_surface)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Respect input inhibit (also used by some lock screens) */
|
|
||||||
if (input_inhibit_blocks_surface(seat, surface->resource)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wlr_seat_get_keyboard(seat->seat)) {
|
if (!wlr_seat_get_keyboard(seat->seat)) {
|
||||||
/*
|
/*
|
||||||
* wlr_seat_keyboard_notify_enter() sends wl_keyboard.modifiers,
|
* wlr_seat_keyboard_notify_enter() sends wl_keyboard.modifiers,
|
||||||
|
|
|
||||||
71
src/server.c
71
src/server.c
|
|
@ -10,7 +10,6 @@
|
||||||
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
||||||
#include <wlr/types/wlr_fractional_scale_v1.h>
|
#include <wlr/types/wlr_fractional_scale_v1.h>
|
||||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||||
#include <wlr/types/wlr_input_inhibitor.h>
|
|
||||||
#include <wlr/types/wlr_presentation_time.h>
|
#include <wlr/types/wlr_presentation_time.h>
|
||||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||||
#include <wlr/types/wlr_screencopy_v1.h>
|
#include <wlr/types/wlr_screencopy_v1.h>
|
||||||
|
|
@ -150,61 +149,6 @@ handle_sigchld(int signal, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
seat_inhibit_input(struct seat *seat, struct wl_client *active_client)
|
|
||||||
{
|
|
||||||
seat->active_client_while_inhibited = active_client;
|
|
||||||
|
|
||||||
if (seat->focused_layer && active_client !=
|
|
||||||
wl_resource_get_client(seat->focused_layer->resource)) {
|
|
||||||
seat_set_focus_layer(seat, NULL);
|
|
||||||
}
|
|
||||||
struct wlr_surface *previous_kb_surface =
|
|
||||||
seat->seat->keyboard_state.focused_surface;
|
|
||||||
if (previous_kb_surface && active_client !=
|
|
||||||
wl_resource_get_client(previous_kb_surface->resource)) {
|
|
||||||
seat_focus_surface(seat, NULL); /* keyboard focus */
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_seat_client *previous_ptr_client =
|
|
||||||
seat->seat->pointer_state.focused_client;
|
|
||||||
if (previous_ptr_client && previous_ptr_client->client != active_client) {
|
|
||||||
wlr_seat_pointer_clear_focus(seat->seat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
seat_disinhibit_input(struct seat *seat)
|
|
||||||
{
|
|
||||||
seat->active_client_while_inhibited = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Triggers a refocus of the topmost surface layer if necessary
|
|
||||||
* TODO: Make layer surface focus per-output based on cursor position
|
|
||||||
*/
|
|
||||||
output_update_all_usable_areas(seat->server, /*layout_changed*/ false);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handle_input_inhibit(struct wl_listener *listener, void *data)
|
|
||||||
{
|
|
||||||
wlr_log(WLR_INFO, "activate input inhibit");
|
|
||||||
|
|
||||||
struct server *server =
|
|
||||||
wl_container_of(listener, server, input_inhibit_activate);
|
|
||||||
seat_inhibit_input(&server->seat, server->input_inhibit->active_client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handle_input_disinhibit(struct wl_listener *listener, void *data)
|
|
||||||
{
|
|
||||||
wlr_log(WLR_INFO, "deactivate input inhibit");
|
|
||||||
|
|
||||||
struct server *server =
|
|
||||||
wl_container_of(listener, server, input_inhibit_deactivate);
|
|
||||||
seat_disinhibit_input(&server->seat);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_drm_lease_request(struct wl_listener *listener, void *data)
|
handle_drm_lease_request(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
|
@ -521,21 +465,6 @@ server_init(struct server *server)
|
||||||
wl_signal_add(&server->constraints->events.new_constraint,
|
wl_signal_add(&server->constraints->events.new_constraint,
|
||||||
&server->new_constraint);
|
&server->new_constraint);
|
||||||
|
|
||||||
server->input_inhibit =
|
|
||||||
wlr_input_inhibit_manager_create(server->wl_display);
|
|
||||||
if (!server->input_inhibit) {
|
|
||||||
wlr_log(WLR_ERROR, "unable to create input inhibit manager");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_signal_add(&server->input_inhibit->events.activate,
|
|
||||||
&server->input_inhibit_activate);
|
|
||||||
server->input_inhibit_activate.notify = handle_input_inhibit;
|
|
||||||
|
|
||||||
wl_signal_add(&server->input_inhibit->events.deactivate,
|
|
||||||
&server->input_inhibit_deactivate);
|
|
||||||
server->input_inhibit_deactivate.notify = handle_input_disinhibit;
|
|
||||||
|
|
||||||
server->foreign_toplevel_manager =
|
server->foreign_toplevel_manager =
|
||||||
wlr_foreign_toplevel_manager_v1_create(server->wl_display);
|
wlr_foreign_toplevel_manager_v1_create(server->wl_display);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[wrap-git]
|
[wrap-git]
|
||||||
url = https://gitlab.freedesktop.org/wlroots/wlroots.git
|
url = https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
revision = 3b4d7d2a926a0b65d3bad6649615c0b6a61c0336
|
revision = 5dd614b9adc97bf1c89c8e2ebe8504841f8635ea
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
dependency_names = wlroots
|
dependency_names = wlroots
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue