@@ -48,12 +48,8 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
48
48
wp_fractional_scale_v1_add_listener (fractional, &fsListener, this );
49
49
viewport = wp_viewporter_get_viewport (g_pHyprlock->getViewporter (), surface);
50
50
wl_display_roundtrip (g_pHyprlock->getDisplay ());
51
- } else {
51
+ } else
52
52
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 );
57
53
58
54
lockSurface = ext_session_lock_v1_get_lock_surface (g_pHyprlock->getSessionLock (), surface, output->output );
59
55
@@ -62,21 +58,21 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
62
58
exit (1 );
63
59
}
64
60
61
+ configure (output->size , {});
62
+
65
63
ext_session_lock_surface_v1_add_listener (lockSurface, &lockListener, this );
66
- wl_display_roundtrip (g_pHyprlock->getDisplay ());
67
- wl_display_flush (g_pHyprlock->getDisplay ());
68
64
}
69
65
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 ) );
72
68
73
- serial = serial_;
69
+ serial = serial_. value_or ( 0 ) ;
74
70
size = (size_ * fractionalScale).floor ();
75
71
logicalSize = size_;
76
72
77
73
Debug::log (LOG, " Configuring surface for logical {} and pixel {}" , logicalSize, size);
78
74
79
- if (serial != 0 )
75
+ if (serial_. has_value () )
80
76
ext_session_lock_surface_v1_ack_configure (lockSurface, serial);
81
77
82
78
if (fractional)
@@ -95,7 +91,7 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
95
91
exit (1 );
96
92
}
97
93
98
- if (serial == 0 )
94
+ if (!eglSurface )
99
95
eglSurface = g_pEGL->eglCreatePlatformWindowSurfaceEXT (g_pEGL->eglDisplay , g_pEGL->eglConfig , eglWindow, nullptr );
100
96
101
97
if (!eglSurface) {
@@ -105,18 +101,10 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
105
101
106
102
readyForFrame = true ;
107
103
108
- if (serial != 0 )
104
+ if (serial_. has_value () )
109
105
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);
120
108
}
121
109
122
110
static void handleDone (void * data, wl_callback* wl_callback, uint32_t callback_data) {
@@ -138,14 +126,8 @@ void CSessionLockSurface::render() {
138
126
const auto FEEDBACK = g_pRenderer->renderLock (*this );
139
127
frameCallback = wl_surface_frame (surface);
140
128
wl_callback_add_listener (frameCallback, &callbackListener, this );
141
- eglSwapBuffers (g_pEGL->eglDisplay , eglSurface);
142
129
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);
149
131
150
132
needsFrame = FEEDBACK.needsFrame ;
151
133
}
0 commit comments