From 87d7157291e0865cfc9728ad09e78e8586ff9e99 Mon Sep 17 00:00:00 2001 From: IoIxD Date: Sun, 7 Dec 2025 20:41:37 -0700 Subject: [PATCH 1/2] subsurfaces have been useless for awhile, remove them and name the sub-widgets sublevels --- include/Mw/LowLevel/Wayland.h | 12 ++++-------- src/backend/wayland.c | 14 +++++++------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index 6ce73fbc7..ed40bfeef 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -52,13 +52,11 @@ struct _MwLLWaylandTopLevel { struct _MwLLWayland { struct _MwLLCommon common; - union { - struct _MwLLWaylandTopLevel* toplevel; - struct wl_subsurface* subsurface; - }; + // data that's only loaded if it's a toplevel + struct _MwLLWaylandTopLevel* toplevel; enum { - MWLL_WAYLAND_TOPLEVEL = 0, - MWLL_WAYLAND_SUBSURFACE = 1, + MWLL_WAYLAND_TOPLEVEL = 0, + MWLL_WAYLAND_SUBLEVEL = 1, } type; struct { @@ -90,8 +88,6 @@ 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 e24267295..c8f2c902d 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_subsurface(MwLL parent, MwLL r, int x, int y) { +static void setup_sublevel(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_subsurface(MwLL parent, MwLL r, int x, int y) { topmost_parent = topmost_parent->wayland.parent; } - r->wayland.type = MWLL_WAYLAND_SUBSURFACE; + r->wayland.type = MWLL_WAYLAND_SUBLEVEL; r->wayland.display = parent->wayland.display; @@ -546,9 +546,9 @@ static void setup_subsurface(MwLL parent, MwLL r, int x, int y) { event_loop(r); wl_region_destroy(region); - r->wayland.subsurface = wl_subcompositor_get_subsurface(subcompositor, r->wayland.surface, parent_surface); + // r->wayland.sublevel = wl_subcompositor_get_sublevel(subcompositor, r->wayland.surface, parent_surface); - wl_subsurface_set_position(r->wayland.subsurface, x, y); + // wl_sublevel_set_position(r->wayland.sublevel, x, y); // printf("position %d %d\n", x, y); @@ -564,7 +564,7 @@ static void setup_subsurface(MwLL parent, MwLL r, int x, int y) { return; } - // arrpush(parent->wayland.subsurfaces, r); + // arrpush(parent->wayland.sublevels, 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_subsurface(parent, r, x, y); + setup_sublevel(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_subsurface_set_position(handle->wayland.subsurface, x, y); + // wl_sublevel_set_position(handle->wayland.sublevel, x, y); MwLLForceRender(handle); } } From 6ecc3fc708a289dc2cac9d9b07e61808b79ceb6b Mon Sep 17 00:00:00 2001 From: IoIxD Date: Sun, 7 Dec 2025 20:43:24 -0700 Subject: [PATCH 2/2] remove some extranous gl stuff --- src/backend/wayland.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/backend/wayland.c b/src/backend/wayland.c index c8f2c902d..6f34ab89c 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -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,7 +672,15 @@ 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); } @@ -807,7 +815,6 @@ 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) {