mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-02 21:16:07 +02:00
Darker title bar
This commit is contained in:
@@ -37,7 +37,7 @@ namespace VRCX
|
|||||||
PersistSessionCookies = true,
|
PersistSessionCookies = true,
|
||||||
UserAgent = Program.Version,
|
UserAgent = Program.Version,
|
||||||
BrowserSubprocessPath = Environment.ProcessPath,
|
BrowserSubprocessPath = Environment.ProcessPath,
|
||||||
BackgroundColor = 0xFF101010
|
BackgroundColor = 0xFF0A0A0A
|
||||||
};
|
};
|
||||||
|
|
||||||
cefSettings.RegisterScheme(new CefCustomScheme
|
cefSettings.RegisterScheme(new CefCustomScheme
|
||||||
|
|||||||
@@ -78,19 +78,30 @@ namespace VRCX
|
|||||||
//Set the theme of the window
|
//Set the theme of the window
|
||||||
SetThemeToGlobal(form.Handle);
|
SetThemeToGlobal(form.Handle);
|
||||||
|
|
||||||
//Change opacity to foce full redraw
|
//Change opacity to force full redraw
|
||||||
form.Opacity = 0.99999;
|
form.Opacity = 0.99999;
|
||||||
form.Opacity = 1;
|
form.Opacity = 1;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
|
||||||
|
private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
|
||||||
|
private const int DWMWA_CAPTION_COLOR = 35;
|
||||||
|
|
||||||
private static void SetThemeToGlobal(IntPtr handle)
|
private static void SetThemeToGlobal(IntPtr handle)
|
||||||
{
|
{
|
||||||
|
int whiteColor = 0xFFFFFF;
|
||||||
|
int blackColor = 0x000000;
|
||||||
if (GetTheme(handle) != currentTheme)
|
if (GetTheme(handle) != currentTheme)
|
||||||
{
|
{
|
||||||
if (PInvoke.DwmSetWindowAttribute(handle, 19, new[] { currentTheme }, 4) != 0)
|
if (PInvoke.DwmSetWindowAttribute(handle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, ref currentTheme, sizeof(int)) != 0)
|
||||||
PInvoke.DwmSetWindowAttribute(handle, 20, new[] { currentTheme }, 4);
|
PInvoke.DwmSetWindowAttribute(handle, DWMWA_USE_IMMERSIVE_DARK_MODE, ref currentTheme, sizeof(int));
|
||||||
|
|
||||||
|
if (currentTheme == 1)
|
||||||
|
PInvoke.DwmSetWindowAttribute(handle, DWMWA_CAPTION_COLOR, ref blackColor, sizeof(int));
|
||||||
|
else
|
||||||
|
PInvoke.DwmSetWindowAttribute(handle, DWMWA_CAPTION_COLOR, ref whiteColor, sizeof(int));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +157,7 @@ namespace VRCX
|
|||||||
internal static class PInvoke
|
internal static class PInvoke
|
||||||
{
|
{
|
||||||
[DllImport("DwmApi")]
|
[DllImport("DwmApi")]
|
||||||
internal static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, int[] pvAttribute, int cbAttribute);
|
internal static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, ref int pvAttribute, int cbAttribute);
|
||||||
|
|
||||||
[DllImport("DwmApi")]
|
[DllImport("DwmApi")]
|
||||||
internal static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, IntPtr pvAttribute, int cbAttribute);
|
internal static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, IntPtr pvAttribute, int cbAttribute);
|
||||||
|
|||||||
Reference in New Issue
Block a user