aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-10-31 17:58:28 -0400
committerGitHub <noreply@github.com>2017-10-31 17:58:28 -0400
commitc7c0d34e920dea27cab3b88c50b1202343a54435 (patch)
tree6966addb32a19e5c9606d0cbded7f922fb372461 /include
parent7200d643363e988edf6777c38e7f8fcd451a2c50 (diff)
parentec22fe713445977c1a122572107495b584117b16 (diff)
Merge pull request #352 from emersion/output-cursor
Add wlr_output_cursor
Diffstat (limited to 'include')
-rw-r--r--include/backend/drm/drm.h1
-rw-r--r--include/backend/wayland.h17
-rw-r--r--include/wlr/types/wlr_cursor.h22
-rw-r--r--include/wlr/types/wlr_output.h46
-rw-r--r--include/wlr/types/wlr_output_layout.h5
5 files changed, 56 insertions, 35 deletions
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index a6dd247c..e08965e5 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -34,6 +34,7 @@ struct wlr_drm_plane {
struct wlr_texture *wlr_tex;
struct gbm_bo *cursor_bo;
bool cursor_enabled;
+ int32_t cursor_hotspot_x, cursor_hotspot_y;
union wlr_drm_plane_props props;
};
diff --git a/include/backend/wayland.h b/include/backend/wayland.h
index e1c89b11..1e8a55d2 100644
--- a/include/backend/wayland.h
+++ b/include/backend/wayland.h
@@ -43,11 +43,15 @@ struct wlr_wl_backend_output {
struct wl_egl_window *egl_window;
struct wl_callback *frame_callback;
- struct wl_shm_pool *cursor_pool;
- void *cursor_buffer; // actually a (client-side) struct wl_buffer*
- uint8_t *cursor_data;
- struct wl_surface *cursor_surface;
- uint32_t cursor_buf_size;
+ struct {
+ struct wl_shm_pool *pool;
+ void *buffer; // actually a (client-side) struct wl_buffer*
+ uint32_t buf_size;
+ uint8_t *data;
+ struct wl_surface *surface;
+ int32_t hotspot_x, hotspot_y;
+ } cursor;
+
uint32_t enter_serial;
void *egl_surface;
@@ -68,8 +72,7 @@ struct wlr_wl_pointer {
};
void wlr_wl_registry_poll(struct wlr_wl_backend *backend);
-void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output,
- uint32_t serial, int32_t hotspot_x, int32_t hotspot_y);
+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);
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h
index e8c13b1d..1aac2b94 100644
--- a/include/wlr/types/wlr_cursor.h
+++ b/include/wlr/types/wlr_cursor.h
@@ -36,8 +36,6 @@ struct wlr_cursor *wlr_cursor_create();
void wlr_cursor_destroy(struct wlr_cursor *cur);
-void wlr_cursor_set_xcursor(struct wlr_cursor *cur, struct wlr_xcursor *xcur);
-
/**
* Warp the cursor to the given x and y in layout coordinates. If x and y are
* out of the layout boundaries or constraints, no warp will happen.
@@ -48,10 +46,10 @@ void wlr_cursor_set_xcursor(struct wlr_cursor *cur, struct wlr_xcursor *xcur);
* Returns true when the mouse warp was successful.
*/
bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
- double x, double y);
+ double x, double y);
void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
- struct wlr_input_device *dev, double x_mm, double y_mm);
+ struct wlr_input_device *dev, double x_mm, double y_mm);
/**
* Move the cursor in the direction of the given x and y coordinates.
@@ -60,7 +58,13 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
* device mapping constraints will be ignored.
*/
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
- double delta_x, double delta_y);
+ double delta_x, double delta_y);
+
+void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
+ int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x,
+ int32_t hotspot_y);
+void wlr_cursor_set_surface(struct wlr_cursor *cur, struct wlr_surface *surface,
+ int32_t hotspot_x, int32_t hotspot_y);
/**
* Attaches this input device to this cursor. The input device must be one of:
@@ -80,7 +84,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
* direction and do not support absolute input events.
*/
void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
- struct wlr_output_layout *l);
+ struct wlr_output_layout *l);
/**
* Attaches this cursor to the given output, which must be among the outputs in
@@ -88,7 +92,7 @@ void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
* without an associated output layout.
*/
void wlr_cursor_map_to_output(struct wlr_cursor *cur,
- struct wlr_output *output);
+ struct wlr_output *output);
/**
* Maps all input from a specific input device to a given output. The input
@@ -96,7 +100,7 @@ void wlr_cursor_map_to_output(struct wlr_cursor *cur,
* outputs in the attached output layout.
*/
void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
- struct wlr_input_device *dev, struct wlr_output *output);
+ struct wlr_input_device *dev, struct wlr_output *output);
/**
* Maps this cursor to an arbitrary region on the associated wlr_output_layout.
@@ -108,6 +112,6 @@ void wlr_cursor_map_to_region(struct wlr_cursor *cur, struct wlr_box *box);
* wlr_output_layout.
*/
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
- struct wlr_input_device *dev, struct wlr_box *box);
+ struct wlr_input_device *dev, struct wlr_box *box);
#endif
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 74eb15ed..f9bce91f 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -12,6 +12,22 @@ struct wlr_output_mode {
struct wl_list link;
};
+struct wlr_output_cursor {
+ struct wlr_output *output;
+ int32_t x, y;
+ uint32_t width, height;
+ int32_t hotspot_x, hotspot_y;
+ struct wl_list link;
+
+ struct wlr_renderer *renderer;
+ struct wlr_texture *texture;
+
+ // only when using a cursor surface
+ struct wlr_surface *surface;
+ struct wl_listener surface_commit;
+ struct wl_listener surface_destroy;
+};
+
struct wlr_output_impl;
struct wlr_output {
@@ -44,19 +60,8 @@ struct wlr_output {
struct wl_signal destroy;
} events;
- struct {
- bool is_sw;
- int32_t x, y;
- uint32_t width, height;
- int32_t hotspot_x, hotspot_y;
- struct wlr_renderer *renderer;
- struct wlr_texture *texture;
-
- // only when using a cursor surface
- struct wlr_surface *surface;
- struct wl_listener surface_commit;
- struct wl_listener surface_destroy;
- } cursor;
+ struct wl_list cursors; // wlr_output_cursor::link
+ struct wlr_output_cursor *hardware_cursor;
// the output position in layout space reported to clients
int32_t lx, ly;
@@ -72,12 +77,6 @@ bool wlr_output_set_mode(struct wlr_output *output,
void wlr_output_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);
-bool wlr_output_set_cursor(struct wlr_output *output,
- const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
- int32_t hotspot_x, int32_t hotspot_y);
-void wlr_output_set_cursor_surface(struct wlr_output *output,
- struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y);
-bool wlr_output_move_cursor(struct wlr_output *output, int x, int y);
void wlr_output_destroy(struct wlr_output *output);
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height);
@@ -87,4 +86,13 @@ void wlr_output_set_gamma(struct wlr_output *output,
uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b);
uint32_t wlr_output_get_gamma_size(struct wlr_output *output);
+struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *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);
+void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
+ struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y);
+bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y);
+void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor);
+
#endif
diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h
index ea8dbcd2..a99debf6 100644
--- a/include/wlr/types/wlr_output_layout.h
+++ b/include/wlr/types/wlr_output_layout.h
@@ -12,6 +12,7 @@ struct wlr_output_layout {
struct wlr_output_layout_state *state;
struct {
+ struct wl_signal add;
struct wl_signal change;
struct wl_signal destroy;
} events;
@@ -24,6 +25,10 @@ struct wlr_output_layout_output {
int x, y;
struct wl_list link;
struct wlr_output_layout_output_state *state;
+
+ struct {
+ struct wl_signal destroy;
+ } events;
};
struct wlr_output_layout *wlr_output_layout_create();