wayland: Assortment of fixes noticed during code review.

Rearranging order of the code, freeing some memory, writing a note
that additional work is required, returning a value through pointer
passed as argument, etc.
This commit is contained in:
Ivan Vučica 2020-04-15 00:36:37 +01:00
parent 80cc4121ae
commit 36eefc981e
No known key found for this signature in database
GPG key ID: 6E4D7BA2D93CAC9D
3 changed files with 11 additions and 3 deletions

View file

@ -72,10 +72,10 @@
# endif /* USE_GLITZ */
#elif BUILD_SERVER == SERVER_wayland
# include "wayland/WaylandServer.h"
# define _CAIRO_GSTATE_CLASSNAME CairoGState
# include "cairo/CairoGState.h"
# define _CAIRO_SURFACE_CLASSNAME WaylandCairoSurface
# include "cairo/WaylandCairoSurface.h"
# define _CAIRO_GSTATE_CLASSNAME CairoGState
# define _CAIRO_SURFACE_CLASSNAME WaylandCairoSurface
#else
# error Invalid server for Cairo backend : non implemented
#endif /* BUILD_SERVER */

View file

@ -121,6 +121,10 @@ create_shm_buffer(struct window *window)
{
struct window *window = (struct window*) gsDevice;
NSDebugLog(@"WaylandCairoSurface: dealloc win=%d", window->window_id);
// FIXME: This is leaking memory. We need to implement counterpart to
// create_shm_buffer.
[super dealloc];
}
@ -162,6 +166,7 @@ create_shm_buffer(struct window *window)
cairo_t *cr = cairo_create(cairo_surface);
if (width != window->width && 0) {
// FIXME: remove this dead fake-drawing branch.
NSDebugLog(@"fake drawing");
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);

View file

@ -954,6 +954,7 @@ int NSToWayland(struct window *window, int ns_y)
window->surface = wl_compositor_create_surface(wlconfig->compositor);
if (!window->surface) {
NSDebugLog(@"can't create wayland surface");
free(window);
return 0;
}
wl_surface_set_user_data(window->surface, window);
@ -1405,7 +1406,9 @@ int NSToWayland(struct window *window, int ns_y)
if (window) {
x += window->pos_x;
y += window->pos_y;
win = &window->window_id;
if (win) {
*win = &window->window_id;
}
}
}