forked from pyrite-dev/milsko
minor improvements on wayland
This commit is contained in:
parent
7398604b7c
commit
f9bbba8af9
4 changed files with 22 additions and 39 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -31,3 +31,5 @@ compile_flags.txt
|
||||||
*.finf
|
*.finf
|
||||||
*.gdb
|
*.gdb
|
||||||
|
|
||||||
|
flamegraph.svg
|
||||||
|
perf.*
|
||||||
|
|
|
||||||
|
|
@ -426,13 +426,9 @@ struct _MwLLWayland {
|
||||||
|
|
||||||
MwBool force_render;
|
MwBool force_render;
|
||||||
MwBool did_event_loop_early;
|
MwBool did_event_loop_early;
|
||||||
MwBool do_cascading_draw;
|
|
||||||
int cascading_child_num;
|
|
||||||
|
|
||||||
MwBool dispatching_resize;
|
MwBool dispatching_resize;
|
||||||
|
|
||||||
MwBool is_toplevel_menu;
|
|
||||||
|
|
||||||
struct _MwLLWaylandShmBuffer framebuffer;
|
struct _MwLLWaylandShmBuffer framebuffer;
|
||||||
struct _MwLLWaylandShmBuffer backbuffer;
|
struct _MwLLWaylandShmBuffer backbuffer;
|
||||||
struct _MwLLWaylandShmBuffer cursor;
|
struct _MwLLWaylandShmBuffer cursor;
|
||||||
|
|
@ -440,15 +436,6 @@ struct _MwLLWayland {
|
||||||
|
|
||||||
MwLLPixmap icon_pixmap;
|
MwLLPixmap icon_pixmap;
|
||||||
|
|
||||||
pthread_mutex_t eventsMutex;
|
|
||||||
|
|
||||||
int cancelEvent;
|
|
||||||
int numCallbacksRunning;
|
|
||||||
|
|
||||||
uint32_t last_time;
|
|
||||||
|
|
||||||
MwBool moving;
|
|
||||||
|
|
||||||
MwI64 keyboard_rate;
|
MwI64 keyboard_rate;
|
||||||
MwI32 keyboard_delay;
|
MwI32 keyboard_delay;
|
||||||
int last_pressed_key;
|
int last_pressed_key;
|
||||||
|
|
|
||||||
|
|
@ -113,3 +113,16 @@ void MwLLWaylandBufferDestroy(struct _MwLLWaylandShmBuffer* buffer) {
|
||||||
close(buffer->fd_back);
|
close(buffer->fd_back);
|
||||||
buffer->setup = MwFALSE;
|
buffer->setup = MwFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MwLLWaylandBufferUpdate(MwLL self, struct _MwLLWaylandShmBuffer* buffer) {
|
||||||
|
if(self->wayland.configured) {
|
||||||
|
memcpy(buffer->buf, buffer->buf_back, buffer->buf_size);
|
||||||
|
if(buffer->surface) {
|
||||||
|
// Yes this is needed every time, it's how we fix weston.
|
||||||
|
if(self->wayland.configured)
|
||||||
|
wl_surface_attach(buffer->surface, buffer->shm_buffer, 0, 0);
|
||||||
|
|
||||||
|
wl_surface_commit(buffer->surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,19 +218,6 @@ static void xdg_surface_configure(
|
||||||
self->wayland.configured = MwTRUE;
|
self->wayland.configured = MwTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwLLWaylandBufferUpdate(MwLL self, struct _MwLLWaylandShmBuffer* buffer) {
|
|
||||||
if(self->wayland.configured) {
|
|
||||||
memcpy(buffer->buf, buffer->buf_back, buffer->buf_size);
|
|
||||||
if(buffer->surface) {
|
|
||||||
// Yes this is needed every time, it's how we fix weston.
|
|
||||||
if(self->wayland.configured)
|
|
||||||
wl_surface_attach(buffer->surface, buffer->shm_buffer, 0, 0);
|
|
||||||
|
|
||||||
wl_surface_commit(buffer->surface);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Toplevel setup function */
|
/* Toplevel setup function */
|
||||||
static void setup_toplevel(MwLL r, int x, int y) {
|
static void setup_toplevel(MwLL r, int x, int y) {
|
||||||
char* mw_force_csd = getenv("MW_FORCE_CSD");
|
char* mw_force_csd = getenv("MW_FORCE_CSD");
|
||||||
|
|
@ -986,7 +973,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
||||||
MwLL r;
|
MwLL r;
|
||||||
r = malloc(sizeof(*r));
|
r = malloc(sizeof(*r));
|
||||||
memset(r, 0, sizeof(*r));
|
memset(r, 0, sizeof(*r));
|
||||||
pthread_mutex_init(&r->wayland.eventsMutex, NULL);
|
// pthread_mutex_init(&r->wayland.eventsMutex, NULL);
|
||||||
MwLLCreateCommon(r);
|
MwLLCreateCommon(r);
|
||||||
|
|
||||||
r->wayland.is_toplevel = parent == NULL;
|
r->wayland.is_toplevel = parent == NULL;
|
||||||
|
|
@ -1015,8 +1002,6 @@ static void MwLLDestroyImpl(MwLL handle) {
|
||||||
|
|
||||||
MwLLWaylandFlush(handle);
|
MwLLWaylandFlush(handle);
|
||||||
|
|
||||||
handle->wayland.cancelEvent = MwTRUE;
|
|
||||||
|
|
||||||
MwLLDestroyCommon(handle);
|
MwLLDestroyCommon(handle);
|
||||||
|
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
|
|
@ -1050,7 +1035,7 @@ static void MwLLDestroyImpl(MwLL handle) {
|
||||||
printf("widget invalid\n");
|
printf("widget invalid\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_destroy(&handle->wayland.eventsMutex);
|
// pthread_mutex_destroy(&handle->wayland.eventsMutex);
|
||||||
|
|
||||||
free(handle);
|
free(handle);
|
||||||
}
|
}
|
||||||
|
|
@ -1321,10 +1306,6 @@ static void MwLLEndDrawImpl(MwLL handle) {
|
||||||
MwLLWaylandBufferUpdate(handle, &handle->wayland.backbuffer);
|
MwLLWaylandBufferUpdate(handle, &handle->wayland.backbuffer);
|
||||||
}
|
}
|
||||||
MwLLWaylandBufferUpdate(handle, &handle->wayland.framebuffer);
|
MwLLWaylandBufferUpdate(handle, &handle->wayland.framebuffer);
|
||||||
|
|
||||||
if(handle->wayland.type != MwLL_WAYLAND_SUBLEVEL) {
|
|
||||||
handle->wayland.do_cascading_draw = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1382,16 +1363,16 @@ static int MwLLPendingImpl(MwLL handle) {
|
||||||
|
|
||||||
handle->wayland.resizing = 0;
|
handle->wayland.resizing = 0;
|
||||||
|
|
||||||
|
if(handle->wayland.type != MwLL_WAYLAND_SUBLEVEL) {
|
||||||
|
draw_children(handle);
|
||||||
|
frontbuffer_draw(handle);
|
||||||
|
}
|
||||||
|
|
||||||
if(handle->wayland.setting_wh) {
|
if(handle->wayland.setting_wh) {
|
||||||
actually_set_wh(handle);
|
actually_set_wh(handle);
|
||||||
handle->wayland.setting_wh = 0;
|
handle->wayland.setting_wh = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(handle->wayland.do_cascading_draw) {
|
|
||||||
draw_children(handle);
|
|
||||||
frontbuffer_draw(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
handle->wayland.end_time = MwTimeGetTick();
|
handle->wayland.end_time = MwTimeGetTick();
|
||||||
|
|
||||||
if(handle->wayland.holding_key) {
|
if(handle->wayland.holding_key) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue