src/video/wayland/SDL_waylandmouse.c
changeset 10098 91b34fbbb88e
parent 9998 f67cf37e9cd4
child 10113 991977532d7f
equal deleted inserted replaced
10097:06085b9c73ef 10098:91b34fbbb88e
   157     cursor = calloc(1, sizeof (*cursor));
   157     cursor = calloc(1, sizeof (*cursor));
   158     if (cursor) {
   158     if (cursor) {
   159         SDL_VideoDevice *vd = SDL_GetVideoDevice ();
   159         SDL_VideoDevice *vd = SDL_GetVideoDevice ();
   160         SDL_VideoData *wd = (SDL_VideoData *) vd->driverdata;
   160         SDL_VideoData *wd = (SDL_VideoData *) vd->driverdata;
   161         Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData));
   161         Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData));
       
   162         if (!data) {
       
   163             SDL_OutOfMemory();
       
   164             free(cursor);
       
   165             return NULL;
       
   166         }
   162         cursor->driverdata = (void *) data;
   167         cursor->driverdata = (void *) data;
   163 
   168 
   164         /* Assume ARGB8888 */
   169         /* Assume ARGB8888 */
   165         SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
   170         SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
   166         SDL_assert(surface->pitch == surface->w * 4);
   171         SDL_assert(surface->pitch == surface->w * 4);
   185 
   190 
   186         data->hot_x = hot_x;
   191         data->hot_x = hot_x;
   187         data->hot_y = hot_y;
   192         data->hot_y = hot_y;
   188         data->w = surface->w;
   193         data->w = surface->w;
   189         data->h = surface->h;
   194         data->h = surface->h;
       
   195     } else {
       
   196         SDL_OutOfMemory();
   190     }
   197     }
   191 
   198 
   192     return cursor;
   199     return cursor;
   193 }
   200 }
   194 
   201 
   198     SDL_Cursor *cursor;
   205     SDL_Cursor *cursor;
   199 
   206 
   200     cursor = calloc(1, sizeof (*cursor));
   207     cursor = calloc(1, sizeof (*cursor));
   201     if (cursor) {
   208     if (cursor) {
   202         Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData));
   209         Wayland_CursorData *data = calloc (1, sizeof (Wayland_CursorData));
       
   210         if (!data) {
       
   211             SDL_OutOfMemory();
       
   212             free(cursor);
       
   213             return NULL;
       
   214         }
   203         cursor->driverdata = (void *) data;
   215         cursor->driverdata = (void *) data;
   204 
   216 
   205         data->buffer = WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]);
   217         data->buffer = WAYLAND_wl_cursor_image_get_buffer(wlcursor->images[0]);
   206         data->surface = wl_compositor_create_surface(d->compositor);
   218         data->surface = wl_compositor_create_surface(d->compositor);
   207         wl_surface_set_user_data(data->surface, NULL);
   219         wl_surface_set_user_data(data->surface, NULL);