Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White titlebar in dark mode [Windows 11] #5661

Open
cmd05 opened this issue May 5, 2024 · 1 comment
Open

White titlebar in dark mode [Windows 11] #5661

cmd05 opened this issue May 5, 2024 · 1 comment
Labels

Comments

@cmd05
Copy link

cmd05 commented May 5, 2024

Operating System

Windows

(Linux only) Distribution

No response

(Linux only) Desktop Environment

No response

(Linux Only) Display Server

None

Installation Method

Release Binaries

Xournal++ Version

1.2.2+dev

libgtk Version

3.24.39

Bug Description

I have enabled dark mode on Xournal++ on Windows 11, however the titlebar is a white color, which can be pretty annoying.

image

This answer provides an insight on how this is possible. I got as far as getting the win32 handle from GDK (reference) and calling DwmSetWindowAttribute on it.

#include <gdk/gdkwin32.h>
#include <dwmapi.h>

GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(GTK_WINDOW(getWindow())));
HWND wnd = static_cast<HWND>(GDK_WINDOW_HWND(gdk_window)); // returns an HGDIOBJ by default

// use immersive dark mode
BOOL USE_DARK_MODE = true;
BOOL SET_IMMERSIVE_DARK_MODE_SUCCESS = SUCCEEDED(DwmSetWindowAttribute(
    wnd, DWMWINDOWATTRIBUTE::DWMWA_USE_IMMERSIVE_DARK_MODE,
    &USE_DARK_MODE, sizeof(USE_DARK_MODE)));

However when running this I got a segmentation fault, and couldn't get any further. Tried this with changing the caption color too, but got the same error. Hope that this gets fixed. I'm loving the experience with the app so far.

Expected Behaviour

The titlebar should have a dark color or a themed color like the windows explorer titlebar.

Steps to Reproduce

Launch Xournal++ in Dark Mode

Additional Context

Windows 11 (Dark Mode)

@cmd05 cmd05 added the bug label May 5, 2024
@cmd05
Copy link
Author

cmd05 commented May 10, 2024

I tried reproducing this with a standalone GTK window, and I am getting the same error. Perhaps its some bug with GTK, or someone who knows how to use the win32 handle can help out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant