Remove unneccessary waylandFlush() calls

This commit is contained in:
Raphael Robatsch 2021-10-22 15:05:47 +02:00
parent b60462feb6
commit 64fa80f8b2
4 changed files with 5 additions and 9 deletions

View file

@ -30,7 +30,6 @@ Bar::~Bar()
{ {
wl_surface_destroy(_surface); wl_surface_destroy(_surface);
zwlr_layer_surface_v1_destroy(_layerSurface); zwlr_layer_surface_v1_destroy(_layerSurface);
waylandFlush();
} }
void Bar::layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height) void Bar::layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height)
@ -56,5 +55,4 @@ void Bar::render()
wl_surface_attach(_surface, _bufs->buffer(), 0, 0); wl_surface_attach(_surface, _bufs->buffer(), 0, 0);
wl_surface_commit(_surface); wl_surface_commit(_surface);
_bufs->flip(); _bufs->flip();
waylandFlush();
} }

View file

@ -5,8 +5,6 @@
#include <wayland-client.h> #include <wayland-client.h>
#include "wlr-layer-shell-unstable-v1-client-protocol.h" #include "wlr-layer-shell-unstable-v1-client-protocol.h"
void waylandFlush();
extern wl_display *display; extern wl_display *display;
extern wl_compositor *compositor; extern wl_compositor *compositor;
extern wl_shm *shm; extern wl_shm *shm;

View file

@ -14,6 +14,7 @@
#include "common.hpp" #include "common.hpp"
#include "bar.hpp" #include "bar.hpp"
static void waylandFlush();
static void waylandWriteReady(); static void waylandWriteReady();
static void requireGlobal(const void *p, const char *name); static void requireGlobal(const void *p, const char *name);
@ -27,7 +28,6 @@ static xdg_wm_base *xdgWmBase;
static const struct xdg_wm_base_listener xdgWmBaseListener = { static const struct xdg_wm_base_listener xdgWmBaseListener = {
[](void*, xdg_wm_base *sender, uint32_t serial) { [](void*, xdg_wm_base *sender, uint32_t serial) {
xdg_wm_base_pong(sender, serial); xdg_wm_base_pong(sender, serial);
waylandFlush();
} }
}; };
@ -38,7 +38,6 @@ static void onReady()
requireGlobal(shm, "wl_shm"); requireGlobal(shm, "wl_shm");
requireGlobal(wlrLayerShell, "zwlr_layer_shell_v1"); requireGlobal(wlrLayerShell, "zwlr_layer_shell_v1");
std::ignore = new Bar(nullptr); std::ignore = new Bar(nullptr);
waylandFlush();
} }
struct HandleGlobalHelper { struct HandleGlobalHelper {
@ -98,9 +97,11 @@ int main(int argc, char **argv)
displayWriteNotifier = new QSocketNotifier(wl_display_get_fd(display), QSocketNotifier::Write); displayWriteNotifier = new QSocketNotifier(wl_display_get_fd(display), QSocketNotifier::Write);
displayWriteNotifier->setEnabled(false); displayWriteNotifier->setEnabled(false);
QObject::connect(displayWriteNotifier, &QSocketNotifier::activated, waylandWriteReady); QObject::connect(displayWriteNotifier, &QSocketNotifier::activated, waylandWriteReady);
waylandFlush();
return app.exec(); while (true) {
waylandFlush();
app.processEvents(QEventLoop::WaitForMoreEvents);
}
} }
void waylandFlush() void waylandFlush()

View file

@ -34,7 +34,6 @@ ShmBuffer::~ShmBuffer()
for (auto i=0; i<n; i++) { for (auto i=0; i<n; i++) {
wl_buffer_destroy(_buffers[i].buffer); wl_buffer_destroy(_buffers[i].buffer);
} }
waylandFlush();
} }
uint8_t* ShmBuffer::data() const { return _buffers[_current].data; } uint8_t* ShmBuffer::data() const { return _buffers[_current].data; }