diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/backend/wayland.h | 3 | ||||
-rw-r--r-- | include/rootston/config.h | 2 | ||||
-rw-r--r-- | include/rootston/cursor.h | 2 | ||||
-rw-r--r-- | include/wlr/interfaces/wlr_output.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_keyboard.h | 12 | ||||
-rw-r--r-- | include/wlr/types/wlr_output.h | 6 | ||||
-rw-r--r-- | include/wlr/types/wlr_seat.h | 1 | ||||
-rw-r--r-- | include/wlr/xwayland.h | 7 | ||||
-rw-r--r-- | include/wlr/xwm.h | 105 |
9 files changed, 139 insertions, 1 deletions
diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 1e8a55d2..7e2ec0d6 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -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; diff --git a/include/rootston/config.h b/include/rootston/config.h index de20fb8e..1d54314e 100644 --- a/include/rootston/config.h +++ b/include/rootston/config.h @@ -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; }; diff --git a/include/rootston/cursor.h b/include/rootston/cursor.h index 2d9a9215..de6b7b92 100644 --- a/include/rootston/cursor.h +++ b/include/rootston/cursor.h @@ -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) diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index b4f39d35..dc2a867b 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -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, diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index e2d50b03..450cd473 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -52,9 +52,15 @@ struct wlr_keyboard { } 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); diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 895536e1..99737c48 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -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); diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 6d59315b..6c04380e 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -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; diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 523dda67..0e79e414 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -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; }; diff --git a/include/wlr/xwm.h b/include/wlr/xwm.h new file mode 100644 index 00000000..47e674c0 --- /dev/null +++ b/include/wlr/xwm.h @@ -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 |