Compare commits

...

3 commits

Author SHA1 Message Date
Andri Yngvason
a3e3253bed
Merge 48765c3465 into 801bc76ce3 2024-12-23 11:41:12 +01:00
Hong Xu
801bc76ce3 Explain that the title bar always shows 2024-12-21 11:37:50 +01:00
Andri Yngvason
48765c3465 Implement ext-virtual-keyboard-v1 2024-05-12 23:04:05 +00:00
4 changed files with 45 additions and 3 deletions

View file

@ -3,6 +3,7 @@
#include <libinput.h> #include <libinput.h>
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h> #include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_ext_virtual_keyboard_v1.h>
#include <wlr/types/wlr_virtual_pointer_v1.h> #include <wlr/types/wlr_virtual_pointer_v1.h>
#include <wlr/types/wlr_transient_seat_v1.h> #include <wlr/types/wlr_transient_seat_v1.h>
#include "sway/config.h" #include "sway/config.h"
@ -24,6 +25,7 @@ struct sway_input_manager {
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit; struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
struct wlr_ext_virtual_keyboard_manager_v1 *ext_virtual_keyboard;
struct wlr_virtual_pointer_manager_v1 *virtual_pointer; struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
struct wlr_pointer_gestures_v1 *pointer_gestures; struct wlr_pointer_gestures_v1 *pointer_gestures;
struct wlr_transient_seat_manager_v1 *transient_seat_manager; struct wlr_transient_seat_manager_v1 *transient_seat_manager;
@ -33,6 +35,7 @@ struct sway_input_manager {
struct wl_listener inhibit_deactivate; struct wl_listener inhibit_deactivate;
struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor; struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
struct wl_listener virtual_keyboard_new; struct wl_listener virtual_keyboard_new;
struct wl_listener ext_virtual_keyboard_new;
struct wl_listener virtual_pointer_new; struct wl_listener virtual_pointer_new;
struct wl_listener transient_seat_create; struct wl_listener transient_seat_create;
}; };

View file

@ -7,6 +7,7 @@
#include <wlr/types/wlr_cursor.h> #include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_keyboard_group.h> #include <wlr/types/wlr_keyboard_group.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h> #include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_ext_virtual_keyboard_v1.h>
#include <wlr/types/wlr_virtual_pointer_v1.h> #include <wlr/types/wlr_virtual_pointer_v1.h>
#include "sway/config.h" #include "sway/config.h"
#include "sway/input/cursor.h" #include "sway/input/cursor.h"
@ -395,6 +396,37 @@ void handle_virtual_keyboard(struct wl_listener *listener, void *data) {
seat_add_device(seat, input_device); seat_add_device(seat, input_device);
} }
void handle_ext_virtual_keyboard(struct wl_listener *listener, void *data) {
struct sway_input_manager *input_manager =
wl_container_of(listener, input_manager, ext_virtual_keyboard_new);
struct wlr_ext_virtual_keyboard_v1 *keyboard = data;
struct wlr_input_device *device = &keyboard->keyboard.base;
struct sway_seat *seat = keyboard->seat ?
input_manager_sway_seat_from_wlr_seat(keyboard->seat) :
input_manager_get_default_seat();
struct sway_input_device *input_device =
calloc(1, sizeof(struct sway_input_device));
if (!sway_assert(input_device, "could not allocate input device")) {
return;
}
device->data = input_device;
input_device->is_virtual = true;
input_device->wlr_device = device;
input_device->identifier = input_device_get_identifier(device);
wl_list_insert(&input_manager->devices, &input_device->link);
sway_log(SWAY_DEBUG, "adding virtual keyboard: '%s'",
input_device->identifier);
wl_signal_add(&device->events.destroy, &input_device->device_destroy);
input_device->device_destroy.notify = handle_device_destroy;
seat_add_device(seat, input_device);
}
void handle_virtual_pointer(struct wl_listener *listener, void *data) { void handle_virtual_pointer(struct wl_listener *listener, void *data) {
struct sway_input_manager *input_manager = struct sway_input_manager *input_manager =
wl_container_of(listener, input_manager, virtual_pointer_new); wl_container_of(listener, input_manager, virtual_pointer_new);
@ -465,6 +497,12 @@ struct sway_input_manager *input_manager_create(struct sway_server *server) {
&input->virtual_keyboard_new); &input->virtual_keyboard_new);
input->virtual_keyboard_new.notify = handle_virtual_keyboard; input->virtual_keyboard_new.notify = handle_virtual_keyboard;
input->ext_virtual_keyboard = wlr_ext_virtual_keyboard_manager_v1_create(
server->wl_display);
wl_signal_add(&input->ext_virtual_keyboard->events.new_ext_virtual_keyboard,
&input->ext_virtual_keyboard_new);
input->ext_virtual_keyboard_new.notify = handle_ext_virtual_keyboard;
input->virtual_pointer = wlr_virtual_pointer_manager_v1_create( input->virtual_pointer = wlr_virtual_pointer_manager_v1_create(
server->wl_display server->wl_display
); );

View file

@ -415,6 +415,7 @@ static void update_keyboard_state(struct sway_keyboard *keyboard,
* Returns NULL if the keyboard is not grabbed by an input method, * Returns NULL if the keyboard is not grabbed by an input method,
* or if event is from virtual keyboard of the same client as grab. * or if event is from virtual keyboard of the same client as grab.
* TODO: see swaywm/wlroots#2322 * TODO: see swaywm/wlroots#2322
* TODO: ext-virtual-keyboard-v1
*/ */
static struct wlr_input_method_keyboard_grab_v2 *keyboard_get_im_grab( static struct wlr_input_method_keyboard_grab_v2 *keyboard_get_im_grab(
struct sway_keyboard *keyboard) { struct sway_keyboard *keyboard) {

View file

@ -106,9 +106,9 @@ They are expected to be used with *bindsym* or at runtime through *swaymsg*(1).
*border* none|normal|csd|pixel [<n>] *border* none|normal|csd|pixel [<n>]
Set border style for focused window. _normal_ includes a border of Set border style for focused window. _normal_ includes a border of
thickness _n_ and a title bar. _pixel_ is a border without title bar _n_ thickness _n_ and a title bar. _pixel_ is a border without title bar _n_
pixels thick. Default is _normal_ with border thickness 2. _csd_ is short pixels thick. The title bar always shows in stacking or tabbed layouts.
for client-side-decorations, which allows the client to draw its own _csd_ is short for client-side-decorations, which allows the client to draw
decorations. its own decorations. Default is _normal_ with border thickness 2.
*border* toggle *border* toggle
Cycles through the available border styles. Cycles through the available border styles.