Skip to content

Commit 0127370

Browse files
committed
nvidia and stuff fixes
1 parent 06b07c5 commit 0127370

File tree

2 files changed

+14
-31
lines changed

2 files changed

+14
-31
lines changed

src/core/LockSurface.cpp

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,8 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
4848
wp_fractional_scale_v1_add_listener(fractional, &fsListener, this);
4949
viewport = wp_viewporter_get_viewport(g_pHyprlock->getViewporter(), surface);
5050
wl_display_roundtrip(g_pHyprlock->getDisplay());
51-
} else {
51+
} else
5252
Debug::log(LOG, "No fractional-scale support! Oops, won't be able to scale!");
53-
}
54-
55-
configure(output->size, 0);
56-
g_pRenderer->renderLock(*this);
5753

5854
lockSurface = ext_session_lock_v1_get_lock_surface(g_pHyprlock->getSessionLock(), surface, output->output);
5955

@@ -62,21 +58,21 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
6258
exit(1);
6359
}
6460

61+
configure(output->size, {});
62+
6563
ext_session_lock_surface_v1_add_listener(lockSurface, &lockListener, this);
66-
wl_display_roundtrip(g_pHyprlock->getDisplay());
67-
wl_display_flush(g_pHyprlock->getDisplay());
6864
}
6965

70-
void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
71-
Debug::log(LOG, "configure with serial {}", serial_);
66+
void CSessionLockSurface::configure(const Vector2D& size_, std::optional<uint32_t> serial_) {
67+
Debug::log(LOG, "configure with serial {}", serial_.value_or(0));
7268

73-
serial = serial_;
69+
serial = serial_.value_or(0);
7470
size = (size_ * fractionalScale).floor();
7571
logicalSize = size_;
7672

7773
Debug::log(LOG, "Configuring surface for logical {} and pixel {}", logicalSize, size);
7874

79-
if (serial != 0)
75+
if (serial_.has_value())
8076
ext_session_lock_surface_v1_ack_configure(lockSurface, serial);
8177

8278
if (fractional)
@@ -95,7 +91,7 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
9591
exit(1);
9692
}
9793

98-
if (serial == 0)
94+
if (!eglSurface)
9995
eglSurface = g_pEGL->eglCreatePlatformWindowSurfaceEXT(g_pEGL->eglDisplay, g_pEGL->eglConfig, eglWindow, nullptr);
10096

10197
if (!eglSurface) {
@@ -105,18 +101,10 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
105101

106102
readyForFrame = true;
107103

108-
if (serial != 0)
104+
if (serial_.has_value())
109105
render();
110-
111-
if (fractional)
112-
wp_viewport_set_destination(viewport, logicalSize.x, logicalSize.y);
113-
114-
wl_surface_set_buffer_scale(surface, 1);
115-
wl_surface_damage_buffer(surface, 0, 0, 0xFFFF, 0xFFFF);
116-
117-
wl_surface_commit(surface);
118-
wl_display_roundtrip(g_pHyprlock->getDisplay());
119-
wl_display_flush(g_pHyprlock->getDisplay());
106+
else
107+
eglSwapBuffers(g_pEGL->eglDisplay, eglSurface);
120108
}
121109

122110
static void handleDone(void* data, wl_callback* wl_callback, uint32_t callback_data) {
@@ -138,14 +126,8 @@ void CSessionLockSurface::render() {
138126
const auto FEEDBACK = g_pRenderer->renderLock(*this);
139127
frameCallback = wl_surface_frame(surface);
140128
wl_callback_add_listener(frameCallback, &callbackListener, this);
141-
eglSwapBuffers(g_pEGL->eglDisplay, eglSurface);
142129

143-
if (fractional)
144-
wp_viewport_set_destination(viewport, logicalSize.x, logicalSize.y);
145-
146-
wl_surface_damage_buffer(surface, 0, 0, 0xFFFF, 0xFFFF);
147-
wl_surface_set_buffer_scale(surface, 1);
148-
wl_surface_commit(surface);
130+
eglSwapBuffers(g_pEGL->eglDisplay, eglSurface);
149131

150132
needsFrame = FEEDBACK.needsFrame;
151133
}

src/core/LockSurface.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <wayland-egl.h>
88
#include "../helpers/Vector2D.hpp"
99
#include <EGL/egl.h>
10+
#include <optional>
1011

1112
class COutput;
1213
class CRenderer;
@@ -16,7 +17,7 @@ class CSessionLockSurface {
1617
CSessionLockSurface(COutput* output);
1718
~CSessionLockSurface();
1819

19-
void configure(const Vector2D& size, uint32_t serial);
20+
void configure(const Vector2D& size, std::optional<uint32_t> serial);
2021

2122
bool readyForFrame = false;
2223

0 commit comments

Comments
 (0)