mirror of
https://github.com/swaywm/sway.git
synced 2026-04-22 06:46:27 -04:00
Add support for wlr-layer-shell ON_DEMAND keyboard interactivity
This allows for layer shell surfaces to receive focus while the surface is explicitly focused, i.e allowing text fields to receive keyboard input just like a regular surface.
This commit is contained in:
parent
7ab8cb2ee6
commit
913a7679cb
6 changed files with 80 additions and 13 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include <float.h>
|
||||
#include <libevdev/libevdev.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_subcompositor.h>
|
||||
#include <wlr/types/wlr_tablet_v2.h>
|
||||
#include <wlr/types/wlr_xcursor_manager.h>
|
||||
#include "gesture.h"
|
||||
|
|
@ -9,6 +10,7 @@
|
|||
#include "sway/input/cursor.h"
|
||||
#include "sway/input/seat.h"
|
||||
#include "sway/input/tablet.h"
|
||||
#include "sway/layers.h"
|
||||
#include "sway/output.h"
|
||||
#include "sway/tree/view.h"
|
||||
#include "sway/tree/workspace.h"
|
||||
|
|
@ -365,10 +367,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
|
|||
return;
|
||||
}
|
||||
|
||||
// Handle clicking a layer surface
|
||||
struct wlr_layer_surface_v1 *layer;
|
||||
if (surface &&
|
||||
(layer = wlr_layer_surface_v1_try_from_wlr_surface(surface))) {
|
||||
// Handle clicking a layer surface and its popups/subsurfaces
|
||||
struct wlr_layer_surface_v1 *layer = NULL;
|
||||
if ((layer = toplevel_layer_surface_from_surface(surface))) {
|
||||
if (layer->current.keyboard_interactive) {
|
||||
seat_set_focus_layer(seat, layer);
|
||||
transaction_commit_dirty();
|
||||
|
|
@ -544,6 +545,21 @@ static void check_focus_follows_mouse(struct sway_seat *seat,
|
|||
if (wlr_output == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_surface *surface = NULL;
|
||||
double sx, sy;
|
||||
node_at_coords(seat, seat->cursor->cursor->x, seat->cursor->cursor->y,
|
||||
&surface, &sx, &sy);
|
||||
|
||||
// Focus topmost layer surface
|
||||
struct wlr_layer_surface_v1 *layer = NULL;
|
||||
if ((layer = toplevel_layer_surface_from_surface(surface)) &&
|
||||
layer->current.keyboard_interactive) {
|
||||
seat_set_focus_layer(seat, layer);
|
||||
transaction_commit_dirty();
|
||||
return;
|
||||
}
|
||||
|
||||
struct sway_output *hovered_output = wlr_output->data;
|
||||
if (focus && hovered_output != node_get_output(focus)) {
|
||||
struct sway_workspace *ws = output_get_active_workspace(hovered_output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue