Merge branch 'master' into xwm-selection

This commit is contained in:
emersion 2017-12-14 11:20:38 +01:00
commit 6ef0219763
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
32 changed files with 268 additions and 54 deletions

View file

@ -7,6 +7,7 @@
#include <wayland-egl.h>
#include <wlr/render/egl.h>
#include <wlr/backend/wayland.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_input_device.h>
#include <wayland-util.h>
@ -75,6 +76,8 @@ void wlr_wl_registry_poll(struct wlr_wl_backend *backend);
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output);
struct wlr_wl_backend_output *wlr_wl_output_for_surface(
struct wlr_wl_backend *backend, struct wl_surface *surface);
void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend,
struct wlr_box *box);
extern const struct wl_seat_listener seat_listener;

View file

@ -42,6 +42,7 @@ struct roots_keyboard_config {
char *layout;
char *variant;
char *options;
int repeat_rate, repeat_delay;
struct wl_list link;
};
@ -50,6 +51,7 @@ struct roots_cursor_config {
char *mapped_output;
struct wlr_box *mapped_box;
char *theme;
char *default_image;
struct wl_list link;
};

View file

@ -20,6 +20,8 @@ struct roots_cursor {
struct roots_seat *seat;
struct wlr_cursor *cursor;
const char *default_xcursor;
enum roots_cursor_mode mode;
// state from input (review if this is necessary)

View file

@ -9,6 +9,8 @@
struct wlr_output_impl {
void (*enable)(struct wlr_output *output, bool enable);
bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode);
bool (*set_custom_mode)(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh);
void (*transform)(struct wlr_output *output,
enum wl_output_transform transform);
bool (*set_cursor)(struct wlr_output *output, const uint8_t *buf,

View file

@ -51,10 +51,16 @@ struct wlr_keyboard {
xkb_mod_mask_t group;
} modifiers;
struct {
int32_t rate;
int32_t delay;
} repeat_info;
struct {
struct wl_signal key;
struct wl_signal modifiers;
struct wl_signal keymap;
struct wl_signal repeat_info;
} events;
void *data;
@ -74,6 +80,12 @@ struct wlr_event_keyboard_key {
void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
struct xkb_keymap *keymap);
/**
* Sets the keyboard repeat info. `rate` is in key repeats/second and delay is
* in milliseconds.
*/
void wlr_keyboard_set_repeat_info(struct wlr_keyboard *kb, int32_t rate,
int32_t delay);
void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds);
uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *keyboard);

View file

@ -62,6 +62,8 @@ struct wlr_output {
struct wl_signal frame;
struct wl_signal swap_buffers;
struct wl_signal resolution;
struct wl_signal scale;
struct wl_signal transform;
struct wl_signal destroy;
} events;
@ -83,7 +85,9 @@ struct wlr_surface;
void wlr_output_enable(struct wlr_output *output, bool enable);
bool wlr_output_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode);
void wlr_output_transform(struct wlr_output *output,
bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh);
void wlr_output_set_transform(struct wlr_output *output,
enum wl_output_transform transform);
void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly);
void wlr_output_set_scale(struct wlr_output *output, uint32_t scale);

View file

@ -146,6 +146,7 @@ struct wlr_seat_keyboard_state {
struct wl_listener keyboard_destroy;
struct wl_listener keyboard_keymap;
struct wl_listener keyboard_repeat_info;
struct wl_listener surface_destroy;
struct wl_listener resource_destroy;

View file

@ -34,6 +34,13 @@ struct wlr_xwayland {
struct wl_signal new_surface;
} events;
/**
* Add a custom event handler to xwayland. Return 1 if the event was
* handled or 0 to use the default wlr-xwayland handler. wlr-xwayland will
* free the event.
*/
int (*user_event_handler)(struct wlr_xwm *xwm, xcb_generic_event_t *event);
void *data;
};

105
include/wlr/xwm.h Normal file
View file

@ -0,0 +1,105 @@
#ifndef XWAYLAND_INTERNALS_H
#define XWAYLAND_INTERNALS_H
#include <xcb/render.h>
#include <wayland-server-core.h>
#include <wlr/xwayland.h>
enum atom_name {
WL_SURFACE_ID,
WM_DELETE_WINDOW,
WM_PROTOCOLS,
WM_HINTS,
WM_NORMAL_HINTS,
WM_SIZE_HINTS,
MOTIF_WM_HINTS,
UTF8_STRING,
WM_S0,
NET_SUPPORTED,
NET_WM_S0,
NET_WM_PID,
NET_WM_NAME,
NET_WM_STATE,
NET_WM_WINDOW_TYPE,
WM_TAKE_FOCUS,
WINDOW,
_NET_ACTIVE_WINDOW,
_NET_WM_MOVERESIZE,
_NET_WM_NAME,
_NET_SUPPORTING_WM_CHECK,
_NET_WM_STATE_FULLSCREEN,
_NET_WM_STATE_MAXIMIZED_VERT,
_NET_WM_STATE_MAXIMIZED_HORZ,
WM_STATE,
CLIPBOARD,
WL_SELECTION,
TARGETS,
CLIPBOARD_MANAGER,
INCR,
TEXT,
TIMESTAMP,
ATOM_LAST,
};
extern const char *atom_map[ATOM_LAST];
enum net_wm_state_action {
NET_WM_STATE_REMOVE = 0,
NET_WM_STATE_ADD = 1,
NET_WM_STATE_TOGGLE = 2,
};
struct wlr_xwm {
struct wlr_xwayland *xwayland;
struct wl_event_source *event_source;
struct wlr_seat *seat;
xcb_atom_t atoms[ATOM_LAST];
xcb_connection_t *xcb_conn;
xcb_screen_t *screen;
xcb_window_t window;
xcb_visualid_t visual_id;
xcb_colormap_t colormap;
xcb_render_pictformat_t render_format_id;
xcb_cursor_t cursor;
// selection properties
xcb_window_t selection_window;
xcb_selection_request_event_t selection_request;
xcb_window_t selection_owner;
xcb_timestamp_t selection_timestamp;
int incr;
int data_source_fd;
int property_start;
xcb_get_property_reply_t *property_reply;
struct wl_event_source *property_source;
int flush_property_on_delete;
struct wl_array source_data;
xcb_atom_t selection_target;
bool selection_property_set;
struct wlr_xwayland_surface *focus_surface;
struct wl_list surfaces; // wlr_xwayland_surface::link
struct wl_list unpaired_surfaces; // wlr_xwayland_surface::unpaired_link
const xcb_query_extension_reply_t *xfixes;
struct wl_listener compositor_surface_create;
struct wl_listener seat_selection_change;
};
struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland);
void xwm_destroy(struct wlr_xwm *xwm);
void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y);
int xwm_handle_selection_event(struct wlr_xwm *xwm, xcb_generic_event_t *event);
void xwm_selection_init(struct wlr_xwm *xwm);
void xwm_set_seat(struct wlr_xwm *xwm, struct wlr_seat *seat);
#endif