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
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
fc7896b5ce
commit
9309b5fe83
9 changed files with 14 additions and 92 deletions
|
|
@ -8,10 +8,8 @@
|
|||
MwLLCreate = MwLLCreateImpl; \
|
||||
MwLLDestroy = MwLLDestroyImpl; \
|
||||
\
|
||||
MwLLPolygon = MwLLPolygonImpl; \
|
||||
MwLLLine = MwLLLineImpl; \
|
||||
MwLLBeginDraw = MwLLBeginDrawImpl; \
|
||||
MwLLEndDraw = MwLLEndDrawImpl; \
|
||||
MwLLPolygon = MwLLPolygonImpl; \
|
||||
MwLLLine = MwLLLineImpl; \
|
||||
\
|
||||
MwLLAllocColor = MwLLAllocColorImpl; \
|
||||
MwLLColorUpdate = MwLLColorUpdateImpl; \
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue