diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index ed40bfeef..6ce73fbc7 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -52,11 +52,13 @@ struct _MwLLWaylandTopLevel { struct _MwLLWayland { struct _MwLLCommon common; - // data that's only loaded if it's a toplevel - struct _MwLLWaylandTopLevel* toplevel; + union { + struct _MwLLWaylandTopLevel* toplevel; + struct wl_subsurface* subsurface; + }; enum { - MWLL_WAYLAND_TOPLEVEL = 0, - MWLL_WAYLAND_SUBLEVEL = 1, + MWLL_WAYLAND_TOPLEVEL = 0, + MWLL_WAYLAND_SUBSURFACE = 1, } type; struct { @@ -88,6 +90,8 @@ struct _MwLLWayland { MwU32 x, y, ww, wh; MwPoint cur_mouse_pos; + int last_serial; + MwLL parent; GLuint fbo; diff --git a/src/backend/wayland.c b/src/backend/wayland.c index 6f34ab89c..e24267295 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -522,7 +522,7 @@ static void setup_toplevel(MwLL r, int x, int y) { // glGenBuffers(1, &vertex_buffer); } -static void setup_sublevel(MwLL parent, MwLL r, int x, int y) { +static void setup_subsurface(MwLL parent, MwLL r, int x, int y) { struct wl_compositor* compositor = parent->wayland.compositor; struct wl_subcompositor* subcompositor = parent->wayland.subcompositor; struct wl_surface* parent_surface = parent->wayland.surface; @@ -533,7 +533,7 @@ static void setup_sublevel(MwLL parent, MwLL r, int x, int y) { topmost_parent = topmost_parent->wayland.parent; } - r->wayland.type = MWLL_WAYLAND_SUBLEVEL; + r->wayland.type = MWLL_WAYLAND_SUBSURFACE; r->wayland.display = parent->wayland.display; @@ -546,9 +546,9 @@ static void setup_sublevel(MwLL parent, MwLL r, int x, int y) { event_loop(r); wl_region_destroy(region); - // r->wayland.sublevel = wl_subcompositor_get_sublevel(subcompositor, r->wayland.surface, parent_surface); + r->wayland.subsurface = wl_subcompositor_get_subsurface(subcompositor, r->wayland.surface, parent_surface); - // wl_sublevel_set_position(r->wayland.sublevel, x, y); + wl_subsurface_set_position(r->wayland.subsurface, x, y); // printf("position %d %d\n", x, y); @@ -564,7 +564,7 @@ static void setup_sublevel(MwLL parent, MwLL r, int x, int y) { return; } - // arrpush(parent->wayland.sublevels, r); + // arrpush(parent->wayland.subsurfaces, r); r->wayland.configured = MwTRUE; if(!r->wayland.egl_setup) { @@ -605,7 +605,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { if(parent == NULL) { setup_toplevel(r, x, y); } else { - setup_sublevel(parent, r, x, y); + setup_subsurface(parent, r, x, y); } return r; @@ -628,7 +628,7 @@ static void MwLLSetXYImpl(MwLL handle, int x, int y) { if(handle->wayland.type != MWLL_WAYLAND_TOPLEVEL) { handle->wayland.x = x; handle->wayland.y = y; - // wl_sublevel_set_position(handle->wayland.sublevel, x, y); + wl_subsurface_set_position(handle->wayland.subsurface, x, y); MwLLForceRender(handle); } } @@ -654,14 +654,14 @@ static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLL float maxX = 0, maxY = 0; float centerX, centerY; - glColor3f(color->common.red / 255.0, color->common.green / 255.0, color->common.blue / 255.0); - glBegin(GL_POLYGON); for(i = 0; i < points_count; i++) { float x = round(handle->wayland.x) + round(points[i].x); float y = round(handle->wayland.y) + round(points[i].y); + glColor3f(color->common.red / 255.0, color->common.green / 255.0, color->common.blue / 255.0); + glVertex2f(x, y); } glEnd(); @@ -672,15 +672,7 @@ static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) { int i; glLineWidth(1); - glColor3f(color->common.red / 255.0, color->common.green / 255.0, color->common.blue / 255.0); - glBegin(GL_LINES); - for(i = 0; i < 2; i++) { - float x = round(handle->wayland.x) + round(points[i].x); - float y = round(handle->wayland.y) + round(points[i].y); - - glVertex2f(x, y); - } glEnd(); glColor3f(0, 0, 0); } @@ -815,6 +807,7 @@ static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) { glTexCoord2f(0.0f, 1); glVertex2f(x, y + rect->height); glEnd(); + glFinish(); } static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {