updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / unity-2d / fix-adwaita-window-buttons.patch
blob48530a04da08f77920567c0d55015b7d89364d98
1 diff -Naur unity-2d-4.12.0.orig/libunity-2d-private/src/panelstyle.cpp unity-2d-4.12.0/libunity-2d-private/src/panelstyle.cpp
2 --- unity-2d-4.12.0.orig/libunity-2d-private/src/panelstyle.cpp 2011-09-15 10:48:41.000000000 +0200
3 +++ unity-2d-4.12.0/libunity-2d-private/src/panelstyle.cpp 2011-11-27 10:53:34.804302928 +0100
4 @@ -36,6 +36,7 @@
5 #include <gtk/gtk.h>
7 static const char* METACITY_THEME_DIR = "/usr/share/themes/%1/metacity-1";
8 +static const char* UNITY_THEME_DIR = "/usr/share/unity/4";
10 class PanelStylePrivate
12 @@ -119,6 +120,42 @@
13 return QPixmap(path);
16 + QPixmap windowButtonPixmapFromDashTheme(PanelStyle::WindowButtonType type, PanelStyle::WindowButtonState state)
17 + {
18 + QString dir = QString(UNITY_THEME_DIR);
20 + QString typeString, stateString;
21 + switch (type) {
22 + case PanelStyle::CloseWindowButton:
23 + typeString = "close_dash";
24 + break;
25 + case PanelStyle::MinimizeWindowButton:
26 + typeString = "minimize_dash";
27 + break;
28 + case PanelStyle::UnmaximizeWindowButton:
29 + typeString = "unmaximize_dash";
30 + break;
31 + }
33 + switch (state) {
34 + case PanelStyle::NormalState:
35 + stateString = "";
36 + break;
37 + case PanelStyle::PrelightState:
38 + stateString = "_prelight";
39 + break;
40 + case PanelStyle::PressedState:
41 + stateString = "_pressed";
42 + break;
43 + }
45 + QString path = QString("%1/%2%3.png")
46 + .arg(dir)
47 + .arg(typeString)
48 + .arg(stateString);
49 + return QPixmap(path);
50 + }
52 QPixmap genericWindowButtonPixmap(PanelStyle::WindowButtonType type, PanelStyle::WindowButtonState state)
54 QStyle::StandardPixmap standardIcon;
55 @@ -194,6 +231,8 @@
56 // fallback to generic button pixmaps.
57 if (d->m_themeName == "Ambiance" || d->m_themeName == "Radiance") {
58 return d->windowButtonPixmapFromWMTheme(type, state);
59 + } else if (d->m_themeName == "Adwaita") {
60 + return d->windowButtonPixmapFromDashTheme(type, state);
61 } else {
62 return d->genericWindowButtonPixmap(type, state);