Fri, 15 Jan 2021 01:17:42 -0600
Remove some dead meson code
Testing Done:
None, it's dead code.
Reviewed at https://reviews.imfreedom.org/r/433/
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
40592
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
40592
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
20 | * along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
40592
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
22 | |
|
40695
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
23 | #include "pidgin/pidginstylecontext.h" |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | /* Assume light mode */ |
|
40592
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
26 | static gboolean dark_mode_have_cache = FALSE; |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
27 | static gboolean dark_mode_cached_value = FALSE; |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
40695
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
29 | /****************************************************************************** |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
30 | * Public API |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
31 | *****************************************************************************/ |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | gboolean |
|
40695
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
33 | pidgin_style_context_is_dark(GtkStyleContext *context) { |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
34 | GdkRGBA bg; |
|
40592
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
35 | gdouble luminance = 0.0; |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
40695
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
37 | if(context == NULL) { |
|
40592
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
38 | if(dark_mode_have_cache) { |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
39 | return dark_mode_cached_value; |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
40 | } |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
41 | |
|
40695
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
42 | context = gtk_style_context_new(); |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
43 | } else { |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
44 | g_object_ref(G_OBJECT(context)); |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | } |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | |
|
40695
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
47 | gtk_style_context_get(context, GTK_STATE_FLAG_NORMAL, |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
48 | GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &bg, |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
49 | NULL); |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
50 | g_object_unref(G_OBJECT(context)); |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | |
|
40592
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
52 | /* magic values are taken from https://en.wikipedia.org/wiki/Luma_(video) |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
53 | * Rec._601_luma_versus_Rec._709_luma_coefficients. |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
54 | */ |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
55 | luminance = (0.299 * bg.red) + (0.587 * bg.green) + (0.114 * bg.blue); |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | |
|
40592
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
57 | dark_mode_cached_value = (luminance < 0x7FFF); |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
58 | dark_mode_have_cache = TRUE; |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
59 | |
|
559881c7bf92
Rename gtkstyle.[ch] to pidginstyle.[ch] and fix up the dark mode check.
Gary Kramlich <grim@reaperworld.com>
parents:
39277
diff
changeset
|
60 | return dark_mode_cached_value; |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | } |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | void |
|
40695
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
64 | pidgin_style_context_adjust_contrast(GtkStyleContext *context, GdkRGBA *rgba) { |
|
df2674f2d982
Rename the pidgin_style_* api to pidgin_style_context_*
Gary Kramlich <grim@reaperworld.com>
parents:
40592
diff
changeset
|
65 | if(pidgin_style_context_is_dark(context)) { |
|
39277
68c17ba18f33
pidgin: Fix GdkColor vs GdkRGBA -Wincompatible-pointer-types warnings
Mike Ruprecht <cmaiku@gmail.com>
parents:
38699
diff
changeset
|
66 | gdouble h, s, v; |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | |
|
39277
68c17ba18f33
pidgin: Fix GdkColor vs GdkRGBA -Wincompatible-pointer-types warnings
Mike Ruprecht <cmaiku@gmail.com>
parents:
38699
diff
changeset
|
68 | gtk_rgb_to_hsv(rgba->red, rgba->green, rgba->blue, &h, &s, &v); |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | v += 0.3; |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | v = v > 1.0 ? 1.0 : v; |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | s = 0.7; |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
39277
68c17ba18f33
pidgin: Fix GdkColor vs GdkRGBA -Wincompatible-pointer-types warnings
Mike Ruprecht <cmaiku@gmail.com>
parents:
38699
diff
changeset
|
74 | gtk_hsv_to_rgb(h, s, v, &rgba->red, &rgba->green, &rgba->blue); |
|
38699
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | } |
|
e7b5011e4728
Namespace the contrast stuff and move it to it's own file/namespace
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | } |