forked from QubesOS/qubes-desktop-linux-xfce4-xfwm4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0006-Qubes-decoration-title-colors.patch
121 lines (111 loc) · 4.16 KB
/
0006-Qubes-decoration-title-colors.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
From 97766a511b020482874ea68bd3d18fa20963bb71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?=
Date: Sat, 16 May 2020 11:45:13 +0200
Subject: [PATCH] Qubes decoration: title colors
Add dark and light title colors
When overriding decoration colors, provide our own title colors as
well. Decide based on HSV whether the title should be dark or light.
Skip title shadow (except for Dom0 where we don't modify it).
This fixes black-on-black titles (QubesOS/qubes-issues#3854), but
also improves the appearance of other titles, especially when the
window is inactive. Before, the title color depended on XFCE theme,
which often looked bad combined with Qubes' title bar (ugly colors,
or similar brightness).
Authors:
@pwmarcz
Original work done in:
- QubesOS/qubes-desktop-linux-xfce4-xfwm4
---
src/frame.c | 5 +++--
src/screen.h | 2 ++
src/settings.c | 19 +++++++++++++++++++
src/settings.h | 11 +++++++++++
4 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/src/frame.c b/src/frame.c
index dee79071c..9f4ed0d05 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -320,7 +320,8 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap *
frameFillTitlePixmap (c, state, TITLE_3, x, w3, top_height, title_pm, top_pm);
title_x = hoffset + x;
cairo_translate (cr, title_x, title_y);
- if (screen_info->params->title_shadow[state])
+ if (c->qubes_label_color == QUBES_LABEL_DOM0 &&
+ screen_info->params->title_shadow[state])
{
gdk_cairo_set_source_rgba (cr, &screen_info->title_shadow_colors[state]);
if (screen_info->params->title_shadow[state] == TITLE_SHADOW_UNDER)
@@ -342,7 +343,7 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap *
cairo_translate (cr, 0, -1);
}
}
- gdk_cairo_set_source_rgba (cr, &screen_info->title_colors[state]);
+ gdk_cairo_set_source_rgba (cr, &decoration->title_colors[state]);
pango_cairo_show_layout (cr, layout);
x = x + w3;
}
diff --git a/src/screen.h b/src/screen.h
index cd60f6e3d..58af7af25 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -96,6 +96,8 @@ struct _Decoration
xfwmPixmap sides[SIDE_COUNT][2];
xfwmPixmap title[TITLE_COUNT][2];
xfwmPixmap top[TITLE_COUNT][2];
+
+ GdkRGBA title_colors[2];
};
struct _ScreenInfo
diff --git a/src/settings.c b/src/settings.c
index 56428f021..3f7452878 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -398,6 +398,25 @@ Decoration *getDecorationForColor(ScreenInfo *screen_info, guint32 color)
xfwmPixmapLoad (screen_info, &decoration->top[i][INACTIVE], theme, imagename, screen_info->colsym, color);
}
+ if (color == QUBES_LABEL_DOM0) {
+ decoration->title_colors[0] = screen_info->title_colors[0];
+ decoration->title_colors[1] = screen_info->title_colors[1];
+ } else {
+ gdouble h, s, v;
+ gtk_rgb_to_hsv(
+ 1.0*((color & 0xFF0000) >> 16)/0xFF,
+ 1.0*((color & 0x00FF00) >> 8)/0xFF,
+ 1.0*((color & 0x0000FF) >> 0)/0xFF,
+ &h, &s, &v);
+ if (v < 0.2) {
+ decoration->title_colors[0] = qubes_title_colors_light[0];
+ decoration->title_colors[1] = qubes_title_colors_light[1];
+ } else {
+ decoration->title_colors[0] = qubes_title_colors_dark[0];
+ decoration->title_colors[1] = qubes_title_colors_dark[1];
+ }
+ }
+
g_hash_table_insert(screen_info->decoration, GINT_TO_POINTER(color), decoration);
return decoration;
}
diff --git a/src/settings.h b/src/settings.h
index 9f4000f6a..6ed534186 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -190,6 +190,17 @@ static const guint qubes_label_colors[] = {
0x000000, /* QUBES_LABEL_BLACK */
};
+/* Title colors: active, inactive */
+static const GdkRGBA qubes_title_colors_dark[2] = {
+ { 0, 0, 0, 1 },
+ { 0.3, 0.3, 0.3, 1},
+};
+
+static const GdkRGBA qubes_title_colors_light[2] = {
+ { 0.8, 0.8, 0.8, 1 },
+ { 0.5, 0.5, 0.5, 1 },
+};
+
struct _Settings
{
gchar *option;
--
2.25.4