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);
88 bytes_per_row = bytes_per_pixel * s_w;
91 pixels = (
char*)surface->
pixels;
93 r_stride = region.stride;
94 p_stride = surface->
pitch;
96 for (i = 0; i < s_h; i++)
107 MirCursorConfiguration* conf;
110 int s_w = surface->
w;
111 int s_h = surface->
h;
114 SDL_Cursor* cursor = MIR_CreateDefaultCursor();
115 MIR_Cursor* mir_cursor;
123 stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->
connection,
125 mir_buffer_usage_software);
127 conf = MIR_mir_cursor_configuration_from_buffer_stream(stream, hot_x, hot_y);
129 CopySurfacePixelsToMirStream(surface, stream);
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;
206 MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->
driverdata;
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)) {
228 MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->
driverdata;
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)
SDL_Mouse * SDL_GetMouse(void)
int(* ShowCursor)(SDL_Cursor *cursor)
GLint GLint GLint GLint GLint x
int(* SetRelativeMouseMode)(SDL_bool enabled)
MirPixelFormat pixel_format
A collection of pixels used in software blitting.
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d ®2 endm macro vzip8 reg2 vzip d d ®2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
GLuint const GLchar * name
MirConnection * connection
SDL_Cursor *(* CreateCursor)(SDL_Surface *surface, int hot_x, int hot_y)
MIR_Window * current_window
SDL_SystemCursor
Cursor types for SDL_CreateSystemCursor().
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
void SDL_SetDefaultCursor(SDL_Cursor *cursor)
int(* WarpMouseGlobal)(int x, int y)
GLenum GLenum GLsizei const GLuint GLboolean enabled
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
void(* FreeCursor)(SDL_Cursor *cursor)
#define SDL_assert(condition)
#define SDL_OutOfMemory()
EGLSurface EGLNativeWindowType * window
The type used to identify a window.
void(* WarpMouse)(SDL_Window *window, int x, int y)
SDL_VideoDevice * SDL_GetVideoDevice(void)
SDL_Cursor *(* CreateSystemCursor)(SDL_SystemCursor id)
#define SDL_Unsupported()
int uint32_t uint32_t uint32_t uint32_t uint32_t int drmModeModeInfoPtr mode int uint32_t uint32_t uint32_t uint32_t int32_t hot_x