mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 18:39:46 +00:00
Fix the issues found while reviewing the Wayland backend
Report the errors the display read loop can fail with instead of dispatching events on a dead connection, and release exactly the keys the user really holds: BaseInput::pressedKeys is never erased, so the previous list sent key releases for keys that were never pressed. The bar is the only owner of the pointer edges now, the fullscreen state comes from the compositor, and the decorations are enabled once, with the window geometry published again. The initialization failure paths destroy their resources exactly once, the screen state is reset on teardown, the clipboard write does not block the frame loop on a slow reader, and the gsettings fallback is not retried after it failed. The stretch blit of the last frame is gone: composeFrame() already paints the cached content.
This commit is contained in:
parent
4d1b4a1638
commit
c635549892
9 changed files with 206 additions and 137 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
#include "window/wayland/WaylandCommon.hpp"
|
#include "window/wayland/WaylandCommon.hpp"
|
||||||
|
|
||||||
|
#include <cerrno>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
|
|
@ -20,7 +21,6 @@ double waylandNow() {
|
||||||
).count();
|
).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GlStateGuard::GlStateGuard() {
|
GlStateGuard::GlStateGuard() {
|
||||||
glGetIntegerv(GL_CURRENT_PROGRAM, &values[0]);
|
glGetIntegerv(GL_CURRENT_PROGRAM, &values[0]);
|
||||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &values[1]);
|
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &values[1]);
|
||||||
|
|
@ -37,6 +37,7 @@ GlStateGuard::GlStateGuard() {
|
||||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &values[12]);
|
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &values[12]);
|
||||||
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &values[13]);
|
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &values[13]);
|
||||||
glGetIntegerv(GL_DEPTH_WRITEMASK, &values[14]);
|
glGetIntegerv(GL_DEPTH_WRITEMASK, &values[14]);
|
||||||
|
glGetIntegerv(GL_PACK_ALIGNMENT, &values[15]);
|
||||||
glGetIntegerv(GL_VIEWPORT, viewport);
|
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||||
glGetIntegerv(GL_COLOR_WRITEMASK, colorMask);
|
glGetIntegerv(GL_COLOR_WRITEMASK, colorMask);
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
|
|
@ -52,11 +53,13 @@ GlStateGuard::GlStateGuard() {
|
||||||
);
|
);
|
||||||
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &attribs[i][3]);
|
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &attribs[i][3]);
|
||||||
glGetVertexAttribiv(
|
glGetVertexAttribiv(
|
||||||
i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &attribs[i][5]
|
i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &attribs[i][4]
|
||||||
);
|
);
|
||||||
void* pointer = nullptr;
|
void* pointer = nullptr;
|
||||||
glGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, &pointer);
|
glGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, &pointer);
|
||||||
attribs[i][6] = static_cast<GLint>(reinterpret_cast<intptr_t>(pointer));
|
attribs[i][5] = static_cast<GLint>(
|
||||||
|
reinterpret_cast<intptr_t>(pointer)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
flags[0] = glIsEnabled(GL_BLEND);
|
flags[0] = glIsEnabled(GL_BLEND);
|
||||||
flags[1] = glIsEnabled(GL_DEPTH_TEST);
|
flags[1] = glIsEnabled(GL_DEPTH_TEST);
|
||||||
|
|
@ -70,6 +73,7 @@ GlStateGuard::~GlStateGuard() {
|
||||||
glActiveTexture(values[2]);
|
glActiveTexture(values[2]);
|
||||||
glBindTexture(GL_TEXTURE_2D, values[3]);
|
glBindTexture(GL_TEXTURE_2D, values[3]);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, values[4]);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, values[4]);
|
||||||
|
glPixelStorei(GL_PACK_ALIGNMENT, values[15]);
|
||||||
glBlendFuncSeparate(values[5], values[6], values[7], values[8]);
|
glBlendFuncSeparate(values[5], values[6], values[7], values[8]);
|
||||||
glBlendEquationSeparate(values[9], values[10]);
|
glBlendEquationSeparate(values[9], values[10]);
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, values[12]);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, values[12]);
|
||||||
|
|
@ -86,11 +90,11 @@ GlStateGuard::~GlStateGuard() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, static_cast<GLuint>(attribs[i][5]));
|
glBindBuffer(GL_ARRAY_BUFFER, static_cast<GLuint>(attribs[i][4]));
|
||||||
glVertexAttribPointer(
|
glVertexAttribPointer(
|
||||||
i, attribs[i][0], static_cast<GLenum>(attribs[i][1]),
|
i, attribs[i][0], static_cast<GLenum>(attribs[i][1]),
|
||||||
attribs[i][2], attribs[i][3],
|
attribs[i][2], attribs[i][3],
|
||||||
reinterpret_cast<void*>(static_cast<intptr_t>(attribs[i][6]))
|
reinterpret_cast<void*>(static_cast<intptr_t>(attribs[i][5]))
|
||||||
);
|
);
|
||||||
if (attribFlags[i]) {
|
if (attribFlags[i]) {
|
||||||
glEnableVertexAttribArray(i);
|
glEnableVertexAttribArray(i);
|
||||||
|
|
@ -125,8 +129,6 @@ class WaylandWindow;
|
||||||
WaylandInput* input = nullptr;
|
WaylandInput* input = nullptr;
|
||||||
WaylandWindow* window = nullptr;
|
WaylandWindow* window = nullptr;
|
||||||
|
|
||||||
bool serverDecorations = false;
|
|
||||||
|
|
||||||
int keycode_from_keysym(xkb_keysym_t sym) {
|
int keycode_from_keysym(xkb_keysym_t sym) {
|
||||||
switch (sym) {
|
switch (sym) {
|
||||||
case XKB_KEY_Escape: return GLFW_KEY_ESCAPE;
|
case XKB_KEY_Escape: return GLFW_KEY_ESCAPE;
|
||||||
|
|
@ -203,21 +205,43 @@ int keycode_from_keysym(xkb_keysym_t sym) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatch_events(int timeoutMs) {
|
void dispatch_events(int timeoutMs) {
|
||||||
wl_display_flush(state.display);
|
if (state.display == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (wl_display_get_error(state.display) != 0) {
|
||||||
|
on_display_error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (wl_display_flush(state.display) == -1 && errno != EAGAIN) {
|
||||||
|
on_display_error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (wl_display_prepare_read(state.display) != 0) {
|
while (wl_display_prepare_read(state.display) != 0) {
|
||||||
wl_display_dispatch_pending(state.display);
|
if (wl_display_get_error(state.display) != 0) {
|
||||||
wl_display_flush(state.display);
|
on_display_error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (wl_display_dispatch_pending(state.display) == -1 ||
|
||||||
|
wl_display_get_error(state.display) != 0) {
|
||||||
|
on_display_error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (wl_display_flush(state.display) == -1 && errno != EAGAIN) {
|
||||||
|
on_display_error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pollfd descriptor {wl_display_get_fd(state.display), POLLIN, 0};
|
pollfd descriptor {wl_display_get_fd(state.display), POLLIN, 0};
|
||||||
if (poll(&descriptor, 1, timeoutMs) > 0) {
|
if (poll(&descriptor, 1, timeoutMs) > 0) {
|
||||||
if (wl_display_read_events(state.display) == -1) {
|
if (wl_display_read_events(state.display) == -1) {
|
||||||
wl_display_cancel_read(state.display);
|
on_display_error();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wl_display_cancel_read(state.display);
|
wl_display_cancel_read(state.display);
|
||||||
}
|
}
|
||||||
wl_display_dispatch_pending(state.display);
|
if (wl_display_dispatch_pending(state.display) == -1 ||
|
||||||
if (wl_display_get_error(state.display) != 0) {
|
wl_display_get_error(state.display) != 0) {
|
||||||
on_display_error();
|
on_display_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,16 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <stack>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct GlStateGuard {
|
struct GlStateGuard {
|
||||||
GLint values[16] {};
|
GLint values[16] {};
|
||||||
GLint attribs[3][7] {};
|
GLint attribs[3][6] {};
|
||||||
GLint viewport[4] {};
|
GLint viewport[4] {};
|
||||||
GLint colorMask[4] {};
|
GLint colorMask[4] {};
|
||||||
GLboolean flags[6] {};
|
GLboolean flags[4] {};
|
||||||
GLboolean attribFlags[3] {};
|
GLboolean attribFlags[3] {};
|
||||||
GlStateGuard();
|
GlStateGuard();
|
||||||
~GlStateGuard();
|
~GlStateGuard();
|
||||||
|
|
@ -100,8 +99,6 @@ void ignore_event(Args...) {
|
||||||
void dispatch_events(int timeoutMs);
|
void dispatch_events(int timeoutMs);
|
||||||
int keycode_from_keysym(xkb_keysym_t sym);
|
int keycode_from_keysym(xkb_keysym_t sym);
|
||||||
|
|
||||||
extern bool serverDecorations;
|
|
||||||
|
|
||||||
void zxdg_decoration_configure(
|
void zxdg_decoration_configure(
|
||||||
void*, zxdg_toplevel_decoration_v1*, uint32_t mode
|
void*, zxdg_toplevel_decoration_v1*, uint32_t mode
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -55,22 +55,27 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool layoutUnavailable = false;
|
||||||
|
|
||||||
bool read_button_layout(
|
bool read_button_layout(
|
||||||
std::vector<DecorationButton>& left,
|
std::vector<DecorationButton>& left,
|
||||||
std::vector<DecorationButton>& right
|
std::vector<DecorationButton>& right
|
||||||
) {
|
) {
|
||||||
FILE* pipe = popen(
|
if (layoutUnavailable) {
|
||||||
"gsettings get org.gnome.desktop.wm.preferences button-layout"
|
return false;
|
||||||
" 2>/dev/null",
|
}
|
||||||
"r"
|
const std::string command = std::string("gsettings get ") +
|
||||||
);
|
LAYOUT_SCHEMA + " " + LAYOUT_KEY + " 2>/dev/null";
|
||||||
|
FILE* pipe = popen(command.c_str(), "r");
|
||||||
if (pipe == nullptr) {
|
if (pipe == nullptr) {
|
||||||
|
layoutUnavailable = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char buffer[256] {};
|
char buffer[256] {};
|
||||||
const char* line = fgets(buffer, sizeof(buffer), pipe);
|
const char* line = fgets(buffer, sizeof(buffer), pipe);
|
||||||
const int status = pclose(pipe);
|
const int status = pclose(pipe);
|
||||||
if (line == nullptr || status != 0) {
|
if (line == nullptr || status != 0) {
|
||||||
|
layoutUnavailable = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
split_layout(std::string(buffer), left, right);
|
split_layout(std::string(buffer), left, right);
|
||||||
|
|
@ -190,7 +195,11 @@ int WaylandWindow::getDecorationHoveredButton() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandWindow::enableOwnDecorations() {
|
void WaylandWindow::enableOwnDecorations() {
|
||||||
|
if (barEnabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
barEnabled = true;
|
barEnabled = true;
|
||||||
|
resize(size.x, size.y);
|
||||||
setShouldRefresh();
|
setShouldRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,10 +231,13 @@ int WaylandWindow::barButtonAt(double x, double y) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t WaylandWindow::barEdgeAt(double x, double y) const {
|
uint32_t WaylandWindow::barEdgeAt(double x, double y) const {
|
||||||
|
if (!barVisible()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (barButtonAt(x, y) >= 0) {
|
if (barButtonAt(x, y) >= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const bool inBar = barVisible() && y >= 0.0 && y < barHeight();
|
const bool inBar = y >= 0.0 && y < barHeight();
|
||||||
uint32_t edges = 0;
|
uint32_t edges = 0;
|
||||||
if (y < BAR_EDGE) {
|
if (y < BAR_EDGE) {
|
||||||
edges |= XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
edges |= XDG_TOPLEVEL_RESIZE_EDGE_TOP;
|
||||||
|
|
@ -276,6 +288,9 @@ CursorShape WaylandWindow::edgeCursor(uint32_t edges) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t WaylandWindow::pointerEdges() const {
|
uint32_t WaylandWindow::pointerEdges() const {
|
||||||
|
if (!barVisible()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
const int margin = marginSize();
|
const int margin = marginSize();
|
||||||
uint32_t edges = 0;
|
uint32_t edges = 0;
|
||||||
if (margin > 0) {
|
if (margin > 0) {
|
||||||
|
|
@ -399,9 +414,11 @@ bool WaylandWindow::handleBarButton(uint32_t serial, int button, bool pressed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaylandWindow::handleBarScroll() const {
|
bool WaylandWindow::handleBarScroll() const {
|
||||||
|
if (!barVisible()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const double y = contentY(pointerY);
|
const double y = contentY(pointerY);
|
||||||
return (barVisible() && y >= 0.0 && y < barHeight()) ||
|
return (y >= 0.0 && y < barHeight()) || pointerEdges() != 0;
|
||||||
pointerEdges() != 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandWindow::onPointerLeave() {
|
void WaylandWindow::onPointerLeave() {
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,42 @@
|
||||||
#include "graphics/core/Texture.hpp"
|
#include "graphics/core/Texture.hpp"
|
||||||
#include <EGL/eglext.h>
|
#include <EGL/eglext.h>
|
||||||
|
|
||||||
|
WaylandInput::~WaylandInput() {
|
||||||
|
if (clipboardFd >= 0) {
|
||||||
|
close(clipboardFd);
|
||||||
|
clipboardFd = -1;
|
||||||
|
}
|
||||||
|
if (state.xkbContext) {
|
||||||
|
xkb_context_unref(state.xkbContext);
|
||||||
|
state.xkbContext = nullptr;
|
||||||
|
}
|
||||||
|
if (input == this) {
|
||||||
|
input = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::tuple<std::unique_ptr<Window>, std::unique_ptr<Input>>
|
std::tuple<std::unique_ptr<Window>, std::unique_ptr<Input>>
|
||||||
wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
state.display = wl_display_connect(nullptr);
|
std::unique_ptr<WaylandInput> inputPtr;
|
||||||
if (state.display == nullptr) {
|
std::unique_ptr<WaylandWindow> windowPtr;
|
||||||
waylandLogger.error() << "could not connect to the Wayland display";
|
const auto fail = [&] (
|
||||||
|
const std::string& message
|
||||||
|
) -> std::tuple<std::unique_ptr<Window>, std::unique_ptr<Input>> {
|
||||||
|
waylandLogger.error() << message;
|
||||||
window = nullptr;
|
window = nullptr;
|
||||||
input = nullptr;
|
input = nullptr;
|
||||||
|
windowPtr.reset();
|
||||||
|
inputPtr.reset();
|
||||||
if (state.display != nullptr) {
|
if (state.display != nullptr) {
|
||||||
wl_display_disconnect(state.display);
|
wl_display_disconnect(state.display);
|
||||||
state.display = nullptr;
|
state.display = nullptr;
|
||||||
}
|
}
|
||||||
return {nullptr, nullptr};
|
return {nullptr, nullptr};
|
||||||
|
};
|
||||||
|
|
||||||
|
state.display = wl_display_connect(nullptr);
|
||||||
|
if (state.display == nullptr) {
|
||||||
|
return fail("could not connect to the Wayland display");
|
||||||
}
|
}
|
||||||
state.registry = wl_display_get_registry(state.display);
|
state.registry = wl_display_get_registry(state.display);
|
||||||
static const wl_registry_listener registryListener = [] {
|
static const wl_registry_listener registryListener = [] {
|
||||||
|
|
@ -30,23 +54,14 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
wl_registry_add_listener(state.registry, ®istryListener, nullptr);
|
wl_registry_add_listener(state.registry, ®istryListener, nullptr);
|
||||||
wl_display_roundtrip(state.display);
|
wl_display_roundtrip(state.display);
|
||||||
if (state.compositor == nullptr || state.wmBase == nullptr) {
|
if (state.compositor == nullptr || state.wmBase == nullptr) {
|
||||||
waylandLogger.error() << "the compositor does not provide xdg-shell";
|
return fail("the compositor does not provide xdg-shell");
|
||||||
wl_display_disconnect(state.display);
|
|
||||||
state.display = nullptr;
|
|
||||||
window = nullptr;
|
|
||||||
input = nullptr;
|
|
||||||
if (state.display != nullptr) {
|
|
||||||
wl_display_disconnect(state.display);
|
|
||||||
state.display = nullptr;
|
|
||||||
}
|
|
||||||
return {nullptr, nullptr};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state.surface = wl_compositor_create_surface(state.compositor);
|
state.surface = wl_compositor_create_surface(state.compositor);
|
||||||
|
|
||||||
auto inputPtr = std::make_unique<WaylandInput>();
|
inputPtr = std::make_unique<WaylandInput>();
|
||||||
input = inputPtr.get();
|
input = inputPtr.get();
|
||||||
auto windowPtr = std::make_unique<WaylandWindow>(
|
windowPtr = std::make_unique<WaylandWindow>(
|
||||||
*inputPtr, settings, settings->width.get(), settings->height.get()
|
*inputPtr, settings, settings->width.get(), settings->height.get()
|
||||||
);
|
);
|
||||||
window = windowPtr.get();
|
window = windowPtr.get();
|
||||||
|
|
@ -66,7 +81,7 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
return value;
|
return value;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
wl_data_device_add_listener(state.dataDevice, &deviceListener, nullptr);
|
wl_data_device_add_listener(state.dataDevice, &deviceListener, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -116,14 +131,7 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
|
|
||||||
while (!window->configured) {
|
while (!window->configured) {
|
||||||
if (wl_display_dispatch(state.display) == -1) {
|
if (wl_display_dispatch(state.display) == -1) {
|
||||||
waylandLogger.error() << "the Wayland connection was lost";
|
return fail("the Wayland connection was lost");
|
||||||
window = nullptr;
|
|
||||||
input = nullptr;
|
|
||||||
if (state.display != nullptr) {
|
|
||||||
wl_display_disconnect(state.display);
|
|
||||||
state.display = nullptr;
|
|
||||||
}
|
|
||||||
return {nullptr, nullptr};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,14 +140,7 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
);
|
);
|
||||||
if (window->eglDisplay == EGL_NO_DISPLAY ||
|
if (window->eglDisplay == EGL_NO_DISPLAY ||
|
||||||
eglInitialize(window->eglDisplay, nullptr, nullptr) == EGL_FALSE) {
|
eglInitialize(window->eglDisplay, nullptr, nullptr) == EGL_FALSE) {
|
||||||
waylandLogger.error() << "could not initialize EGL";
|
return fail("could not initialize EGL");
|
||||||
window = nullptr;
|
|
||||||
input = nullptr;
|
|
||||||
if (state.display != nullptr) {
|
|
||||||
wl_display_disconnect(state.display);
|
|
||||||
state.display = nullptr;
|
|
||||||
}
|
|
||||||
return {nullptr, nullptr};
|
|
||||||
}
|
}
|
||||||
eglBindAPI(EGL_OPENGL_API);
|
eglBindAPI(EGL_OPENGL_API);
|
||||||
|
|
||||||
|
|
@ -179,14 +180,7 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
waylandLogger.warning()
|
waylandLogger.warning()
|
||||||
<< "no EGL config with alpha, the drop shadow is off";
|
<< "no EGL config with alpha, the drop shadow is off";
|
||||||
if (!chooseConfig(0, requestedSamples) && !chooseConfig(0, 0)) {
|
if (!chooseConfig(0, requestedSamples) && !chooseConfig(0, 0)) {
|
||||||
waylandLogger.error() << "no suitable EGL config";
|
return fail("no suitable EGL config");
|
||||||
window = nullptr;
|
|
||||||
input = nullptr;
|
|
||||||
if (state.display != nullptr) {
|
|
||||||
wl_display_disconnect(state.display);
|
|
||||||
state.display = nullptr;
|
|
||||||
}
|
|
||||||
return {nullptr, nullptr};
|
|
||||||
}
|
}
|
||||||
window->shadowEnabled = false;
|
window->shadowEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
@ -214,29 +208,17 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
window->eglDisplay, window->eglSurface, window->eglSurface,
|
window->eglDisplay, window->eglSurface, window->eglSurface,
|
||||||
window->eglContext
|
window->eglContext
|
||||||
) == EGL_FALSE) {
|
) == EGL_FALSE) {
|
||||||
waylandLogger.error() << "could not create the OpenGL context";
|
return fail("could not create the OpenGL context");
|
||||||
window = nullptr;
|
|
||||||
input = nullptr;
|
|
||||||
if (state.display != nullptr) {
|
|
||||||
wl_display_disconnect(state.display);
|
|
||||||
state.display = nullptr;
|
|
||||||
}
|
|
||||||
return {nullptr, nullptr};
|
|
||||||
}
|
}
|
||||||
eglSwapInterval(window->eglDisplay, 0);
|
eglSwapInterval(window->eglDisplay, 0);
|
||||||
|
|
||||||
glewExperimental = GL_TRUE;
|
glewExperimental = GL_TRUE;
|
||||||
GLenum glewError = glewInit();
|
GLenum glewError = glewInit();
|
||||||
if (glewError != GLEW_OK && glewError != GLEW_ERROR_NO_GLX_DISPLAY) {
|
if (glewError != GLEW_OK && glewError != GLEW_ERROR_NO_GLX_DISPLAY) {
|
||||||
waylandLogger.error() << "failed to initialize GLEW:\n"
|
return fail(
|
||||||
<< glewGetErrorString(glewError);
|
std::string("failed to initialize GLEW:\n") +
|
||||||
window = nullptr;
|
reinterpret_cast<const char*>(glewGetErrorString(glewError))
|
||||||
input = nullptr;
|
);
|
||||||
if (state.display != nullptr) {
|
|
||||||
wl_display_disconnect(state.display);
|
|
||||||
state.display = nullptr;
|
|
||||||
}
|
|
||||||
return {nullptr, nullptr};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window->initStretchRenderer();
|
window->initStretchRenderer();
|
||||||
|
|
@ -259,6 +241,10 @@ wayland_window_initialize(DisplaySettings* settings, std::string title) {
|
||||||
<< reinterpret_cast<const char*>(glGetString(GL_RENDERER));
|
<< reinterpret_cast<const char*>(glGetString(GL_RENDERER));
|
||||||
waylandLogger.info() << "windowing platform: Wayland (native)";
|
waylandLogger.info() << "windowing platform: Wayland (native)";
|
||||||
|
|
||||||
|
// The first configure may arrive with a zero size, so the geometry is
|
||||||
|
// published once the surface exists.
|
||||||
|
window->updateWindowGeometry();
|
||||||
|
|
||||||
return {std::move(windowPtr), std::move(inputPtr)};
|
return {std::move(windowPtr), std::move(inputPtr)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,12 @@
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <cerrno>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/// @brief Offset between the evdev keycode and the xkb one
|
/// @brief Offset between the evdev keycode and the xkb one
|
||||||
|
|
@ -21,6 +23,8 @@ static constexpr uint32_t XKB_KEYCODE_OFFSET = 8;
|
||||||
|
|
||||||
class WaylandInput : public BaseInput {
|
class WaylandInput : public BaseInput {
|
||||||
public:
|
public:
|
||||||
|
~WaylandInput() override;
|
||||||
|
|
||||||
void pollEvents(bool waitForRefresh) override;
|
void pollEvents(bool waitForRefresh) override;
|
||||||
|
|
||||||
const char* getClipboardText() const override {
|
const char* getClipboardText() const override {
|
||||||
|
|
@ -161,7 +165,8 @@ public:
|
||||||
|
|
||||||
/// @brief Release every pressed key, e.g. when the keyboard focus is lost
|
/// @brief Release every pressed key, e.g. when the keyboard focus is lost
|
||||||
void releasePressedKeys() {
|
void releasePressedKeys() {
|
||||||
const auto keys = pressedKeys;
|
const auto keys = heldKeys;
|
||||||
|
heldKeys.clear();
|
||||||
for (auto key : keys) {
|
for (auto key : keys) {
|
||||||
onKeyCallback(static_cast<int>(key), false);
|
onKeyCallback(static_cast<int>(key), false);
|
||||||
}
|
}
|
||||||
|
|
@ -190,6 +195,11 @@ public:
|
||||||
int keycode = keycode_from_keysym(syms[0]);
|
int keycode = keycode_from_keysym(syms[0]);
|
||||||
if (keycode != 0) {
|
if (keycode != 0) {
|
||||||
onKeyCallback(keycode, pressed);
|
onKeyCallback(keycode, pressed);
|
||||||
|
if (pressed) {
|
||||||
|
heldKeys.insert(static_cast<uint32_t>(keycode));
|
||||||
|
} else {
|
||||||
|
heldKeys.erase(static_cast<uint32_t>(keycode));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
repeatKeycode = code;
|
repeatKeycode = code;
|
||||||
|
|
@ -344,13 +354,45 @@ private:
|
||||||
listener.send = [] (
|
listener.send = [] (
|
||||||
void*, wl_data_source*, const char*, int32_t fd
|
void*, wl_data_source*, const char*, int32_t fd
|
||||||
) {
|
) {
|
||||||
if (input) {
|
if (input == nullptr) {
|
||||||
const std::string& text = input->sourceText;
|
close(fd);
|
||||||
if (!text.empty() &&
|
return;
|
||||||
write(fd, text.data(), text.size()) < 0) {
|
}
|
||||||
waylandLogger.warning()
|
const std::string& text = input->sourceText;
|
||||||
<< "could not write to the clipboard";
|
const int flags = fcntl(fd, F_GETFL, 0);
|
||||||
|
if (flags != -1) {
|
||||||
|
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
||||||
|
}
|
||||||
|
// The reader may be slow, so the frame loop is not allowed to
|
||||||
|
// block on the pipe: partial writes and EAGAIN are retried
|
||||||
|
// only for a bounded time.
|
||||||
|
const double deadline = waylandNow() + 0.1;
|
||||||
|
size_t offset = 0;
|
||||||
|
while (offset < text.size()) {
|
||||||
|
const ssize_t written = write(
|
||||||
|
fd, text.data() + offset, text.size() - offset
|
||||||
|
);
|
||||||
|
if (written > 0) {
|
||||||
|
offset += static_cast<size_t>(written);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (written < 0 && errno == EINTR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (written < 0 &&
|
||||||
|
(errno == EAGAIN || errno == EWOULDBLOCK)) {
|
||||||
|
if (waylandNow() < deadline) {
|
||||||
|
pollfd descriptor {fd, POLLOUT, 0};
|
||||||
|
if (poll(&descriptor, 1, 10) > 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (offset < text.size()) {
|
||||||
|
waylandLogger.warning()
|
||||||
|
<< "could not write to the clipboard";
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
};
|
};
|
||||||
|
|
@ -386,6 +428,8 @@ private:
|
||||||
|
|
||||||
CursorShape cursor = CursorShape::ARROW;
|
CursorShape cursor = CursorShape::ARROW;
|
||||||
std::optional<CursorShape> overrideCursor;
|
std::optional<CursorShape> overrideCursor;
|
||||||
|
// the keys really held: BaseInput::pressedKeys is never erased
|
||||||
|
std::unordered_set<uint32_t> heldKeys;
|
||||||
xkb_keycode_t repeatKeycode = 0;
|
xkb_keycode_t repeatKeycode = 0;
|
||||||
double repeatTime = 0.0;
|
double repeatTime = 0.0;
|
||||||
double lastRepeat = 0.0;
|
double lastRepeat = 0.0;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ static void pointer_motion(
|
||||||
const double x = wl_fixed_to_double(sx);
|
const double x = wl_fixed_to_double(sx);
|
||||||
const double y = wl_fixed_to_double(sy);
|
const double y = wl_fixed_to_double(sy);
|
||||||
if (window && window->handleBarMotion(x, y)) {
|
if (window && window->handleBarMotion(x, y)) {
|
||||||
|
window->setShouldRefresh();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (input) {
|
if (input) {
|
||||||
|
|
@ -371,7 +372,8 @@ void registry_global_remove(void*, wl_registry*, uint32_t) {
|
||||||
void zxdg_decoration_configure(
|
void zxdg_decoration_configure(
|
||||||
void*, zxdg_toplevel_decoration_v1*, uint32_t mode
|
void*, zxdg_toplevel_decoration_v1*, uint32_t mode
|
||||||
) {
|
) {
|
||||||
serverDecorations = mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
const bool serverDecorations =
|
||||||
|
mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
||||||
if (window != nullptr) {
|
if (window != nullptr) {
|
||||||
if (serverDecorations) {
|
if (serverDecorations) {
|
||||||
window->disableOwnDecorations();
|
window->disableOwnDecorations();
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ namespace {
|
||||||
struct SettingsWatcher::Impl {
|
struct SettingsWatcher::Impl {
|
||||||
#ifdef VOXELCORE_SDBUS
|
#ifdef VOXELCORE_SDBUS
|
||||||
sd_bus* bus = nullptr;
|
sd_bus* bus = nullptr;
|
||||||
|
std::string changedSchema;
|
||||||
std::string changedKey;
|
std::string changedKey;
|
||||||
std::string changedValue;
|
std::string changedValue;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
@ -58,7 +59,8 @@ struct SettingsWatcher::Impl {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const std::string value = readVariant(message);
|
const std::string value = readVariant(message);
|
||||||
if (key != nullptr && !value.empty()) {
|
if (schema != nullptr && key != nullptr && !value.empty()) {
|
||||||
|
self->changedSchema = schema;
|
||||||
self->changedKey = key;
|
self->changedKey = key;
|
||||||
self->changedValue = value;
|
self->changedValue = value;
|
||||||
self->changed = true;
|
self->changed = true;
|
||||||
|
|
@ -86,10 +88,14 @@ bool SettingsWatcher::open() {
|
||||||
impl->bus = nullptr;
|
impl->bus = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sd_bus_match_signal(
|
if (sd_bus_match_signal(
|
||||||
impl->bus, nullptr, nullptr, PORTAL_PATH, PORTAL_INTERFACE,
|
impl->bus, nullptr, nullptr, PORTAL_PATH, PORTAL_INTERFACE,
|
||||||
"SettingChanged", &Impl::onSettingChanged, impl
|
"SettingChanged", &Impl::onSettingChanged, impl
|
||||||
);
|
) < 0) {
|
||||||
|
sd_bus_flush_close_unref(impl->bus);
|
||||||
|
impl->bus = nullptr;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -163,10 +169,17 @@ bool SettingsWatcher::poll(
|
||||||
message = nullptr;
|
message = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!impl->changed || impl->changedKey != key) {
|
if (result < 0) {
|
||||||
|
close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!impl->changed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
impl->changed = false;
|
impl->changed = false;
|
||||||
|
if (impl->changedSchema != schema || impl->changedKey != key) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
value = impl->changedValue;
|
value = impl->changedValue;
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#include "window/wayland/WaylandWindow.hpp"
|
#include "window/wayland/WaylandWindow.hpp"
|
||||||
|
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
#include "graphics/core/Texture.hpp"
|
|
||||||
#include "util/platform.hpp"
|
#include "util/platform.hpp"
|
||||||
|
|
||||||
WaylandWindow::WaylandWindow(
|
WaylandWindow::WaylandWindow(
|
||||||
|
|
@ -100,6 +99,14 @@ WaylandWindow::~WaylandWindow() {
|
||||||
xkb_keymap_unref(state.xkbKeymap);
|
xkb_keymap_unref(state.xkbKeymap);
|
||||||
state.xkbKeymap = nullptr;
|
state.xkbKeymap = nullptr;
|
||||||
}
|
}
|
||||||
|
if (state.xkbContext) {
|
||||||
|
xkb_context_unref(state.xkbContext);
|
||||||
|
state.xkbContext = nullptr;
|
||||||
|
}
|
||||||
|
if (state.display) {
|
||||||
|
wl_display_disconnect(state.display);
|
||||||
|
}
|
||||||
|
state = WaylandState {};
|
||||||
}
|
}
|
||||||
|
|
||||||
double WaylandWindow::time() {
|
double WaylandWindow::time() {
|
||||||
|
|
@ -118,13 +125,11 @@ void WaylandWindow::swapBuffers() {
|
||||||
cacheContent();
|
cacheContent();
|
||||||
}
|
}
|
||||||
} else if (resizing) {
|
} else if (resizing) {
|
||||||
// While the pointer drags the window border the content is only
|
// While the pointer drags the window border the content is redrawn
|
||||||
// redrawn when the engine asked for it, otherwise the last frame is
|
// only when the engine asked for it, otherwise composeFrame() reuses
|
||||||
// stretched into the new size.
|
// the cached frame.
|
||||||
if (renderPending) {
|
if (renderPending) {
|
||||||
cacheContent();
|
cacheContent();
|
||||||
} else if (marginSize() == 0) {
|
|
||||||
drawStretched();
|
|
||||||
}
|
}
|
||||||
} else if (frameRendered) {
|
} else if (frameRendered) {
|
||||||
cacheContent();
|
cacheContent();
|
||||||
|
|
@ -291,7 +296,7 @@ int WaylandWindow::marginSize() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaylandWindow::compactBar() const {
|
bool WaylandWindow::compactBar() const {
|
||||||
return settings != nullptr && settings->compactWindowBar.get();
|
return settings->compactWindowBar.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaylandWindow::barHeight() const {
|
int WaylandWindow::barHeight() const {
|
||||||
|
|
@ -299,13 +304,10 @@ int WaylandWindow::barHeight() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaylandWindow::liveResizeEnabled() const {
|
bool WaylandWindow::liveResizeEnabled() const {
|
||||||
return settings == nullptr || settings->liveResize.get();
|
return settings->liveResize.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandWindow::updateSettings() {
|
void WaylandWindow::updateSettings() {
|
||||||
if (settings == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const bool compactBar = settings->compactWindowBar.get();
|
const bool compactBar = settings->compactWindowBar.get();
|
||||||
if (compactBar != compactBarSetting) {
|
if (compactBar != compactBarSetting) {
|
||||||
compactBarSetting = compactBar;
|
compactBarSetting = compactBar;
|
||||||
|
|
@ -342,8 +344,8 @@ void WaylandWindow::resize(int width, int height) {
|
||||||
if (eglWindow) {
|
if (eglWindow) {
|
||||||
const auto surface = surfaceSize();
|
const auto surface = surfaceSize();
|
||||||
wl_egl_window_resize(eglWindow, surface.x, surface.y, 0, 0);
|
wl_egl_window_resize(eglWindow, surface.x, surface.y, 0, 0);
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
glViewport(0, 0, width, height);
|
|
||||||
updateWindowGeometry();
|
updateWindowGeometry();
|
||||||
if (Window::mode == WindowMode::WINDOWED && !maximized) {
|
if (Window::mode == WindowMode::WINDOWED && !maximized) {
|
||||||
settings->width.set(width);
|
settings->width.set(width);
|
||||||
|
|
@ -359,6 +361,7 @@ void WaylandWindow::onConfigure(
|
||||||
pendingWidth = width;
|
pendingWidth = width;
|
||||||
pendingHeight = height;
|
pendingHeight = height;
|
||||||
stateMaximized = false;
|
stateMaximized = false;
|
||||||
|
stateFullscreen = false;
|
||||||
stateSuspended = false;
|
stateSuspended = false;
|
||||||
stateActivated = false;
|
stateActivated = false;
|
||||||
const auto* values = static_cast<const uint32_t*>(states->data);
|
const auto* values = static_cast<const uint32_t*>(states->data);
|
||||||
|
|
@ -367,6 +370,9 @@ void WaylandWindow::onConfigure(
|
||||||
case XDG_TOPLEVEL_STATE_MAXIMIZED:
|
case XDG_TOPLEVEL_STATE_MAXIMIZED:
|
||||||
stateMaximized = true;
|
stateMaximized = true;
|
||||||
break;
|
break;
|
||||||
|
case XDG_TOPLEVEL_STATE_FULLSCREEN:
|
||||||
|
stateFullscreen = true;
|
||||||
|
break;
|
||||||
case XDG_TOPLEVEL_STATE_SUSPENDED:
|
case XDG_TOPLEVEL_STATE_SUSPENDED:
|
||||||
stateSuspended = true;
|
stateSuspended = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -379,6 +385,7 @@ void WaylandWindow::onConfigure(
|
||||||
|
|
||||||
void WaylandWindow::applyConfigure() {
|
void WaylandWindow::applyConfigure() {
|
||||||
maximized = stateMaximized;
|
maximized = stateMaximized;
|
||||||
|
fullscreen = stateFullscreen;
|
||||||
suspended = stateSuspended;
|
suspended = stateSuspended;
|
||||||
if (pendingWidth > 0 && pendingHeight > 0) {
|
if (pendingWidth > 0 && pendingHeight > 0) {
|
||||||
if (!initialSizeApplied && Window::mode == WindowMode::WINDOWED &&
|
if (!initialSizeApplied && Window::mode == WindowMode::WINDOWED &&
|
||||||
|
|
@ -531,7 +538,6 @@ void WaylandWindow::initShadowRenderer() {
|
||||||
for (int i = 0; names[i] != nullptr; i++) {
|
for (int i = 0; names[i] != nullptr; i++) {
|
||||||
shadowUniforms[i] = glGetUniformLocation(shadowProgram, names[i]);
|
shadowUniforms[i] = glGetUniformLocation(shadowProgram, names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
@ -680,29 +686,6 @@ void WaylandWindow::cacheContent() {
|
||||||
lastCacheTime = now();
|
lastCacheTime = now();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaylandWindow::drawStretched() {
|
|
||||||
GlStateGuard state;
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
||||||
glViewport(0, 0, size.x, size.y);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
glDisable(GL_CULL_FACE);
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
|
||||||
if (stretchProgram == 0 || cacheWidth == 0) {
|
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
glUseProgram(stretchProgram);
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, cacheTexture);
|
|
||||||
glUniform1i(stretchTextureUniform, 0);
|
|
||||||
glBindVertexArray(stretchVao);
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
|
||||||
glBindVertexArray(0);
|
|
||||||
glUseProgram(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaylandWindow::onFrameDone() {
|
void WaylandWindow::onFrameDone() {
|
||||||
frameCallback = nullptr;
|
frameCallback = nullptr;
|
||||||
frameDone = true;
|
frameDone = true;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class WaylandWindow : public Window {
|
class WaylandWindow : public Window {
|
||||||
public:
|
public:
|
||||||
WaylandInput& input;
|
WaylandInput& input;
|
||||||
DisplaySettings* settings;
|
DisplaySettings* settings;
|
||||||
EGLDisplay eglDisplay = EGL_NO_DISPLAY;
|
EGLDisplay eglDisplay = EGL_NO_DISPLAY;
|
||||||
|
|
@ -25,6 +25,7 @@ class WaylandWindow : public Window {
|
||||||
int32_t pendingWidth = 0;
|
int32_t pendingWidth = 0;
|
||||||
int32_t pendingHeight = 0;
|
int32_t pendingHeight = 0;
|
||||||
bool stateMaximized = false;
|
bool stateMaximized = false;
|
||||||
|
bool stateFullscreen = false;
|
||||||
bool stateSuspended = false;
|
bool stateSuspended = false;
|
||||||
bool stateActivated = true;
|
bool stateActivated = true;
|
||||||
bool configured = false;
|
bool configured = false;
|
||||||
|
|
@ -70,6 +71,10 @@ class WaylandWindow : public Window {
|
||||||
double frameCost = 0.0;
|
double frameCost = 0.0;
|
||||||
double cacheTimeout = 0.5;
|
double cacheTimeout = 0.5;
|
||||||
bool resizing = false;
|
bool resizing = false;
|
||||||
|
// renderPending asks the engine for a new frame after a resize pause,
|
||||||
|
// presentPending marks a buffer the compositor has not taken yet and
|
||||||
|
// frameDone a frame callback that already fired. frameOnCallback says
|
||||||
|
// that pacing follows those callbacks rather than the wall clock.
|
||||||
bool renderPending = true;
|
bool renderPending = true;
|
||||||
bool presentPending = true;
|
bool presentPending = true;
|
||||||
double lastPresent = 0.0;
|
double lastPresent = 0.0;
|
||||||
|
|
@ -173,7 +178,6 @@ class WaylandWindow : public Window {
|
||||||
|
|
||||||
void makeContentOpaque(int x, int y, int width, int height);
|
void makeContentOpaque(int x, int y, int width, int height);
|
||||||
|
|
||||||
|
|
||||||
const std::vector<DecorationButtonLayout>& getDecorationButtons() const
|
const std::vector<DecorationButtonLayout>& getDecorationButtons() const
|
||||||
override;
|
override;
|
||||||
|
|
||||||
|
|
@ -197,11 +201,10 @@ class WaylandWindow : public Window {
|
||||||
void initStretchRenderer();
|
void initStretchRenderer();
|
||||||
void resizeCache(int width, int height);
|
void resizeCache(int width, int height);
|
||||||
void cacheContent();
|
void cacheContent();
|
||||||
void drawStretched();
|
|
||||||
void enableOwnDecorations();
|
void enableOwnDecorations();
|
||||||
void disableOwnDecorations();
|
void disableOwnDecorations();
|
||||||
bool barVisible() const;
|
bool barVisible() const;
|
||||||
int barButtonAt(double x, double y) const;
|
int barButtonAt(double x, double y) const;
|
||||||
uint32_t barEdgeAt(double x, double y) const;
|
uint32_t barEdgeAt(double x, double y) const;
|
||||||
static CursorShape edgeCursor(uint32_t edges);
|
static CursorShape edgeCursor(uint32_t edges);
|
||||||
uint32_t pointerEdges() const;
|
uint32_t pointerEdges() const;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue