remove old hacks from wayland code, including MwLLBeginDraw and MwLLEndDraw which was really only ever needed for wayland and not anymore
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
IoIxD 2026-03-18 19:24:51 -07:00
commit 9309b5fe83
9 changed files with 14 additions and 92 deletions

View file

@ -190,8 +190,6 @@ MWDECL void (*MwLLDestroy)(MwLL handle);
MWDECL void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color);
MWDECL void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color);
MWDECL void (*MwLLBeginDraw)(MwLL handle);
MWDECL void (*MwLLEndDraw)(MwLL handle);
MWDECL MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b);
MWDECL void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b);

View file

@ -8,10 +8,8 @@
MwLLCreate = MwLLCreateImpl; \
MwLLDestroy = MwLLDestroyImpl; \
\
MwLLPolygon = MwLLPolygonImpl; \
MwLLLine = MwLLLineImpl; \
MwLLBeginDraw = MwLLBeginDrawImpl; \
MwLLEndDraw = MwLLEndDrawImpl; \
MwLLPolygon = MwLLPolygonImpl; \
MwLLLine = MwLLLineImpl; \
\
MwLLAllocColor = MwLLAllocColorImpl; \
MwLLColorUpdate = MwLLColorUpdateImpl; \

View file

@ -24,10 +24,10 @@ static NSPoint pointFlip(NSPoint point) {
static NSRect localRectFlip(NSRect originFrame, NSView* view) {
float viewHeight = [view bounds].size.height;
NSRect destinationFrame = NSMakeRect(
originFrame.origin.x,
[view bounds].size.height - (originFrame.origin.y + originFrame.size.height),
originFrame.size.width,
originFrame.size.height);
originFrame.origin.x,
[view bounds].size.height - (originFrame.origin.y + originFrame.size.height),
originFrame.size.width,
originFrame.size.height);
return destinationFrame;
}
@ -151,8 +151,8 @@ static NSRect localRectFlip(NSRect originFrame, NSView* view) {
if(parent) {
MilskoCocoa* topmost = p;
NSRect rect = localRectFlip(c->rect, p->view);
printf("%0.2f %0.2f %0.2f %0.2f\n",c->rect.origin.x, c->rect.origin.y, c->rect.size.width, c->rect.size.height);
NSRect rect = localRectFlip(c->rect, p->view);
printf("%0.2f %0.2f %0.2f %0.2f\n", c->rect.origin.x, c->rect.origin.y, c->rect.size.width, c->rect.size.height);
c->view = [[MilskoCocoaView alloc] initWithFrame:rect];
[c->view setBounds:c->rect];
} else {
@ -181,7 +181,6 @@ static NSRect localRectFlip(NSRect originFrame, NSView* view) {
c->pointerLocked = MwFALSE;
return c;
}
@ -279,7 +278,7 @@ static NSRect localRectFlip(NSRect originFrame, NSView* view) {
}
};
- (int)pending {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[NSApp runModalSession:self->modalSession];
[pool release];
return 1;
@ -327,7 +326,6 @@ static NSRect localRectFlip(NSRect originFrame, NSView* view) {
objectAtIndex:0]) pointer];
}
switch([ev type]) {
case NSLeftMouseDragged:
case NSRightMouseDragged:
@ -808,7 +806,7 @@ static NSRect localRectFlip(NSRect originFrame, NSView* view) {
- (void)drawRect:(NSRect)dirtyRect {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSSize sz = [self->rep size];
MwLL ll = [((MilskoFakePointer *)[[[[self window] contentView] subviews]
MwLL ll = [((MilskoFakePointer*)[[[[self window] contentView] subviews]
objectAtIndex:0]) pointer];
[super drawRect:dirtyRect];
@ -1003,14 +1001,6 @@ static void MwLLDestroyImpl(MwLL handle) {
free(handle);
}
static void MwLLBeginDrawImpl(MwLL handle) {
(void)handle;
}
static void MwLLEndDrawImpl(MwLL handle) {
(void)handle;
}
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count,
MwLLColor color) {
MilskoCocoa* h = handle->cocoa.real;

View file

@ -310,14 +310,6 @@ static void MwLLDestroyImpl(MwLL handle) {
free(handle);
}
static void MwLLBeginDrawImpl(MwLL handle) {
(void)handle;
}
static void MwLLEndDrawImpl(MwLL handle) {
(void)handle;
}
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
POINT* p = malloc(sizeof(*p) * points_count);
HPEN pen = CreatePen(PS_NULL, 0, RGB(0, 0, 0));

View file

@ -5,16 +5,12 @@
#include <wayland-client-protocol.h>
#include "../../external/stb_ds.h"
#include "Mw/BaseTypes.h"
#include "Mw/LowLevel.h"
#include "Mw/LowLevel/Wayland/xdg-shell-client-protocol.h"
#include <sys/mman.h>
#include <wayland-util.h>
#include <xkbcommon/xkbcommon.h>
/* TODO:
* - MwLLGrabPointerImpl
* - MwLLMakePopupImpl
* - MwLLShowImpl
*/
@ -250,8 +246,6 @@ static void wl_data_source_listener_send(void* data,
if(self->wayland.clipboard_buffer != NULL) {
write(fd, self->wayland.clipboard_buffer, strlen(self->wayland.clipboard_buffer));
close(fd);
self->wayland.events_pending = 1;
}
WAYLAND_EVENT_OP_END(self);
};
@ -296,8 +290,6 @@ static void zwp_primary_selection_source_v1_send(void* data,
if(self->wayland.clipboard_buffer != NULL) {
write(fd, self->wayland.clipboard_buffer, strlen(self->wayland.clipboard_buffer));
close(fd);
self->wayland.events_pending = 1;
}
WAYLAND_EVENT_OP_END(self);
@ -422,11 +414,7 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time
self->wayland.last_time = time;
}
self->wayland.events_pending += 1;
WAYLAND_EVENT_OP_END(self);
/*timed_redraw(self, time, 50, &self->wayland.cooldown_timer);*/
};
/* `wl_pointer.button` callback */
@ -481,7 +469,6 @@ static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 seri
if(!self->wayland.always_render) {
MwLLDispatch(self, draw, NULL);
self->wayland.events_pending += 1;
}
WAYLAND_EVENT_OP_END(self);
@ -540,7 +527,6 @@ static void keyboard_enter(void* data,
self->wayland.keyboard_serial = serial;
MwLLDispatch(self, focus_in, NULL);
self->wayland.events_pending += 1;
WAYLAND_EVENT_OP_END(self);
};
@ -555,7 +541,6 @@ static void keyboard_leave(void* data,
WAYLAND_EVENT_OP_START(self);
MwLLDispatch(self, focus_out, NULL);
self->wayland.events_pending += 1;
WAYLAND_EVENT_OP_END(self);
};
@ -659,7 +644,6 @@ static void keyboard_key(void* data,
if(!self->wayland.always_render) {
MwLLDispatch(self, draw, NULL);
self->wayland.events_pending += 1;
}
WAYLAND_EVENT_OP_END(self);
@ -783,7 +767,6 @@ static wayland_protocol_t* wl_seat_setup(MwU32 name, MwLL ll) {
static void wl_seat_interface_destroy(struct _MwLLWayland* wayland, wayland_protocol_t* data) {
free(data->listener);
// wl_seat_destroy(data->context);
}
/* wl_output setup function */
@ -832,7 +815,6 @@ static wayland_protocol_t* xdg_wm_base_setup(MwU32 name, struct _MwLLWayland* wa
}
static void xdg_wm_base_interface_destroy(struct _MwLLWayland* wayland, wayland_protocol_t* data) {
// xdg_wm_base_destroy(data->context);
free(data->listener);
}
@ -857,10 +839,6 @@ static wayland_protocol_t* zxdg_decoration_manager_v1_setup(MwU32 name, struct _
}
static void zxdg_decoration_manager_v1_interface_destroy(struct _MwLLWayland* wayland, wayland_protocol_t* data) {
zxdg_decoration_manager_v1_context_t* context = data->context;
// zxdg_decoration_manager_v1_destroy(context->manager);
// zxdg_toplevel_decoration_v1_destroy(context->decoration);
}
/* `xdg_toplevel.close` callback */
@ -1000,8 +978,6 @@ static void framebuffer_setup(struct _MwLLWayland* wayland) {
memset(wayland->framebuffer.buf, 255, wayland->framebuffer.buf_size);
update_buffer(&wayland->framebuffer);
wayland->events_pending += 1;
};
static void framebuffer_destroy(struct _MwLLWayland* wayland) {
buffer_destroy(&wayland->framebuffer);
@ -1040,7 +1016,6 @@ static wayland_protocol_t* xdg_toplevel_icon_manager_v1_setup(MwU32 name, struct
static void xdg_toplevel_icon_manager_v1_interface_destroy(struct _MwLLWayland* wayland, wayland_protocol_t* data) {
free(data->listener);
// xdg_toplevel_icon_manager_v1_destroy(data->context);
}
/* Standard Wayland event loop. */
@ -1504,7 +1479,6 @@ static void MwLLSetXYImpl(MwLL handle, int x, int y) {
region_setup(handle);
MwLLDispatch(handle, draw, NULL);
handle->wayland.events_pending += 1;
}
static void MwLLSetWHImpl(MwLL handle, int w, int h) {
@ -1551,7 +1525,7 @@ static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLL
cairo_close_path(handle->wayland.cairo);
cairo_fill(handle->wayland.cairo);
handle->wayland.events_pending += 1;
handle->wayland.events_pending = 1;
}
static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
@ -1570,16 +1544,7 @@ static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
cairo_close_path(handle->wayland.cairo);
cairo_stroke(handle->wayland.cairo);
handle->wayland.events_pending += 1;
}
static void MwLLBeginDrawImpl(MwLL handle) {
}
static void MwLLEndDrawImpl(MwLL handle) {
update_buffer(&handle->wayland.framebuffer);
handle->wayland.events_pending += 1;
handle->wayland.events_pending = 1;
}
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
@ -1756,12 +1721,6 @@ static void MwLLForceRenderImpl(MwLL handle) {
wl_surface_damage(handle->wayland.framebuffer.surface, 0, 0, handle->wayland.ww, handle->wayland.wh);
handle->wayland.force_render = MwTRUE;
/*
if(handle->wayland.egl_setup) {
timed_redraw_by_epoch(handle, 25);
}
*/
}
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {

View file

@ -261,15 +261,8 @@ static void MwLLDestroyImpl(MwLL handle) {
free(handle);
}
static void MwLLBeginDrawImpl(MwLL handle) {
(void)handle;
}
static void MwLLEndDrawImpl(MwLL handle) {
(void)handle;
}
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
static void
MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
int i;
XPoint* p = malloc(sizeof(*p) * points_count);

View file

@ -6,14 +6,11 @@ static void lldrawhandler(MwLL handle, void* data) {
MwWidget h = (MwWidget)handle->common.user;
(void)data;
MwLLBeginDraw(handle);
h->bgcolor = NULL;
MwDispatch(h, draw);
if(h->draw_inject != NULL) h->draw_inject(h);
MwDispatchUserHandler(h, MwNdrawHandler, NULL);
MwLLEndDraw(handle);
}
static void lluphandler(MwLL handle, void* data) {

View file

@ -6,9 +6,6 @@ void (*MwLLDestroy)(MwLL handle) = NULL;
void (*MwLLPolygon)(MwLL handle, MwPoint* points, int points_count, MwLLColor color) = NULL;
void (*MwLLLine)(MwLL handle, MwPoint* points, MwLLColor color) = NULL;
void (*MwLLBeginDraw)(MwLL handle) = NULL;
void (*MwLLEndDraw)(MwLL handle) = NULL;
MwLLColor (*MwLLAllocColor)(MwLL handle, int r, int g, int b) = NULL;
void (*MwLLColorUpdate)(MwLL handle, MwLLColor c, int r, int g, int b) = NULL;
void (*MwLLFreeColor)(MwLLColor color) = NULL;

View file

@ -364,14 +364,12 @@ static void mwOpenGLSwapBufferImpl(MwWidget handle) {
#ifdef USE_WAYLAND
if(handle->lowlevel->common.type == MwLLBackendWayland) {
waylandopengl_t* o = handle->internal;
// eglSwapInterval(o->egl_display, 0);
if(!eglSwapBuffers(o->egl_display, o->egl_surface)) {
printf("ERROR: eglSwapBuffers, %0X\n", eglGetError());
};
wl_egl_window_resize((struct wl_egl_window*)o->egl_window_native,
handle->lowlevel->wayland.ww,
handle->lowlevel->wayland.wh, 0, 0);
// MwLLForceRender(handle->lowlevel);
}
#endif
}