mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-22 13:29:48 +01:00
core: handle missing wayland protocol support (#408)
* core: check support of wp_factional_scale_manager_v1 and wp_viewporter * core: check support of zwlr_screencopy_manager_v1
This commit is contained in:
parent
0552a1eddd
commit
43f2b7441b
4 changed files with 31 additions and 11 deletions
|
@ -53,12 +53,20 @@ CSessionLockSurface::CSessionLockSurface(COutput* output) : output(output) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
fractional = wp_fractional_scale_manager_v1_get_fractional_scale(g_pHyprlock->getFractionalMgr(), surface);
|
||||
if (fractional) {
|
||||
wp_fractional_scale_v1_add_listener(fractional, &fsListener, this);
|
||||
viewport = wp_viewporter_get_viewport(g_pHyprlock->getViewporter(), surface);
|
||||
} else
|
||||
const auto PFRACTIONALMGR = g_pHyprlock->getFractionalMgr();
|
||||
const auto PVIEWPORTER = g_pHyprlock->getViewporter();
|
||||
if (PFRACTIONALMGR && PVIEWPORTER) {
|
||||
fractional = wp_fractional_scale_manager_v1_get_fractional_scale(PFRACTIONALMGR, surface);
|
||||
if (fractional) {
|
||||
wp_fractional_scale_v1_add_listener(fractional, &fsListener, this);
|
||||
viewport = wp_viewporter_get_viewport(PVIEWPORTER, surface);
|
||||
}
|
||||
}
|
||||
|
||||
if (!PFRACTIONALMGR || !fractional)
|
||||
Debug::log(LOG, "No fractional-scale support! Oops, won't be able to scale!");
|
||||
if (!PVIEWPORTER)
|
||||
Debug::log(LOG, "No viewporter support! Oops, won't be able to scale!");
|
||||
|
||||
lockSurface = ext_session_lock_v1_get_lock_surface(g_pHyprlock->getSessionLock(), surface, output->output);
|
||||
|
||||
|
|
|
@ -12,6 +12,17 @@
|
|||
#include "../helpers/Webp.hpp"
|
||||
|
||||
CAsyncResourceGatherer::CAsyncResourceGatherer() {
|
||||
if (g_pHyprlock->getScreencopy())
|
||||
enqueueDMAFrames();
|
||||
|
||||
initialGatherThread = std::thread([this]() { this->gather(); });
|
||||
initialGatherThread.detach();
|
||||
|
||||
asyncLoopThread = std::thread([this]() { this->asyncAssetSpinLock(); });
|
||||
asyncLoopThread.detach();
|
||||
}
|
||||
|
||||
void CAsyncResourceGatherer::enqueueDMAFrames() {
|
||||
// some things can't be done async :(
|
||||
// gather background textures when needed
|
||||
|
||||
|
@ -48,12 +59,6 @@ CAsyncResourceGatherer::CAsyncResourceGatherer() {
|
|||
|
||||
dmas.emplace_back(std::make_unique<CDMAFrame>(PMONITOR));
|
||||
}
|
||||
|
||||
initialGatherThread = std::thread([this]() { this->gather(); });
|
||||
initialGatherThread.detach();
|
||||
|
||||
asyncLoopThread = std::thread([this]() { this->asyncAssetSpinLock(); });
|
||||
asyncLoopThread.detach();
|
||||
}
|
||||
|
||||
SPreloadedAsset* CAsyncResourceGatherer::getAssetByID(const std::string& id) {
|
||||
|
|
|
@ -86,4 +86,5 @@ class CAsyncResourceGatherer {
|
|||
std::unordered_map<std::string, SPreloadedAsset> assets;
|
||||
|
||||
void gather();
|
||||
void enqueueDMAFrames();
|
||||
};
|
||||
|
|
|
@ -331,6 +331,12 @@ std::vector<std::unique_ptr<IWidget>>* CRenderer::getOrCreateWidgetsFor(const CS
|
|||
if (!asyncResourceGatherer->getAssetByID(resourceID))
|
||||
resourceID = ""; // Fallback to solid color (background:color)
|
||||
}
|
||||
|
||||
if (!g_pHyprlock->getScreencopy()) {
|
||||
Debug::log(ERR, "No screencopy support! path=screenshot won't work. Falling back to background color.");
|
||||
resourceID = "";
|
||||
}
|
||||
|
||||
} else if (!PATH.empty())
|
||||
resourceID = "background:" + PATH;
|
||||
|
||||
|
|
Loading…
Reference in a new issue