mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 18:09:49 +01:00
Merge branch 'master' into rootston
This commit is contained in:
commit
f4387b437f
56 changed files with 376 additions and 121 deletions
48
dist/archlinux/PKGBUILD
vendored
Normal file
48
dist/archlinux/PKGBUILD
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
pkgname=wlroots
|
||||
pkgver=r600.d89272d
|
||||
pkgrel=1
|
||||
license=('MIT')
|
||||
pkgdesc='Wayland compositor library'
|
||||
makedepends=("meson")
|
||||
depends=(
|
||||
"wayland"
|
||||
"wayland-protocols"
|
||||
"mesa"
|
||||
"libdrm"
|
||||
"libinput"
|
||||
"libxkbcommon"
|
||||
"libsystemd"
|
||||
"pixman"
|
||||
"libxcb"
|
||||
)
|
||||
arch=("x86_64")
|
||||
url="https://github.com/SirCmpwn/wlroots"
|
||||
source=("${pkgname}::git+https://github.com/SirCmpwn/wlroots.git")
|
||||
sha1sums=('SKIP')
|
||||
provides=('wlroots')
|
||||
conflicts=('wlroots')
|
||||
|
||||
pkgver() {
|
||||
cd "${srcdir}/${pkgname}"
|
||||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${pkgname}"
|
||||
|
||||
meson build \
|
||||
--prefix=/usr \
|
||||
-Dbuildtype=debugoptimized \
|
||||
-Db_lto=True \
|
||||
-Denable-systemd=True \
|
||||
-Denable-elogind=False \
|
||||
-Denable-libcap=False
|
||||
|
||||
ninja -C build
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/${pkgname}"
|
||||
|
||||
DESTDIR="${pkgdir}" ninja -C build install
|
||||
}
|
|
@ -121,6 +121,15 @@ static void example_set_focused_surface(struct sample_state *sample,
|
|||
}
|
||||
}
|
||||
|
||||
if (surface) {
|
||||
// TODO: send array of currently pressed keys
|
||||
struct wl_array keys;
|
||||
wl_array_init(&keys);
|
||||
wlr_seat_keyboard_enter(sample->wl_seat, surface->surface, keys);
|
||||
} else {
|
||||
wlr_seat_keyboard_clear_focus(sample->wl_seat);
|
||||
}
|
||||
|
||||
sample->focused_surface = surface;
|
||||
}
|
||||
|
||||
|
@ -325,7 +334,8 @@ static void handle_output_frame(struct output_state *output,
|
|||
}
|
||||
|
||||
static void handle_keyboard_key(struct keyboard_state *keyboard,
|
||||
uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state) {
|
||||
uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state,
|
||||
uint64_t time_usec) {
|
||||
struct compositor_state *state = keyboard->compositor;
|
||||
struct sample_state *sample = state->data;
|
||||
if (sym == XKB_KEY_Super_L || sym == XKB_KEY_Super_R) {
|
||||
|
|
|
@ -157,7 +157,8 @@ static void update_velocities(struct compositor_state *state,
|
|||
}
|
||||
|
||||
static void handle_keyboard_key(struct keyboard_state *kbstate,
|
||||
uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state) {
|
||||
uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state,
|
||||
uint64_t time_usec) {
|
||||
// NOTE: It may be better to simply refer to our key state during each frame
|
||||
// and make this change in pixels/sec^2
|
||||
// Also, key repeat
|
||||
|
|
|
@ -99,7 +99,8 @@ static void update_velocities(struct compositor_state *state,
|
|||
}
|
||||
|
||||
static void handle_keyboard_key(struct keyboard_state *kbstate,
|
||||
uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state) {
|
||||
uint32_t keycode, xkb_keysym_t sym, enum wlr_key_state key_state,
|
||||
uint64_t time_usec) {
|
||||
// NOTE: It may be better to simply refer to our key state during each frame
|
||||
// and make this change in pixels/sec^2
|
||||
// Also, key repeat
|
||||
|
|
|
@ -48,7 +48,8 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
|||
key_state == WLR_KEY_PRESSED ? "pressed" : "released");
|
||||
}
|
||||
if (kbstate->compositor->keyboard_key_cb) {
|
||||
kbstate->compositor->keyboard_key_cb(kbstate, event->keycode, sym, key_state);
|
||||
kbstate->compositor->keyboard_key_cb(kbstate, event->keycode, sym,
|
||||
key_state, event->time_usec);
|
||||
}
|
||||
if (sym == XKB_KEY_Escape) {
|
||||
wl_display_terminate(kbstate->compositor->display);
|
||||
|
|
|
@ -87,7 +87,7 @@ struct compositor_state {
|
|||
struct output_state *s);
|
||||
void (*keyboard_remove_cb)(struct keyboard_state *s);
|
||||
void (*keyboard_key_cb)(struct keyboard_state *s, uint32_t keycode,
|
||||
xkb_keysym_t sym, enum wlr_key_state key_state);
|
||||
xkb_keysym_t sym, enum wlr_key_state key_state, uint64_t time_usec);
|
||||
void (*pointer_motion_cb)(struct pointer_state *s,
|
||||
double d_x, double d_y);
|
||||
void (*pointer_motion_absolute_cb)(struct pointer_state *s,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef DRM_PROPERTIES_H
|
||||
#define DRM_PROPERTIES_H
|
||||
#ifndef BACKEND_DRM_PROPERTIES_H
|
||||
#define BACKEND_DRM_PROPERTIES_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef WLR_DRM_UTIL_H
|
||||
#define WLR_DRM_UTIL_H
|
||||
#ifndef BACKEND_DRM_UTIL_H
|
||||
#define BACKEND_DRM_UTIL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <xf86drm.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef DRM_BACKEND_H
|
||||
#define DRM_BACKEND_H
|
||||
#ifndef BACKEND_DRM_H
|
||||
#define BACKEND_DRM_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_BACKEND_LIBINPUT_INTERNAL_H
|
||||
#define _WLR_BACKEND_LIBINPUT_INTERNAL_H
|
||||
#ifndef BACKEND_LIBINPUT_H
|
||||
#define BACKEND_LIBINPUT_H
|
||||
#include <libinput.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_MULTI_BACKEND_INTERNAL
|
||||
#define _WLR_MULTI_BACKEND_INTERNAL
|
||||
#ifndef BACKEND_MULTI_H
|
||||
#define BACKEND_MULTI_H
|
||||
|
||||
#include <wlr/backend/interface.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SESSION_DIRECT_IPC
|
||||
#define SESSION_DIRECT_IPC
|
||||
#ifndef BACKEND_SESSION_DIRECT_IPC_H
|
||||
#define BACKEND_SESSION_DIRECT_IPC_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_INTERNAL_BACKEND_WAYLAND_H
|
||||
#define _WLR_INTERNAL_BACKEND_WAYLAND_H
|
||||
#ifndef BACKEND_WAYLAND_H
|
||||
#define BACKEND_WAYLAND_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wayland-client.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_RENDER_GLES2_INTERNAL_H
|
||||
#define _WLR_RENDER_GLES2_INTERNAL_H
|
||||
#ifndef RENDER_GLES2_H
|
||||
#define RENDER_GLES2_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_BACKEND_H
|
||||
#define _WLR_BACKEND_H
|
||||
#ifndef WLR_BACKEND_H
|
||||
#define WLR_BACKEND_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/backend/session.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_BACKEND_INTERFACE_H
|
||||
#define _WLR_BACKEND_INTERFACE_H
|
||||
#ifndef WLR_BACKEND_INTERFACE_H
|
||||
#define WLR_BACKEND_INTERFACE_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wlr/backend.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_BACKEND_MULTI_H
|
||||
#define _WLR_BACKEND_MULTI_H
|
||||
#ifndef WLR_BACKEND_MULTI_H
|
||||
#define WLR_BACKEND_MULTI_H
|
||||
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/session.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef WLR_SESSION_H
|
||||
#define WLR_SESSION_H
|
||||
#ifndef WLR_BACKEND_SESSION_H
|
||||
#define WLR_BACKEND_SESSION_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wayland-server.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef WLR_SESSION_INTERFACE_H
|
||||
#define WLR_SESSION_INTERFACE_H
|
||||
#ifndef WLR_BACKEND_SESSION_INTERFACE_H
|
||||
#define WLR_BACKEND_SESSION_INTERFACE_H
|
||||
|
||||
#include <wlr/backend/session.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_INTERFACES_DATA_SOURCE_H
|
||||
#define _WLR_INTERFACES_DATA_SOURCE_H
|
||||
#ifndef WLR_INTERFACES_WLR_DATA_SOURCE_H
|
||||
#define WLR_INTERFACES_WLR_DATA_SOURCE_H
|
||||
|
||||
#include <wlr/types/wlr_data_source.h>
|
||||
|
||||
struct wlr_data_source_impl {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_INTERFACES_INPUT_DEVICE_H
|
||||
#define _WLR_INTERFACES_INPUT_DEVICE_H
|
||||
#ifndef WLR_INTERFACES_WLR_INPUT_DEVICE_H
|
||||
#define WLR_INTERFACES_WLR_INPUT_DEVICE_H
|
||||
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
|
||||
struct wlr_input_device_impl {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_INTERFACE_KEYBOARD_H
|
||||
#define _WLR_INTERFACE_KEYBOARD_H
|
||||
#ifndef WLR_INTERFACES_WLR_KEYBOARD_H
|
||||
#define WLR_INTERFACES_WLR_KEYBOARD_H
|
||||
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_INTERFACE_OUTPUT_H
|
||||
#define _WLR_INTERFACE_OUTPUT_H
|
||||
#ifndef WLR_INTERFACES_WLR_OUTPUT_H
|
||||
#define WLR_INTERFACES_WLR_OUTPUT_H
|
||||
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_INTERFACES_POINTER_H
|
||||
#define _WLR_INTERFACES_POINTER_H
|
||||
#ifndef WLR_INTERFACES_WLR_POINTER_H
|
||||
#define WLR_INTERFACES_WLR_POINTER_H
|
||||
|
||||
#include <wlr/types/wlr_pointer.h>
|
||||
|
||||
struct wlr_pointer_impl {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_INTERFACES_TABLET_PAD_H
|
||||
#define _WLR_INTERFACES_TABLET_PAD_H
|
||||
#ifndef WLR_INTERFACES_WLR_TABLET_PAD_H
|
||||
#define WLR_INTERFACES_WLR_TABLET_PAD_H
|
||||
|
||||
#include <wlr/types/wlr_tablet_pad.h>
|
||||
|
||||
struct wlr_tablet_pad_impl {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_INTERFACES_TABLET_TOOL_H
|
||||
#define _WLR_INTERFACES_TABLET_TOOL_H
|
||||
#ifndef WLR_INTERFACES_WLR_TABLET_TOOL_H
|
||||
#define WLR_INTERFACES_WLR_TABLET_TOOL_H
|
||||
|
||||
#include <wlr/types/wlr_tablet_tool.h>
|
||||
|
||||
struct wlr_tablet_tool_impl {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_INTERFACES_TOUCH_H
|
||||
#define _WLR_INTERFACES_TOUCH_H
|
||||
#ifndef WLR_INTERFACES_WLR_TOUCH_H
|
||||
#define WLR_INTERFACES_WLR_TOUCH_H
|
||||
|
||||
#include <wlr/types/wlr_touch.h>
|
||||
|
||||
struct wlr_touch_impl {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_RENDER_H
|
||||
#define _WLR_RENDER_H
|
||||
#ifndef WLR_RENDER_H
|
||||
#define WLR_RENDER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <wayland-server-protocol.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_GLES2_RENDERER_H
|
||||
#define _WLR_GLES2_RENDERER_H
|
||||
#ifndef WLR_RENDER_GLES2_H
|
||||
#define WLR_RENDER_GLES2_H
|
||||
|
||||
#include <wlr/render.h>
|
||||
#include <wlr/backend.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_RENDER_INTERFACE_H
|
||||
#define _WLR_RENDER_INTERFACE_H
|
||||
#ifndef WLR_RENDER_INTERFACE_H
|
||||
#define WLR_RENDER_INTERFACE_H
|
||||
|
||||
#include <wayland-server-protocol.h>
|
||||
#include <stdbool.h>
|
||||
#include <wlr/render.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_RENDER_MATRIX_H
|
||||
#define _WLR_RENDER_MATRIX_H
|
||||
#ifndef WLR_RENDER_MATRIX_H
|
||||
#define WLR_RENDER_MATRIX_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_GEOMETRY_H
|
||||
#define _WLR_TYPES_GEOMETRY_H
|
||||
#ifndef WLR_TYPES_WLR_BOX_H
|
||||
#define WLR_TYPES_WLR_BOX_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct wlr_box {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _EXAMPLE_COMPOSITOR_H
|
||||
#define _EXAMPLE_COMPOSITOR_H
|
||||
#ifndef WLR_TYPES_WLR_COMPOSITOR_H
|
||||
#define WLR_TYPES_WLR_COMPOSITOR_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/render.h>
|
||||
|
||||
|
@ -22,4 +23,5 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
|||
struct wlr_surface;
|
||||
void wl_compositor_surface_destroyed(struct wlr_compositor *wlr_compositor,
|
||||
struct wlr_surface *surface);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_CURSOR_H
|
||||
#define _WLR_TYPES_CURSOR_H
|
||||
#ifndef WLR_TYPES_WLR_CURSOR_H
|
||||
#define WLR_TYPES_WLR_CURSOR_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_TYPES_DATA_DEVICE_MANAGER_H
|
||||
#define _WLR_TYPES_DATA_DEVICE_MANAGER_H
|
||||
#ifndef WLR_TYPES_WLR_DATA_DEVICE_MANAGER_H
|
||||
#define WLR_TYPES_WLR_DATA_DEVICE_MANAGER_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_TYPES_DATA_SOURCE_H
|
||||
#define _WLR_TYPES_DATA_SOURCE_H
|
||||
#ifndef WLR_TYPES_WLR_DATA_SOURCE_H
|
||||
#define WLR_TYPES_WLR_DATA_SOURCE_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/util/list.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_GAMMA_CONTROL_H
|
||||
#define _WLR_GAMMA_CONTROL_H
|
||||
#ifndef WLR_TYPES_WLR_GAMMA_CONTROL_H
|
||||
#define WLR_TYPES_WLR_GAMMA_CONTROL_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
|
||||
struct wlr_gamma_control_manager {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_TYPES_INPUT_H
|
||||
#define _WLR_TYPES_INPUT_H
|
||||
#ifndef WLR_TYPES_WLR_INPUT_DEVICE_H
|
||||
#define WLR_TYPES_WLR_INPUT_DEVICE_H
|
||||
|
||||
enum wlr_button_state {
|
||||
WLR_BUTTON_RELEASED,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#ifndef _WLR_TYPES_KEYBOARD_H
|
||||
#define _WLR_TYPES_KEYBOARD_H
|
||||
#ifndef WLR_TYPES_WLR_KEYBOARD_H
|
||||
#define WLR_TYPES_WLR_KEYBOARD_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <stdint.h>
|
||||
#include <wayland-server.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_OUTPUT_H
|
||||
#define _WLR_TYPES_OUTPUT_H
|
||||
#ifndef WLR_TYPES_WLR_OUTPUT_H
|
||||
#define WLR_TYPES_WLR_OUTPUT_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/util/list.h>
|
||||
#include <stdbool.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_OUTPUT_LAYOUT_H
|
||||
#define _WLR_TYPES_OUTPUT_LAYOUT_H
|
||||
#ifndef WLR_TYPES_WLR_OUTPUT_LAYOUT_H
|
||||
#define WLR_TYPES_WLR_OUTPUT_LAYOUT_H
|
||||
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wayland-util.h>
|
||||
#include <stdbool.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_POINTER_H
|
||||
#define _WLR_TYPES_POINTER_H
|
||||
#ifndef WLR_TYPES_WLR_POINTER_H
|
||||
#define WLR_TYPES_WLR_POINTER_H
|
||||
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wayland-server.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_TYPES_REGION_H
|
||||
#define _WLR_TYPES_REGION_H
|
||||
#ifndef WLR_TYPES_WLR_REGION_H
|
||||
#define WLR_TYPES_WLR_REGION_H
|
||||
|
||||
struct wl_resource;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_SEAT_H
|
||||
#define _WLR_TYPES_SEAT_H
|
||||
#ifndef WLR_TYPES_WLR_SEAT_H
|
||||
#define WLR_TYPES_WLR_SEAT_H
|
||||
|
||||
#include <wlr/types/wlr_surface.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
|
@ -41,6 +42,18 @@ struct wlr_seat_keyboard {
|
|||
struct wl_list link;
|
||||
};
|
||||
|
||||
struct wlr_seat_keyboard_state {
|
||||
struct wlr_seat *wlr_seat;
|
||||
struct wlr_seat_handle *focused_handle;
|
||||
struct wlr_surface *focused_surface;
|
||||
|
||||
int keymap_fd;
|
||||
size_t keymap_size;
|
||||
|
||||
struct wl_listener surface_destroy;
|
||||
struct wl_listener resource_destroy;
|
||||
};
|
||||
|
||||
struct wlr_seat {
|
||||
struct wl_global *wl_global;
|
||||
struct wl_display *display;
|
||||
|
@ -51,6 +64,7 @@ struct wlr_seat {
|
|||
struct wlr_data_device *data_device;
|
||||
|
||||
struct wlr_seat_pointer_state pointer_state;
|
||||
struct wlr_seat_keyboard_state keyboard_state;
|
||||
|
||||
struct {
|
||||
struct wl_signal client_bound;
|
||||
|
@ -137,4 +151,19 @@ void wlr_seat_attach_keyboard(struct wlr_seat *seat,
|
|||
*/
|
||||
void wlr_seat_detach_keyboard(struct wlr_seat *seat, struct wlr_keyboard *kb);
|
||||
|
||||
/**
|
||||
* Send a keyboard enter event to the given surface and consider it to be the
|
||||
* focused surface for the keyboard. This will send a leave event to the last
|
||||
* surface that was entered. Pass an array of currently pressed keys.
|
||||
*/
|
||||
void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
|
||||
struct wlr_surface *surface);
|
||||
|
||||
/**
|
||||
* Clear the focused surface for the keyboard and leave all entered surfaces.
|
||||
*/
|
||||
void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat);
|
||||
|
||||
// TODO: May be useful to be able to simulate keyboard input events
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_WLR_SURFACE_H
|
||||
#define _WLR_TYPES_WLR_SURFACE_H
|
||||
#ifndef WLR_TYPES_WLR_SURFACE_H
|
||||
#define WLR_TYPES_WLR_SURFACE_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <pixman.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_TABLET_PAD_H
|
||||
#define _WLR_TYPES_TABLET_PAD_H
|
||||
#ifndef WLR_TYPES_WLR_TABLET_PAD_H
|
||||
#define WLR_TYPES_WLR_TABLET_PAD_H
|
||||
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wayland-server.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_TABLET_TOOL_H
|
||||
#define _WLR_TYPES_TABLET_TOOL_H
|
||||
#ifndef WLR_TYPES_TABLET_TOOL_H
|
||||
#define WLR_TYPES_TABLET_TOOL_H
|
||||
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wayland-server.h>
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_TYPES_TOUCH_H
|
||||
#define _WLR_TYPES_TOUCH_H
|
||||
#ifndef WLR_TYPES_WLR_TOUCH_H
|
||||
#define WLR_TYPES_WLR_TOUCH_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_WL_SHELL_H
|
||||
#define _WLR_WL_SHELL_H
|
||||
#ifndef WLR_TYPES_WLR_WL_SHELL_H
|
||||
#define WLR_TYPES_WLR_WL_SHELL_H
|
||||
|
||||
#include <wayland-server.h>
|
||||
|
||||
struct wlr_wl_shell {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_XDG_SHELL_V6_H
|
||||
#define _WLR_XDG_SHELL_V6_H
|
||||
#ifndef WLR_TYPES_WLR_XDG_SHELL_V6_H
|
||||
#define WLR_TYPES_WLR_XDG_SHELL_V6_H
|
||||
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wayland-server.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _WLR_UTIL_LIST_H
|
||||
#define _WLR_UTIL_LIST_H
|
||||
#ifndef WLR_UTIL_LIST_H
|
||||
#define WLR_UTIL_LIST_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_UTIL_LOG_H
|
||||
#define _WLR_UTIL_LOG_H
|
||||
#ifndef WLR_UTIL_LOG_H
|
||||
#define WLR_UTIL_LOG_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
* This is adapted from wayland-cursor, but with the wl_shm client stuff removed
|
||||
* so we can use it on the compositor, too.
|
||||
*/
|
||||
#ifndef _WLR_XCURSOR_H
|
||||
#define _WLR_XCURSOR_H
|
||||
|
||||
#ifndef WLR_XCURSOR_H
|
||||
#define WLR_XCURSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct wlr_xcursor_image {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef _WLR_XWAYLAND_H
|
||||
#define _WLR_XWAYLAND_H
|
||||
#ifndef WLR_XWAYLAND_H
|
||||
#define WLR_XWAYLAND_H
|
||||
|
||||
#include <time.h>
|
||||
#include <stdbool.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
|
|
11
meson.build
11
meson.build
|
@ -20,6 +20,7 @@ add_project_link_arguments(
|
|||
)
|
||||
|
||||
wlr_inc = include_directories('include')
|
||||
install_subdir('include/wlr', install_dir: 'include')
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
|
@ -103,6 +104,7 @@ lib_wlr = library(
|
|||
],
|
||||
dependencies: wlr_deps,
|
||||
include_directories: wlr_inc,
|
||||
install: true,
|
||||
)
|
||||
|
||||
wlroots = declare_dependency(
|
||||
|
@ -113,3 +115,12 @@ wlroots = declare_dependency(
|
|||
|
||||
subdir('rootston')
|
||||
subdir('examples')
|
||||
|
||||
pkgconfig = import('pkgconfig')
|
||||
pkgconfig.generate(
|
||||
libraries: lib_wlr,
|
||||
version: '0.0.1',
|
||||
filebase: 'wlroots',
|
||||
name: 'wlroots',
|
||||
description: 'Wayland compositor library',
|
||||
)
|
||||
|
|
162
types/wlr_seat.c
162
types/wlr_seat.c
|
@ -70,7 +70,7 @@ static void wl_seat_get_keyboard(struct wl_client *client,
|
|||
}
|
||||
if (handle->keyboard) {
|
||||
// TODO: this is probably a protocol violation but it simplifies our
|
||||
// code and it'd be stupid for clients to create several pointers for
|
||||
// code and it'd be stupid for clients to create several keyboards for
|
||||
// the same seat
|
||||
wl_resource_destroy(handle->keyboard);
|
||||
}
|
||||
|
@ -114,6 +114,9 @@ static void wlr_seat_handle_resource_destroy(struct wl_resource *resource) {
|
|||
if (handle == handle->wlr_seat->pointer_state.focused_handle) {
|
||||
handle->wlr_seat->pointer_state.focused_handle = NULL;
|
||||
}
|
||||
if (handle == handle->wlr_seat->keyboard_state.focused_handle) {
|
||||
handle->wlr_seat->keyboard_state.focused_handle = NULL;
|
||||
}
|
||||
|
||||
if (handle->pointer) {
|
||||
wl_resource_destroy(handle->pointer);
|
||||
|
@ -168,6 +171,14 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
|||
}
|
||||
|
||||
wlr_seat->pointer_state.wlr_seat = wlr_seat;
|
||||
wl_list_init(&wlr_seat->pointer_state.focus_resource_destroy_listener.link);
|
||||
wl_list_init(&wlr_seat->pointer_state.focus_surface_destroy_listener.link);
|
||||
|
||||
wlr_seat->keyboard_state.wlr_seat = wlr_seat;
|
||||
wl_list_init(
|
||||
&wlr_seat->keyboard_state.focus_resource_destroy_listener.link);
|
||||
wl_list_init(
|
||||
&wlr_seat->keyboard_state.focus_surface_destroy_listener.link);
|
||||
|
||||
struct wl_global *wl_global = wl_global_create(display,
|
||||
&wl_seat_interface, 6, wlr_seat, wl_seat_bind);
|
||||
|
@ -184,9 +195,6 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
|||
wl_signal_init(&wlr_seat->events.client_bound);
|
||||
wl_signal_init(&wlr_seat->events.client_unbound);
|
||||
|
||||
wl_list_init(&wlr_seat->pointer_state.focus_resource_destroy_listener.link);
|
||||
wl_list_init(&wlr_seat->pointer_state.focus_surface_destroy_listener.link);
|
||||
|
||||
return wlr_seat;
|
||||
}
|
||||
|
||||
|
@ -294,13 +302,6 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
|||
wl_pointer_send_frame(focused_handle->pointer);
|
||||
}
|
||||
|
||||
// TEMPORARY
|
||||
if (focused_handle && focused_handle->pointer && focused_surface) {
|
||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||
wl_keyboard_send_leave(focused_handle->keyboard,
|
||||
serial, focused_surface->resource);
|
||||
}
|
||||
|
||||
// enter the current surface
|
||||
if (handle && handle->pointer) {
|
||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||
|
@ -309,15 +310,6 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
|||
wl_pointer_send_frame(handle->pointer);
|
||||
}
|
||||
|
||||
// TEMPORARY
|
||||
if (handle && handle->keyboard) {
|
||||
wlr_log(L_DEBUG, "Sending keyboard");
|
||||
struct wl_array keys;
|
||||
wl_array_init(&keys);
|
||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||
wl_keyboard_send_enter(handle->keyboard, serial, surface->resource, &keys);
|
||||
}
|
||||
|
||||
// reinitialize the focus destroy events
|
||||
wl_list_remove(
|
||||
&wlr_seat->pointer_state.focus_surface_destroy_listener.link);
|
||||
|
@ -478,3 +470,133 @@ void wlr_seat_detach_keyboard(struct wlr_seat *seat, struct wlr_keyboard *kb) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void keyboard_surface_destroy_notify(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct wlr_seat_keyboard_state *state = wl_container_of(
|
||||
listener, state, surface_destroy);
|
||||
state->focused_surface = NULL;
|
||||
wlr_seat_keyboard_clear_focus(state->wlr_seat);
|
||||
}
|
||||
|
||||
static void keyboard_resource_destroy_notify(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct wlr_seat_keyboard_state *state = wl_container_of(
|
||||
listener, state, resource_destroy);
|
||||
state->focused_surface = NULL;
|
||||
wlr_seat_keyboard_clear_focus(state->wlr_seat);
|
||||
}
|
||||
|
||||
void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
|
||||
struct wlr_surface *surface) {
|
||||
if (wlr_seat->keyboard_state.focused_surface == surface) {
|
||||
// this surface already got an enter notify
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_seat_handle *handle = NULL;
|
||||
|
||||
if (surface) {
|
||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
||||
handle = wlr_seat_handle_for_client(wlr_seat, client);
|
||||
}
|
||||
|
||||
struct wlr_seat_handle *focused_handle =
|
||||
wlr_seat->keyboard_state.focused_handle;
|
||||
struct wlr_surface *focused_surface =
|
||||
wlr_seat->keyboard_state.focused_surface;
|
||||
|
||||
// leave the previously entered surface
|
||||
if (focused_handle && focused_handle->keyboard && focused_surface) {
|
||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||
wl_keyboard_send_leave(focused_handle->keyboard, serial,
|
||||
focused_surface->resource);
|
||||
}
|
||||
|
||||
// enter the current surface
|
||||
if (handle && handle->keyboard) {
|
||||
// TODO: handle keys properly
|
||||
struct wl_array keys;
|
||||
wl_array_init(&keys);
|
||||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||
wl_keyboard_send_enter(handle->keyboard, serial,
|
||||
surface->resource, &keys);
|
||||
}
|
||||
|
||||
// reinitialize the focus destroy events
|
||||
wl_list_remove(
|
||||
&wlr_seat->keyboard_state.focus_surface_destroy_listener.link);
|
||||
wl_list_init(&wlr_seat->keyboard_state.focus_surface_destroy_listener.link);
|
||||
wl_list_remove(
|
||||
&wlr_seat->keyboard_state.focus_resource_destroy_listener.link);
|
||||
wl_list_init(
|
||||
&wlr_seat->keyboard_state.focus_resource_destroy_listener.link);
|
||||
if (surface) {
|
||||
wl_signal_add(&surface->signals.destroy,
|
||||
&wlr_seat->keyboard_state.surface_destroy);
|
||||
wl_resource_add_destroy_listener(surface->resource,
|
||||
&wlr_seat->keyboard_state.resource_destroy);
|
||||
wlr_seat->keyboard_state.resource_destroy.notify =
|
||||
keyboard_resource_destroy_notify;
|
||||
wlr_seat->keyboard_state.surface_destroy.notify =
|
||||
keyboard_surface_destroy_notify;
|
||||
}
|
||||
|
||||
wlr_seat->keyboard_state.focused_handle = handle;
|
||||
wlr_seat->keyboard_state.focused_surface = surface;
|
||||
}
|
||||
|
||||
void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat) {
|
||||
struct wl_array keys;
|
||||
wl_array_init(&keys);
|
||||
wlr_seat_keyboard_enter(wlr_seat, NULL, keys);
|
||||
}
|
||||
|
||||
static bool wlr_seat_keyboard_has_focus_resource(struct wlr_seat *wlr_seat) {
|
||||
return wlr_seat->keyboard_state.focused_handle &&
|
||||
wlr_seat->keyboard_state.focused_handle->keyboard;
|
||||
}
|
||||
|
||||
/*
|
||||
void wlr_seat_keyboard_send_modifiers(struct wlr_seat *wlr_seat,
|
||||
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
|
||||
uint32_t group) {
|
||||
uint32_t serial = 0;
|
||||
struct wl_resource *keyboard;
|
||||
|
||||
if (wlr_seat_keyboard_has_focus_resource(wlr_seat)) {
|
||||
serial = wl_display_next_serial(wlr_seat->display);
|
||||
keyboard = wlr_seat->keyboard_state.focused_handle->keyboard;
|
||||
wl_keyboard_send_modifiers(keyboard, serial, mods_depressed,
|
||||
mods_latched, mods_locked, group);
|
||||
}
|
||||
|
||||
if (wlr_seat_pointer_has_focus_resource(wlr_seat) &&
|
||||
wlr_seat->pointer_state.focused_handle->keyboard &&
|
||||
wlr_seat->pointer_state.focused_handle !=
|
||||
wlr_seat->keyboard_state.focused_handle) {
|
||||
if (serial == 0) {
|
||||
serial = wl_display_next_serial(wlr_seat->display);
|
||||
}
|
||||
keyboard = wlr_seat->pointer_state.focused_handle->keyboard;
|
||||
|
||||
wl_keyboard_send_modifiers(keyboard, serial, mods_depressed,
|
||||
mods_latched, mods_locked, group);
|
||||
}
|
||||
}
|
||||
|
||||
void wlr_seat_keyboard_set_keymap(struct wlr_seat *wlr_seat, int keymap_fd,
|
||||
size_t keymap_size) {
|
||||
// TODO: we probably should wait to send the keymap if keys are pressed
|
||||
struct wlr_seat_handle *handle;
|
||||
wl_list_for_each(handle, &wlr_seat->handles, link) {
|
||||
if (handle->keyboard) {
|
||||
wl_keyboard_send_keymap(handle->keyboard,
|
||||
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keymap_fd, keymap_size);
|
||||
}
|
||||
}
|
||||
|
||||
wlr_seat->keyboard_state.keymap_fd = keymap_fd;
|
||||
wlr_seat->keyboard_state.keymap_size = keymap_size;
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue