wayland: don't do parent draws on every event when we do'nt need to

This commit is contained in:
IoIxD
2026-01-12 19:21:21 -07:00
parent d340c64ca3
commit 32f09a9af2
2 changed files with 6 additions and 17 deletions

View File

@@ -7,6 +7,7 @@
#ifndef __MW_LOWLEVEL_WAYLAND_H__
#define __MW_LOWLEVEL_WAYLAND_H__
#include "Mw/BaseTypes.h"
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>

View File

@@ -412,17 +412,14 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time
p.point = self->wayland.cur_mouse_pos;
MwLLDispatch(self, move, &p);
self->wayland.events_pending += 1;
/* Only draw once every 10 milliseconds */
if((self->wayland.last_time + 10) <= time) {
if(!self->wayland.always_render) {
MwLLDispatch(self, draw, NULL);
self->wayland.events_pending += 1;
}
/* Only draw once every 50 milliseconds */
if((self->wayland.last_time + 50) <= time) {
MwLLDispatch(self, draw, NULL);
self->wayland.last_time = time;
}
self->wayland.events_pending += 1;
WAYLAND_EVENT_OP_END(self);
/*timed_redraw(self, time, 50, &self->wayland.cooldown_timer);*/
@@ -474,10 +471,6 @@ static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 seri
if(!self->wayland.always_render) {
MwLLDispatch(self, draw, NULL);
if(self->wayland.parent != NULL) {
MwLLDispatch(self->wayland.parent, draw, NULL);
self->wayland.parent->wayland.events_pending += 1;
}
self->wayland.events_pending += 1;
}
@@ -655,9 +648,6 @@ static void keyboard_key(void* data,
if(!self->wayland.always_render) {
MwLLDispatch(self, draw, NULL);
if(self->wayland.parent != NULL) {
MwLLDispatch(self->wayland.parent, draw, NULL);
}
self->wayland.events_pending += 1;
}
@@ -943,8 +933,6 @@ static void wl_shm_interface_destroy(struct _MwLLWayland* wayland, wayland_proto
}
static void update_buffer(struct _MwLLWaylandShmBuffer* buffer) {
fsync(buffer->fd);
wl_surface_attach(buffer->surface, buffer->shm_buffer, 0, 0);
wl_surface_commit(buffer->surface);
}