Parcourir la source

GTK dark titlebar

Set X11 Window Property for GTK darker titlebar. This pure cosmetic
patch makes the titlebar less intrusive when using the player in
windowed mode.

Plex-CLA-1.0-signed-off-by: Max Resch <resch.max@gmail.com>
Max Resch il y a 6 ans
Parent
commit
7997181415
1 fichiers modifiés avec 21 ajouts et 0 suppressions
  1. 21 0
      src/ui/KonvergoWindow.cpp

+ 21 - 0
src/ui/KonvergoWindow.cpp

@@ -21,6 +21,11 @@
 #include "Globals.h"
 #include "EventFilter.h"
 
+#ifdef Q_OS_UNIX
+#include <QX11Info>
+#include <X11/Xlib.h> 
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 class ScopedDecrementer
 {
@@ -67,6 +72,22 @@ KonvergoWindow::KonvergoWindow(QWindow* parent) :
 #else
   setColor(QColor("#000000"));
 #endif
+ 
+#ifdef Q_OS_UNIX
+  // On Gnome show a darker title bar
+  if (QX11Info::isPlatformX11())
+  {
+    Display* dpy = QX11Info::display();
+    if (dpy)
+    {
+      WId win = winId();
+      XChangeProperty(dpy, win,
+                      XInternAtom(dpy, "_GTK_THEME_VARIANT", false),
+                      XInternAtom(dpy, "UTF8_STRING", false),
+                      8, PropModeReplace, (unsigned char *) "dark", 4);
+    }
+  }
+#endif
 
   QRect loadedGeo = loadGeometry();