mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-22 05:19:48 +01:00
lockSurface: fix dynamic output mode and scale updates (#462)
* lockSurface: reload widgets on output change * lockSurface: only configure when scale actually changed * lockSurface: enable fsv1 per default for all compositors
This commit is contained in:
parent
9393a3e94d
commit
f673759d01
2 changed files with 17 additions and 7 deletions
|
@ -16,10 +16,12 @@ static const ext_session_lock_surface_v1_listener lockListener = {
|
|||
|
||||
static void handlePreferredScale(void* data, wp_fractional_scale_v1* wp_fractional_scale_v1, uint32_t scale) {
|
||||
const auto PSURF = (CSessionLockSurface*)data;
|
||||
const bool SAMESCALE = PSURF->fractionalScale == scale / 120.0;
|
||||
PSURF->fractionalScale = scale / 120.0;
|
||||
|
||||
Debug::log(LOG, "Got fractional scale: {}", PSURF->fractionalScale);
|
||||
|
||||
if (PSURF->readyForFrame)
|
||||
if (!SAMESCALE && PSURF->readyForFrame)
|
||||
PSURF->onScaleUpdate();
|
||||
}
|
||||
|
||||
|
@ -55,8 +57,7 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
|
|||
}
|
||||
|
||||
const auto PFRACTIONALSCALING = (Hyprlang::INT* const*)g_pConfigManager->getValuePtr("general:fractional_scaling");
|
||||
const auto ENABLE_FSV1 = **PFRACTIONALSCALING == 1 ||
|
||||
/* auto */ (**PFRACTIONALSCALING == 2 && (g_pHyprlock->m_sCurrentDesktop == "Hyprland" || g_pHyprlock->m_sCurrentDesktop == "niri"));
|
||||
const auto ENABLE_FSV1 = **PFRACTIONALSCALING == 1 || /* auto enable */ (**PFRACTIONALSCALING == 2);
|
||||
const auto PFRACTIONALMGR = g_pHyprlock->getFractionalMgr();
|
||||
const auto PVIEWPORTER = g_pHyprlock->getViewporter();
|
||||
|
||||
|
@ -87,9 +88,12 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
|
|||
Debug::log(LOG, "configure with serial {}", serial_);
|
||||
|
||||
const bool SAMESERIAL = serial == serial_;
|
||||
const bool SAMESIZE = logicalSize == size_;
|
||||
const bool SAMESCALE = appliedScale == fractionalScale;
|
||||
|
||||
serial = serial_;
|
||||
logicalSize = size_;
|
||||
appliedScale = fractionalScale;
|
||||
|
||||
if (fractional) {
|
||||
size = (size_ * fractionalScale).floor();
|
||||
|
@ -127,6 +131,11 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) {
|
|||
}
|
||||
}
|
||||
|
||||
if (readyForFrame && !(SAMESIZE && SAMESCALE)) {
|
||||
g_pRenderer->removeWidgetsFor(this);
|
||||
Debug::log(LOG, "Reloading widgets");
|
||||
}
|
||||
|
||||
readyForFrame = true;
|
||||
|
||||
render();
|
||||
|
|
|
@ -34,6 +34,7 @@ class CSessionLockSurface {
|
|||
wl_egl_window* eglWindow = nullptr;
|
||||
Vector2D size;
|
||||
Vector2D logicalSize;
|
||||
float appliedScale;
|
||||
EGLSurface eglSurface = nullptr;
|
||||
wp_fractional_scale_v1* fractional = nullptr;
|
||||
wp_viewport* viewport = nullptr;
|
||||
|
|
Loading…
Reference in a new issue