@@ -39,7 +39,7 @@ static void handleGlobal(CCWlRegistry* registry, uint32_t name, const char* inte
39
39
static void handleGlobalRemove (CCWlRegistry* registry, uint32_t name) {
40
40
for (auto & m : g_pHyprpaper->m_vMonitors ) {
41
41
if (m->wayland_name == name) {
42
- Debug::log (LOG, " Destroying output %s " , m->name . c_str () );
42
+ Debug::log (LOG, " Destroying output {} " , m->name );
43
43
g_pHyprpaper->clearWallpaperFromMonitor (m->name );
44
44
std::erase_if (g_pHyprpaper->m_vMonitors , [&](const auto & other) { return other->wayland_name == name; });
45
45
return ;
@@ -139,7 +139,7 @@ void CHyprpaper::unloadWallpaper(const std::string& path) {
139
139
140
140
const auto PRELOADPATH = it->get ()->name ;
141
141
142
- Debug::log (LOG, " Unloading target %s , preload path %s " , path. c_str () , PRELOADPATH. c_str () );
142
+ Debug::log (LOG, " Unloading target {} , preload path {} " , path, PRELOADPATH);
143
143
144
144
std::filesystem::remove (PRELOADPATH);
145
145
@@ -161,7 +161,7 @@ void CHyprpaper::preloadAllWallpapersFromConfig() {
161
161
bool exists = false ;
162
162
for (auto & [ewp, cls] : m_mWallpaperTargets) {
163
163
if (ewp == wp) {
164
- Debug::log (LOG, " Ignoring request to preload %s as it already is preloaded!" , ewp. c_str () );
164
+ Debug::log (LOG, " Ignoring request to preload {} as it already is preloaded!" , ewp);
165
165
exists = true ;
166
166
break ;
167
167
}
@@ -243,14 +243,13 @@ void CHyprpaper::removeOldHyprpaperImages() {
243
243
244
244
memoryFreed += entry.file_size ();
245
245
if (!std::filesystem::remove (entry.path ()))
246
- Debug::log (LOG, " Couldn't remove %s " , entry.path ().string (). c_str ());
246
+ Debug::log (LOG, " Couldn't remove {} " , entry.path ().string ());
247
247
cleaned++;
248
248
}
249
249
}
250
250
251
- if (cleaned != 0 ) {
252
- Debug::log (LOG, " Cleaned old hyprpaper preloads (%i), removing %.1fMB" , cleaned, ((float )memoryFreed) / 1000000 .f );
253
- }
251
+ if (cleaned != 0 )
252
+ Debug::log (LOG, " Cleaned old hyprpaper preloads ({}), removing {:.1f}MB" , cleaned, ((float )memoryFreed) / 1000000 .f );
254
253
}
255
254
256
255
SMonitor* CHyprpaper::getMonitorFromName (const std::string& monname) {
@@ -294,7 +293,7 @@ void CHyprpaper::ensurePoolBuffersPresent() {
294
293
295
294
PBUFFER->target = wt.m_szPath ;
296
295
297
- Debug::log (LOG, " Buffer created for target %s , Shared Memory usage: %.1fMB " , wt.m_szPath . c_str () , PBUFFER->size / 1000000 .f );
296
+ Debug::log (LOG, " Buffer created for target {} , Shared Memory usage: {:.1f}MB " , wt.m_szPath , PBUFFER->size / 1000000 .f );
298
297
299
298
anyNewBuffers = true ;
300
299
}
@@ -308,7 +307,7 @@ void CHyprpaper::ensurePoolBuffersPresent() {
308
307
bytesUsed += bf->size ;
309
308
}
310
309
311
- Debug::log (LOG, " Total SM usage for all buffers: %.1fMB " , bytesUsed / 1000000 .f );
310
+ Debug::log (LOG, " Total SM usage for all buffers: {:.1f}MB " , bytesUsed / 1000000 .f );
312
311
}
313
312
}
314
313
@@ -398,7 +397,7 @@ void CHyprpaper::ensureMonitorHasActiveWallpaper(SMonitor* pMonitor) {
398
397
399
398
if (!it->second ) {
400
399
pMonitor->hasATarget = false ;
401
- Debug::log (WARN, " Monitor %s does not have a target! A wallpaper will not be created." , pMonitor->name . c_str () );
400
+ Debug::log (WARN, " Monitor {} does not have a target! A wallpaper will not be created." , pMonitor->name );
402
401
return ;
403
402
}
404
403
@@ -507,8 +506,8 @@ SPoolBuffer* CHyprpaper::getPoolBuffer(SMonitor* pMonitor, CWallpaperTarget* pWa
507
506
}
508
507
509
508
void CHyprpaper::renderWallpaperForMonitor (SMonitor* pMonitor) {
510
- static auto * const PRENDERSPLASH = reinterpret_cast <Hyprlang::INT* const * >(g_pConfigManager->config -> getConfigValuePtr ( " splash" )-> getDataStaticPtr () );
511
- static auto * const PSPLASHOFFSET = reinterpret_cast <Hyprlang::FLOAT* const * >(g_pConfigManager->config -> getConfigValuePtr ( " splash_offset" )-> getDataStaticPtr () );
509
+ static auto PRENDERSPLASH = Hyprlang::CSimpleConfigValue <Hyprlang::INT>(g_pConfigManager->config . get (), " splash" );
510
+ static auto PSPLASHOFFSET = Hyprlang::CSimpleConfigValue <Hyprlang::FLOAT>(g_pConfigManager->config . get (), " splash_offset" );
512
511
513
512
if (!m_mMonitorActiveWallpaperTargets[pMonitor])
514
513
recheckMonitor (pMonitor);
@@ -565,8 +564,8 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) {
565
564
origin.x = -(PWALLPAPERTARGET->m_vSize .x * scale - DIMENSIONS.x ) / 2.0 / scale;
566
565
}
567
566
568
- Debug::log (LOG, " Image data for %s: %s at [% .2f, % .2f], scale: % .2f (original image size: [%i, %i ])" , pMonitor->name . c_str () , PWALLPAPERTARGET->m_szPath . c_str () , origin.x ,
569
- origin. y , scale, (int )PWALLPAPERTARGET->m_vSize .x , (int )PWALLPAPERTARGET->m_vSize .y );
567
+ Debug::log (LOG, " Image data for {}: {} at [{: .2f}, {: .2f} ], scale: {: .2f} (original image size: [{}, {} ])" , pMonitor->name , PWALLPAPERTARGET->m_szPath , origin.x , origin. y ,
568
+ scale, (int )PWALLPAPERTARGET->m_vSize .x , (int )PWALLPAPERTARGET->m_vSize .y );
570
569
571
570
if (TILE) {
572
571
cairo_pattern_t * pattern = cairo_pattern_create_for_surface (PWALLPAPERTARGET->m_pCairoSurface ->cairo ());
@@ -579,7 +578,7 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) {
579
578
580
579
cairo_paint (PCAIRO);
581
580
582
- if (** PRENDERSPLASH && getenv (" HYPRLAND_INSTANCE_SIGNATURE" )) {
581
+ if (*PRENDERSPLASH && getenv (" HYPRLAND_INSTANCE_SIGNATURE" )) {
583
582
auto SPLASH = execAndGet (" hyprctl splash" );
584
583
SPLASH.pop_back ();
585
584
@@ -590,20 +589,20 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) {
590
589
const auto FONTSIZE = (int )(DIMENSIONS.y / 76.0 / scale);
591
590
cairo_set_font_size (PCAIRO, FONTSIZE);
592
591
593
- static auto * const PSPLASHCOLOR = reinterpret_cast <Hyprlang::INT* const * >(g_pConfigManager->config -> getConfigValuePtr ( " splash_color" )-> getDataStaticPtr () );
592
+ static auto PSPLASHCOLOR = Hyprlang::CSimpleConfigValue <Hyprlang::INT>(g_pConfigManager->config . get (), " splash_color" );
594
593
595
- Debug::log (LOG, " Splash color: %x " , * *PSPLASHCOLOR);
594
+ Debug::log (LOG, " Splash color: {:x} " , *PSPLASHCOLOR);
596
595
597
- cairo_set_source_rgba (PCAIRO, ((** PSPLASHCOLOR >> 16 ) & 0xFF ) / 255.0 , ((**PSPLASHCOLOR >> 8 ) & 0xFF ) / 255.0 , (* *PSPLASHCOLOR & 0xFF ) / 255.0 ,
598
- ((** PSPLASHCOLOR >> 24 ) & 0xFF ) / 255.0 );
596
+ cairo_set_source_rgba (PCAIRO, ((*PSPLASHCOLOR >> 16 ) & 0xFF ) / 255.0 , ((**PSPLASHCOLOR >> 8 ) & 0xFF ) / 255.0 , (*PSPLASHCOLOR & 0xFF ) / 255.0 ,
597
+ ((*PSPLASHCOLOR >> 24 ) & 0xFF ) / 255.0 );
599
598
600
599
cairo_text_extents_t textExtents;
601
600
cairo_text_extents (PCAIRO, SPLASH.c_str (), &textExtents);
602
601
603
- cairo_move_to (PCAIRO, ((DIMENSIONS.x - textExtents.width * scale) / 2.0 ) / scale, ((DIMENSIONS.y * (100 - ** PSPLASHOFFSET)) / 100 - textExtents.height * scale) / scale);
602
+ cairo_move_to (PCAIRO, ((DIMENSIONS.x - textExtents.width * scale) / 2.0 ) / scale, ((DIMENSIONS.y * (100 - *PSPLASHOFFSET)) / 100 - textExtents.height * scale) / scale);
604
603
605
- Debug::log (LOG, " Splash font size: %d , pos: % .2f, % .2f" , FONTSIZE, (DIMENSIONS.x - textExtents.width ) / 2.0 / scale,
606
- ((DIMENSIONS.y * (100 - ** PSPLASHOFFSET)) / 100 - textExtents.height * scale) / scale);
604
+ Debug::log (LOG, " Splash font size: {} , pos: {: .2f}, {: .2f} " , FONTSIZE, (DIMENSIONS.x - textExtents.width ) / 2.0 / scale,
605
+ ((DIMENSIONS.y * (100 - *PSPLASHOFFSET)) / 100 - textExtents.height * scale) / scale);
607
606
608
607
cairo_show_text (PCAIRO, SPLASH.c_str ());
609
608
@@ -623,7 +622,7 @@ void CHyprpaper::renderWallpaperForMonitor(SMonitor* pMonitor) {
623
622
pMonitor->pCurrentLayerSurface ->pSurface ->sendSetOpaqueRegion (opaqueRegion.get ());
624
623
625
624
if (pMonitor->pCurrentLayerSurface ->pFractionalScaleInfo ) {
626
- Debug::log (LOG, " Submitting viewport dest size %ix%i for %x " , static_cast <int >(std::round (pMonitor->size .x )), static_cast <int >(std::round (pMonitor->size .y )),
625
+ Debug::log (LOG, " Submitting viewport dest size {}x{} for {:x} " , static_cast <int >(std::round (pMonitor->size .x )), static_cast <int >(std::round (pMonitor->size .y )),
627
626
pMonitor->pCurrentLayerSurface );
628
627
pMonitor->pCurrentLayerSurface ->pViewport ->sendSetDestination (static_cast <int >(std::round (pMonitor->size .x )), static_cast <int >(std::round (pMonitor->size .y )));
629
628
}
0 commit comments