mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2024-11-16 22:25:59 +01:00
fix crash when XCURSOR_SIZE environment variable is set incorrectly
This commit is contained in:
parent
ab85578dce
commit
8e544370d9
1 changed files with 11 additions and 6 deletions
|
@ -136,8 +136,13 @@ void CHyprpaper::recheckMonitor(SMonitor* pMonitor) {
|
|||
zwlr_layer_surface_v1_ack_configure(pMonitor->pCurrentLayerSurface->pLayerSurface, pMonitor->configureSerial);
|
||||
|
||||
int XCURSOR_SIZE = 24;
|
||||
if (getenv("XCURSOR_SIZE")) {
|
||||
XCURSOR_SIZE = std::stoi(getenv("XCURSOR_SIZE"));
|
||||
if (getenv("XCURSOR_SIZE") != NULL) {
|
||||
char *endptr;
|
||||
XCURSOR_SIZE = strtol(getenv("XCURSOR_SIZE"), &endptr, 10);
|
||||
if (*endptr || XCURSOR_SIZE <= 0) {
|
||||
Debug::log(WARN, "XCURSOR_SIZE environment variable is set incorrectly");
|
||||
XCURSOR_SIZE = 24;
|
||||
}
|
||||
}
|
||||
|
||||
pMonitor->pCurrentLayerSurface->pCursorImg = wl_cursor_theme_get_cursor(wl_cursor_theme_load(getenv("XCURSOR_THEME"), XCURSOR_SIZE * pMonitor->scale, m_sSHM), "left_ptr")->images[0];
|
||||
|
@ -233,9 +238,9 @@ void CHyprpaper::clearWallpaperFromMonitor(const std::string& monname) {
|
|||
|
||||
if (it != m_mMonitorActiveWallpaperTargets.end())
|
||||
m_mMonitorActiveWallpaperTargets.erase(it);
|
||||
|
||||
|
||||
if (PMONITOR->pCurrentLayerSurface) {
|
||||
|
||||
|
||||
PMONITOR->pCurrentLayerSurface = nullptr;
|
||||
|
||||
PMONITOR->wantsACK = false;
|
||||
|
@ -256,7 +261,7 @@ void CHyprpaper::ensureMonitorHasActiveWallpaper(SMonitor* pMonitor) {
|
|||
it = m_mMonitorActiveWallpaperTargets.find(pMonitor);
|
||||
}
|
||||
|
||||
if (it->second)
|
||||
if (it->second)
|
||||
return; // has
|
||||
|
||||
// get the target
|
||||
|
@ -296,7 +301,7 @@ void CHyprpaper::ensureMonitorHasActiveWallpaper(SMonitor* pMonitor) {
|
|||
// create it for thy if it doesnt have
|
||||
if (!pMonitor->pCurrentLayerSurface)
|
||||
createLSForMonitor(pMonitor);
|
||||
else
|
||||
else
|
||||
pMonitor->wantsReload = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue