26 #include "../../SDL_internal.h"
28 #if SDL_VIDEO_DRIVER_MIR
30 #include "../../events/SDL_mouse_c.h"
31 #include "../SDL_sysvideo.h"
42 MirCursorConfiguration* conf;
48 MIR_CreateDefaultCursor()
55 MIR_Cursor* mir_cursor =
SDL_calloc(1,
sizeof(MIR_Cursor));
57 mir_cursor->conf =
NULL;
58 mir_cursor->stream =
NULL;
59 mir_cursor->name =
NULL;
79 int i, s_w, s_h, r_stride, p_stride, bytes_per_pixel, bytes_per_row;
81 MirGraphicsRegion region;
82 MIR_mir_buffer_stream_get_graphics_region(
stream, ®ion);
87 bytes_per_pixel =
surface->format->BytesPerPixel;
88 bytes_per_row = bytes_per_pixel * s_w;
93 r_stride = region.stride;
96 for (
i = 0;
i < s_h;
i++)
107 MirCursorConfiguration* conf;
115 MIR_Cursor* mir_cursor;
125 mir_buffer_usage_software);
127 conf = MIR_mir_cursor_configuration_from_buffer_stream(
stream,
hot_x, hot_y);
130 MIR_mir_buffer_stream_swap_buffers_sync(
stream);
132 mir_cursor->conf = conf;
133 mir_cursor->stream =
stream;
141 char const* cursor_name =
NULL;
143 MIR_Cursor* mir_cursor;
147 cursor_name = MIR_mir_arrow_cursor_name;
150 cursor_name = MIR_mir_caret_cursor_name;
153 cursor_name = MIR_mir_busy_cursor_name;
157 cursor_name = MIR_mir_arrow_cursor_name;
160 cursor_name = MIR_mir_busy_cursor_name;
163 cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
166 cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
169 cursor_name = MIR_mir_horizontal_resize_cursor_name;
172 cursor_name = MIR_mir_vertical_resize_cursor_name;
175 cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
179 cursor_name = MIR_mir_closed_hand_cursor_name;
182 cursor_name = MIR_mir_open_hand_cursor_name;
189 cursor = MIR_CreateDefaultCursor();
195 mir_cursor->name = cursor_name;
208 if (mir_cursor->conf)
209 MIR_mir_cursor_configuration_destroy(mir_cursor->conf);
210 if (mir_cursor->stream)
211 MIR_mir_buffer_stream_release_sync(mir_cursor->stream);
227 if (mir_window && MIR_mir_window_is_valid(mir_window->
window)) {
230 if (mir_cursor->name !=
NULL) {
231 MirWindowSpec*
spec = MIR_mir_create_window_spec(mir_data->
connection);
232 MIR_mir_window_spec_set_cursor_name(
spec, mir_cursor->name);
233 MIR_mir_window_apply_spec(mir_window->
window,
spec);
234 MIR_mir_window_spec_release(
spec);
237 if (mir_cursor->conf) {
238 MIR_mir_window_configure_cursor(mir_window->
window, mir_cursor->conf);
242 else if(mir_window && MIR_mir_window_is_valid(mir_window->
window)) {
243 MIR_mir_window_configure_cursor(mir_window->
window,
NULL);
256 MIR_WarpMouseGlobal(
int x,
int y)