aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-09-28 19:06:41 -0400
committerDrew DeVault <sir@cmpwn.com>2017-09-28 19:06:41 -0400
commit033036712ade73a872f1034ddb47235be11a74aa (patch)
treeecae511da6a408177369858ac43d200bae427472 /include/wlr
parent2850a9360b23eaf27f6437a889b13bdcbe506863 (diff)
parente4ad534ab41b01a08b6b4f19aa47805f6040f7b4 (diff)
Merge branch 'rootston'
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/interfaces/wlr_keyboard.h2
-rw-r--r--include/wlr/types/wlr_keyboard.h13
-rw-r--r--include/wlr/types/wlr_seat.h61
-rw-r--r--include/wlr/types/wlr_wl_shell.h90
-rw-r--r--include/wlr/xwayland.h22
5 files changed, 153 insertions, 35 deletions
diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h
index 4958e2b8..78c1f753 100644
--- a/include/wlr/interfaces/wlr_keyboard.h
+++ b/include/wlr/interfaces/wlr_keyboard.h
@@ -11,5 +11,7 @@ struct wlr_keyboard_impl {
void wlr_keyboard_init(struct wlr_keyboard *keyboard, struct wlr_keyboard_impl *impl);
void wlr_keyboard_destroy(struct wlr_keyboard *keyboard);
+void wlr_keyboard_update_state(struct wlr_keyboard *keyboard,
+ struct wlr_event_keyboard_key *event);
#endif
diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h
index 3f5d0d0c..af205c63 100644
--- a/include/wlr/types/wlr_keyboard.h
+++ b/include/wlr/types/wlr_keyboard.h
@@ -3,6 +3,8 @@
#include <wayland-server.h>
#include <stdint.h>
+#include <wayland-server.h>
+#include <xkbcommon/xkbcommon.h>
enum WLR_KEYBOARD_LED {
WLR_LED_NUM_LOCK = 1,
@@ -15,9 +17,17 @@ struct wlr_keyboard_impl;
struct wlr_keyboard {
struct wlr_keyboard_impl *impl;
+ // TODO: Should this store key repeat info too?
+
+ int keymap_fd;
+ size_t keymap_size;
+ struct xkb_keymap *keymap;
+ struct xkb_state *xkb_state;
+ xkb_led_index_t leds[WLR_LED_LAST];
struct {
struct wl_signal key;
+ struct wl_signal keymap;
} events;
void *data;
@@ -37,4 +47,7 @@ struct wlr_event_keyboard_key {
enum wlr_key_state state;
};
+void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
+ struct xkb_keymap *keymap);
+
#endif
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index 0270ad4e..6927cd16 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -3,6 +3,7 @@
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_input_device.h>
+#include <wlr/types/wlr_keyboard.h>
#include <wayland-server.h>
/**
@@ -13,6 +14,7 @@
struct wlr_seat_handle {
struct wl_resource *wl_resource;
struct wlr_seat *wlr_seat;
+ struct wlr_seat_keyboard *seat_keyboard;
struct wl_resource *pointer;
struct wl_resource *keyboard;
@@ -27,8 +29,17 @@ struct wlr_seat_pointer_state {
struct wlr_seat_handle *focused_handle;
struct wlr_surface *focused_surface;
- struct wl_listener focus_surface_destroy_listener;
- struct wl_listener focus_resource_destroy_listener;
+ struct wl_listener surface_destroy;
+ struct wl_listener resource_destroy;
+};
+
+struct wlr_seat_keyboard {
+ struct wlr_seat *seat;
+ struct wlr_keyboard *keyboard;
+ struct wl_listener key;
+ struct wl_listener keymap;
+ struct wl_listener destroy;
+ struct wl_list link;
};
struct wlr_seat_keyboard_state {
@@ -36,17 +47,15 @@ struct wlr_seat_keyboard_state {
struct wlr_seat_handle *focused_handle;
struct wlr_surface *focused_surface;
- int keymap_fd;
- size_t keymap_size;
-
- struct wl_listener focus_surface_destroy_listener;
- struct wl_listener focus_resource_destroy_listener;
+ struct wl_listener surface_destroy;
+ struct wl_listener resource_destroy;
};
struct wlr_seat {
struct wl_global *wl_global;
struct wl_display *display;
struct wl_list handles;
+ struct wl_list keyboards;
char *name;
uint32_t capabilities;
struct wlr_data_device *data_device;
@@ -57,7 +66,6 @@ struct wlr_seat {
struct {
struct wl_signal client_bound;
struct wl_signal client_unbound;
- struct wl_signal keyboard_bound;
} events;
void *data;
@@ -127,37 +135,32 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
enum wlr_axis_orientation orientation, double value);
/**
- * 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.
+ * Attaches this keyboard to the seat. Key events from this keyboard will be
+ * propegated to the focused client.
*/
-void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
- struct wlr_surface *surface, struct wl_array keys);
+void wlr_seat_attach_keyboard(struct wlr_seat *seat,
+ struct wlr_input_device *dev);
/**
- * Clear the focused surface for the keyboard and leave all entered surfaces.
+ * Detaches this keyboard from the seat. This is done automatically when the
+ * keyboard is destroyed; you only need to use this if you want to remove it for
+ * some other reason.
*/
-void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat);
+void wlr_seat_detach_keyboard(struct wlr_seat *seat, struct wlr_keyboard *kb);
/**
- * Send a key event to the surface with keyboard focus. Returns the event
- * serial.
+ * 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.
*/
-uint32_t wlr_seat_keyboard_send_key(struct wlr_seat *wlr_seat, uint32_t time,
- uint32_t key, uint32_t state);
+void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat,
+ struct wlr_surface *surface);
/**
- * Send the modifiers event to the surface with keyboard focus. Also sends the
- * event to the surface with pointer focus.
+ * Clear the focused surface for the keyboard and leave all entered surfaces.
*/
-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);
+void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat);
-/**
- * Set the keymap and send it to seat keyboard resources.
- */
-void wlr_seat_keyboard_set_keymap(struct wlr_seat *wlr_seat, int keymap_fd,
- size_t keymap_size);
+// TODO: May be useful to be able to simulate keyboard input events
#endif
diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h
index 1443bbf0..0b18a131 100644
--- a/include/wlr/types/wlr_wl_shell.h
+++ b/include/wlr/types/wlr_wl_shell.h
@@ -1,26 +1,112 @@
#ifndef WLR_TYPES_WLR_WL_SHELL_H
#define WLR_TYPES_WLR_WL_SHELL_H
+#include <stdbool.h>
#include <wayland-server.h>
struct wlr_wl_shell {
struct wl_global *wl_global;
struct wl_list wl_resources;
struct wl_list surfaces;
+ uint32_t ping_timeout;
+
+ struct {
+ struct wl_signal new_surface;
+ } events;
void *data;
};
+struct wlr_wl_shell_surface_transient_state {
+ struct wlr_wl_shell_surface *parent;
+ int32_t x;
+ int32_t y;
+ enum wl_shell_surface_transient flags;
+};
+
+struct wlr_wl_shell_surface_popup_state {
+ struct wlr_seat_handle *seat_handle;
+ uint32_t serial;
+};
+
+enum wlr_wl_shell_surface_state {
+ WLR_WL_SHELL_SURFACE_STATE_NONE,
+ WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL,
+ WLR_WL_SHELL_SURFACE_STATE_TRANSIENT,
+ WLR_WL_SHELL_SURFACE_STATE_POPUP,
+};
+
struct wlr_wl_shell_surface {
- struct wl_resource *surface;
- struct wlr_texture *wlr_texture;
+ struct wlr_wl_shell *shell;
+ struct wl_client *client;
+ struct wl_resource *resource;
+ struct wlr_surface *surface;
struct wl_list link;
+ uint32_t ping_serial;
+ struct wl_event_source *ping_timer;
+
+ enum wlr_wl_shell_surface_state state;
+ struct wlr_wl_shell_surface_transient_state *transient_state;
+ struct wlr_wl_shell_surface_popup_state *popup_state;
+
+ char *title;
+ char *class;
+
+ struct wl_listener surface_destroy_listener;
+
+ struct {
+ struct wl_signal destroy;
+ struct wl_signal ping_timeout;
+
+ struct wl_signal request_move;
+ struct wl_signal request_resize;
+ struct wl_signal request_set_fullscreen;
+ struct wl_signal request_set_maximized;
+
+ struct wl_signal set_state;
+ struct wl_signal set_title;
+ struct wl_signal set_class;
+ } events;
+
void *data;
};
+struct wlr_wl_shell_surface_move_event {
+ struct wl_client *client;
+ struct wlr_wl_shell_surface *surface;
+ struct wlr_seat_handle *seat_handle;
+ uint32_t serial;
+};
+
+struct wlr_wl_shell_surface_resize_event {
+ struct wl_client *client;
+ struct wlr_wl_shell_surface *surface;
+ struct wlr_seat_handle *seat_handle;
+ uint32_t serial;
+ enum wl_shell_surface_resize edges;
+};
+
+struct wlr_wl_shell_surface_set_fullscreen_event {
+ struct wl_client *client;
+ struct wlr_wl_shell_surface *surface;
+ enum wl_shell_surface_fullscreen_method method;
+ uint32_t framerate;
+ struct wlr_output *output;
+};
+
+struct wlr_wl_shell_surface_set_maximized_event {
+ struct wl_client *client;
+ struct wlr_wl_shell_surface *surface;
+ struct wlr_output *output;
+};
struct wlr_wl_shell *wlr_wl_shell_create(struct wl_display *display);
void wlr_wl_shell_destroy(struct wlr_wl_shell *wlr_wl_shell);
+void wlr_wl_shell_surface_ping(struct wlr_wl_shell_surface *surface);
+void wlr_wl_shell_surface_configure(struct wlr_wl_shell_surface *surface,
+ uint32_t edges, int32_t width, int32_t height);
+void wlr_wl_shell_surface_popup_done(struct wlr_wl_shell_surface *surface);
+
#endif
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
index 41b8042f..2b9d4e81 100644
--- a/include/wlr/xwayland.h
+++ b/include/wlr/xwayland.h
@@ -20,23 +20,37 @@ struct wlr_xwayland {
struct wl_event_source *sigusr1_source;
struct wl_listener destroy_listener;
struct wlr_xwm *xwm;
- struct wl_list displayable_windows;
+ struct wl_list displayable_surfaces;
+
+ struct {
+ struct wl_signal new_surface;
+ } events;
+
+ void *data;
};
-struct wlr_x11_window {
+struct wlr_xwayland_surface {
xcb_window_t window_id;
uint32_t surface_id;
struct wl_list link;
- struct wl_resource *surface;
+ struct wlr_surface *surface;
struct wl_listener surface_destroy_listener;
int16_t x, y;
uint16_t width, height;
bool override_redirect;
+
+ struct {
+ struct wl_signal destroy;
+ } events;
+
+ void *data;
};
void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland);
struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,
- struct wlr_compositor *compositor);
+ struct wlr_compositor *compositor);
+void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland,
+ struct wlr_xwayland_surface *surface);
#endif