From 799cb39e0866b0be17367580fd08b37215d3dcdd Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 22 Mar 2019 22:29:11 +0100 Subject: [PATCH] Remove win32 themeing support It was unused through all of GTK 3, so it is not worth supporting. The best Windows themes do not make use of it at all. --- docs/reference/gtk/css-overview.xml | 18 +- docs/reference/gtk/css-properties.xml | 14 - gtk/gen-gtk-gresources-xml.py | 5 - gtk/gtkcsscolorvalue.c | 130 +- gtk/gtkcsscolorvalueprivate.h | 2 - gtk/gtkcssimage.c | 2 - gtk/gtkcssimagewin32.c | 263 --- gtk/gtkcssimagewin32private.h | 64 - gtk/gtkcssnumbervalue.c | 18 +- gtk/gtkcsswin32sizevalue.c | 407 ----- gtk/gtkcsswin32sizevalueprivate.h | 32 - gtk/gtkwin32draw.c | 803 --------- gtk/gtkwin32drawprivate.h | 181 --- gtk/gtkwin32theme.c | 518 ------ gtk/gtkwin32themeprivate.h | 70 - gtk/meson.build | 5 - gtk/theme/win32/gtk-win32-base.css | 1438 ----------------- gtk/theme/win32/gtk.css | 251 --- .../background-win32-color-is-no-error.css | 3 - ...background-win32-color-is-no-error.ref.css | 9 - testsuite/css/parser/meson.build | 2 - 21 files changed, 5 insertions(+), 4230 deletions(-) delete mode 100644 gtk/gtkcssimagewin32.c delete mode 100644 gtk/gtkcssimagewin32private.h delete mode 100644 gtk/gtkcsswin32sizevalue.c delete mode 100644 gtk/gtkcsswin32sizevalueprivate.h delete mode 100644 gtk/gtkwin32draw.c delete mode 100644 gtk/gtkwin32drawprivate.h delete mode 100644 gtk/gtkwin32theme.c delete mode 100644 gtk/gtkwin32themeprivate.h delete mode 100644 gtk/theme/win32/gtk-win32-base.css delete mode 100644 gtk/theme/win32/gtk.css delete mode 100644 testsuite/css/parser/background-win32-color-is-no-error.css delete mode 100644 testsuite/css/parser/background-win32-color-is-no-error.ref.css diff --git a/docs/reference/gtk/css-overview.xml b/docs/reference/gtk/css-overview.xml index 9c942e72d2..bbdf66485e 100644 --- a/docs/reference/gtk/css-overview.xml +++ b/docs/reference/gtk/css-overview.xml @@ -546,7 +546,7 @@ checkbutton:indeterminate { GTK adds several additional ways to specify colors. -〈gtk color〉 = 〈symbolic color〉 | 〈color expression〉 | 〈win32 color〉 +〈gtk color〉 = 〈symbolic color〉 | 〈color expression〉 @@ -592,13 +592,6 @@ checkbutton:indeterminate { 〈color expression〉 = lighter( 〈color〉 ) | darker( 〈color〉 ) | shade( 〈color〉, 〈number〉 ) | alpha( 〈color〉, 〈number〉 ) | mix( 〈color〉, 〈color〉, 〈number〉 ) - - - - On Windows, GTK allows to refer to system colors, as follows: - - -〈win32 color〉 = -gtk-win32-color( 〈name〉, 〈integer〉 ) @@ -737,7 +730,7 @@ label { GTK extends the CSS syntax for images and also uses it for specifying icons. -〈gtk image〉 = 〈themed icon〉 | 〈scaled image〉 | 〈recolored image〉 | 〈win32 theme part〉 +〈gtk image〉 = 〈themed icon〉 | 〈scaled image〉 | 〈recolored image〉 @@ -815,13 +808,6 @@ arrow { } ]]> - - On Windows, GTK allows to refer to system theme parts as images, as follows: - - -〈win32 theme part〉 = -gtk-win32-theme-part( 〈name〉, 〈integer〉 〈integer〉 - [ , [ over( 〈integer〉 〈integer〉 [ , 〈alpha value〉 ]? ) | margins( 〈integer〉{1,4} ) ] ]* ) - diff --git a/docs/reference/gtk/css-properties.xml b/docs/reference/gtk/css-properties.xml index beadcfa880..5be2484754 100644 --- a/docs/reference/gtk/css-properties.xml +++ b/docs/reference/gtk/css-properties.xml @@ -65,20 +65,6 @@ We use for syntax productions, and each line is put in a not quite the same as the CSS definition of rem. - - Whereever a number is allowed, GTK also accepts a Windows-specific - theme size: - - - -〈win32 theme size〉 = 〈win32 size〉 | 〈win32 part size〉 -〈win32 size〉 = -gtk-win32-size ( 〈theme name〉, 〈metric id〉 ) -〈win32 part size〉 = [ -gtk-win32-part-width | -gtk-win32-part-height | - -gtk-win32-part-border-top | -gtk-win32-part-border-right | - -gtk-win32-part-border-bottom | -gtk-win32-part-border-left ] - ( 〈theme name〉 , 〈integer〉 , 〈integer〉 ) - - 〈calc expression〉 = calc( 〈calc sum〉 ) 〈calc sum〉 = 〈calc product〉 [ [ + | - ] 〈calc product〉 ]* 〈calc product〉 = 〈calc value〉 [ * 〈calc value〉 | / 〈number〉 ]* diff --git a/gtk/gen-gtk-gresources-xml.py b/gtk/gen-gtk-gresources-xml.py index 96a52b3e1f..cd42ce6169 100644 --- a/gtk/gen-gtk-gresources-xml.py +++ b/gtk/gen-gtk-gresources-xml.py @@ -46,11 +46,6 @@ xml += '\n' for f in get_files('theme/HighContrast/assets', '.svg'): xml += ' theme/HighContrast/assets/{0}\n'.format(f) -xml += ''' - theme/win32/gtk-win32-base.css - theme/win32/gtk.css -''' - for f in get_files('gesture', '.symbolic.png'): xml += ' gesture/{0}\n'.format(f) diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c index 7f39810e13..3e1bade582 100644 --- a/gtk/gtkcsscolorvalue.c +++ b/gtk/gtkcsscolorvalue.c @@ -23,8 +23,6 @@ #include "gtkcssstylepropertyprivate.h" #include "gtkhslaprivate.h" #include "gtkstylepropertyprivate.h" -#include "gtkwin32drawprivate.h" -#include "gtkwin32themeprivate.h" #include "gtkprivate.h" @@ -34,7 +32,6 @@ typedef enum { COLOR_TYPE_SHADE, COLOR_TYPE_ALPHA, COLOR_TYPE_MIX, - COLOR_TYPE_WIN32, COLOR_TYPE_CURRENT_COLOR } ColorType; @@ -60,12 +57,6 @@ struct _GtkCssValue GtkCssValue *color2; gdouble factor; } mix; - - struct - { - GtkWin32Theme *theme; - gint id; - } win32; } sym_col; }; @@ -90,9 +81,6 @@ gtk_css_value_color_free (GtkCssValue *color) _gtk_css_value_unref (color->sym_col.mix.color1); _gtk_css_value_unref (color->sym_col.mix.color2); break; - case COLOR_TYPE_WIN32: - gtk_win32_theme_unref (color->sym_col.win32.theme); - break; case COLOR_TYPE_LITERAL: case COLOR_TYPE_CURRENT_COLOR: default: @@ -240,18 +228,6 @@ _gtk_css_color_value_resolve (GtkCssValue *color, value =_gtk_css_rgba_value_new_from_rgba (&res); } - break; - case COLOR_TYPE_WIN32: - { - GdkRGBA res; - - gtk_win32_theme_get_color (color->sym_col.win32.theme, - color->sym_col.win32.id, - &res); - - value = _gtk_css_rgba_value_new_from_rgba (&res); - } - break; case COLOR_TYPE_CURRENT_COLOR: if (current) @@ -350,9 +326,6 @@ gtk_css_value_color_equal (const GtkCssValue *value1, value2->sym_col.mix.color1) && _gtk_css_value_equal (value1->sym_col.mix.color2, value2->sym_col.mix.color2); - case COLOR_TYPE_WIN32: - return gtk_win32_theme_equal (value1->sym_col.win32.theme, value2->sym_col.win32.theme) && - value1->sym_col.win32.id == value2->sym_col.win32.id; case COLOR_TYPE_CURRENT_COLOR: return TRUE; default: @@ -421,20 +394,6 @@ gtk_css_value_color_print (const GtkCssValue *value, g_string_append (string, ")"); } break; - case COLOR_TYPE_WIN32: - { - const char *name; - g_string_append (string, GTK_WIN32_THEME_SYMBOLIC_COLOR_NAME"("); - gtk_win32_theme_print (value->sym_col.win32.theme, string); - g_string_append (string, ", "); - name = gtk_win32_get_sys_color_name_for_id (value->sym_col.win32.id); - if (name) - g_string_append (string, name); - else - g_string_append_printf (string, "%d", value->sym_col.win32.id); - g_string_append (string, ")"); - } - break; case COLOR_TYPE_CURRENT_COLOR: g_string_append (string, "currentColor"); break; @@ -543,38 +502,6 @@ _gtk_css_color_value_new_mix (GtkCssValue *color1, return value; } -static GtkCssValue * -gtk_css_color_value_new_win32_for_theme (GtkWin32Theme *theme, - gint id) -{ - GtkCssValue *value; - - gtk_internal_return_val_if_fail (theme != NULL, NULL); - - value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_COLOR); - value->type = COLOR_TYPE_WIN32; - value->sym_col.win32.theme = gtk_win32_theme_ref (theme); - value->sym_col.win32.id = id; - - return value; -} - -GtkCssValue * -_gtk_css_color_value_new_win32 (const gchar *theme_class, - gint id) -{ - GtkWin32Theme *theme; - GtkCssValue *value; - - gtk_internal_return_val_if_fail (theme_class != NULL, NULL); - - theme = gtk_win32_theme_lookup (theme_class); - value = gtk_css_color_value_new_win32_for_theme (theme, id); - gtk_win32_theme_unref (theme); - - return value; -} - GtkCssValue * _gtk_css_color_value_new_current_color (void) { @@ -590,54 +517,9 @@ typedef enum { COLOR_DARKER, COLOR_SHADE, COLOR_ALPHA, - COLOR_MIX, - COLOR_WIN32 + COLOR_MIX } ColorParseType; -static GtkCssValue * -gtk_css_color_parse_win32 (GtkCssParser *parser) -{ - GtkCssValue *color; - GtkWin32Theme *theme; - char *name; - int id; - - theme = gtk_win32_theme_parse (parser); - if (theme == NULL) - return NULL; - - if (! _gtk_css_parser_try (parser, ",", TRUE)) - { - gtk_win32_theme_unref (theme); - _gtk_css_parser_error (parser, - "Expected ','"); - return NULL; - } - - name = _gtk_css_parser_try_ident (parser, TRUE); - if (name) - { - id = gtk_win32_get_sys_color_id_for_name (name); - if (id == -1) - { - _gtk_css_parser_error (parser, "'%s' is not a win32 color name.", name); - g_free (name); - return NULL; - } - g_free (name); - } - else if (!_gtk_css_parser_try_int (parser, &id)) - { - gtk_win32_theme_unref (theme); - _gtk_css_parser_error (parser, "Expected a valid integer value"); - return NULL; - } - - color = gtk_css_color_value_new_win32_for_theme (theme, id); - gtk_win32_theme_unref (theme); - return color; -} - static GtkCssValue * _gtk_css_color_value_parse_function (GtkCssParser *parser, ColorParseType color) @@ -704,12 +586,6 @@ _gtk_css_color_value_parse_function (GtkCssParser *parser, value = _gtk_css_color_value_new_literal (&rgba); } - else if (color == COLOR_WIN32) - { - value = gtk_css_color_parse_win32 (parser); - if (value == NULL) - return NULL; - } else { child1 = _gtk_css_color_value_parse (parser); @@ -775,7 +651,6 @@ _gtk_css_color_value_parse_function (GtkCssParser *parser, break; case COLOR_RGB: case COLOR_RGBA: - case COLOR_WIN32: default: g_assert_not_reached (); value = NULL; @@ -802,8 +677,7 @@ _gtk_css_color_value_parse (GtkCssParser *parser) GtkCssValue *value; GdkRGBA rgba; guint color; - const char *names[] = {"rgba", "rgb", "lighter", "darker", "shade", "alpha", "mix", - GTK_WIN32_THEME_SYMBOLIC_COLOR_NAME}; + const char *names[] = {"rgba", "rgb", "lighter", "darker", "shade", "alpha", "mix"}; char *name; if (_gtk_css_parser_try (parser, "currentColor", TRUE)) diff --git a/gtk/gtkcsscolorvalueprivate.h b/gtk/gtkcsscolorvalueprivate.h index 490d5fbde9..e5f9c42ee6 100644 --- a/gtk/gtkcsscolorvalueprivate.h +++ b/gtk/gtkcsscolorvalueprivate.h @@ -37,8 +37,6 @@ GtkCssValue * _gtk_css_color_value_new_alpha (GtkCssValue *color, GtkCssValue * _gtk_css_color_value_new_mix (GtkCssValue *color1, GtkCssValue *color2, gdouble factor); -GtkCssValue * _gtk_css_color_value_new_win32 (const gchar *theme_class, - gint id); GtkCssValue * _gtk_css_color_value_new_current_color (void); GtkCssValue * _gtk_css_color_value_parse (GtkCssParser *parser); diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c index 90919b0109..8a8332287d 100644 --- a/gtk/gtkcssimage.c +++ b/gtk/gtkcssimage.c @@ -33,7 +33,6 @@ #include "gtk/gtkcssimagescaledprivate.h" #include "gtk/gtkcssimagerecolorprivate.h" #include "gtk/gtkcssimagefallbackprivate.h" -#include "gtk/gtkcssimagewin32private.h" G_DEFINE_ABSTRACT_TYPE (GtkCssImage, _gtk_css_image, G_TYPE_OBJECT) @@ -499,7 +498,6 @@ gtk_css_image_get_parser_type (GtkCssParser *parser) { "-gtk-icontheme", _gtk_css_image_icon_theme_get_type }, { "-gtk-scaled", _gtk_css_image_scaled_get_type }, { "-gtk-recolor", _gtk_css_image_recolor_get_type }, - { "-gtk-win32-theme-part", _gtk_css_image_win32_get_type }, { "linear-gradient", _gtk_css_image_linear_get_type }, { "repeating-linear-gradient", _gtk_css_image_linear_get_type }, { "radial-gradient", _gtk_css_image_radial_get_type }, diff --git a/gtk/gtkcssimagewin32.c b/gtk/gtkcssimagewin32.c deleted file mode 100644 index 2fad915882..0000000000 --- a/gtk/gtkcssimagewin32.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright © 2011 Red Hat Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Authors: Benjamin Otte - */ - -#include "config.h" - -#include "gtkcssimagewin32private.h" - -#include "gtkcssprovider.h" - -G_DEFINE_TYPE (GtkCssImageWin32, _gtk_css_image_win32, GTK_TYPE_CSS_IMAGE) - -static void -gtk_css_image_win32_snapshot (GtkCssImage *image, - GtkSnapshot *snapshot, - double width, - double height) -{ - GtkCssImageWin32 *wimage = GTK_CSS_IMAGE_WIN32 (image); - cairo_surface_t *surface; - int dx, dy; - cairo_t *cr; - - cr = gtk_snapshot_append_cairo (snapshot, - &GRAPHENE_RECT_INIT (0, 0, width, height)); - - surface = gtk_win32_theme_create_surface (wimage->theme, wimage->part, wimage->state, wimage->margins, - width, height, &dx, &dy); - - if (wimage->state2 >= 0) - { - cairo_surface_t *surface2; - cairo_t *cr2; - int dx2, dy2; - - surface2 = gtk_win32_theme_create_surface (wimage->theme, wimage->part2, wimage->state2, wimage->margins, - width, height, &dx2, &dy2); - - cr2 = cairo_create (surface); - - cairo_set_source_surface (cr2, surface2, dx2 - dx, dy2-dy); - cairo_paint_with_alpha (cr2, wimage->over_alpha); - - cairo_destroy (cr2); - - cairo_surface_destroy (surface2); - } - - cairo_set_source_surface (cr, surface, dx, dy); - cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_NONE); - cairo_rectangle (cr, 0, 0, width, height); - cairo_fill (cr); - - cairo_surface_destroy (surface); - - cairo_destroy (cr); -} - -static gboolean -gtk_css_image_win32_parse (GtkCssImage *image, - GtkCssParser *parser) -{ - GtkCssImageWin32 *wimage = GTK_CSS_IMAGE_WIN32 (image); - - if (!_gtk_css_parser_try (parser, "-gtk-win32-theme-part", TRUE)) - { - _gtk_css_parser_error (parser, "'-gtk-win32-theme-part'"); - return FALSE; - } - - if (!_gtk_css_parser_try (parser, "(", TRUE)) - { - _gtk_css_parser_error (parser, - "Expected '(' after '-gtk-win32-theme-part'"); - return FALSE; - } - - wimage->theme = gtk_win32_theme_parse (parser); - if (wimage->theme == NULL) - return FALSE; - - if (! _gtk_css_parser_try (parser, ",", TRUE)) - { - _gtk_css_parser_error (parser, "Expected ','"); - return FALSE; - } - - if (!_gtk_css_parser_try_int (parser, &wimage->part)) - { - _gtk_css_parser_error (parser, "Expected a valid integer value"); - return FALSE; - } - - if (! _gtk_css_parser_try (parser, ",", TRUE)) - { - _gtk_css_parser_error (parser, "Expected ','"); - return FALSE; - } - - if (!_gtk_css_parser_try_int (parser, &wimage->state)) - { - _gtk_css_parser_error (parser, "Expected a valid integer value"); - return FALSE; - } - - while ( _gtk_css_parser_try (parser, ",", TRUE)) - { - if ( _gtk_css_parser_try (parser, "over", TRUE)) - { - if (!_gtk_css_parser_try (parser, "(", TRUE)) - { - _gtk_css_parser_error (parser, - "Expected '(' after 'over'"); - return FALSE; - } - - if (!_gtk_css_parser_try_int (parser, &wimage->part2)) - { - _gtk_css_parser_error (parser, "Expected a valid integer value"); - return FALSE; - } - - if (! _gtk_css_parser_try (parser, ",", TRUE)) - { - _gtk_css_parser_error (parser, "Expected ','"); - return FALSE; - } - - if (!_gtk_css_parser_try_int (parser, &wimage->state2)) - { - _gtk_css_parser_error (parser, "Expected a valid integer value"); - return FALSE; - } - - if ( _gtk_css_parser_try (parser, ",", TRUE)) - { - if (!_gtk_css_parser_try_double (parser, &wimage->over_alpha)) - { - _gtk_css_parser_error (parser, "Expected a valid double value"); - return FALSE; - } - } - - if (!_gtk_css_parser_try (parser, ")", TRUE)) - { - _gtk_css_parser_error (parser, - "Expected ')' at end of 'over'"); - return FALSE; - } - } - else if ( _gtk_css_parser_try (parser, "margins", TRUE)) - { - guint i; - - if (!_gtk_css_parser_try (parser, "(", TRUE)) - { - _gtk_css_parser_error (parser, - "Expected '(' after 'margins'"); - return FALSE; - } - - for (i = 0; i < 4; i++) - { - if (!_gtk_css_parser_try_int (parser, &wimage->margins[i])) - break; - } - - if (i == 0) - { - _gtk_css_parser_error (parser, "Expected valid margins"); - return FALSE; - } - - if (i == 1) - wimage->margins[1] = wimage->margins[0]; - if (i <= 2) - wimage->margins[2] = wimage->margins[1]; - if (i <= 3) - wimage->margins[3] = wimage->margins[2]; - - if (!_gtk_css_parser_try (parser, ")", TRUE)) - { - _gtk_css_parser_error (parser, - "Expected ')' at end of 'margins'"); - return FALSE; - } - } - else - { - _gtk_css_parser_error (parser, - "Expected identifier"); - return FALSE; - } - } - - if (!_gtk_css_parser_try (parser, ")", TRUE)) - { - _gtk_css_parser_error (parser, - "Expected ')'"); - return FALSE; - } - - return TRUE; -} - -static void -gtk_css_image_win32_print (GtkCssImage *image, - GString *string) -{ - GtkCssImageWin32 *wimage = GTK_CSS_IMAGE_WIN32 (image); - - g_string_append (string, "-gtk-win32-theme-part("); - gtk_win32_theme_print (wimage->theme, string); - g_string_append_printf (string, ", %d, %d)", wimage->part, wimage->state); -} - -static void -gtk_css_image_win32_finalize (GObject *object) -{ - GtkCssImageWin32 *wimage = GTK_CSS_IMAGE_WIN32 (object); - - if (wimage->theme) - gtk_win32_theme_unref (wimage->theme); - - G_OBJECT_CLASS (_gtk_css_image_win32_parent_class)->finalize (object); -} - -static void -_gtk_css_image_win32_class_init (GtkCssImageWin32Class *klass) -{ - GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = gtk_css_image_win32_finalize; - - image_class->snapshot = gtk_css_image_win32_snapshot; - image_class->parse = gtk_css_image_win32_parse; - image_class->print = gtk_css_image_win32_print; -} - -static void -_gtk_css_image_win32_init (GtkCssImageWin32 *wimage) -{ - wimage->over_alpha = 1.0; - wimage->part2 = -1; - wimage->state2 = -1; -} - diff --git a/gtk/gtkcssimagewin32private.h b/gtk/gtkcssimagewin32private.h deleted file mode 100644 index da58412df2..0000000000 --- a/gtk/gtkcssimagewin32private.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright © 2011 Red Hat Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Authors: Benjamin Otte - */ - -#ifndef __GTK_CSS_IMAGE_WIN32_PRIVATE_H__ -#define __GTK_CSS_IMAGE_WIN32_PRIVATE_H__ - -#include "gtk/gtkcssimageprivate.h" -#include "gtk/gtkwin32themeprivate.h" - -G_BEGIN_DECLS - -#define GTK_TYPE_CSS_IMAGE_WIN32 (_gtk_css_image_win32_get_type ()) -#define GTK_CSS_IMAGE_WIN32(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_IMAGE_WIN32, GtkCssImageWin32)) -#define GTK_CSS_IMAGE_WIN32_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_IMAGE_WIN32, GtkCssImageWin32Class)) -#define GTK_IS_CSS_IMAGE_WIN32(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_IMAGE_WIN32)) -#define GTK_IS_CSS_IMAGE_WIN32_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_IMAGE_WIN32)) -#define GTK_CSS_IMAGE_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_IMAGE_WIN32, GtkCssImageWin32Class)) - -typedef struct _GtkCssImageWin32 GtkCssImageWin32; -typedef struct _GtkCssImageWin32Class GtkCssImageWin32Class; - -struct _GtkCssImageWin32 -{ - GtkCssImage parent; - - int part; - int state; - - double over_alpha; - int part2; - int state2; - - gint margins[4]; - - GtkWin32Theme *theme; -}; - -struct _GtkCssImageWin32Class -{ - GtkCssImageClass parent_class; -}; - -GType _gtk_css_image_win32_get_type (void) G_GNUC_CONST; - - -G_END_DECLS - -#endif /* __GTK_CSS_IMAGE_WIN32_PRIVATE_H__ */ diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c index 5348a209f4..24396fa29d 100644 --- a/gtk/gtkcssnumbervalue.c +++ b/gtk/gtkcssnumbervalue.c @@ -21,7 +21,6 @@ #include "gtkcsscalcvalueprivate.h" #include "gtkcssdimensionvalueprivate.h" -#include "gtkcsswin32sizevalueprivate.h" #include "gtkprivate.h" struct _GtkCssValue { @@ -131,14 +130,7 @@ gboolean gtk_css_number_value_can_parse (GtkCssParser *parser) { return _gtk_css_parser_has_number (parser) - || _gtk_css_parser_has_prefix (parser, "calc") - || _gtk_css_parser_has_prefix (parser, "-gtk-win32-size") - || _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-width") - || _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-height") - || _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-border-top") - || _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-border-left") - || _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-border-bottom") - || _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-border-right"); + || _gtk_css_parser_has_prefix (parser, "calc"); } GtkCssValue * @@ -147,14 +139,6 @@ _gtk_css_number_value_parse (GtkCssParser *parser, { if (_gtk_css_parser_has_prefix (parser, "calc")) return gtk_css_calc_value_parse (parser, flags); - if (_gtk_css_parser_has_prefix (parser, "-gtk-win32-size") || - _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-width") || - _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-height") || - _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-border-top") || - _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-border-left") || - _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-border-bottom") || - _gtk_css_parser_has_prefix (parser, "-gtk-win32-part-border-right")) - return gtk_css_win32_size_value_parse (parser, flags); return gtk_css_dimension_value_parse (parser, flags); } diff --git a/gtk/gtkcsswin32sizevalue.c b/gtk/gtkcsswin32sizevalue.c deleted file mode 100644 index 0136ee1200..0000000000 --- a/gtk/gtkcsswin32sizevalue.c +++ /dev/null @@ -1,407 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2011 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include "config.h" - -#include "gtkcsswin32sizevalueprivate.h" - -#include "gtkwin32drawprivate.h" -#include "gtkwin32themeprivate.h" - -typedef enum { - GTK_WIN32_SIZE, - GTK_WIN32_PART_WIDTH, - GTK_WIN32_PART_HEIGHT, - GTK_WIN32_PART_BORDER_TOP, - GTK_WIN32_PART_BORDER_RIGHT, - GTK_WIN32_PART_BORDER_BOTTOM, - GTK_WIN32_PART_BORDER_LEFT -} GtkWin32SizeType; - -static const char *css_value_names[] = { - "-gtk-win32-size(", - "-gtk-win32-part-width(", - "-gtk-win32-part-height(", - "-gtk-win32-part-border-top(", - "-gtk-win32-part-border-right(", - "-gtk-win32-part-border-bottom(", - "-gtk-win32-part-border-left(" -}; - -struct _GtkCssValue { - GTK_CSS_VALUE_BASE - double scale; /* needed for calc() math */ - GtkWin32Theme *theme; - GtkWin32SizeType type; - union { - struct { - gint id; - } size; - struct { - gint part; - gint state; - } part; - } val; -}; - -static GtkCssValue * gtk_css_win32_size_value_new (double scale, - GtkWin32Theme *theme, - GtkWin32SizeType type); - -static void -gtk_css_value_win32_size_free (GtkCssValue *value) -{ - gtk_win32_theme_unref (value->theme); - g_slice_free (GtkCssValue, value); -} - -static int -gtk_css_value_win32_compute_size (const GtkCssValue *value) -{ - GtkBorder border; - int size; - - switch (value->type) - { - case GTK_WIN32_SIZE: - size = gtk_win32_theme_get_size (value->theme, value->val.size.id); - break; - - case GTK_WIN32_PART_WIDTH: - gtk_win32_theme_get_part_size (value->theme, value->val.part.part, value->val.part.state, &size, NULL); - break; - - case GTK_WIN32_PART_HEIGHT: - gtk_win32_theme_get_part_size (value->theme, value->val.part.part, value->val.part.state, NULL, &size); - break; - - case GTK_WIN32_PART_BORDER_TOP: - gtk_win32_theme_get_part_border (value->theme, value->val.part.part, value->val.part.state, &border); - size = border.top; - break; - - case GTK_WIN32_PART_BORDER_RIGHT: - gtk_win32_theme_get_part_border (value->theme, value->val.part.part, value->val.part.state, &border); - size = border.right; - break; - - case GTK_WIN32_PART_BORDER_BOTTOM: - gtk_win32_theme_get_part_border (value->theme, value->val.part.part, value->val.part.state, &border); - size = border.bottom; - break; - - case GTK_WIN32_PART_BORDER_LEFT: - gtk_win32_theme_get_part_border (value->theme, value->val.part.part, value->val.part.state, &border); - size = border.left; - break; - - default: - g_assert_not_reached (); - return 0; - } - - return size; -} - -static GtkCssValue * -gtk_css_value_win32_size_compute (GtkCssValue *value, - guint property_id, - GtkStyleProvider *provider, - GtkCssStyle *style, - GtkCssStyle *parent_style) -{ - return _gtk_css_number_value_new (value->scale * gtk_css_value_win32_compute_size (value), GTK_CSS_PX); -} - -static gboolean -gtk_css_value_win32_size_equal (const GtkCssValue *value1, - const GtkCssValue *value2) -{ - if (value1->type != value2->type || - !gtk_win32_theme_equal (value1->theme, value2->theme) ) - return FALSE; - - switch (value1->type) - { - case GTK_WIN32_SIZE: - return value1->val.size.id == value2->val.size.id; - - case GTK_WIN32_PART_WIDTH: - case GTK_WIN32_PART_HEIGHT: - return value1->val.part.part == value2->val.part.part - && value1->val.part.state == value2->val.part.state; - - case GTK_WIN32_PART_BORDER_TOP: - case GTK_WIN32_PART_BORDER_RIGHT: - case GTK_WIN32_PART_BORDER_BOTTOM: - case GTK_WIN32_PART_BORDER_LEFT: - default: - g_assert_not_reached (); - return FALSE; - } -} - -static void -gtk_css_value_win32_size_print (const GtkCssValue *value, - GString *string) -{ - if (value->scale != 1.0) - { - g_string_append_printf (string, "%g * ", value->scale); - } - g_string_append (string, css_value_names[value->type]); - gtk_win32_theme_print (value->theme, string); - - switch (value->type) - { - case GTK_WIN32_SIZE: - { - const char *name = gtk_win32_get_sys_metric_name_for_id (value->val.size.id); - if (name) - g_string_append (string, name); - else - g_string_append_printf (string, ", %d", value->val.size.id); - } - break; - - case GTK_WIN32_PART_WIDTH: - case GTK_WIN32_PART_HEIGHT: - case GTK_WIN32_PART_BORDER_TOP: - case GTK_WIN32_PART_BORDER_RIGHT: - case GTK_WIN32_PART_BORDER_BOTTOM: - case GTK_WIN32_PART_BORDER_LEFT: - g_string_append_printf (string, ", %d, %d", value->val.part.part, value->val.part.state); - break; - - default: - g_assert_not_reached (); - break; - } - - g_string_append (string, ")"); -} - -static double -gtk_css_value_win32_size_get (const GtkCssValue *value, - double one_hundred_percent) -{ - return value->scale * gtk_css_value_win32_compute_size (value); -} - -static GtkCssDimension -gtk_css_value_win32_size_get_dimension (const GtkCssValue *value) -{ - return GTK_CSS_DIMENSION_LENGTH; -} - -static gboolean -gtk_css_value_win32_size_has_percent (const GtkCssValue *value) -{ - return FALSE; -} - -static GtkCssValue * -gtk_css_value_win32_size_multiply (const GtkCssValue *value, - double factor) -{ - GtkCssValue *result; - - result = gtk_css_win32_size_value_new (value->scale * factor, value->theme, value->type); - result->val = value->val; - - return result; -} - -static GtkCssValue * -gtk_css_value_win32_size_try_add (const GtkCssValue *value1, - const GtkCssValue *value2) -{ - GtkCssValue *result; - - if (!gtk_css_value_win32_size_equal (value1, value2)) - return NULL; - - result = gtk_css_win32_size_value_new (value1->scale + value2->scale, value1->theme, value1->type); - result->val = value1->val; - - return result; -} - -static gint -gtk_css_value_win32_size_get_calc_term_order (const GtkCssValue *value) -{ - return 2000 + 100 * value->type; -} - -static const GtkCssNumberValueClass GTK_CSS_VALUE_WIN32_SIZE = { - { - gtk_css_value_win32_size_free, - gtk_css_value_win32_size_compute, - gtk_css_value_win32_size_equal, - gtk_css_number_value_transition, - NULL, - NULL, - gtk_css_value_win32_size_print - }, - gtk_css_value_win32_size_get, - gtk_css_value_win32_size_get_dimension, - gtk_css_value_win32_size_has_percent, - gtk_css_value_win32_size_multiply, - gtk_css_value_win32_size_try_add, - gtk_css_value_win32_size_get_calc_term_order -}; - -static GtkCssValue * -gtk_css_win32_size_value_new (double scale, - GtkWin32Theme *theme, - GtkWin32SizeType type) -{ - GtkCssValue *result; - - result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_WIN32_SIZE.value_class); - result->scale = scale; - result->theme = gtk_win32_theme_ref (theme); - result->type = type; - - return result; -} - -static GtkCssValue * -gtk_css_win32_size_value_parse_size (GtkCssValue *value, - GtkCssParser *parser) -{ - char *name; - - name = _gtk_css_parser_try_ident (parser, TRUE); - if (name) - { - value->val.size.id = gtk_win32_get_sys_metric_id_for_name (name); - if (value->val.size.id == -1) - { - _gtk_css_parser_error (parser, "'%s' is not a name for a win32 metric.", name); - _gtk_css_value_unref (value); - g_free (name); - return NULL; - } - g_free (name); - } - else if (!_gtk_css_parser_try_int (parser, &value->val.size.id)) - { - _gtk_css_value_unref (value); - _gtk_css_parser_error (parser, "Expected an integer ID"); - return NULL; - } - - return value; -} - -static GtkCssValue * -gtk_css_win32_size_value_parse_part_size (GtkCssValue *value, - GtkCssParser *parser) -{ - if (!_gtk_css_parser_try_int (parser, &value->val.part.part)) - { - _gtk_css_value_unref (value); - _gtk_css_parser_error (parser, "Expected an integer part ID"); - return NULL; - } - - if (! _gtk_css_parser_try (parser, ",", TRUE)) - { - _gtk_css_value_unref (value); - _gtk_css_parser_error (parser, "Expected ','"); - return NULL; - } - - if (!_gtk_css_parser_try_int (parser, &value->val.part.state)) - { - _gtk_css_value_unref (value); - _gtk_css_parser_error (parser, "Expected an integer state ID"); - return NULL; - } - - return value; -} - -GtkCssValue * -gtk_css_win32_size_value_parse (GtkCssParser *parser, - GtkCssNumberParseFlags flags) -{ - GtkWin32Theme *theme; - GtkCssValue *result; - guint type; - - for (type = 0; type < G_N_ELEMENTS(css_value_names); type++) - { - if (_gtk_css_parser_try (parser, css_value_names[type], TRUE)) - break; - } - - if (type >= G_N_ELEMENTS(css_value_names)) - { - _gtk_css_parser_error (parser, "Not a win32 size value"); - return NULL; - } - - theme = gtk_win32_theme_parse (parser); - if (theme == NULL) - return NULL; - - result = gtk_css_win32_size_value_new (1.0, theme, type); - gtk_win32_theme_unref (theme); - - if (! _gtk_css_parser_try (parser, ",", TRUE)) - { - _gtk_css_value_unref (result); - _gtk_css_parser_error (parser, "Expected ','"); - return NULL; - } - - switch (result->type) - { - case GTK_WIN32_SIZE: - result = gtk_css_win32_size_value_parse_size (result, parser); - break; - - case GTK_WIN32_PART_WIDTH: - case GTK_WIN32_PART_HEIGHT: - case GTK_WIN32_PART_BORDER_TOP: - case GTK_WIN32_PART_BORDER_RIGHT: - case GTK_WIN32_PART_BORDER_BOTTOM: - case GTK_WIN32_PART_BORDER_LEFT: - result = gtk_css_win32_size_value_parse_part_size (result, parser); - break; - - default: - g_assert_not_reached (); - _gtk_css_value_unref (result); - result = NULL; - break; - } - - if (result == NULL) - return NULL; - - if (!_gtk_css_parser_try (parser, ")", TRUE)) - { - _gtk_css_value_unref (result); - _gtk_css_parser_error (parser, "Expected ')'"); - return NULL; - } - - return result; -} diff --git a/gtk/gtkcsswin32sizevalueprivate.h b/gtk/gtkcsswin32sizevalueprivate.h deleted file mode 100644 index fd9bf19a40..0000000000 --- a/gtk/gtkcsswin32sizevalueprivate.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright © 2012 Red Hat Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Authors: Alexander Larsson - */ - -#ifndef __GTK_CSS_WIN32_SIZE_VALUE_PRIVATE_H__ -#define __GTK_CSS_WIN32_SIZE_VALUE_PRIVATE_H__ - -#include "gtkcssnumbervalueprivate.h" - -G_BEGIN_DECLS - -GtkCssValue * gtk_css_win32_size_value_parse (GtkCssParser *parser, - GtkCssNumberParseFlags flags); - -G_END_DECLS - -#endif /* __GTK_CSS_WIN32_SIZE_VALUE_PRIVATE_H__ */ diff --git a/gtk/gtkwin32draw.c b/gtk/gtkwin32draw.c deleted file mode 100644 index fcd7fa6a28..0000000000 --- a/gtk/gtkwin32draw.c +++ /dev/null @@ -1,803 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2016 Benjamin Otte - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include - -#include "gtkwin32drawprivate.h" - -typedef enum { - ICON_CLOSE, - ICON_MINIMIZE, - ICON_MAXIMIZE, - ICON_RESTORE -} Icon; - -const guchar icon_close_pixels[] = { - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x06, 0x00, 0x00, - 0x1c, 0x07, 0x00, 0x00, - 0xb8, 0x03, 0x00, 0x00, - 0xf0, 0x01, 0x00, 0x00, - 0xe0, 0x00, 0x00, 0x00, - 0xf0, 0x01, 0x00, 0x00, - 0xb8, 0x03, 0x00, 0x00, - 0x1c, 0x07, 0x00, 0x00, - 0x0c, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -const guchar icon_minimize_pixels[] = { - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xfc, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -const guchar icon_maximize_pixels[] = { - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xfe, 0x07, 0x00, 0x00, - 0xfe, 0x07, 0x00, 0x00, - 0x02, 0x04, 0x00, 0x00, - 0x02, 0x04, 0x00, 0x00, - 0x02, 0x04, 0x00, 0x00, - 0x02, 0x04, 0x00, 0x00, - 0x02, 0x04, 0x00, 0x00, - 0x02, 0x04, 0x00, 0x00, - 0xfe, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -const guchar icon_restore_pixels[] = { - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xf8, 0x07, 0x00, 0x00, - 0xf8, 0x07, 0x00, 0x00, - 0x08, 0x04, 0x00, 0x00, - 0x08, 0x04, 0x00, 0x00, - 0xfe, 0x04, 0x00, 0x00, - 0x82, 0x07, 0x00, 0x00, - 0x82, 0x00, 0x00, 0x00, - 0x82, 0x00, 0x00, 0x00, - 0xfe, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -static struct { - int width; - int height; - gsize pixels_size; - const guchar *pixels; -} icon_masks[] = { - { 13, 13, sizeof (icon_close_pixels), icon_close_pixels }, - { 13, 13, sizeof (icon_minimize_pixels), icon_minimize_pixels }, - { 13, 13, sizeof (icon_maximize_pixels), icon_maximize_pixels }, - { 13, 13, sizeof (icon_restore_pixels), icon_restore_pixels } -}; - -static void -mask_icon (cairo_t *cr, - Icon icon, - double x, - double y, - double width, - double height) -{ - cairo_surface_t *surface; - - surface = cairo_image_surface_create_for_data ((guchar *) icon_masks[icon].pixels, - CAIRO_FORMAT_A1, - icon_masks[icon].width, - icon_masks[icon].height, - icon_masks[icon].pixels_size / icon_masks[icon].height); - cairo_mask_surface (cr, - surface, - x + (width - icon_masks[icon].width) / 2, - y + (height - icon_masks[icon].height) / 2); - cairo_surface_destroy (surface); -} - -static void -gtk_cairo_set_source_sys_color (cairo_t *cr, - gint id) -{ - GdkRGBA rgba; - - gtk_win32_get_sys_color (id, &rgba); - gdk_cairo_set_source_rgba (cr, &rgba); -} - -static void -draw_outline (cairo_t *cr, - int top_color_id, - int bottom_color_id, - int x, - int y, - int width, - int height) -{ - gtk_cairo_set_source_sys_color (cr, top_color_id); - cairo_rectangle (cr, x, y, width, 1); - cairo_rectangle (cr, x, y, 1, height); - cairo_fill (cr); - - gtk_cairo_set_source_sys_color (cr, bottom_color_id); - cairo_rectangle (cr, x + width, y + height, -1, -height); - cairo_rectangle (cr, x + width, y + height, -width, -1); - cairo_fill (cr); -} - -typedef enum { - EDGE_RAISED_OUTER = 1 << 0, - EDGE_SUNKEN_OUTER = 1 << 1, - EDGE_RAISED_INNER = 1 << 2, - EDGE_SUNKEN_INNER = 1 << 3, - EDGE_RAISED = (EDGE_RAISED_OUTER | EDGE_RAISED_INNER), - EDGE_SUNKEN = (EDGE_SUNKEN_OUTER | EDGE_SUNKEN_INNER), - EDGE_ETCHED = (EDGE_SUNKEN_OUTER | EDGE_RAISED_INNER), - EDGE_BUMP = (EDGE_RAISED_OUTER | EDGE_SUNKEN_INNER) -} GtkWin32Edge; - -static void -draw_edge (cairo_t *cr, - GtkWin32Edge edge, - gboolean soft, - int x, - int y, - int width, - int height) -{ - switch (edge & (EDGE_RAISED_OUTER | EDGE_SUNKEN_OUTER)) - { - case EDGE_RAISED_OUTER: - draw_outline (cr, - soft ? GTK_WIN32_SYS_COLOR_BTNHIGHLIGHT : GTK_WIN32_SYS_COLOR_3DLIGHT, - GTK_WIN32_SYS_COLOR_3DDKSHADOW, - x, y, width, height); - break; - case EDGE_SUNKEN_OUTER: - draw_outline (cr, - soft ? GTK_WIN32_SYS_COLOR_3DDKSHADOW : GTK_WIN32_SYS_COLOR_BTNSHADOW, - GTK_WIN32_SYS_COLOR_BTNHIGHLIGHT, - x, y, width, height); - break; - case (EDGE_RAISED_OUTER | EDGE_SUNKEN_OUTER): - return; - default: - break; - } - - x += 1; - y += 1; - width -= 2; - height -= 2; - - switch (edge & (EDGE_RAISED_INNER | EDGE_SUNKEN_INNER)) - { - case EDGE_RAISED_INNER: - draw_outline (cr, - soft ? GTK_WIN32_SYS_COLOR_3DLIGHT : GTK_WIN32_SYS_COLOR_BTNHIGHLIGHT, - GTK_WIN32_SYS_COLOR_BTNSHADOW, - x, y, width, height); - break; - case EDGE_SUNKEN_INNER: - draw_outline (cr, - soft ? GTK_WIN32_SYS_COLOR_BTNSHADOW : GTK_WIN32_SYS_COLOR_3DDKSHADOW, - GTK_WIN32_SYS_COLOR_3DLIGHT, - x, y, width, height); - break; - case (EDGE_RAISED_INNER | EDGE_SUNKEN_INNER): - return; - default: - break; - } -} - -static void -draw_button (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - draw_edge (cr, state == 3 ? EDGE_SUNKEN : EDGE_RAISED, TRUE, 0, 0, width, height); - - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNFACE); - cairo_rectangle (cr, 2, 2, width - 4, height - 4); - cairo_fill (cr); -} - -static void -draw_frame (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - draw_edge (cr, EDGE_ETCHED, FALSE, 0, 0, width, height); - - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNFACE); - cairo_rectangle (cr, 2, 2, width - 4, height - 4); - cairo_fill (cr); -} - -static void -draw_check (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNHIGHLIGHT); - cairo_set_line_width (cr, 1.0); - cairo_rectangle (cr, 0.5, 0.5, width - 1.0, height - 1.0); - cairo_stroke (cr); -} - -static void -draw_radio (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNHIGHLIGHT); - cairo_set_line_width (cr, 1.0); - cairo_arc (cr, width / 2.0, height / 2.0, MIN (width, height) / 2.0 - 0.5, 0, G_PI * 2); - cairo_stroke (cr); -} - -static void -draw_edit (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - int xborder = gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CXBORDER); - int yborder = gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CYBORDER); - - cairo_rectangle (cr, 0, 0, width, height); - gtk_cairo_set_source_sys_color (cr, (state == 6 || state == 4) ? GTK_WIN32_SYS_COLOR_BTNFACE - : GTK_WIN32_SYS_COLOR_WINDOW); - cairo_fill_preserve (cr); - - cairo_rectangle (cr, width - xborder, yborder, - - (width - 2 * xborder), height - 2 * yborder); - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_WINDOWFRAME); - cairo_fill (cr); -} - -static void -draw_edit_noborder (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - - cairo_rectangle (cr, 0, 0, width, height); - gtk_cairo_set_source_sys_color (cr, (state == 6 || state == 4) ? GTK_WIN32_SYS_COLOR_BTNFACE - : GTK_WIN32_SYS_COLOR_WINDOW); - cairo_fill (cr); -} - -static void -draw_window (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - draw_edge (cr, EDGE_RAISED, TRUE, 0, 0, width, height + 2); - - gtk_cairo_set_source_sys_color (cr, state == 2 ? GTK_WIN32_SYS_COLOR_INACTIVECAPTION - : GTK_WIN32_SYS_COLOR_ACTIVECAPTION); - cairo_rectangle (cr, 2, 2, width - 4, height - 2); - cairo_fill (cr); -} - -static void -draw_window_left (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - draw_edge (cr, EDGE_RAISED, TRUE, 0, -2, width + 2, height + 4); - - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNFACE); - cairo_rectangle (cr, 2, 0, width - 2, height); - cairo_fill (cr); -} - -static void -draw_window_right (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - draw_edge (cr, EDGE_RAISED, TRUE, -2, -2, width + 2, height + 4); - - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNFACE); - cairo_rectangle (cr, 0, 0, width - 2, height); - cairo_fill (cr); -} - -static void -draw_window_bottom (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - draw_edge (cr, EDGE_RAISED, TRUE, 0, -2, width, height + 2); - - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNFACE); - cairo_rectangle (cr, 2, 0, width - 4, height - 2); - cairo_fill (cr); -} - -static void -draw_window_button (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - Icon icon; - - - switch (part) - { - case 15: /* minimize */ - icon = ICON_MINIMIZE; - break; - case 17: /* maximize */ - icon = ICON_MAXIMIZE; - break; - default: - g_assert_not_reached (); - case 18: /* close */ - icon = ICON_CLOSE; - break; - case 21: /* restore */ - icon = ICON_RESTORE; - break; - } - - draw_button (cr, 0, state, width, height); - - gtk_cairo_set_source_sys_color (cr, state == 4 ? GTK_WIN32_SYS_COLOR_BTNSHADOW - : GTK_WIN32_SYS_COLOR_BTNTEXT); - mask_icon (cr, icon, 1, 1, width - 2, height - 2); -} - -static void -draw_tab_item (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - draw_edge (cr, EDGE_RAISED, TRUE, 0, 0, width, height + 2); - - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNFACE); - cairo_rectangle (cr, 2, 2, width - 4, height - 2); - cairo_fill (cr); -} - -static void -draw_tab_pane (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - draw_edge (cr, EDGE_RAISED, TRUE, 0, 0, width, height); - - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_BTNFACE); - cairo_rectangle (cr, 2, 2, width - 4, height - 4); - cairo_fill (cr); -} - -static void -draw_tooltip (cairo_t *cr, - int part, - int state, - int width, - int height) -{ - int xborder = gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CXDLGFRAME) - - gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CXEDGE); - int yborder = gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CYDLGFRAME) - - gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CYEDGE); - - cairo_rectangle (cr, 0, 0, width, height); - cairo_rectangle (cr, width - xborder, yborder, - - (width - 2 * xborder), height - 2 * yborder); - gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_WINDOWFRAME); - cairo_fill (cr); -} - -typedef struct _GtkWin32ThemePart GtkWin32ThemePart; -struct _GtkWin32ThemePart { - const char *class_name; - gint part; - gint size; - GtkBorder margins; - void (* draw_func) (cairo_t *cr, - int part, - int state, - int width, - int height); -}; - -static GtkWin32ThemePart theme_parts[] = { - { "button", 1, 0, { 3, 3, 3, 3 }, draw_button }, - { "button", 2, 13, { 0, 0, 0, 0 }, draw_radio }, - { "button", 3, 13, { 0, 0, 0, 0 }, draw_check }, - { "button", 4, 0, { 3, 3, 3, 3 }, draw_frame }, - { "edit", 1, 0, { 0, 0, 0, 0 }, draw_edit }, - { "edit", 3, 0, { 0, 0, 0, 0 }, draw_edit_noborder }, - { "edit", 6, 0, { 0, 0, 0, 0 }, draw_edit }, - { "edit", 7, 0, { 0, 0, 0, 0 }, draw_edit }, - { "edit", 8, 0, { 0, 0, 0, 0 }, draw_edit }, - { "edit", 9, 0, { 0, 0, 0, 0 }, draw_edit }, - { "tab", 1, 0, { 0, 0, 0, 0 }, draw_tab_item }, - { "tab", 2, 0, { 0, 0, 0, 0 }, draw_tab_item }, - { "tab", 3, 0, { 0, 0, 0, 0 }, draw_tab_item }, - { "tab", 4, 0, { 0, 0, 0, 0 }, draw_tab_item }, - { "tab", 5, 0, { 0, 0, 0, 0 }, draw_tab_item }, - { "tab", 6, 0, { 0, 0, 0, 0 }, draw_tab_item }, - { "tab", 7, 0, { 0, 0, 0, 0 }, draw_tab_item }, - { "tab", 8, 0, { 0, 0, 0, 0 }, draw_tab_item }, - { "tab", 9, 0, { 0, 0, 0, 0 }, draw_tab_pane }, - { "tooltip", 1, 0, { 0, 0, 0, 0 }, draw_tooltip }, - { "window", 1, 0, { 0, 0, 0, 0 }, draw_window }, - { "window", 7, 0, { 0, 0, 0, 0 }, draw_window_left }, - { "window", 8, 0, { 0, 0, 0, 0 }, draw_window_right }, - { "window", 9, 0, { 0, 0, 0, 0 }, draw_window_bottom }, - { "window", 15, 0, { 0, 0, 0, 0 }, draw_window_button }, - { "window", 17, 0, { 0, 0, 0, 0 }, draw_window_button }, - { "window", 18, 0, { 0, 0, 0, 0 }, draw_window_button }, - { "window", 21, 0, { 0, 0, 0, 0 }, draw_window_button } -}; - -static const GtkWin32ThemePart * -get_theme_part (const char *class_name, - gint part) -{ - gsize i; - - for (i = 0; i < G_N_ELEMENTS (theme_parts); i++) - { - if (g_str_equal (theme_parts[i].class_name, class_name) && - theme_parts[i].part == part) - return &theme_parts[i]; - } - - return NULL; -} - -void -gtk_win32_draw_theme_background (cairo_t *cr, - const char *class_name, - int part, - int state, - int width, - int height) -{ - const GtkWin32ThemePart *theme_part; - - theme_part = get_theme_part (class_name, part); - - if (theme_part) - { - theme_part->draw_func (cr, part, state, width, height); - } - else - { - g_warning ("No fallback code to draw background for class \"%s\", part %d", class_name, part); - } -} - -void -gtk_win32_get_theme_part_size (const char *class_name, - int part, - int state, - int *width, - int *height) -{ - const GtkWin32ThemePart *theme_part; - - theme_part = get_theme_part (class_name, part); - - if (theme_part) - { - if (width) - *width = theme_part->size; - if (height) - *height = theme_part->size; - } - else - { - if (width) - *width = 1; - if (height) - *height = 1; - } -} - -void -gtk_win32_get_theme_margins (const char *class_name, - int part, - int state, - GtkBorder *out_margins) -{ - const GtkWin32ThemePart *theme_part; - - theme_part = get_theme_part (class_name, part); - - if (theme_part) - { - *out_margins = theme_part->margins; - } - else - { - out_margins->top = out_margins->bottom = out_margins->left = out_margins->right = 0; - } -} - -static int -FIXME_IMPLEMENT (int id) -{ - g_warning ("win32 sys metric %d not implemented", id); - return 0; -} - -static struct { - const char *name; - int value; - int (* get_value) (int id); -} win32_default_metrics[] = { - { "cxscreen", 0, FIXME_IMPLEMENT }, - { "cyscreen", 0, FIXME_IMPLEMENT }, - { "cxvscroll", 16, NULL }, - { "cyhscroll", 16, NULL }, - { "cycaption", 16, NULL }, - { "cxborder", 1, NULL }, - { "cyborder", 1, NULL }, - { "cxdlgframe", 3, NULL }, - { "cydlgframe", 3, NULL }, - { "cyvthumb", 16, NULL }, - { "cxhthumb", 16, NULL }, - { "cxicon", 32, NULL }, - { "cyicon", 32, NULL }, - { "cxcursor", 32, NULL }, - { "cycursor", 32, NULL }, - { "cymenu", 19, NULL }, - { "cxfullscreen", 0, FIXME_IMPLEMENT }, - { "cyfullscreen", 0, FIXME_IMPLEMENT }, - { "cykanjiwindow", 0, NULL }, - { "mousepresent", 1, NULL }, - { "cyvscroll", 16, NULL }, - { "cxhscroll", 16, NULL }, - { "debug", 0, NULL }, - { "swapbutton", 0, NULL }, - { "reserved1", 0, NULL }, - { "reserved2", 0, NULL }, - { "reserved3", 0, NULL }, - { "reserved4", 0, NULL }, - { "cxmin", 112, NULL }, - { "cymin", 24, NULL }, - { "cxsize", 18, NULL }, - { "cysize", 15, NULL }, - { "cxframe", 4, NULL }, - { "cyframe", 4, NULL }, - { "cxmintrack", 112, NULL }, - { "cymintrack", 24, NULL }, - { "cxdoubleclk", 0, FIXME_IMPLEMENT }, - { "cydoubleclk", 0, FIXME_IMPLEMENT }, - { "cxiconspacing", 75, NULL }, - { "cyiconspacing", 75, NULL }, - { "menudropalignment", 0, NULL }, - { "penwindows", 0, NULL }, - { "dbcsenabled", 1, NULL }, - { "cmousebuttons", 3, NULL }, - { "secure", 0, NULL }, - { "cxedge", 2, NULL }, - { "cyedge", 2, NULL }, - { "cxminspacing", 160, NULL }, - { "cyminspacing", 21, NULL }, - { "cxsmicon", 16, NULL }, - { "cysmicon", 16, NULL }, - { "cysmcaption", 16, NULL }, - { "cxsmsize", 15, NULL }, - { "cysmsize", 15, NULL }, - { "cxmenusize", 18, NULL }, - { "cymenusize", 18, NULL }, - { "arrange", 8, NULL }, - { "cxminimized", 160, NULL }, - { "cyminimized", 21, NULL }, - { "cxmaxtrack", 0, FIXME_IMPLEMENT }, - { "cymaxtrack", 0, FIXME_IMPLEMENT }, - { "cxmaximized", 0, FIXME_IMPLEMENT }, - { "cymaximized", 0, FIXME_IMPLEMENT }, - { "network", 3, NULL }, - { NULL, 0, NULL }, - { NULL, 0, NULL }, - { NULL, 0, NULL }, - { "cleanboot", 0, NULL }, - { "cxdrag", 4, NULL }, - { "cydrag", 4, NULL }, - { "showsounds", 0, NULL }, - { "cxmenucheck", 13, NULL }, - { "cymenucheck", 13, NULL }, - { "slowmachine", 0, NULL }, - { "mideastenabled", 0, NULL }, - { "mousewheelpresent", 1, NULL }, - { "xvirtualscreen", 0, FIXME_IMPLEMENT }, - { "yvirtualscreen", 0, FIXME_IMPLEMENT }, - { "cxvirtualscreen", 0, FIXME_IMPLEMENT }, - { "cyvirtualscreen", 0, FIXME_IMPLEMENT }, - { "cmonitors", 0, FIXME_IMPLEMENT }, - { "samedisplayformat", 1, NULL }, - { "immenabled", 1, NULL }, - { "cxfocusborder", 1, NULL }, - { "cyfocusborder", 1, NULL }, - { NULL, 0, NULL }, - { "tabletpc", 0, NULL }, - { "mediacenter", 0, NULL }, - { "starter", 0, NULL }, - { "serverr2", 0, NULL }, - { "cmetrics", 90, NULL }, - { "mousehorizontalwheelpresent", 0, NULL }, - { "cxpaddedborder", 0, NULL } -}; - -const char * -gtk_win32_get_sys_metric_name_for_id (gint id) -{ - if (id >= 0 && id < G_N_ELEMENTS (win32_default_metrics)) - return win32_default_metrics[id].name; - else - return NULL; -} - -int -gtk_win32_get_sys_metric_id_for_name (const char *name) -{ - int i; - - g_return_val_if_fail (name != NULL, -1); - - for (i = 0; i < G_N_ELEMENTS (win32_default_metrics); i++) - { - if (win32_default_metrics[i].name == NULL) - continue; - - if (g_str_equal (name, win32_default_metrics[i].name)) - return i; - } - - return -1; -} - -int -gtk_win32_get_sys_metric (gint id) -{ - if (id < 0 || id >= G_N_ELEMENTS (win32_default_metrics)) - return 0; - - if (win32_default_metrics[id].get_value) - return win32_default_metrics[id].get_value (id); - - return win32_default_metrics[id].value; -} - -static struct { - const char *name; - GdkRGBA rgba; -} win32_default_colors[] = { -#define RGB(r, g, b) { (r)/255.0, (g)/255.0, (b)/255., 1.0 } - { "scrollbar", RGB(212, 208, 200) }, - { "background", RGB(58, 110, 165) }, - { "activecaption", RGB(10, 36, 106) }, - { "inactivecaption", RGB(128, 128, 128) }, - { "menu", RGB(212, 208, 200) }, - { "window", RGB(255, 255, 255) }, - { "windowframe", RGB(0, 0, 0) }, - { "menutext", RGB(0, 0, 0) }, - { "windowtext", RGB(0, 0, 0) }, - { "captiontext", RGB(255, 255, 255) }, - { "activeborder", RGB(212, 208, 200) }, - { "inactiveborder", RGB(212, 208, 200) }, - { "appworkspace", RGB(128, 128, 128) }, - { "highlight", RGB(10, 36, 106) }, - { "highlighttext", RGB(255, 255, 255) }, - { "btnface", RGB(212, 208, 200) }, - { "btnshadow", RGB(128, 128, 128) }, - { "graytext", RGB(128, 128, 128) }, - { "btntext", RGB(0, 0, 0) }, - { "inactivecaptiontext", RGB(212, 208, 200) }, - { "btnhighlight", RGB(255, 255, 255) }, - { "3ddkshadow", RGB(64, 64, 64) }, - { "3dlight", RGB(212, 208, 200) }, - { "infotext", RGB(0, 0, 0) }, - { "infobk", RGB(255, 255, 225) }, - { "alternatebtnface", RGB(181, 181, 181) }, - { "hotlight", RGB(0, 0, 200) }, - { "gradientactivecaption", RGB(166, 202, 240) }, - { "gradientinactivecaption", RGB(192, 192, 192) }, - { "menuhilight", RGB(10, 36, 106) }, - { "menubar", RGB(212, 208, 200) } -#undef RGB -}; - -const char * -gtk_win32_get_sys_color_name_for_id (gint id) -{ - if (id >= 0 && id < G_N_ELEMENTS (win32_default_colors)) - return win32_default_colors[id].name; - else - return NULL; -} - -int -gtk_win32_get_sys_color_id_for_name (const char *name) -{ - int i; - - g_return_val_if_fail (name != NULL, -1); - - for (i = 0; i < G_N_ELEMENTS (win32_default_colors); i++) - { - if (g_str_equal (name, win32_default_colors[i].name)) - return i; - } - - return -1; -} - -void -gtk_win32_get_sys_color (gint id, - GdkRGBA *color) -{ - if (id < 0 || id >= G_N_ELEMENTS (win32_default_colors)) - { - gdk_rgba_parse (color, "black"); - return; - } - - *color = win32_default_colors[id].rgba; -} - diff --git a/gtk/gtkwin32drawprivate.h b/gtk/gtkwin32drawprivate.h deleted file mode 100644 index ad419ae672..0000000000 --- a/gtk/gtkwin32drawprivate.h +++ /dev/null @@ -1,181 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2016 Benjamin Otte - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef __GTK_WIN32_DRAW_H__ -#define __GTK_WIN32_DRAW_H__ - -#include -#include - -#include - -G_BEGIN_DECLS - -enum { - GTK_WIN32_SYS_COLOR_SCROLLBAR, - GTK_WIN32_SYS_COLOR_BACKGROUND, - GTK_WIN32_SYS_COLOR_ACTIVECAPTION, - GTK_WIN32_SYS_COLOR_INACTIVECAPTION, - GTK_WIN32_SYS_COLOR_MENU, - GTK_WIN32_SYS_COLOR_WINDOW, - GTK_WIN32_SYS_COLOR_WINDOWFRAME, - GTK_WIN32_SYS_COLOR_MENUTEXT, - GTK_WIN32_SYS_COLOR_WINDOWTEXT, - GTK_WIN32_SYS_COLOR_CAPTIONTEXT, - GTK_WIN32_SYS_COLOR_ACTIVEBORDER, - GTK_WIN32_SYS_COLOR_INACTIVEBORDER, - GTK_WIN32_SYS_COLOR_APPWORKSPACE, - GTK_WIN32_SYS_COLOR_HIGHLIGHT, - GTK_WIN32_SYS_COLOR_HIGHLIGHTTEXT, - GTK_WIN32_SYS_COLOR_BTNFACE, - GTK_WIN32_SYS_COLOR_BTNSHADOW, - GTK_WIN32_SYS_COLOR_GRAYTEXT, - GTK_WIN32_SYS_COLOR_BTNTEXT, - GTK_WIN32_SYS_COLOR_INACTIVECAPTIONTEXT, - GTK_WIN32_SYS_COLOR_BTNHIGHLIGHT, - GTK_WIN32_SYS_COLOR_3DDKSHADOW, - GTK_WIN32_SYS_COLOR_3DLIGHT, - GTK_WIN32_SYS_COLOR_INFOTEXT, - GTK_WIN32_SYS_COLOR_INFOBK, - GTK_WIN32_SYS_COLOR_ALTERNATEBTNFACE, - GTK_WIN32_SYS_COLOR_HOTLIGHT, - GTK_WIN32_SYS_COLOR_GRADIENTACTIVECAPTION, - GTK_WIN32_SYS_COLOR_GRADIENTINACTIVECAPTION, - GTK_WIN32_SYS_COLOR_MENUHILIGHT, - GTK_WIN32_SYS_COLOR_MENUBAR -}; - -enum { - GTK_WIN32_SYS_METRIC_CXSCREEN = 0, - GTK_WIN32_SYS_METRIC_CYSCREEN = 1, - GTK_WIN32_SYS_METRIC_CXVSCROLL = 2, - GTK_WIN32_SYS_METRIC_CYHSCROLL = 3, - GTK_WIN32_SYS_METRIC_CYCAPTION = 4, - GTK_WIN32_SYS_METRIC_CXBORDER = 5, - GTK_WIN32_SYS_METRIC_CYBORDER = 6, - GTK_WIN32_SYS_METRIC_CXDLGFRAME = 7, - GTK_WIN32_SYS_METRIC_CYDLGFRAME = 8, - GTK_WIN32_SYS_METRIC_CYVTHUMB = 9, - GTK_WIN32_SYS_METRIC_CXHTHUMB = 10, - GTK_WIN32_SYS_METRIC_CXICON = 11, - GTK_WIN32_SYS_METRIC_CYICON = 12, - GTK_WIN32_SYS_METRIC_CXCURSOR = 13, - GTK_WIN32_SYS_METRIC_CYCURSOR = 14, - GTK_WIN32_SYS_METRIC_CYMENU = 15, - GTK_WIN32_SYS_METRIC_CXFULLSCREEN = 16, - GTK_WIN32_SYS_METRIC_CYFULLSCREEN = 17, - GTK_WIN32_SYS_METRIC_CYKANJIWINDOW = 18, - GTK_WIN32_SYS_METRIC_MOUSEPRESENT = 19, - GTK_WIN32_SYS_METRIC_CYVSCROLL = 20, - GTK_WIN32_SYS_METRIC_CXHSCROLL = 21, - GTK_WIN32_SYS_METRIC_DEBUG = 22, - GTK_WIN32_SYS_METRIC_SWAPBUTTON = 23, - GTK_WIN32_SYS_METRIC_RESERVED1 = 24, - GTK_WIN32_SYS_METRIC_RESERVED2 = 25, - GTK_WIN32_SYS_METRIC_RESERVED3 = 26, - GTK_WIN32_SYS_METRIC_RESERVED4 = 27, - GTK_WIN32_SYS_METRIC_CXMIN = 28, - GTK_WIN32_SYS_METRIC_CYMIN = 29, - GTK_WIN32_SYS_METRIC_CXSIZE = 30, - GTK_WIN32_SYS_METRIC_CYSIZE = 31, - GTK_WIN32_SYS_METRIC_CXFRAME = 32, - GTK_WIN32_SYS_METRIC_CYFRAME = 33, - GTK_WIN32_SYS_METRIC_CXMINTRACK = 34, - GTK_WIN32_SYS_METRIC_CYMINTRACK = 35, - GTK_WIN32_SYS_METRIC_CXDOUBLECLK = 36, - GTK_WIN32_SYS_METRIC_CYDOUBLECLK = 37, - GTK_WIN32_SYS_METRIC_CXICONSPACING = 38, - GTK_WIN32_SYS_METRIC_CYICONSPACING = 39, - GTK_WIN32_SYS_METRIC_MENUDROPALIGNMENT = 40, - GTK_WIN32_SYS_METRIC_PENWINDOWS = 41, - GTK_WIN32_SYS_METRIC_DBCSENABLED = 42, - GTK_WIN32_SYS_METRIC_CMOUSEBUTTONS = 43, - GTK_WIN32_SYS_METRIC_SECURE = 44, - GTK_WIN32_SYS_METRIC_CXEDGE = 45, - GTK_WIN32_SYS_METRIC_CYEDGE = 46, - GTK_WIN32_SYS_METRIC_CXMINSPACING = 47, - GTK_WIN32_SYS_METRIC_CYMINSPACING = 48, - GTK_WIN32_SYS_METRIC_CXSMICON = 49, - GTK_WIN32_SYS_METRIC_CYSMICON = 50, - GTK_WIN32_SYS_METRIC_CYSMCAPTION = 51, - GTK_WIN32_SYS_METRIC_CXSMSIZE = 52, - GTK_WIN32_SYS_METRIC_CYSMSIZE = 53, - GTK_WIN32_SYS_METRIC_CXMENUSIZE = 54, - GTK_WIN32_SYS_METRIC_CYMENUSIZE = 55, - GTK_WIN32_SYS_METRIC_ARRANGE = 56, - GTK_WIN32_SYS_METRIC_CXMINIMIZED = 57, - GTK_WIN32_SYS_METRIC_CYMINIMIZED = 58, - GTK_WIN32_SYS_METRIC_CXMAXTRACK = 59, - GTK_WIN32_SYS_METRIC_CYMAXTRACK = 60, - GTK_WIN32_SYS_METRIC_CXMAXIMIZED = 61, - GTK_WIN32_SYS_METRIC_CYMAXIMIZED = 62, - GTK_WIN32_SYS_METRIC_NETWORK = 63, - GTK_WIN32_SYS_METRIC_CLEANBOOT = 67, - GTK_WIN32_SYS_METRIC_CXDRAG = 68, - GTK_WIN32_SYS_METRIC_CYDRAG = 69, - GTK_WIN32_SYS_METRIC_SHOWSOUNDS = 70, - GTK_WIN32_SYS_METRIC_CXMENUCHECK = 71, - GTK_WIN32_SYS_METRIC_CYMENUCHECK = 72, - GTK_WIN32_SYS_METRIC_SLOWMACHINE = 73, - GTK_WIN32_SYS_METRIC_MIDEASTENABLED = 74, - GTK_WIN32_SYS_METRIC_MOUSEWHEELPRESENT = 75, - GTK_WIN32_SYS_METRIC_XVIRTUALSCREEN = 76, - GTK_WIN32_SYS_METRIC_YVIRTUALSCREEN = 77, - GTK_WIN32_SYS_METRIC_CXVIRTUALSCREEN = 78, - GTK_WIN32_SYS_METRIC_CYVIRTUALSCREEN = 79, - GTK_WIN32_SYS_METRIC_CMONITORS = 80, - GTK_WIN32_SYS_METRIC_SAMEDISPLAYFORMAT = 81, - GTK_WIN32_SYS_METRIC_IMMENABLED = 82, - GTK_WIN32_SYS_METRIC_CXFOCUSBORDER = 83, - GTK_WIN32_SYS_METRIC_CYFOCUSBORDER = 84, - GTK_WIN32_SYS_METRIC_TABLETPC = 86, - GTK_WIN32_SYS_METRIC_MEDIACENTER = 87, - GTK_WIN32_SYS_METRIC_STARTER = 88, - GTK_WIN32_SYS_METRIC_SERVERR2 = 89, - GTK_WIN32_SYS_METRIC_CMETRICS = 90, - GTK_WIN32_SYS_METRIC_MOUSEHORIZONTALWHEELPRESENT = 91, - GTK_WIN32_SYS_METRIC_CXPADDEDBORDER = 92 -}; - -void gtk_win32_draw_theme_background (cairo_t *cr, - const char *class_name, - int part, - int state, - int width, - int height); -void gtk_win32_get_theme_part_size (const char *class_name, - int part, - int state, - int *width, - int *height); -void gtk_win32_get_theme_margins (const char *class_name, - int part, - int state, - GtkBorder *out_margins); - -const char * gtk_win32_get_sys_metric_name_for_id (gint id); -int gtk_win32_get_sys_metric_id_for_name (const char *name); -int gtk_win32_get_sys_metric (gint id); - -const char * gtk_win32_get_sys_color_name_for_id (gint id); -int gtk_win32_get_sys_color_id_for_name (const char *name); -void gtk_win32_get_sys_color (gint id, - GdkRGBA *color); - -G_END_DECLS - -#endif /* __GTK_WIN32_DRAW_H__ */ diff --git a/gtk/gtkwin32theme.c b/gtk/gtkwin32theme.c deleted file mode 100644 index 06f14496dd..0000000000 --- a/gtk/gtkwin32theme.c +++ /dev/null @@ -1,518 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2010 Carlos Garnacho - * Copyright (C) 2011 Red Hat, Inc. - * - * Authors: Carlos Garnacho - * Cosimo Cecchi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include - -#include "gtkwin32themeprivate.h" - -#include "gtkwin32drawprivate.h" - -#include "gdk/gdk-private.h" - -#ifdef G_OS_WIN32 - -#include -#include -#include - -typedef HANDLE HTHEME; - -#define UXTHEME_DLL "uxtheme.dll" - -static HINSTANCE uxtheme_dll = NULL; -static gboolean use_xp_theme = FALSE; - -typedef HRESULT (FAR PASCAL *GetThemeSysFontFunc) (HTHEME hTheme, int iFontID, OUT LOGFONTW *plf); -typedef int (FAR PASCAL *GetThemeSysSizeFunc) (HTHEME hTheme, int iSizeId); -typedef COLORREF (FAR PASCAL *GetThemeSysColorFunc) (HTHEME hTheme, - int iColorID); -typedef HTHEME (FAR PASCAL *OpenThemeDataFunc) (HWND hwnd, - LPCWSTR pszClassList); -typedef HRESULT (FAR PASCAL *CloseThemeDataFunc) (HTHEME theme); -typedef HRESULT (FAR PASCAL *DrawThemeBackgroundFunc) (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, - const RECT *pRect, const RECT *pClipRect); -typedef HRESULT (FAR PASCAL *EnableThemeDialogTextureFunc) (HWND hwnd, - DWORD dwFlags); -typedef BOOL (FAR PASCAL *IsThemeActiveFunc) (VOID); -typedef BOOL (FAR PASCAL *IsAppThemedFunc) (VOID); -typedef BOOL (FAR PASCAL *IsThemeBackgroundPartiallyTransparentFunc) (HTHEME hTheme, - int iPartId, - int iStateId); -typedef HRESULT (FAR PASCAL *DrawThemeParentBackgroundFunc) (HWND hwnd, - HDC hdc, - RECT *prc); -typedef HRESULT (FAR PASCAL *GetThemePartSizeFunc) (HTHEME hTheme, - HDC hdc, - int iPartId, - int iStateId, - RECT *prc, - int eSize, - SIZE *psz); -typedef HRESULT (FAR PASCAL *GetThemeBackgroundExtentFunc) (HTHEME hTheme, - HDC hdc, - int iPartId, - int iStateId, - const RECT *pContentRect, - RECT *pExtentRect); - -static GetThemeSysFontFunc get_theme_sys_font = NULL; -static GetThemeSysColorFunc GetThemeSysColor = NULL; -static GetThemeSysSizeFunc GetThemeSysSize = NULL; -static OpenThemeDataFunc OpenThemeData = NULL; -static CloseThemeDataFunc CloseThemeData = NULL; -static DrawThemeBackgroundFunc draw_theme_background = NULL; -static EnableThemeDialogTextureFunc enable_theme_dialog_texture = NULL; -static IsThemeActiveFunc is_theme_active = NULL; -static IsAppThemedFunc is_app_themed = NULL; -static IsThemeBackgroundPartiallyTransparentFunc is_theme_partially_transparent = NULL; -static DrawThemeParentBackgroundFunc draw_theme_parent_background = NULL; -static GetThemePartSizeFunc GetThemePartSize = NULL; -static GetThemeBackgroundExtentFunc GetThemeBackgroundExtent = NULL; - -#endif - -static GHashTable *themes_by_class = NULL; - -struct _GtkWin32Theme { - char *class_name; - gint ref_count; -#ifdef G_OS_WIN32 - HTHEME htheme; -#endif -}; - -GtkWin32Theme * -gtk_win32_theme_ref (GtkWin32Theme *theme) -{ - theme->ref_count++; - - return theme; -} - -static gboolean -gtk_win32_theme_close (GtkWin32Theme *theme) -{ -#ifdef G_OS_WIN32 - if (theme->htheme) - { - CloseThemeData (theme->htheme); - theme->htheme = NULL; - return TRUE; - } -#endif - return FALSE; -} - -void -gtk_win32_theme_unref (GtkWin32Theme *theme) -{ - theme->ref_count--; - - if (theme->ref_count > 0) - return; - - g_hash_table_remove (themes_by_class, theme->class_name); - - gtk_win32_theme_close (theme); - g_free (theme->class_name); - - g_slice_free (GtkWin32Theme, theme); -} - -gboolean -gtk_win32_theme_equal (GtkWin32Theme *theme1, - GtkWin32Theme *theme2) -{ - /* Themes are cached so they're guaranteed unique. */ - return theme1 == theme2; -} - -#ifdef G_OS_WIN32 - -static GdkWin32MessageFilterReturn -invalidate_win32_themes (GdkWin32Display *display, - MSG *msg, - gint *ret_valp, - gpointer data) -{ - GHashTableIter iter; - gboolean theme_was_open = FALSE; - gpointer theme; - - if (msg->message != WM_THEMECHANGED) - return GDK_WIN32_MESSAGE_FILTER_CONTINUE; - - g_hash_table_iter_init (&iter, themes_by_class); - while (g_hash_table_iter_next (&iter, NULL, &theme)) - { - theme_was_open |= gtk_win32_theme_close (theme); - } - if (theme_was_open) - gtk_style_context_reset_widgets (display); - - return GDK_WIN32_MESSAGE_FILTER_CONTINUE; -} - -static void -gtk_win32_theme_init (void) -{ - char *buf; - char dummy; - int n, k; - - if (uxtheme_dll) - return; - - n = GetSystemDirectory (&dummy, 0); - if (n <= 0) - return; - - buf = g_malloc (n + 1 + strlen (UXTHEME_DLL)); - k = GetSystemDirectory (buf, n); - if (k == 0 || k > n) - { - g_free (buf); - return; - } - - if (!G_IS_DIR_SEPARATOR (buf[strlen (buf) -1])) - strcat (buf, G_DIR_SEPARATOR_S); - strcat (buf, UXTHEME_DLL); - - uxtheme_dll = LoadLibrary (buf); - g_free (buf); - - if (!uxtheme_dll) - return; - - is_app_themed = (IsAppThemedFunc) GetProcAddress (uxtheme_dll, "IsAppThemed"); - if (is_app_themed) - { - is_theme_active = (IsThemeActiveFunc) GetProcAddress (uxtheme_dll, "IsThemeActive"); - OpenThemeData = (OpenThemeDataFunc) GetProcAddress (uxtheme_dll, "OpenThemeData"); - CloseThemeData = (CloseThemeDataFunc) GetProcAddress (uxtheme_dll, "CloseThemeData"); - draw_theme_background = (DrawThemeBackgroundFunc) GetProcAddress (uxtheme_dll, "DrawThemeBackground"); - enable_theme_dialog_texture = (EnableThemeDialogTextureFunc) GetProcAddress (uxtheme_dll, "EnableThemeDialogTexture"); - get_theme_sys_font = (GetThemeSysFontFunc) GetProcAddress (uxtheme_dll, "GetThemeSysFont"); - GetThemeSysColor = (GetThemeSysColorFunc) GetProcAddress (uxtheme_dll, "GetThemeSysColor"); - GetThemeSysSize = (GetThemeSysSizeFunc) GetProcAddress (uxtheme_dll, "GetThemeSysSize"); - is_theme_partially_transparent = (IsThemeBackgroundPartiallyTransparentFunc) GetProcAddress (uxtheme_dll, "IsThemeBackgroundPartiallyTransparent"); - draw_theme_parent_background = (DrawThemeParentBackgroundFunc) GetProcAddress (uxtheme_dll, "DrawThemeParentBackground"); - GetThemePartSize = (GetThemePartSizeFunc) GetProcAddress (uxtheme_dll, "GetThemePartSize"); - GetThemeBackgroundExtent = (GetThemeBackgroundExtentFunc) GetProcAddress (uxtheme_dll, "GetThemeBackgroundExtent"); - } - - if (is_app_themed && is_theme_active) - { - use_xp_theme = (is_app_themed () && is_theme_active ()); - } - else - { - use_xp_theme = FALSE; - } - - gdk_win32_display_add_filter (gdk_display_get_default (), invalidate_win32_themes, NULL); -} - -static HTHEME -gtk_win32_theme_get_htheme (GtkWin32Theme *theme) -{ - guint16 *wclass; - - gtk_win32_theme_init (); - - if (theme->htheme) - return theme->htheme; - - wclass = g_utf8_to_utf16 (theme->class_name, -1, NULL, NULL, NULL); - theme->htheme = OpenThemeData (NULL, wclass); - g_free (wclass); - - return theme->htheme; -} - -#endif /* G_OS_WIN32 */ - -static char * -canonicalize_class_name (const char *classname) -{ - /* Wine claims class names are case insensitive, so we convert them - here to avoid multiple theme objects referencing the same HTHEME. */ - return g_ascii_strdown (classname, -1); -} - -GtkWin32Theme * -gtk_win32_theme_lookup (const char *classname) -{ - GtkWin32Theme *theme; - char *canonical_classname; - - if (G_UNLIKELY (themes_by_class == NULL)) - themes_by_class = g_hash_table_new (g_str_hash, g_str_equal); - - canonical_classname = canonicalize_class_name (classname); - theme = g_hash_table_lookup (themes_by_class, canonical_classname); - - if (theme != NULL) - { - g_free (canonical_classname); - return gtk_win32_theme_ref (theme); - } - - theme = g_slice_new0 (GtkWin32Theme); - theme->ref_count = 1; - theme->class_name = canonical_classname; - - g_hash_table_insert (themes_by_class, theme->class_name, theme); - - return theme; -} - -GtkWin32Theme * -gtk_win32_theme_parse (GtkCssParser *parser) -{ - GtkWin32Theme *theme; - char *class_name; - - class_name = _gtk_css_parser_try_name (parser, TRUE); - if (class_name == NULL) - { - _gtk_css_parser_error (parser, "Expected valid win32 theme name"); - return NULL; - } - - theme = gtk_win32_theme_lookup (class_name); - g_free (class_name); - - return theme; -} - -cairo_surface_t * -gtk_win32_theme_create_surface (GtkWin32Theme *theme, - int xp_part, - int state, - int margins[4], - int width, - int height, - int *x_offs_out, - int *y_offs_out) -{ - cairo_surface_t *surface; - cairo_t *cr; - int x_offs; - int y_offs; -#ifdef G_OS_WIN32 - gboolean has_alpha; - HDC hdc; - RECT rect; - SIZE size; - HRESULT res; - HTHEME htheme; -#endif - - x_offs = margins[3]; - y_offs = margins[0]; - - width -= margins[3] + margins[1]; - height -= margins[0] + margins[2]; - -#ifdef G_OS_WIN32 - htheme = gtk_win32_theme_get_htheme (theme); - if (htheme) - { - rect.left = 0; - rect.top = 0; - rect.right = width; - rect.bottom = height; - - hdc = GetDC (NULL); - res = GetThemePartSize (htheme, hdc, xp_part, state, &rect, 2 /*TS_DRAW*/, &size); - ReleaseDC (NULL, hdc); - - if (res == S_OK) - { - x_offs += (width - size.cx) / 2; - y_offs += (height - size.cy) / 2; - - width = size.cx; - height = size.cy; - - rect.right = width; - rect.bottom = height; - } - - has_alpha = is_theme_partially_transparent (htheme, xp_part, state); - if (has_alpha) - surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32, width, height); - else - surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_RGB24, width, height); - - hdc = cairo_win32_surface_get_dc (surface); - - res = draw_theme_background (htheme, hdc, xp_part, state, &rect, &rect); - - *x_offs_out = x_offs; - *y_offs_out = y_offs; - - if (res == S_OK) - return surface; - } - else -#endif /* G_OS_WIN32 */ - { - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); - } - - cr = cairo_create (surface); - - gtk_win32_draw_theme_background (cr, theme->class_name, xp_part, state, width, height); - - cairo_destroy (cr); - - *x_offs_out = x_offs; - *y_offs_out = y_offs; - - return surface; -} - -void -gtk_win32_theme_get_part_border (GtkWin32Theme *theme, - int part, - int state, - GtkBorder *out_border) -{ -#ifdef G_OS_WIN32 - HTHEME htheme = gtk_win32_theme_get_htheme (theme); - RECT content, extent; - HDC hdc; - HRESULT res; - - if (use_xp_theme && GetThemeBackgroundExtent != NULL && htheme != NULL) - { - /* According to Wine source code, these values don't matter - * because uxtheme.dll deals with margins internally. */ - content.left = content.top = 0; - content.right = content.bottom = 100; - - hdc = GetDC (NULL); - res = GetThemeBackgroundExtent (htheme, hdc, part, state, &content, &extent); - ReleaseDC (NULL, hdc); - - if (SUCCEEDED (res)) - { - out_border->top = content.top - extent.top; - out_border->left = content.left - extent.left; - out_border->bottom = extent.bottom - content.bottom; - out_border->right = extent.right - content.right; - return; - } - } -#endif - - gtk_win32_get_theme_margins (theme->class_name, part, state, out_border); -} - -void -gtk_win32_theme_get_part_size (GtkWin32Theme *theme, - int part, - int state, - int *width, - int *height) -{ -#ifdef G_OS_WIN32 - HTHEME htheme = gtk_win32_theme_get_htheme (theme); - SIZE size; - HRESULT res; - - if (use_xp_theme && GetThemePartSize != NULL && htheme != NULL) - { - res = GetThemePartSize (htheme, NULL, part, state, NULL, 1 /* TS_TRUE */, &size); - - if (SUCCEEDED (res)) - { - if (width) - *width = size.cx; - if (height) - *height = size.cy; - return; - } - } -#endif - gtk_win32_get_theme_part_size (theme->class_name, part, state, width, height); -} - -int -gtk_win32_theme_get_size (GtkWin32Theme *theme, - int id) -{ -#ifdef G_OS_WIN32 - if (use_xp_theme && GetThemeSysSize != NULL) - { - HTHEME htheme = gtk_win32_theme_get_htheme (theme); - int size; - - /* If htheme is NULL it will just return the GetSystemMetrics value */ - size = GetThemeSysSize (htheme, id); - /* fall through on invalid parameter */ - if (GetLastError () == 0) - return size; - } - - return GetSystemMetrics (id); -#else - return gtk_win32_get_sys_metric (id); -#endif -} - -void -gtk_win32_theme_get_color (GtkWin32Theme *theme, - gint id, - GdkRGBA *color) -{ -#ifdef G_OS_WIN32 - HTHEME htheme; - DWORD dcolor; - - if (use_xp_theme && GetThemeSysColor != NULL) - { - htheme = gtk_win32_theme_get_htheme (theme); - - /* if htheme is NULL, it will just return the GetSysColor() value */ - dcolor = GetThemeSysColor (htheme, id); - } - else - dcolor = GetSysColor (id); - - color->alpha = 1.0; - color->red = GetRValue (dcolor) / 255.0; - color->green = GetGValue (dcolor) / 255.0; - color->blue = GetBValue (dcolor) / 255.0; -#else - gtk_win32_get_sys_color (id, color); -#endif -} - -void -gtk_win32_theme_print (GtkWin32Theme *theme, - GString *string) -{ - g_string_append (string, theme->class_name); -} diff --git a/gtk/gtkwin32themeprivate.h b/gtk/gtkwin32themeprivate.h deleted file mode 100644 index 056e098062..0000000000 --- a/gtk/gtkwin32themeprivate.h +++ /dev/null @@ -1,70 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2011 Red Hat, Inc. - * - * Authors: Alexander Larsson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef __GTK_WIN32_THEME_PART_H__ -#define __GTK_WIN32_THEME_PART_H__ - -#include "gtkborder.h" -#include "gtkcssparserprivate.h" - -G_BEGIN_DECLS - -typedef struct _GtkWin32Theme GtkWin32Theme; - -#define GTK_WIN32_THEME_SYMBOLIC_COLOR_NAME "-gtk-win32-color" - -GtkWin32Theme * gtk_win32_theme_lookup (const char *class_name); -GtkWin32Theme * gtk_win32_theme_parse (GtkCssParser *parser); - -GtkWin32Theme * gtk_win32_theme_ref (GtkWin32Theme *theme); -void gtk_win32_theme_unref (GtkWin32Theme *theme); - -gboolean gtk_win32_theme_equal (GtkWin32Theme *theme1, - GtkWin32Theme *theme2); - -void gtk_win32_theme_print (GtkWin32Theme *theme, - GString *string); - -cairo_surface_t * gtk_win32_theme_create_surface (GtkWin32Theme *theme, - int xp_part, - int state, - int margins[4], - int width, - int height, - int *x_offs_out, - int *y_offs_out); - -void gtk_win32_theme_get_part_border (GtkWin32Theme *theme, - int part, - int state, - GtkBorder *out_border); -void gtk_win32_theme_get_part_size (GtkWin32Theme *theme, - int part, - int state, - int *width, - int *height); -int gtk_win32_theme_get_size (GtkWin32Theme *theme, - int id); -void gtk_win32_theme_get_color (GtkWin32Theme *theme, - gint id, - GdkRGBA *color); - -G_END_DECLS - -#endif /* __GTK_WIN32_THEME_PART_H__ */ diff --git a/gtk/meson.build b/gtk/meson.build index 714c0eab65..ef9b7a0e32 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -65,7 +65,6 @@ gtk_private_sources = files([ 'gtkcssimagescaled.c', 'gtkcssimageurl.c', 'gtkcssimagevalue.c', - 'gtkcssimagewin32.c', 'gtkcssinheritvalue.c', 'gtkcssinitialvalue.c', 'gtkcsskeyframes.c', @@ -99,7 +98,6 @@ gtk_private_sources = files([ 'gtkcssunsetvalue.c', 'gtkcssvalue.c', 'gtkcsswidgetnode.c', - 'gtkcsswin32sizevalue.c', 'gtkfilechooserembed.c', 'gtkfilechooserentry.c', 'gtkfilechoosererrorstack.c', @@ -144,9 +142,6 @@ gtk_private_sources = files([ 'gtktextbtree.c', 'gtktrashmonitor.c', 'gtktreedatalist.c', - 'gtkwin32draw.c', - 'gtkwin32theme.c', - 'gtkwin32theme.c', ]) # List of files that contain public API, and should be introspected diff --git a/gtk/theme/win32/gtk-win32-base.css b/gtk/theme/win32/gtk-win32-base.css deleted file mode 100644 index 8f92398f43..0000000000 --- a/gtk/theme/win32/gtk-win32-base.css +++ /dev/null @@ -1,1438 +0,0 @@ -@define-color bg_color -gtk-win32-color(button, btnface); -@define-color text_color -gtk-win32-color(button, btntext); -@define-color selected_bg_color -gtk-win32-color(button, highlight); -@define-color selected_fg_color -gtk-win32-color(button, highlighttext); -@define-color info_fg_color rgb(181, 171, 156); -@define-color info_bg_color rgb(252, 252, 189); -@define-color warning_fg_color rgb(173, 120, 41); -@define-color warning_bg_color rgb(250, 173, 61); -@define-color question_fg_color rgb(97, 122, 214); -@define-color question_bg_color rgb(138, 173, 212); -@define-color error_fg_color rgb(166, 38, 38); -@define-color error_bg_color rgb(237, 54, 54); - -@define-color app_notification_a #aeaea4; -@define-color app_notification_b #d1d1cb; -@define-color app_notification_c #d8d8d3; - -@define-color app_notification_border #949486; - -@define-color primary_toolbarbutton_text_shadow alpha(black, 0.1); - -.background, -viewport { - /* XXX: This should be the default, but isn't?! */ - font-family: "Segoe UI", Sans; - font-size: 9pt; - background-color: -gtk-win32-color(window, btnface); - color: -gtk-win32-color(window, btntext); -} - -* { - -GtkScrolledWindow-scrollbars-spacing: 0; -} - -:link { - color: -gtk-win32-color(button, hotlight); -} - -:visited { - color: -gtk-win32-color(button, hotlight); -} - -*:disabled { - color: -gtk-win32-color(button, graytext); -} - -*:selected, -*:selected:focus { - background-color: @selected_bg_color; - color: @selected_fg_color; -} - -.info { - background-color: @info_bg_color; - color: @info_fg_color; -} - -.warning { - background-color: @warning_bg_color; - color: @warning_fg_color; -} - -.question { - background-color: @question_bg_color; - color: @question_fg_color; -} - -.error { - background-color: @error_bg_color; - color: @error_fg_color; -} - -.highlight { - background-color: @selected_bg_color; - color: @selected_fg_color; -} - -.light-area-focus { - color: #000; -} - -.dark-area-focus { - color: #fff; -} - -scrolledwindow.frame { - border-style: solid; - border-width: 2px; - border-image: -gtk-win32-theme-part(listview, 5, 1) 2 2 2 2 stretch; -} - -.view { - border-width: 0; - border-radius: 0; - background-color: -gtk-win32-color(edit, window); - color: @text_color; -} - -.view:selected { - background-color: shade(-gtk-win32-color(edit, window), 0.9); - color: @fg_color; -} - -.view:selected:focus { - background-color: @selected_bg_color; - color: @selected_fg_color; -} - -tooltip, tooltip.background { - background-color: -gtk-win32-color(tooltip, infobk); - background-image: -gtk-win32-theme-part(tooltip, 1, 1); - color: -gtk-win32-color(button, infotext); - padding: 2px; -} - -assistant .sidebar .highlight { - font-weight: bold; - color: -gtk-win32-color(button, captiontext); -} - -/* checkmarks */ - -check { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 1); - min-width: -gtk-win32-part-width(button, 3, 1); - min-height: -gtk-win32-part-height(button, 3, 1); -} - -check:hover { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 2); - min-width: -gtk-win32-part-width(button, 3, 2); - min-height: -gtk-win32-part-height(button, 3, 2); -} - -check:active { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 3); - min-width: -gtk-win32-part-width(button, 3, 3); - min-height: -gtk-win32-part-height(button, 3, 3); -} - -check:disabled { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 4); - min-width: -gtk-win32-part-width(button, 3, 4); - min-height: -gtk-win32-part-height(button, 3, 4); -} - -check:checked { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 5); - min-width: -gtk-win32-part-width(button, 3, 5); - min-height: -gtk-win32-part-height(button, 3, 5); -} - -check:checked:hover { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 6); - min-width: -gtk-win32-part-width(button, 3, 6); - min-height: -gtk-win32-part-height(button, 3, 6); -} - -check:checked:active { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 7); - min-width: -gtk-win32-part-width(button, 3, 7); - min-height: -gtk-win32-part-height(button, 3, 7); -} - -check:checked:disabled { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 8); - min-width: -gtk-win32-part-width(button, 3, 8); - min-height: -gtk-win32-part-height(button, 3, 8); -} - -check:indeterminate { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 9); - min-width: -gtk-win32-part-width(button, 3, 9); - min-height: -gtk-win32-part-height(button, 3, 9); -} - -check:indeterminate:hover { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 10); - min-width: -gtk-win32-part-width(button, 3, 10); - min-height: -gtk-win32-part-height(button, 3, 10); -} - -check:indeterminate:active { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 11); - min-width: -gtk-win32-part-width(button, 3, 11); - min-height: -gtk-win32-part-height(button, 3, 11); -} - -check:indeterminate:disabled { - -gtk-icon-source: -gtk-win32-theme-part(button, 3, 12); - min-width: -gtk-win32-part-width(button, 3, 12); - min-height: -gtk-win32-part-height(button, 3, 12); -} - -/* radiomarks */ - -radio { - -gtk-icon-source: -gtk-win32-theme-part(button, 2, 1); - min-width: -gtk-win32-part-width(button, 2, 1); - min-height: -gtk-win32-part-height(button, 2, 1); -} - -radio:hover { - -gtk-icon-source: -gtk-win32-theme-part(button, 2, 2); - min-width: -gtk-win32-part-width(button, 2, 2); - min-height: -gtk-win32-part-height(button, 2, 2); -} - -radio:active { - -gtk-icon-source: -gtk-win32-theme-part(button, 2, 3); - min-width: -gtk-win32-part-width(button, 2, 3); - min-height: -gtk-win32-part-height(button, 2, 3); -} - -radio:disabled { - -gtk-icon-source: -gtk-win32-theme-part(button, 2, 4); - min-width: -gtk-win32-part-width(button, 2, 4); - min-height: -gtk-win32-part-height(button, 2, 4); -} - -radio:checked { - -gtk-icon-source: -gtk-win32-theme-part(button, 2, 5); - min-width: -gtk-win32-part-width(button, 2, 5); - min-height: -gtk-win32-part-height(button, 2, 5); -} - -radio:checked:hover { - -gtk-icon-source: -gtk-win32-theme-part(button, 2, 6); - min-width: -gtk-win32-part-width(button, 2, 6); - min-height: -gtk-win32-part-height(button, 2, 6); -} - -radio:checked:active { - -gtk-icon-source: -gtk-win32-theme-part(button, 2, 7); - min-width: -gtk-win32-part-width(button, 2, 7); - min-height: -gtk-win32-part-height(button, 2, 7); -} - -radio:checked:disabled { - -gtk-icon-source: -gtk-win32-theme-part(button, 2, 8); - min-width: -gtk-win32-part-width(button, 2, 8); - min-height: -gtk-win32-part-height(button, 2, 8); -} - -radio:indeterminate { - -gtk-icon-source: cross-fade(30% -gtk-win32-theme-part(button, 2, 5), -gtk-win32-theme-part(button, 2, 1)); - min-width: -gtk-win32-part-width(button, 2, 9); - min-height: -gtk-win32-part-height(button, 2, 9); -} - -radio:indeterminate:hover { - -gtk-icon-source: cross-fade(30% -gtk-win32-theme-part(button, 2, 6), -gtk-win32-theme-part(button, 2, 2)); - min-width: -gtk-win32-part-width(button, 2, 2); - min-height: -gtk-win32-part-height(button, 2, 2); -} - -radio:indeterminate:active { - -gtk-icon-source: cross-fade(30% -gtk-win32-theme-part(button, 2, 7), -gtk-win32-theme-part(button, 2, 3)); - min-width: -gtk-win32-part-width(button, 2, 3); - min-height: -gtk-win32-part-height(button, 2, 3); -} - -radio:indeterminate:disabled { - -gtk-icon-source: cross-fade(30% -gtk-win32-theme-part(button, 2, 8), -gtk-win32-theme-part(button, 2, 4)); - min-width: -gtk-win32-part-width(button, 2, 4); - min-height: -gtk-win32-part-height(button, 2, 4); -} - -/* Buttons */ - -button { - background-image: -gtk-win32-theme-part(button, 1, 1); - padding-top: calc(1px + -gtk-win32-part-border-top(button, 1, 1)); - padding-right: calc(1px + -gtk-win32-part-border-right(button, 1, 1)); - padding-bottom: calc(1px + -gtk-win32-part-border-bottom(button, 1, 1)); - padding-left: calc(1px + -gtk-win32-part-border-left(button, 1, 1)); -} - -button.default { - background-image: -gtk-win32-theme-part(button, 1, 5); -} - -button:hover { - background-image: -gtk-win32-theme-part(button, 1, 2); -} - -button:active, button:checked { - background-image: -gtk-win32-theme-part(button, 1, 3); -} - -/* XXX: Figure out how to handle disabled active togglebuttons */ -button:disabled { - background-image: -gtk-win32-theme-part(button, 1, 4); -} - -/* checkbuttons */ - -/* This is the magic spacing that's hardcoded in Wine */ -checkbutton:dir(ltr) check, -radiobutton:dir(ltr) radio { - margin-right: 6px; -} - -checkbutton:dir(rtl) check, -radiobutton:dir(rtl) radio { - margin-left: 6px; -} - -/* Frame */ - -frame { - padding: 0px 10px; -} - -frame > border { - margin: 0px -10px; - background-image: -gtk-win32-theme-part(button, 4, 1); - padding-top: -gtk-win32-part-border-top(button, 4, 1); - padding-right: -gtk-win32-part-border-right(button, 4, 1); - padding-bottom: -gtk-win32-part-border-bottom(button, 4, 1); - padding-left: -gtk-win32-part-border-left(button, 4, 1); -} - -frame:disabled > border { - margin: 0px -10px; - background-image: -gtk-win32-theme-part(button, 4, 2); - padding-top: -gtk-win32-part-border-top(button, 4, 2); - padding-right: -gtk-win32-part-border-right(button, 4, 2); - padding-bottom: -gtk-win32-part-border-bottom(button, 4, 2); - padding-left: -gtk-win32-part-border-left(button, 4, 2); -} - -frame > :not(border) { - margin: 0px 2px; -} - -/* Notebooks */ - -notebook > stack { - background-image: -gtk-win32-theme-part(tab, 9, 1); -} - -notebook > header > tabs { - padding: 2px; -} - -notebook > header.top > tabs { - padding-bottom: 0px; -} - -notebook > header.right > tabs { - padding-left: 0px; -} - -notebook > header.bottom > tabs { - padding-top: 0px; -} - -notebook > header.left > tabs { - padding-right: 0px; -} - -notebook > header > tabs > tab { - background-image: -gtk-win32-theme-part(tab, 1, 1); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 1, 1)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 1, 1)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 1, 1)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 1, 1)); -} - -notebook > header > tabs > tab:hover { - background-image: -gtk-win32-theme-part(tab, 1, 2); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 1, 2)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 1, 2)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 1, 2)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 1, 2)); -} - -notebook > header > tabs > tab:focus { - background-image: -gtk-win32-theme-part(tab, 1, 5); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 1, 5)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 1, 5)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 1, 5)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 1, 5)); -} - -notebook > header > tabs > tab:disabled { - background-image: -gtk-win32-theme-part(tab, 1, 4); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 1, 4)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 1, 4)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 1, 4)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 1, 4)); -} - -notebook > header > tabs > tab:checked { - background-image: -gtk-win32-theme-part(tab, 5, 3); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 5, 3)); - padding-right: calc(5px + -gtk-win32-part-border-right(tab, 5, 3)); - padding-bottom: calc(4px + -gtk-win32-part-border-bottom(tab, 5, 3)); - padding-left: calc(5px + -gtk-win32-part-border-left(tab, 5, 3)); - margin: -2px; -} - -notebook > header > tabs > tab:first-child { - background-image: -gtk-win32-theme-part(tab, 2, 1); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 2, 1)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 2, 1)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 2, 1)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 2, 1)); -} - -notebook > header > tabs > tab:first-child:hover { - background-image: -gtk-win32-theme-part(tab, 2, 2); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 2, 2)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 2, 2)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 2, 2)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 2, 2)); -} - -notebook > header > tabs > tab:first-child:focus { - background-image: -gtk-win32-theme-part(tab, 1, 5); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 2, 5)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 2, 5)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 2, 5)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 2, 5)); -} - -notebook > header > tabs > tab:first-child:disabled { - background-image: -gtk-win32-theme-part(tab, 1, 4); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 2, 4)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 2, 4)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 2, 4)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 2, 4)); -} - -notebook > header > tabs > tab:first-child:checked { - background-image: -gtk-win32-theme-part(tab, 6, 3); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 6, 3)); - padding-right: calc(5px + -gtk-win32-part-border-right(tab, 6, 3)); - padding-bottom: calc(4px + -gtk-win32-part-border-bottom(tab, 6, 3)); - padding-left: calc(5px + -gtk-win32-part-border-left(tab, 6, 3)); - margin: -2px; -} - -notebook > header > tabs > tab:last-child { - background-image: -gtk-win32-theme-part(tab, 3, 1); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 3, 1)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 3, 1)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 3, 1)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 3, 1)); -} - -notebook > header > tabs > tab:last-child:hover { - background-image: -gtk-win32-theme-part(tab, 3, 2); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 3, 2)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 3, 2)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 3, 2)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 3, 2)); -} - -notebook > header > tabs > tab:last-child:focus { - background-image: -gtk-win32-theme-part(tab, 3, 5); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 3, 5)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 3, 5)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 3, 5)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 3, 5)); -} - -notebook > header > tabs > tab:last-child:disabled { - background-image: -gtk-win32-theme-part(tab, 3, 4); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 3, 4)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 3, 4)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 3, 4)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 3, 4)); -} - -notebook > header > tabs > tab:last-child:checked { - background-image: -gtk-win32-theme-part(tab, 7, 3); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 7, 3)); - padding-right: calc(5px + -gtk-win32-part-border-right(tab, 7, 3)); - padding-bottom: calc(4px + -gtk-win32-part-border-bottom(tab, 7, 3)); - padding-left: calc(5px + -gtk-win32-part-border-left(tab, 7, 3)); - margin: -2px; -} - -notebook > header > tabs > tab:only-child { - background-image: -gtk-win32-theme-part(tab, 4, 1); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 4, 1)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 4, 1)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 4, 1)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 4, 1)); -} - -notebook > header > tabs > tab:only-child:hover { - background-image: -gtk-win32-theme-part(tab, 4, 2); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 4, 2)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 4, 2)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 4, 2)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 4, 2)); -} - -notebook > header > tabs > tab:only-child:focus { - background-image: -gtk-win32-theme-part(tab, 4, 5); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 4, 5)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 4, 5)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 4, 5)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 4, 5)); -} - -notebook > header > tabs > tab:only-child:disabled { - background-image: -gtk-win32-theme-part(tab, 4, 4); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 4, 4)); - padding-right: calc(3px + -gtk-win32-part-border-right(tab, 4, 4)); - padding-bottom: calc(2px + -gtk-win32-part-border-bottom(tab, 4, 4)); - padding-left: calc(3px + -gtk-win32-part-border-left(tab, 4, 4)); -} - -notebook > header > tabs > tab:only-child:checked { - background-image: -gtk-win32-theme-part(tab, 8, 3); - padding-top: calc(1px + -gtk-win32-part-border-top(tab, 8, 3)); - padding-right: calc(5px + -gtk-win32-part-border-right(tab, 8, 3)); - padding-bottom: calc(4px + -gtk-win32-part-border-bottom(tab, 8, 3)); - padding-left: calc(5px + -gtk-win32-part-border-left(tab, 8, 3)); - margin: -2px; -} - -/* Scrollbars */ - -/* TODO: Win32 has different concept for upper and lower trough, we - don't use this atm */ - -scrollbar { - background-color: transparent; -} - -scrollbar.horizontal button { - min-width : -gtk-win32-size(scrollbar, cxhscroll); - min-height : -gtk-win32-size(scrollbar, cyhscroll); -} -scrollbar.vertical button { - min-width : -gtk-win32-size(scrollbar, cxvscroll); - min-height : -gtk-win32-size(scrollbar, cyvscroll); -} -scrollbar button, scrollbar button:disabled { - color: transparent; - margin: 0; - padding: 0; -} - -/* up button */ -scrollbar.vertical button.up { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 1); -} -scrollbar.vertical:hover button.up { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 17); -} -scrollbar.vertical:hover button.up:hover { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 2); -} -scrollbar.vertical:hover button.up:active { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 3); -} -scrollbar.vertical:hover button.up:disabled { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 4); -} - -/* down button */ -scrollbar.vertical button.down { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 5); -} -scrollbar.vertical:hover button.down { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 18); -} -scrollbar.vertical:hover button.down:hover { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 6); -} -scrollbar.vertical:hover button.down:active { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 7); -} -scrollbar.vertical:hover button.down:disabled { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 8); -} - -/* left button */ -scrollbar.horizontal button.up { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 9); -} -scrollbar.horizontal:hover button.up { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 19); -} -scrollbar.horizontal:hover button.up:hover { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 10); -} -scrollbar.horizontal:hover button.up:active { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 11); -} -scrollbar.horizontal:hover button.up:disabled { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 12); -} - -/* right button */ -scrollbar.horizontal button.down { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 13); -} -scrollbar.horizontal:hover button.down { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 20); -} -scrollbar.horizontal:hover button.down:hover { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 14); -} -scrollbar.horizontal:hover button.down:active { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 16); -} -scrollbar.horizontal:hover button.down:disabled { -background-image: -gtk-win32-theme-part(scrollbar, 1 , 17); -} - -scrollbar trough { - border-width: 0; - background-image: -gtk-win32-theme-part(scrollbar, 6, 1); -} - -scrollbar trough.vertical { - border-width: 0; - background-image: -gtk-win32-theme-part(scrollbar, 2, 1, over(6, 1)); -} - -scrollbar.horizontal slider { - min-height: -gtk-win32-size(scrollbar, cyhscroll); - min-width: -gtk-win32-size(scrollbar, cxhthumb); -} -scrollbar.vertical slider { - min-width: -gtk-win32-size(scrollbar, cxvscroll); - min-height: -gtk-win32-size(scrollbar, cyvthumb); -} - - -scrollbar slider { - border-width: 0; - background-image: -gtk-win32-theme-part(scrollbar, 2, 1, over(8, 1)); -} - -scrollbar slider:hover { - background-image: -gtk-win32-theme-part(scrollbar, 2, 2, over(8, 2)); -} - -scrollbar slider:active { - background-image: -gtk-win32-theme-part(scrollbar, 2, 3, over(8, 3)); -} - -scrollbar slider:disabled { - /* There's a theme part for "disabled slider", but the only app observed - to have a disabled scrollbar (Notepad) does not draw its slider at all - when scrollbar is disabled. */ - background-image: none; - background-color: transparent; -} - -scrollbar.vertical slider { - background-image: -gtk-win32-theme-part(scrollbar, 3, 1, over(9, 1)); -} - -scrollbar.vertical slider:hover { - background-image: -gtk-win32-theme-part(scrollbar, 3, 2, over(9, 2)); -} - -scrollbar.vertical slider:active { - background-image: -gtk-win32-theme-part(scrollbar, 3, 3, over(9, 3)); -} - -scrollbar.vertical slider:disabled { - background-image: none; - background-color: transparent; -} - -/* Entry */ - -textview.view, -entry { - background-image: -gtk-win32-theme-part(edit, 1, 1); - /* The 1em/3 is the "margin" that Windows uses. I'm pretty sure that's the "ABC width" - of the font. But we don't get those fancy things in CSS. */ - padding: -gtk-win32-size(edit, cyedge) calc(-gtk-win32-size(edit, cxedge) + 1em/3); -} - -textview.view:focus, -entry:focus { - background-image: -gtk-win32-theme-part(edit, 1, 3); -} - -textview.view:disabled, -entry:disabled { - background-image: -gtk-win32-theme-part(edit, 1, 4); - color: -gtk-win32-color(edit, graytext); -} - -selection { - background: -gtk-win32-color(edit, highlight); - color: -gtk-win32-color(edit, highlighttext); -} - -entry.flat { - padding: 0px; - background-image: -gtk-win32-theme-part(edit, 3, 1); -} - -entry.flat:focus { - background-image: -gtk-win32-theme-part(edit, 3, 3); -} - -entry.flat:disabled { - background-image: -gtk-win32-theme-part(edit, 3, 4); - color: -gtk-win32-color(edit, graytext); -} - -/* Spinbutton (horizontal) */ - -spinbutton.horizontal { - padding: 2px 1px; - background-image: -gtk-win32-theme-part(edit, 1, 1); -} - -spinbutton.horizontal:focus { - background-image: -gtk-win32-theme-part(edit, 1, 3); -} - -spinbutton.horizontal:disabled { - background-image: -gtk-win32-theme-part(edit, 1, 4); -} - -spinbutton.horizontal entry { - all: unset; - padding: 0px calc(1em/3); -} - -spinbutton.horizontal button { - all: unset; - color: transparent; - min-width: 15px; - min-height: 9px; - background-size: 15px 9px; - background-repeat: no-repeat; -} - -spinbutton.horizontal button.down { - background-image: -gtk-win32-theme-part(spin, 2, 1); - background-position: top center; - padding-left: 1px; - margin-left: -1px; - margin-top: 8px; - margin-bottom: -8px; - margin-right: -1px; -} - -spinbutton.horizontal button.up { - background-image: -gtk-win32-theme-part(spin, 1, 1); - background-position: bottom center; - margin-top: -8px; - margin-bottom: 8px; - margin-left: -16px; - margin-right: -1px; -} - -spinbutton.horizontal button.down:hover { - background-image: -gtk-win32-theme-part(spin, 2, 2); -} - -spinbutton.horizontal button.up:hover { - background-image: -gtk-win32-theme-part(spin, 1, 2); -} - -spinbutton.horizontal button.down:active { - background-image: -gtk-win32-theme-part(spin, 2, 3); -} - -spinbutton.horizontal button.up:active { - background-image: -gtk-win32-theme-part(spin, 1, 3); -} - -spinbutton.horizontal button.down:disabled { - background-image: -gtk-win32-theme-part(spin, 2, 4); -} - -spinbutton.horizontal button.up:disabled { - background-image: -gtk-win32-theme-part(spin, 1, 4); -} - -/* Spinbutton (vertical) */ - -spinbutton.vertical button, -spinbutton.vertical button:focus { - background-color: transparent; - color: rgba(0, 0, 0, 0); - background-image: -gtk-win32-theme-part(spin, 1, 1, margins(0 -1 -0 -1)); -} - -spinbutton.vertical button:last-child, -spinbutton.vertical button:focus:last-child { - background-image: -gtk-win32-theme-part(spin, 2, 1, margins(0 -1 0 -1)); -} - - -spinbutton.vertical button:hover, -spinbutton.vertical button:hover:focus { - background-image: -gtk-win32-theme-part(spin, 1, 2, margins(0 -1 -0 -1)); -} - -spinbutton.vertical button:hover:last-child, -spinbutton.vertical button:hover:focus:last-child { - background-image: -gtk-win32-theme-part(spin, 2, 2, margins(0 -1 0 -1)); -} - - -spinbutton.vertical button:active, -spinbutton.vertical button:active:hover, -spinbutton.vertical button:active:focus, -spinbutton.vertical button:active:hover:focus { - background-image: -gtk-win32-theme-part(spin, 1, 3, margins(0 -1 -0 -1)); -} - -spinbutton.vertical button:active:last-child, -spinbutton.vertical button:active:hover:last-child, -spinbutton.vertical button:active:focus:last-child, -spinbutton.vertical button:active:hover:focus:last-child { - background-image: -gtk-win32-theme-part(spin, 2, 3, margins(0 -1 0 -1)); -} - -spinbutton.vertical button:disabled { - background-image: -gtk-win32-theme-part(spin, 1, 4, margins(0 -1 -0 -1)); -} - -spinbutton.vertical button:disabled:last-child { - background-image: -gtk-win32-theme-part(spin, 2, 4, margins(0 -1 0 -1)); -} - - - -spinbutton button:dir(rtl), -spinbutton button:focus:dir(rtl) { - background-color: transparent; - background-image: -gtk-win32-theme-part(spin, 2, 1, margins(0 -1 -1 -1)); - color: rgba(0, 0, 0, 0); -} - -spinbutton button:first-child:dir(rtl), -spinbutton button:focus:first-child:dir(rtl) { - background-image: -gtk-win32-theme-part(spin, 1, 1, margins(-1 -1 0 -1)); -} - -spinbutton button:hover:dir(rtl), -spinbutton button:hover:focus:dir(rtl) { - background-image: -gtk-win32-theme-part(spin, 2, 2, margins(0 -1 -1 -1)); -} - -spinbutton button:hover:first-child:dir(rtl), -spinbutton button:hover:focus:first-child:dir(rtl) { - background-image: -gtk-win32-theme-part(spin, 1, 2, margins(-1 -1 0 -1)); -} - - -spinbutton button:active:dir(rtl), -spinbutton button:active:hover:dir(rtl), -spinbutton button:active:focus:dir(rtl), -spinbutton button:active:hover:focus:dir(rtl) { - background-image: -gtk-win32-theme-part(spin, 2, 3, margins(0 -1 -1 -1)); -} - -spinbutton button:active:first-child:dir(rtl), -spinbutton button:active:hover:first-child:dir(rtl), -spinbutton button:active:focus:first-child:dir(rtl), -spinbutton button:active:hover:focus:first-child:dir(rtl) { - background-image: -gtk-win32-theme-part(spin, 1, 3, margins(-1 -1 0 -1)); -} - -spinbutton button:disabled:dir(rtl) { - background-image: -gtk-win32-theme-part(spin, 2, 4, margins(0 -1 -1 -1)); -} - -spinbutton button:disabled:first-child:dir(rtl) { - background-image: -gtk-win32-theme-part(spin, 1, 4, margins(-1 -1 0 -1)); -} - -/* Ranges */ - -scale.horizontal trough { - margin: calc( -gtk-win32-part-height(trackbar, 4, 1) / 2 + 1px ) 0; - padding: 0 calc( -gtk-win32-part-width(trackbar, 4, 1) / 2); - background-image: -gtk-win32-theme-part(trackbar, 1, 1); - min-height: -gtk-win32-part-height(trackbar, 1, 1); -} -scale.vertical trough { - margin: 0 calc( -gtk-win32-part-width(trackbar, 8, 1) / 2 + 1px ); - padding: calc( -gtk-win32-part-height(trackbar, 8, 1) / 2 ) 0; - background-image: -gtk-win32-theme-part(trackbar, 2, 1); - min-width: -gtk-win32-part-width(trackbar, 2, 1); -} - -scale.horizontal indicator { - min-height: -gtk-win32-part-height(trackbar, 9, 1); - min-width: -gtk-win32-part-width(trackbar, 9, 1); - color: shade(@bg_color, 0.6); - margin-top: -2px; - margin-bottom: 2px; -} -scale.vertical indicator { - min-height: -gtk-win32-part-height(trackbar, 10, 1) ; - min-width: -gtk-win32-part-width(trackbar, 10, 1); - color: shade(@bg_color, 0.6); - margin-left: -2px; - margin-right: 2px; -} - -scale.horizontal slider { - min-height: -gtk-win32-part-height(trackbar, 4, 1); - min-width: -gtk-win32-part-width(trackbar, 4, 1); - margin: calc( (-gtk-win32-part-height(trackbar, 4, 1) - -gtk-win32-part-height(trackbar, 1, 1)) / -2) 0; -} - -scale.vertical slider { - min-height: -gtk-win32-part-height(trackbar, 8, 1); - min-width: -gtk-win32-part-width(trackbar, 8, 1); - margin: 0 calc( (-gtk-win32-part-width(trackbar, 8, 1) - -gtk-win32-part-width(trackbar, 2, 1)) / -2); -} - -scale.horizontal slider { - background-image: -gtk-win32-theme-part(trackbar, 3,1) -} -scale.horizontal.marks-after slider { - background-image: -gtk-win32-theme-part(trackbar, 4,1) -} -scale.horizontal slider:hover { - background-image: -gtk-win32-theme-part(trackbar, 3,2) -} -scale.horizontal.marks-after slider:hover { - background-image: -gtk-win32-theme-part(trackbar, 4,2) -} -scale.horizontal slider:focus { - background-image: -gtk-win32-theme-part(trackbar, 3,4) -} -scale.horizontal.marks-after slider:focus { - background-image: -gtk-win32-theme-part(trackbar, 4,4) -} -scale.horizontal slider:active { - background-image: -gtk-win32-theme-part(trackbar, 3,3) -} -scale.horizontal.marks-after slider:active { - background-image: -gtk-win32-theme-part(trackbar, 4,3) -} -scale.horizontal slider:disabled { - background-image: -gtk-win32-theme-part(trackbar, 3,5) -} -scale.horizontal.marks-after slider:disabled { - background-image: -gtk-win32-theme-part(trackbar, 4,5) -} - -scale.vertical slider { - background-image: -gtk-win32-theme-part(trackbar, 6, 1) -} -scale.vertical.marks-after slider { - background-image: -gtk-win32-theme-part(trackbar, 8, 1) -} -scale.vertical slider:hover { - background-image: -gtk-win32-theme-part(trackbar, 6, 2) -} -scale.vertical.marks-after slider:hover { - background-image: -gtk-win32-theme-part(trackbar, 8, 2) -} -scale.vertical slider:focus { - background-image: -gtk-win32-theme-part(trackbar, 6, 4) -} -scale.vertical.marks-after slider:focus { - background-image: -gtk-win32-theme-part(trackbar, 8, 4) -} -scale.vertical slider:active { - background-image: -gtk-win32-theme-part(trackbar, 6, 3) -} -scale.vertical.marks-after slider:active { - background-image: -gtk-win32-theme-part(trackbar, 8, 3) -} -scale.vertical slider:disabled { - background-image: -gtk-win32-theme-part(trackbar, 6, 5) -} -scale.vertical.marks-after slider:disabled { - background-image: -gtk-win32-theme-part(trackbar, 8, 5) -} - -scale.horizontal highlight { - background-image: -gtk-win32-theme-part(progress, 5,1); - margin: 0 calc( -gtk-win32-part-width(trackbar, 4, 1) / -2); -} -scale.vertical highlight { - background-image: -gtk-win32-theme-part(progress, 6,1); - margin: calc( -gtk-win32-part-height(trackbar, 6, 1) / -2) 0; -} - -scale value { - margin-bottom: 5px; -} - - -/* Progress bars */ - -progressbar { - background-color: transparent; - padding: 0; -} - -progressbar trough { - border-width: 0; - background-image: -gtk-win32-theme-part(progress, 1, 1); -} - -progressbar progress, -entry progress, -entry progress:focus { - border-width: 0; - background-image: -gtk-win32-theme-part(progress, 5, 1); -} - -progressbar progress.pulse, -entry progress.pulse, -entry progress.pulse:focus { - background-color: transparent; - background-image: -gtk-win32-theme-part(progress, 8, 1); -} - -progressbar.vertical trough { - background-image: -gtk-win32-theme-part(progress, 2, 1); -} - -progressbar.vertical progress { - background-image: -gtk-win32-theme-part(progress, 6, 1); -} - -progressbar.vertical progress.pulse { - background-image: -gtk-win32-theme-part(progress, 10, 1); -} - -/* Combobox */ - -combobox entry { - margin-right: calc( -2ex - -gtk-win32-part-width(combobox, 6, 1)); - background-image: -gtk-win32-theme-part(combobox, 4, 1); -} -combobox entry:hover { - background-image: -gtk-win32-theme-part(combobox, 4, 2); -} -combobox entry:focus { - background-image: -gtk-win32-theme-part(combobox, 4, 3); -} -combobox:disabled entry { - background-image: -gtk-win32-theme-part(combobox, 5, 4); -} - -combobox entry, combobox entry:disabled, combobox entry:focus { - padding-left: 1ex; -} - -combobox button { - padding: 2px; -} - -combobox entry + button { - padding: 0; - background-image: none; -} - -combobox button arrow { - background-image: -gtk-win32-theme-part(combobox, 6, 1); - min-height: -gtk-win32-part-height(combobox, 6, 1); - /* this width is too small, so better put some padding */ - min-width: -gtk-win32-part-width(combobox, 6, 1); - padding: 0 1ex; -} -combobox entry + button:hover arrow { - background-image: -gtk-win32-theme-part(combobox, 6, 2); -} - -combobox entry + button:disabled { - background-image: none; -} - -combobox entry + button:disabled arrow { - background-image: -gtk-win32-theme-part(combobox, 6, 4); -} -combobox entry + button:checked arrow { - background-image: -gtk-win32-theme-part(combobox, 6, 3); -} - -combobox menu { - /* Dropdown list should have "window" color, as listbox - contents do (usually it's "white") */ - background-color: -gtk-win32-color(listview, window); - padding: 2px; -} - -combobox menuitem { - padding: 0 2px; -} - -combobox menuitem > cellview { - padding: 0px; -} - -/* Toolbar */ - -toolbar { - background-color: transparent; - border-width: 0; - background-image: -gtk-win32-theme-part(rebar, 6, 1); -} - -toolbar button, -toolbar button:focus { - background-color: transparent; - background-image: -gtk-win32-theme-part(toolbar, 1, 1); -} - -toolbar button:hover, -toolbar button:hover:focus { - background-image: -gtk-win32-theme-part(toolbar, 1, 2); -} - -toolbar button:active { - background-image: -gtk-win32-theme-part(toolbar, 1, 3); -} - -toolbar button:active:hover { - background-image: -gtk-win32-theme-part(toolbar, 1, 6); -} - -toolbar button:disabled { - background-image: -gtk-win32-theme-part(toolbar, 1, 4); -} - -/* Column headers */ - -header button, -header button:focus { - background-color: transparent; - border-width: 0; - background-image: -gtk-win32-theme-part(header, 1, 1); -} - -header button:hover, -header button:hover:focus { - background-image: -gtk-win32-theme-part(header, 1, 2); -} - -header button:active, -header button:active:hover, -header button:active:focus, -header button:active:hover:focus { - background-image: -gtk-win32-theme-part(header, 1, 3); -} - -/* Switch */ - -switch { - background-image: -gtk-win32-theme-part(button, 1, 1); -} - -switch:checked { - background-image: -gtk-win32-theme-part(button, 1, 3); -} - -switch:disabled { - background-image: -gtk-win32-theme-part(button, 1, 4); -} - -switch slider { - background-image: -gtk-win32-theme-part(button, 1, 1); -} - -switch:hover slider { - background-image: -gtk-win32-theme-part(button, 1, 2); -} - -switch:checked slider { - background-image: -gtk-win32-theme-part(button, 1, 3); -} - -switch:disabled slider { - background-image: -gtk-win32-theme-part(button, 1, 4); -} - -/* Menus */ - -menu { - background-color: -gtk-win32-color(button, menu); - border-color: shade(-gtk-win32-color(button, menu), 0.6); - border-style: solid; - border-width: 1px; - padding: 2px; -} - -menuitem { - color: -gtk-win32-color(button, menutext); -} - -menubar menuitem *:backdrop { - color: mix(-gtk-win32-color(button, menutext), white, 0.5); -} - -menubar > menuitem { - padding: 3px 5px; -} - -/* Add more padding to menus, increasing visible height of each menuitem */ -menu * { - padding: 2px; -} - -/* Assistant */ - -GtkAssistant .sidebar .highlight { - background-color: gray; - font-weight: bold; -} - -GtkAssistant .sidebar { - padding: 12px; - - background-color: white; - - border-image: none; - border-width: 0 1px 0 0; - border-style: solid; -} - -colorswatch { - border-style: solid; - border-width: 1px; -} - -colorswatch:hover { - border-color: shade(@bg_color, 0.2); -} - -separator, -separator:hover { - color: shade(@bg_color, 0.6); -} - -statusbar > frame { - border-width: 1px 1px 1px 1px; - border-style: solid; - border-image: -gtk-win32-theme-part(status, 0, 0, margins(-1 0 0 0)) 2 1 1 1 stretch; - background-image: none; -} - -/* Spinner */ - -@keyframes spin { - to { -gtk-icon-transform: rotate(1turn); } -} - -spinner { - background: none; - opacity: 0; - -gtk-icon-source: -gtk-icontheme('process-working-symbolic'); -} - -spinner:checked { - opacity: 1; - animation: spin 1s linear infinite; -} - -spinner:checked:disabled -{ - opacity: 0.5; -} - -spinner:active { - background-image: -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.916667)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.833333)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.75)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.666667)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.583333)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.5)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.416667)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.333333)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.25)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.166667)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(alpha(currentColor, 0.0833333)), to(transparent)), - -gtk-gradient(radial, center center, 0, center center, 0.5, to(currentColor), to(transparent)); - animation: spinner 1s infinite linear; -} - -/* Popovers */ -popover { - border-radius: 3px; - background-clip: border-box; - background-color: @bg_color; - - border-color: rgba(0, 0, 0, 1); - border-width: 1px; - border-style: solid; - - box-shadow: 0 2px 3px alpha(black, 0.5); - margin: 10px; - padding: 2px; -} -popover > list, -popover > .view, -popover > toolbar { - background-color: transparent; -} - -/* Listbox */ -list { - background-color: -gtk-win32-color(listbox, window); -} - -/* Dim label */ -.dim-label { - color: alpha(currentColor, 0.55); - text-shadow: none; -} - -/* Modelbuttons */ - -modelbutton:focus, -modelbutton { - background-color: transparent; - background-image: -gtk-win32-theme-part(menu, 14, 1); -} - -modelbutton:active, -modelbutton:active:focus { - background-color: transparent; - background-image: -gtk-win32-theme-part(menu, 14, 1); -} - -modelbutton:active:hover:focus, -modelbutton:hover:focus, -modelbutton:hover { - background-image: -gtk-win32-theme-part(menu, 14, 2); -} - -modelbutton:active:hover:disabled:focus, -modelbutton:hover:disabled:focus, -modelbutton:hover:disabled { - background-image: -gtk-win32-theme-part(menu, 14, 4); -} - - -modelbutton radio:focus, -modelbutton radio, -modelbutton radio:hover, -modelbutton radio:disabled { - background-color: transparent; - background-image: none; - border-width: 0; -} - -modelbutton radio:active:focus, -modelbutton radio:active, -modelbutton radio:active:hover { - background-image: -gtk-win32-theme-part(menu, 12, 2, over(11, 3)); - border-width: 0; -} - -modelbutton radio:indeterminate:focus, -modelbutton radio:indeterminate, -modelbutton radio:indeterminate:disabled, -modelbutton radio:indeterminate:hover, -modelbutton radio:indeterminate:active, -modelbutton radio:indeterminate:active:hover { - background-image: none; /* Fall back to default, this state is not in win32 */ - border-width: 0; -} - -modelbutton radio:disabled:active:focus, -modelbutton radio:disabled:active, -modelbutton radio:disabled:active:hover { - background-image: -gtk-win32-theme-part(menu, 12, 1, over(11, 4)); - border-width: 0; -} - -modelbutton check:focus, -modelbutton check, -modelbutton check:disabled, -modelbutton check:hover, -modelbutton check:hover:focus { - background-color: transparent; - background-image: none; - border-width: 0; -} - - -modelbutton check:active:focus, -modelbutton check:active, -modelbutton check:active:hover:focus, -modelbutton check:active:hover { - background-image: -gtk-win32-theme-part(menu, 12, 2, over(11, 1)); - border-width: 0; -} - -modelbutton check:indeterminate:focus, -modelbutton check:indeterminate, -modelbutton check:indeterminate:disabled, -modelbutton check:indeterminate:disabled:focus, -modelbutton check:indeterminate:hover, -modelbutton check:indeterminate:hover:focus, -modelbutton check:indeterminate:active, -modelbutton check:indeterminate:active:focus, -modelbutton check:indeterminate:active:hover:focus, -modelbutton check:indeterminate:active:hover { - background-image: none; /* Fall back to default, this state is not in win32 */ - border-width: 0; -} - -modelbutton check:disabled:active:focus, -modelbutton check:disabled:active, -modelbutton check:disabled:active:hover:focus, -modelbutton check:disabled:active:hover { - background-image: -gtk-win32-theme-part(menu, 12, 1, over(11, 2)); - border-width: 0; -} - -/* Application notification */ -.app-notification { - border-style: solid; - border-color: @app_notification_border; - border-width: 0 1px 1px 1px; - border-radius: 0 0 5px 5px; - padding: 8px; - - background-image: linear-gradient(to bottom, - @app_notification_a, - @app_notification_b 18%, - @app_notification_c); - - color: @theme_text_color; - text-shadow: 0 1px @primary_toolbarbutton_text_shadow; - border-image: none; -} diff --git a/gtk/theme/win32/gtk.css b/gtk/theme/win32/gtk.css deleted file mode 100644 index 218875e589..0000000000 --- a/gtk/theme/win32/gtk.css +++ /dev/null @@ -1,251 +0,0 @@ -@import url("gtk-win32-base.css"); - -/* Menus */ - -menubar { - background-color: transparent; - border-width: 0; - background-image: -gtk-win32-theme-part(menu, 7, 1); -} - -menubar > menuitem { - background-color: transparent; - border-width: 0; - background-image: -gtk-win32-theme-part(menu, 8, 1); -} - -menubar > menuitem:hover { - background-image: -gtk-win32-theme-part(menu, 8, 3); -} - -menuitem:hover { - background-image: -gtk-win32-theme-part(menu, 14, 2); -} - -menuitem:hover:disabled { - background-image: -gtk-win32-theme-part(menu, 14, 4); -} - -menuitem radio, -menuitem radio:hover, -menuitem radio:disabled { - background-color: transparent; - background-image: none; - border-width: 0; -} - -menuitem radio:active, -menuitem radio:active:hover { - background-image: -gtk-win32-theme-part(menu, 11, 3); - border-width: 0; -} - -menuitem radio:indeterminate, -menuitem radio:indeterminate:disabled, -menuitem radio:indeterminate:hover, -menuitem radio:indeterminate:active, -menuitem radio:indeterminate:active:hover { - background-image: none; /* Fall back to default, this state is not in win32 */ - border-width: 0; -} - -menuitem radio:disabled:active, -menuitem radio:disabled:active:hover { - background-image: -gtk-win32-theme-part(menu, 11, 4); - border-width: 0; -} - -menuitem check, -menuitem check:hover, -menuitem check:disabled { - background-image: none; - border-width: 0; -} - -menuitem check:active, -menuitem check:active:hover { - background-image: -gtk-win32-theme-part(menu, 11, 1); - border-width: 0; -} - -menuitem check:indeterminate, -menuitem check:indeterminate:disabled, -menuitem check:indeterminate:hover, -menuitem check:indeterminate:active, -menuitem check:indeterminate:active:hover { - background-image: none; /* Fall back to default, this state is not in win32 */ - border-width: 0; -} - -menuitem check:disabled:active, -menuitem check:disabled:active:hover{ - background-image: -gtk-win32-theme-part(menu, 11, 2); - border-width: 0; -} - -/* Listbox */ - -/* We're cheating here, using part 6 (listview header group), - because part 1 (listview item) is empty for some reason */ -row:hover { - background-image: -gtk-win32-theme-part(listview, 6, 10); -} - -row:selected { - background-color: transparent; - /* Override *:selected {} blanket style, keeping the background - bright - and the text - dark */ - color: @text_color; - background-image: -gtk-win32-theme-part(listview, 6, 13); -} - -row:selected:focus { - background-image: -gtk-win32-theme-part(listview, 6, 11); -} - -row:selected:hover { - background-image: -gtk-win32-theme-part(listview, 6, 12); -} - -/* Titlebar */ - -decoration { - padding: calc(-gtk-win32-size(window, cyframe) + -gtk-win32-size(window, cxpaddedborder)) - calc(-gtk-win32-size(window, cxframe) + -gtk-win32-size(window, cxpaddedborder)); - background-image: -gtk-win32-theme-part(window, 1, 1), - -gtk-win32-theme-part(window, 9, 1), - -gtk-win32-theme-part(window, 7, 1), - -gtk-win32-theme-part(window, 8, 1); - background-size: 100% -gtk-win32-size(window, cycaption), - 100% calc(-gtk-win32-size(window, cyframe) + -gtk-win32-size(window, cxpaddedborder)), - calc(-gtk-win32-size(window, cxframe) + -gtk-win32-size(window, cxpaddedborder)) calc(100% - 2 * (-gtk-win32-size(window, cyframe) + -gtk-win32-size(window, cxpaddedborder))), - calc(-gtk-win32-size(window, cxframe) + -gtk-win32-size(window, cxpaddedborder)) calc(100% - 2 * (-gtk-win32-size(window, cyframe) + -gtk-win32-size(window, cxpaddedborder))); - background-position: top, bottom, left, right; - background-repeat: no-repeat; -} - -/* Unset above settings when the window is a popup menu or tooltip */ -* window decoration, tooltip decoration { - all: unset; -} - -.titlebar { - margin: calc(0px - -gtk-win32-size(window, cyframe) - -gtk-win32-size(window, cxpaddedborder)) - calc(0px - -gtk-win32-size(window, cxframe) - -gtk-win32-size(window, cxpaddedborder)); - margin-bottom: 0px; - padding: calc(-gtk-win32-size(window, cyframe) + -gtk-win32-size(window, cxpaddedborder)) - calc(-gtk-win32-size(window, cxframe) + -gtk-win32-size(window, cxpaddedborder)); - padding-bottom: 0px; - background: -gtk-win32-theme-part(window, 1, 1); - min-height: calc(-gtk-win32-size(window, cycaption) - -gtk-win32-size(window, cyframe) - -gtk-win32-size(window, cxpaddedborder)); -} - -decoration:backdrop { - background-image: -gtk-win32-theme-part(window, 1, 2), - -gtk-win32-theme-part(window, 9, 2), - -gtk-win32-theme-part(window, 7, 2), - -gtk-win32-theme-part(window, 8, 2); -} -.titlebar:backdrop { - background: -gtk-win32-theme-part(window, 1, 2); -} - -decoration:disabled { - background-image: -gtk-win32-theme-part(window, 1, 3), - -gtk-win32-theme-part(window, 9, 3), - -gtk-win32-theme-part(window, 7, 3), - -gtk-win32-theme-part(window, 8, 3); -} -.titlebar:disabled { - background: -gtk-win32-theme-part(window, 1, 3); -} - -.titlebar button.titlebutton { - margin-top: -gtk-win32-size(button, cyedge); - margin-bottom: -gtk-win32-size(button, cyedge); - margin-right: -gtk-win32-size(button, cxedge); - min-width: calc(-gtk-win32-size(button, cxsize) - 2 * -gtk-win32-size(button, cxedge)); - min-height: calc(-gtk-win32-size(button, cysize) - 2 * -gtk-win32-size(button, cyedge)); - background-repeat: no-repeat; - background-size: 100% calc(-gtk-win32-size(button, cysize) - 2 * -gtk-win32-size(button, cyedge)); - background-position: 50% calc(100% - -gtk-win32-size(window, cycaption) + -gtk-win32-size(window, cysize) - -gtk-win32-size(window, cyedge)); -} - -/* XXX: headerbar insists on 6px spacing between buttons. Windows doesn't - * think so. */ -.titlebar .titlebutton + .titlebutton { - margin-left: -6px; -} - -/* XXX: We don't draw icons here, but the GtkImage still sizes itself to 16x16, - * so shrink it enough: */ -.titlebar button.titlebutton image { - margin: -3px; -} - -.titlebar button.close { - background-image: -gtk-win32-theme-part(window, 18, 1); - color: transparent; -} - -.titlebar button.close:hover { - background-image: -gtk-win32-theme-part(window, 18, 2); -} - -.titlebar button.close:active { - background-image: -gtk-win32-theme-part(window, 18, 3); -} - -.titlebar button.close:disabled { - background-image: -gtk-win32-theme-part(window, 18, 4); -} - -.titlebar button.minimize { - background-image: -gtk-win32-theme-part(window, 15, 1); - color: transparent; -} - -.titlebar button.minimize:hover { - background-image: -gtk-win32-theme-part(window, 15, 2); -} - -.titlebar button.minimize:active { - background-image: -gtk-win32-theme-part(window, 15, 3); -} - -.titlebar button.minimize:disabled { - background-image: -gtk-win32-theme-part(window, 15, 4); -} - -.titlebar button.maximize { - background-image: -gtk-win32-theme-part(window, 17, 1); - color: transparent; -} - -.titlebar button.maximize:hover { - background-image: -gtk-win32-theme-part(window, 17, 2); -} - -.titlebar button.maximize:active { - background-image: -gtk-win32-theme-part(window, 17, 3); -} - -.titlebar button.maximize:disabled { - background-image: -gtk-win32-theme-part(window, 17, 4); -} - -.maximized .titlebar button.maximize { - background-image: -gtk-win32-theme-part(window, 21, 1); -} - -.maximized .titlebar button.maximize:hover { - background-image: -gtk-win32-theme-part(window, 21, 2); -} - -.maximized .titlebar button.maximize:active { - background-image: -gtk-win32-theme-part(window, 21, 3); -} - -.maximized .titlebar button.maximize:disabled { - background-image: -gtk-win32-theme-part(window, 21, 4); -} diff --git a/testsuite/css/parser/background-win32-color-is-no-error.css b/testsuite/css/parser/background-win32-color-is-no-error.css deleted file mode 100644 index 3b17e20c02..0000000000 --- a/testsuite/css/parser/background-win32-color-is-no-error.css +++ /dev/null @@ -1,3 +0,0 @@ -a { - background: -gtk-win32-color(edit, highlight); -} diff --git a/testsuite/css/parser/background-win32-color-is-no-error.ref.css b/testsuite/css/parser/background-win32-color-is-no-error.ref.css deleted file mode 100644 index 7879519a91..0000000000 --- a/testsuite/css/parser/background-win32-color-is-no-error.ref.css +++ /dev/null @@ -1,9 +0,0 @@ -a { - background-clip: border-box; - background-color: -gtk-win32-color(edit, highlight); - background-image: none; - background-origin: padding-box; - background-position: left top; - background-repeat: repeat; - background-size: auto; -} diff --git a/testsuite/css/parser/meson.build b/testsuite/css/parser/meson.build index a5e7d91c4c..db4672365a 100644 --- a/testsuite/css/parser/meson.build +++ b/testsuite/css/parser/meson.build @@ -157,8 +157,6 @@ test_data = [ 'background-shorthand-single.ref.css', 'background-size.css', 'background-size.ref.css', - 'background-win32-color-is-no-error.css', - 'background-win32-color-is-no-error.ref.css', 'border-color.css', 'border-color-currentcolor.css', 'border-color-currentcolor.ref.css',