diff --git a/src/backend/wayland.c b/src/backend/wayland.c index 91e46d7..abec1b9 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -370,10 +370,6 @@ static void setup_subsurface(MwLL parent, MwLL r, int x, int y, int width, int h } r->wayland.configured = MwTRUE; - - buffer_setup(&r->wayland); - - wl_surface_commit(parent->wayland.surface); } static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { MwLL r; @@ -397,6 +393,8 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { setup_subsurface(parent, r, x, y, width, height); } + buffer_setup(&r->wayland); + return r; } @@ -414,13 +412,6 @@ static void MwLLGetXYWHImpl(MwLL handle, int* x, int* y, unsigned int* w, unsign } static void MwLLSetXYImpl(MwLL handle, int x, int y) { - handle->wayland.x = x; - handle->wayland.y = y; - if(handle->wayland.type == MWLL_WAYLAND_TOPLEVEL) { - xdg_surface_set_window_geometry(handle->wayland.toplevel->xdg_surface, handle->wayland.x, handle->wayland.y, handle->wayland.ww, handle->wayland.wh); - } else { - wl_subsurface_set_position(handle->wayland.subsurface, x, y); - } } static void MwLLSetWHImpl(MwLL handle, int w, int h) { @@ -431,29 +422,26 @@ static void MwLLSetWHImpl(MwLL handle, int w, int h) { xdg_surface_set_window_geometry(handle->wayland.toplevel->xdg_surface, handle->wayland.x, handle->wayland.y, handle->wayland.ww, handle->wayland.wh); } else { // setup the buffer again with the new size. - buffer_setup(&handle->wayland); + // buffer_setup(&handle->wayland); } } static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) { - int i; + int i = 0; cairo_t* cairo = cairo_create(handle->wayland.cairo_surface); cairo_set_source_rgb(cairo, color->common.red / 255., color->common.green / 255., color->common.blue / 255.); - cairo_set_line_width(cairo, 1); + cairo_set_line_width(cairo, 0.1); cairo_set_fill_rule(cairo, CAIRO_FILL_RULE_EVEN_ODD); cairo_new_path(cairo); - for(i = 0; i < points_count + 1; i++) { + for(; i < points_count; i++) { cairo_line_to(cairo, points[i].x, points[i].y); } - if(points[0].x != points[i].x && points[0].y != points[i].y) { - cairo_line_to(cairo, points[0].x, points[0].y); - } cairo_close_path(cairo); + // cairo_paint(cairo); cairo_stroke_preserve(cairo); cairo_fill(cairo); - // cairo_paint(cairo); cairo_destroy(cairo); }