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;
47 MIR_CreateDefaultCursor()
54 MIR_Cursor* mir_cursor =
SDL_calloc(1,
sizeof(MIR_Cursor));
56 mir_cursor->conf =
NULL;
57 mir_cursor->stream =
NULL;
77 int i, s_w, s_h, r_stride, p_stride, bytes_per_pixel, bytes_per_row;
79 MirGraphicsRegion region;
80 MIR_mir_buffer_stream_get_graphics_region(stream, ®ion);
86 bytes_per_row = bytes_per_pixel * s_w;
89 pixels = (
char*)surface->
pixels;
91 r_stride = region.stride;
92 p_stride = surface->
pitch;
94 for (i = 0; i < s_h; i++)
103 MIR_CreateCursor(
SDL_Surface* surface,
int hot_x,
int hot_y)
105 MirCursorConfiguration* conf;
108 int s_w = surface->
w;
109 int s_h = surface->
h;
112 SDL_Cursor* cursor = MIR_CreateDefaultCursor();
113 MIR_Cursor* mir_cursor;
121 stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->
connection,
123 mir_buffer_usage_software);
125 conf = MIR_mir_cursor_configuration_from_buffer_stream(stream, hot_x, hot_y);
127 CopySurfacePixelsToMirStream(surface, stream);
128 MIR_mir_buffer_stream_swap_buffers_sync(stream);
130 mir_cursor->conf = conf;
131 mir_cursor->stream =
stream;
139 char const* cursor_name =
NULL;
140 SDL_Cursor* cursor = MIR_CreateDefaultCursor();
141 MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->
driverdata;
149 cursor_name = MIR_mir_arrow_cursor_name;
152 cursor_name = MIR_mir_caret_cursor_name;
155 cursor_name = MIR_mir_busy_cursor_name;
159 cursor_name = MIR_mir_arrow_cursor_name;
162 cursor_name = MIR_mir_busy_cursor_name;
165 cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
168 cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
171 cursor_name = MIR_mir_horizontal_resize_cursor_name;
174 cursor_name = MIR_mir_vertical_resize_cursor_name;
177 cursor_name = MIR_mir_omnidirectional_resize_cursor_name;
181 cursor_name = MIR_mir_closed_hand_cursor_name;
184 cursor_name = MIR_mir_open_hand_cursor_name;
191 mir_cursor->conf = MIR_mir_cursor_configuration_from_name(cursor_name);
202 MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->
driverdata;
204 if (mir_cursor->conf)
205 MIR_mir_cursor_configuration_destroy(mir_cursor->conf);
206 if (mir_cursor->stream)
207 MIR_mir_buffer_stream_release_sync(mir_cursor->stream);
223 if (mir_window && MIR_mir_surface_is_valid(mir_window->
surface)) {
224 MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->
driverdata;
226 if (mir_cursor->conf) {
227 MIR_mir_surface_configure_cursor(mir_window->
surface, mir_cursor->conf);
231 else if(mir_window && MIR_mir_surface_is_valid(mir_window->
surface)) {
232 MIR_mir_surface_configure_cursor(mir_window->
surface,
NULL);
245 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)
static SDL_Window * window
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
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
MirConnection * connection
SDL_Cursor *(* CreateCursor)(SDL_Surface *surface, int hot_x, int hot_y)
void * SDL_calloc(size_t nmemb, size_t size)
MIR_Window * current_window
GLint GLint GLint GLint GLint GLint y
SDL_SystemCursor
Cursor types for SDL_CreateSystemCursor().
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()
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()