mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-10 13:29:44 -05:00
Merge branch 'master' into surface-transform
This commit is contained in:
commit
466e86b7b2
44 changed files with 549 additions and 209 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,6 @@ enum roots_cursor_mode {
|
|||
ROOTS_CURSOR_ROTATE = 3,
|
||||
};
|
||||
|
||||
enum roots_cursor_resize_edge {
|
||||
ROOTS_CURSOR_RESIZE_EDGE_TOP = 1,
|
||||
ROOTS_CURSOR_RESIZE_EDGE_BOTTOM = 2,
|
||||
ROOTS_CURSOR_RESIZE_EDGE_LEFT = 4,
|
||||
ROOTS_CURSOR_RESIZE_EDGE_RIGHT = 8,
|
||||
};
|
||||
|
||||
struct roots_input_event {
|
||||
uint32_t serial;
|
||||
struct wlr_cursor *cursor;
|
||||
|
|
@ -27,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)
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#define ROOTS_XCURSOR_SIZE 16
|
||||
#define ROOTS_XCURSOR_SIZE 24
|
||||
|
||||
#define ROOTS_XCURSOR_DEFAULT "left_ptr"
|
||||
#define ROOTS_XCURSOR_MOVE "grabbing"
|
||||
#define ROOTS_XCURSOR_ROTATE "grabbing"
|
||||
|
||||
const char *roots_xcursor_get_resize_name(uint32_t edges);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ struct wlr_output_cursor {
|
|||
struct wlr_output *output;
|
||||
double x, y;
|
||||
bool enabled;
|
||||
bool visible;
|
||||
uint32_t width, height;
|
||||
int32_t hotspot_x, hotspot_y;
|
||||
struct wl_list link;
|
||||
|
|
@ -61,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;
|
||||
|
||||
|
|
@ -82,9 +85,12 @@ 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);
|
||||
void wlr_output_destroy(struct wlr_output *output);
|
||||
void wlr_output_effective_resolution(struct wlr_output *output,
|
||||
int *width, int *height);
|
||||
|
|
@ -97,6 +103,9 @@ void wlr_output_set_fullscreen_surface(struct wlr_output *output,
|
|||
struct wlr_surface *surface);
|
||||
|
||||
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output);
|
||||
/**
|
||||
* Sets the cursor image. The image must be already scaled for the output.
|
||||
*/
|
||||
bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
|
||||
const uint8_t *pixels, int32_t stride, uint32_t width, uint32_t height,
|
||||
int32_t hotspot_x, int32_t hotspot_y);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -3,12 +3,35 @@
|
|||
|
||||
#include <wayland-server.h>
|
||||
|
||||
/**
|
||||
* Possible values to use in request_mode and the event mode. Same as
|
||||
* org_kde_kwin_server_decoration_manager_mode.
|
||||
*/
|
||||
enum wlr_server_decoration_manager_mode {
|
||||
/**
|
||||
* Undecorated: The surface is not decorated at all, neither server nor
|
||||
* client-side. An example is a popup surface which should not be
|
||||
* decorated.
|
||||
*/
|
||||
WLR_SERVER_DECORATION_MANAGER_MODE_NONE = 0,
|
||||
/**
|
||||
* Client-side decoration: The decoration is part of the surface and the
|
||||
* client.
|
||||
*/
|
||||
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT = 1,
|
||||
/**
|
||||
* Server-side decoration: The server embeds the surface into a decoration
|
||||
* frame.
|
||||
*/
|
||||
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER = 2,
|
||||
};
|
||||
|
||||
struct wlr_server_decoration_manager {
|
||||
struct wl_global *wl_global;
|
||||
struct wl_list wl_resources;
|
||||
struct wl_list decorations; // wlr_server_decoration::link
|
||||
|
||||
uint32_t default_mode; // enum org_kde_kwin_server_decoration_manager_mode
|
||||
uint32_t default_mode; // enum wlr_server_decoration_manager_mode
|
||||
|
||||
struct {
|
||||
struct wl_signal new_decoration;
|
||||
|
|
@ -22,7 +45,7 @@ struct wlr_server_decoration {
|
|||
struct wlr_surface *surface;
|
||||
struct wl_list link;
|
||||
|
||||
uint32_t mode; // enum org_kde_kwin_server_decoration_manager_mode
|
||||
uint32_t mode; // enum wlr_server_decoration_manager_mode
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ struct wlr_wl_shell_surface {
|
|||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
struct wl_signal commit;
|
||||
struct wl_signal ping_timeout;
|
||||
|
||||
struct wl_signal request_move;
|
||||
|
|
|
|||
12
include/wlr/util/edges.h
Normal file
12
include/wlr/util/edges.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef WLR_UTIL_EDGES_H
|
||||
#define WLR_UTIL_EDGES_H
|
||||
|
||||
enum wlr_edges {
|
||||
WLR_EDGE_NONE = 0,
|
||||
WLR_EDGE_TOP = 1,
|
||||
WLR_EDGE_BOTTOM = 2,
|
||||
WLR_EDGE_LEFT = 4,
|
||||
WLR_EDGE_RIGHT = 8,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
#define WLR_XCURSOR_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <wlr/util/edges.h>
|
||||
|
||||
struct wlr_xcursor_image {
|
||||
uint32_t width; /* actual width */
|
||||
|
|
@ -65,4 +66,9 @@ struct wlr_xcursor *wlr_xcursor_theme_get_cursor(
|
|||
|
||||
int wlr_xcursor_frame(struct wlr_xcursor *cursor, uint32_t time);
|
||||
|
||||
/**
|
||||
* Get the name of the resize cursor image for the given edges.
|
||||
*/
|
||||
const char *wlr_xcursor_get_resize_name(enum wlr_edges edges);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,6 +32,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;
|
||||
};
|
||||
|
||||
|
|
@ -153,20 +160,18 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
|
|||
uint8_t *pixels, uint32_t stride, uint32_t width, uint32_t height,
|
||||
int32_t hotspot_x, int32_t hotspot_y);
|
||||
|
||||
void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland,
|
||||
struct wlr_xwayland_surface *surface, bool activated);
|
||||
void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *surface,
|
||||
bool activated);
|
||||
|
||||
void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland,
|
||||
struct wlr_xwayland_surface *surface, int16_t x, int16_t y,
|
||||
uint16_t width, uint16_t height);
|
||||
void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *surface,
|
||||
int16_t x, int16_t y, uint16_t width, uint16_t height);
|
||||
|
||||
void wlr_xwayland_surface_close(struct wlr_xwayland *wlr_xwayland,
|
||||
struct wlr_xwayland_surface *surface);
|
||||
void wlr_xwayland_surface_close(struct wlr_xwayland_surface *surface);
|
||||
|
||||
void wlr_xwayland_surface_set_maximized(struct wlr_xwayland *wlr_xwayland,
|
||||
struct wlr_xwayland_surface *surface, bool maximized);
|
||||
void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface,
|
||||
bool maximized);
|
||||
|
||||
void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland *wlr_xwayland,
|
||||
struct wlr_xwayland_surface *surface, bool fullscreen);
|
||||
void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface,
|
||||
bool fullscreen);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
75
include/wlr/xwm.h
Normal file
75
include/wlr/xwm.h
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
#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,
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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 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);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue