mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 23:05:58 +01:00
renderer: Update splash text properties to be configurable (#4707)
* Update splash text properties to be configurable The splash text's font and color properties have been updated to be configurable. This change includes adding new configuration values for the splash screen color and font. The rendering of the splash screen is also adjusted to use these new config values, allowing for easy customization of the splash text appearance. * Updated to use Hyprlang config manager
This commit is contained in:
parent
fc5ca391ad
commit
dad8ffd576
2 changed files with 11 additions and 3 deletions
|
@ -320,6 +320,8 @@ CConfigManager::CConfigManager() {
|
||||||
|
|
||||||
m_pConfig->addConfigValue("misc:disable_hyprland_logo", {0L});
|
m_pConfig->addConfigValue("misc:disable_hyprland_logo", {0L});
|
||||||
m_pConfig->addConfigValue("misc:disable_splash_rendering", {0L});
|
m_pConfig->addConfigValue("misc:disable_splash_rendering", {0L});
|
||||||
|
m_pConfig->addConfigValue("misc:col.splash", {0xffffffffL});
|
||||||
|
m_pConfig->addConfigValue("misc:splash_font_family", {"Sans"});
|
||||||
m_pConfig->addConfigValue("misc:force_default_wallpaper", {-1L});
|
m_pConfig->addConfigValue("misc:force_default_wallpaper", {-1L});
|
||||||
m_pConfig->addConfigValue("misc:vfr", {1L});
|
m_pConfig->addConfigValue("misc:vfr", {1L});
|
||||||
m_pConfig->addConfigValue("misc:vrr", {0L});
|
m_pConfig->addConfigValue("misc:vrr", {0L});
|
||||||
|
|
|
@ -1912,12 +1912,18 @@ void CHyprOpenGLImpl::renderMirrored() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const CAIROSURFACE, double offsetY, const Vector2D& size) {
|
void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const CAIROSURFACE, double offsetY, const Vector2D& size) {
|
||||||
cairo_select_font_face(CAIRO, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
static auto* const PSPLASHCOLOR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:col.splash");
|
||||||
|
|
||||||
|
static auto* const PSPLASHFONT = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("misc:splash_font_family");
|
||||||
|
|
||||||
|
cairo_select_font_face(CAIRO, *PSPLASHFONT, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||||
|
|
||||||
const auto FONTSIZE = (int)(size.y / 76);
|
const auto FONTSIZE = (int)(size.y / 76);
|
||||||
cairo_set_font_size(CAIRO, FONTSIZE);
|
cairo_set_font_size(CAIRO, FONTSIZE);
|
||||||
|
|
||||||
cairo_set_source_rgba(CAIRO, 1.0, 1.0, 1.0, 0.32);
|
const auto COLOR = CColor(**PSPLASHCOLOR);
|
||||||
|
|
||||||
|
cairo_set_source_rgba(CAIRO, COLOR.r, COLOR.g, COLOR.b, COLOR.a);
|
||||||
|
|
||||||
cairo_text_extents_t textExtents;
|
cairo_text_extents_t textExtents;
|
||||||
cairo_text_extents(CAIRO, g_pCompositor->m_szCurrentSplash.c_str(), &textExtents);
|
cairo_text_extents(CAIRO, g_pCompositor->m_szCurrentSplash.c_str(), &textExtents);
|
||||||
|
@ -2013,7 +2019,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
|
||||||
cairo_set_source_surface(CAIRO, CAIROISURFACE, 0, 0);
|
cairo_set_source_surface(CAIRO, CAIROISURFACE, 0, 0);
|
||||||
cairo_paint(CAIRO);
|
cairo_paint(CAIRO);
|
||||||
|
|
||||||
if (!*PNOSPLASH)
|
if (!**PNOSPLASH)
|
||||||
renderSplash(CAIRO, CAIROSURFACE, origin.y * WPRATIO / MONRATIO * scale, IMAGESIZE);
|
renderSplash(CAIRO, CAIROSURFACE, origin.y * WPRATIO / MONRATIO * scale, IMAGESIZE);
|
||||||
|
|
||||||
cairo_surface_flush(CAIROSURFACE);
|
cairo_surface_flush(CAIROSURFACE);
|
||||||
|
|
Loading…
Reference in a new issue