diff options
Diffstat (limited to 'gtk-themes')
-rw-r--r-- | gtk-themes/ContrastHigh/Makefile.am | 17 | ||||
-rw-r--r-- | gtk-themes/ContrastHigh/create-contrasthigh.c | 381 | ||||
-rw-r--r-- | gtk-themes/ContrastHigh/gtk-3.0/Makefile.am | 14 | ||||
-rw-r--r-- | gtk-themes/ContrastHigh/gtk-3.0/gtk.css | 2 | ||||
-rw-r--r-- | gtk-themes/ContrastHigh/gtk-3.0/gtk.gresource.xml | 6 | ||||
-rw-r--r-- | gtk-themes/ContrastHigh/gtkrc.in | 92 | ||||
-rw-r--r-- | gtk-themes/ContrastHigh/metacity-1/Makefile.am | 4 | ||||
-rw-r--r-- | gtk-themes/ContrastHigh/metacity-1/metacity-theme-3.xml | 2 |
8 files changed, 9 insertions, 509 deletions
diff --git a/gtk-themes/ContrastHigh/Makefile.am b/gtk-themes/ContrastHigh/Makefile.am index d960d395..47fef671 100644 --- a/gtk-themes/ContrastHigh/Makefile.am +++ b/gtk-themes/ContrastHigh/Makefile.am @@ -3,17 +3,8 @@ SUBDIRS = \ gtk-2.0 \ metacity-1 -THEME_NAME=ContrastHigh - -themedir = $(datadir)/themes/$(THEME_NAME) - -noinst_PROGRAMS = -if GTK3 -noinst_PROGRAMS += create-contrasthigh -endif - -create_contrasthigh_SOURCES = create-contrasthigh.c -create_contrasthigh_CFLAGS = $(CONTRASTHIGH_CFLAGS) -create_contrasthigh_LDADD = $(CONTRASTHIGH_LIBS) -lm +DIST_SUBDIRS = \ + gtk-3.0 \ + gtk-2.0 \ + metacity-1 --include $(top_srcdir)/git.mk diff --git a/gtk-themes/ContrastHigh/create-contrasthigh.c b/gtk-themes/ContrastHigh/create-contrasthigh.c deleted file mode 100644 index 4902d076..00000000 --- a/gtk-themes/ContrastHigh/create-contrasthigh.c +++ /dev/null @@ -1,381 +0,0 @@ -#include <cairo/cairo.h> -#include <gio/gio.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gdk/gdk.h> -#include <glib.h> -#include <string.h> -#include <math.h> - -GFile *gnome_dir = NULL; -GFile *hc_dir = NULL; - -static const gint icon_sizes[] = { - 16, 22, 24, 32, 48, 256 -}; - -static char * -replace_str (char *str, - const char *substr, - const char *new_substr) -{ - static char buf[4096]; - char *ptr; - - /* if we didn't find the substring, return */ - if (!(ptr = (char*)strstr (str, substr))) - return str; - - /* copy up to the substring */ - strncpy (buf, str, ptr - str); - buf[ptr - str] = '\0'; - - if (strlen (substr) >=strlen (new_substr)) - { - sprintf (buf + (ptr - str), "%s%s", new_substr, ptr + strlen (substr)); - } - else - { - static char buf2[4096]; - - strncpy (buf2, str, ptr - str + strlen (substr)); - buf2[ptr - str + strlen (substr)] = '\0'; - - sprintf (buf2 + (ptr - str), "%s%s", new_substr, ptr + strlen (substr)); - strncpy (buf, buf2, strlen (buf)); - } - - return buf; -} - -static gchar * -ensure_dest_path (GFile *file, - gint icon_size) -{ - gchar *str, *str2, *size_string, *dest_path; - GFile *dest_file, *dest_dir, *tmp; - - str = g_file_get_relative_path (gnome_dir, file); - tmp = g_file_resolve_relative_path (hc_dir, str); - g_free (str); - - str = g_file_get_path (tmp); - size_string = g_strdup_printf ("%dx%d", icon_size, icon_size); - str2 = replace_str (str, "-symbolic.svg", ".png"); - dest_path = replace_str (str2, "scalable", size_string); - - dest_file = g_file_new_for_path (dest_path); - dest_dir = g_file_get_parent (dest_file); - - g_file_make_directory_with_parents (dest_dir, NULL, NULL); - - g_object_unref (dest_file); - g_object_unref (dest_dir); - g_object_unref (tmp); - g_free (str); - g_free (size_string); - - return dest_path; -} - -static void -optimize_png (const gchar *png_path) -{ - gchar *cmd = g_strconcat ("optipng -quiet", " ", png_path, NULL); - g_spawn_command_line_async (cmd, NULL); - g_free (cmd); -} - -static GdkPixbuf * -get_recolored_svg (GFile *file, - gint icon_size) -{ - gchar *data, *str; - GdkPixbuf *pixbuf; - GInputStream *stream; - - str = g_file_get_path (file); - data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" - "<svg version=\"1.1\"\n" - " xmlns=\"http://www.w3.org/2000/svg\"\n" - " xmlns:xi=\"http://www.w3.org/2001/XInclude\"\n" - " width=\"16\"\n" - " height=\"16\">\n" - " <style type=\"text/css\">\n" - " rect,path {\n" - " fill: black !important;\n" - " }\n" - " .warning {\n" - " fill: #f57900 !important;\n" - " }\n" - " .error {\n" - " fill: #cc0000 !important;\n" - " }\n" - " .success {\n" - " fill: #4e9a06 !important;\n" - " }\n" - " </style>\n" - " <xi:include href=\"", str, "\"/>\n" - "</svg>", - NULL); - - stream = g_memory_input_stream_new_from_data (data, -1, g_free); - pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream, - icon_size, icon_size, - TRUE, NULL, NULL); - g_object_unref (stream); - g_free (str); - - return pixbuf; -} - -/* taken from gdkcairo.c */ -static gboolean -_gdk_cairo_surface_extents (cairo_surface_t *surface, - GdkRectangle *extents) -{ - double x1, x2, y1, y2; - cairo_t *cr; - - g_return_val_if_fail (surface != NULL, FALSE); - g_return_val_if_fail (extents != NULL, FALSE); - - cr = cairo_create (surface); - cairo_clip_extents (cr, &x1, &y1, &x2, &y2); - cairo_destroy (cr); - - x1 = floor (x1); - y1 = floor (y1); - x2 = ceil (x2); - y2 = ceil (y2); - x2 -= x1; - y2 -= y1; - - if (x1 < G_MININT || x1 > G_MAXINT || - y1 < G_MININT || y1 > G_MAXINT || - x2 > G_MAXINT || y2 > G_MAXINT) - { - extents->x = extents->y = extents->width = extents->height = 0; - return FALSE; - } - - extents->x = x1; - extents->y = y1; - extents->width = x2; - extents->height = y2; - - return TRUE; -} - -/* This function originally from Jean-Edouard Lachand-Robert, and - * available at www.codeguru.com. Simplified for our needs, not sure - * how much of the original code left any longer. Now handles just - * one-bit deep bitmaps (in Window parlance, ie those that GDK calls - * bitmaps (and not pixmaps), with zero pixels being transparent. - * - * Changed again here from the GDK version to use an 8-bit surface instead - * of a 1-bit bitmap. - */ -static cairo_region_t * -_gdk_cairo_region_create_from_surface (cairo_surface_t *surface) -{ - cairo_region_t *region; - GdkRectangle extents, rect; - cairo_surface_t *image; - cairo_t *cr; - gint x, y, stride; - guchar *data; - - _gdk_cairo_surface_extents (surface, &extents); - - if (cairo_surface_get_content (surface) == CAIRO_CONTENT_COLOR) - return cairo_region_create_rectangle (&extents); - - if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_IMAGE || - cairo_image_surface_get_format (surface) != CAIRO_FORMAT_A8) - { - /* coerce to an A8 image */ - image = cairo_image_surface_create (CAIRO_FORMAT_A8, - extents.width, extents.height); - cr = cairo_create (image); - cairo_set_source_surface (cr, surface, -extents.x, -extents.y); - cairo_paint (cr); - cairo_destroy (cr); - } - else - image = cairo_surface_reference (surface); - - data = cairo_image_surface_get_data (image); - stride = cairo_image_surface_get_stride (image); - - region = cairo_region_create (); - - for (y = 0; y < extents.height; y++) - { - for (x = 0; x < extents.width; x++) - { - /* Search for a continuous range of "non transparent pixels"*/ - gint x0 = x; - while (x < extents.width) - { - guint8 alpha = data[x]; - if (alpha < 24) - /* This pixel is "transparent"*/ - break; - x++; - } - - if (x > x0) - { - /* Add the pixels (x0, y) to (x, y+1) as a new rectangle - * in the region - */ - rect.x = x0; - rect.width = x - x0; - rect.y = y; - rect.height = 1; - - cairo_region_union_rectangle (region, &rect); - } - } - data += stride; - } - - cairo_surface_destroy (image); - - cairo_region_translate (region, extents.x, extents.y); - - return region; -} - -static void -write_png_theme (GList *svg_files, - gint icon_size) -{ - GList *l; - - g_print ("Writing size: %dx%d\n", icon_size, icon_size); - - for (l = svg_files; l != NULL; l = l->next) - { - GFile *file; - gchar *dest_path; - GdkPixbuf *pixbuf; - gint border_offset; - cairo_surface_t *surface; - cairo_region_t *region; - cairo_t *cr; - - file = l->data; - border_offset = (gint) floor (icon_size / 16); - pixbuf = get_recolored_svg (file, icon_size - 2.0 * border_offset); - - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, - icon_size, icon_size); - cr = cairo_create (surface); - - gdk_cairo_set_source_pixbuf (cr, pixbuf, - border_offset, border_offset); - cairo_paint (cr); - cairo_destroy (cr); - - region = _gdk_cairo_region_create_from_surface (surface); - cairo_surface_destroy (surface); - - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, - icon_size, icon_size); - cr = cairo_create (surface); - - cairo_save (cr); - gdk_cairo_region (cr, region); - - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); - cairo_set_line_width (cr, 2.0 * border_offset); - cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); - cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND); - - cairo_stroke (cr); - cairo_restore (cr); - - gdk_cairo_set_source_pixbuf (cr, pixbuf, - border_offset, border_offset); - cairo_paint (cr); - - dest_path = ensure_dest_path (file, icon_size); - cairo_surface_write_to_png (surface, dest_path); - - cairo_destroy (cr); - cairo_surface_destroy (surface); - cairo_region_destroy (region); - g_object_unref (pixbuf); - - optimize_png (dest_path); - } -} - -static void -process (int argc, - char **argv) -{ - GList *svg_files = NULL; - GQueue *descend_into_files; - GFile *current_dir, *symbolic_theme, *file; - gchar *str; - gint idx; - - str = g_get_current_dir (); - current_dir = g_file_new_for_path (str); - g_free (str); - - symbolic_theme = g_file_new_for_commandline_arg (argv[1]); - gnome_dir = g_file_resolve_relative_path (symbolic_theme, "gnome"); - hc_dir = g_file_resolve_relative_path (current_dir, "icons"); - g_object_unref (symbolic_theme); - - descend_into_files = g_queue_new (); - g_queue_push_tail (descend_into_files, g_object_ref (gnome_dir)); - while ((file = g_queue_pop_head (descend_into_files)) != NULL) - { - GFileInfo *child_info; - GFileEnumerator *enumerator = - g_file_enumerate_children (file, "standard::name,standard::type,standard::content-type", - G_FILE_QUERY_INFO_NONE, NULL, NULL); - - while ((child_info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL) - { - if (g_file_info_get_file_type (child_info) == G_FILE_TYPE_DIRECTORY) - g_queue_push_tail (descend_into_files, g_file_resolve_relative_path (file, g_file_info_get_name (child_info))); - else if (g_content_type_is_a (g_file_info_get_content_type (child_info), "image/svg+xml")) - svg_files = g_list_prepend (svg_files, g_file_resolve_relative_path (file, g_file_info_get_name (child_info))); - - g_object_unref (child_info); - } - - g_object_unref (enumerator); - g_object_unref (file); - } - - for (idx = 0; idx < G_N_ELEMENTS (icon_sizes); idx++) - write_png_theme (svg_files, icon_sizes[idx]); - - g_list_free_full (svg_files, g_object_unref); - g_queue_free (descend_into_files); - g_clear_object (&gnome_dir); - g_clear_object (&hc_dir); -} - -int -main (int argc, - char **argv) -{ - if (argc == 1) - { - g_critical ("Location of gnome-icon-theme-symbolic repo must be given"); - return 0; - } - - g_type_init (); - process (argc, argv); - g_spawn_command_line_async ("./create-makefiles.sh", NULL); - - return 0; -} diff --git a/gtk-themes/ContrastHigh/gtk-3.0/Makefile.am b/gtk-themes/ContrastHigh/gtk-3.0/Makefile.am index f8add4cc..fde2eadd 100644 --- a/gtk-themes/ContrastHigh/gtk-3.0/Makefile.am +++ b/gtk-themes/ContrastHigh/gtk-3.0/Makefile.am @@ -1,19 +1,9 @@ -gtk.gresource: gtk.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies $(srcdir)/gtk.gresource.xml) - $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $< - themedir = $(datadir)/themes/ContrastHigh/gtk-3.0 -theme_DATA = \ - gtk.css \ - gtk.gresource \ - settings.ini -EXTRA_DIST = \ +theme_DATA = \ gtk.css \ gtk-widgets.css \ - gtk.gresource.xml \ settings.ini -CLEANFILES = \ - gtk.gresource +EXTRA_DIST = $(theme_DATA) --include $(top_srcdir)/git.mk diff --git a/gtk-themes/ContrastHigh/gtk-3.0/gtk.css b/gtk-themes/ContrastHigh/gtk-3.0/gtk.css index 120fc154..6ef136ac 100644 --- a/gtk-themes/ContrastHigh/gtk-3.0/gtk.css +++ b/gtk-themes/ContrastHigh/gtk-3.0/gtk.css @@ -88,4 +88,4 @@ -GtkWidget-visited-link-color: #ff80ff; } -@import url("resource:///org/mate/ContrastHigh/gtk-widgets.css"); +@import url("gtk-widgets.css"); diff --git a/gtk-themes/ContrastHigh/gtk-3.0/gtk.gresource.xml b/gtk-themes/ContrastHigh/gtk-3.0/gtk.gresource.xml deleted file mode 100644 index 57cdb701..00000000 --- a/gtk-themes/ContrastHigh/gtk-3.0/gtk.gresource.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<gresources> - <gresource prefix="/org/mate/ContrastHigh"> - <file>gtk-widgets.css</file> - </gresource> -</gresources> diff --git a/gtk-themes/ContrastHigh/gtkrc.in b/gtk-themes/ContrastHigh/gtkrc.in deleted file mode 100644 index 8828f3ac..00000000 --- a/gtk-themes/ContrastHigh/gtkrc.in +++ /dev/null @@ -1,92 +0,0 @@ -# High-Contrast, "Normal Size" Theme -# -# Original gtkrc by Bill Haneman, based on Standard theme by T. Liebeck, -# which was in turn based on lots of different gtkrc files but -# primarily the one for the metal theme. -# -# High-contrast pixmap icons by jimmac with input from tigert. - -pixmap_path "@prefix@/share/themes/ContrastHighLargePrint/pixmaps" - -#TODO: move sun-jds style downstream -style "sun-jds" -{ - PanelMenu::stripe-gradient-top = "#000000" - PanelMenu::stripe-gradient-bottom = "#000000" -} -class "GtkWidget" style "sun-jds" - -style "default" -{ - engine "hcengine" { - edge_thickness = 2 - } - - xthickness = 2 - ythickness = 2 - - EelEditableLabel::cursor_aspect_ratio = 0.1 - EelEditableLabel::cursor_color = "#cc0000" - - GtkEntry::cursor_color = "#cc0000" - GtkEntry::cursor_aspect_ratio = 0.1 - - GtkHSV::focus-line-pattern = "\0" - - GtkRange::stepper-size = 20 - - GtkTextView::cursor_aspect_ratio = 0.1 - GtkTextView::cursor_color = "#cc0000" - - GtkTreeView::expander-size = 16 - - GtkWidget::focus-line-pattern = "\4\2" - GtkWidget::focus-line-width = 2 - GtkWidget::focus-padding = 0 - GtkWidget::interior_focus = 1 - GtkWidget::link-color = "#000060" - GtkWidget::visited-link-color = "#600000" - - # Caja - CajaIconContainer::frame_text = 1 - - # Pidgin - GtkIMHtml::hyperlink-color = "#000060" - GtkIMHtml::hyperlink-visited-color = "#600000" - GtkIMHtml::hyperlink-prelight-color = "#404080" - - # Evolution - GtkHTML::link_color = "#000060" - GtkHTML::vlink_color = "#600000" - GtkHTML::cite_color = "#003000" - - fg[NORMAL] = "#000000" - text[NORMAL] = "#000000" - bg[NORMAL] = "#ffffff" - base[NORMAL] = "#ffffff" - - fg[INSENSITIVE] = "#999999" - text[INSENSITIVE] = "#999999" - bg[INSENSITIVE] = "#ccccff" - base[INSENSITIVE] = "#ccccff" - - fg[PRELIGHT] = "#ccccff" - text[PRELIGHT] = "#ccccff" - bg[PRELIGHT] = "#000000" - base[PRELIGHT] = "#000000" - - fg[ACTIVE] = "#000000" - text[ACTIVE] = "#000000" - bg[ACTIVE] = "#b8b891" - base[ACTIVE] = "#b8b891" - - fg[SELECTED] = "#ffffff" - text[SELECTED] = "#ffffff" - bg[SELECTED] = "#000000" - base[SELECTED] = "#333300" - -@gtk_stock_icons_rc@ -@panel_stock_icons_rc@ -@media_stock_icons_rc@ -@capplet_stock_icons_rc@ -@marco_stock_icons_rc@ diff --git a/gtk-themes/ContrastHigh/metacity-1/Makefile.am b/gtk-themes/ContrastHigh/metacity-1/Makefile.am index 0d28f5af..b2e27d74 100644 --- a/gtk-themes/ContrastHigh/metacity-1/Makefile.am +++ b/gtk-themes/ContrastHigh/metacity-1/Makefile.am @@ -1,7 +1,5 @@ themedir = $(datadir)/themes/ContrastHigh/metacity-1 + theme_DATA = metacity-theme-3.xml EXTRA_DIST = $(theme_DATA) - - --include $(top_srcdir)/git.mk diff --git a/gtk-themes/ContrastHigh/metacity-1/metacity-theme-3.xml b/gtk-themes/ContrastHigh/metacity-1/metacity-theme-3.xml index 58dab98b..dbb15dae 100644 --- a/gtk-themes/ContrastHigh/metacity-1/metacity-theme-3.xml +++ b/gtk-themes/ContrastHigh/metacity-1/metacity-theme-3.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <metacity_theme> <info> - <name>HighContrast</name> + <name>ContrastHigh</name> <author>GNOME Art Team <art.gnome.org></author> <copyright>Â Intel, Â Red Hat, Lapo Calamandrei</copyright> <date>2012</date> |