File unico-fix-render-focus.patch of Package unico
=== modified file 'unico/unico-draw.c'
--- unico/unico-draw.c 2012-07-25 22:49:45 +0000
+++ unico/unico-draw.c 2012-08-06 15:06:54 +0000
@@ -168,23 +168,27 @@
static void
unico_draw_focus (DRAW_ARGS)
{
- GdkRGBA *fill_color, *border_color, *outer_stroke_color;
+ GdkRGBA *fill_color, *border_color;
GtkStateFlags state;
gint focus_pad, line_width;
gint radius;
state = gtk_theming_engine_get_state (engine);
+ gtk_theming_engine_get_style (engine,
+ "focus-padding", &focus_pad,
+ "focus-line-width", &line_width,
+ NULL);
+
+ /* Skip rendering if focus-line-width is 0 or less. */
+ if (line_width < 1)
+ return;
+
gtk_theming_engine_get (engine, state,
"-unico-focus-border-color", &border_color,
"-unico-focus-border-radius", &radius,
"-unico-focus-fill-color", &fill_color,
- "-unico-focus-outer-stroke-color", &outer_stroke_color,
NULL);
- gtk_theming_engine_get_style (engine,
- "focus-padding", &focus_pad,
- "focus-line-width", &line_width,
- NULL);
x += focus_pad;
y += focus_pad;
@@ -202,14 +206,7 @@
gdk_cairo_set_source_rgba (cr, fill_color);
cairo_fill (cr);
- /* second layer, outer stroke */
- unico_cairo_round_rect_inner (cr, x - line_width, y - line_width,
- width + line_width * 2, height + line_width * 2,
- radius + 1, SIDE_ALL, GTK_JUNCTION_NONE);
- gdk_cairo_set_source_rgba (cr, outer_stroke_color);
- cairo_stroke (cr);
-
- /* third layer, border */
+ /* second layer, border */
unico_cairo_round_rect_inner (cr, x, y,
width, height,
radius, SIDE_ALL, GTK_JUNCTION_NONE);
@@ -220,7 +217,6 @@
gdk_rgba_free (border_color);
gdk_rgba_free (fill_color);
- gdk_rgba_free (outer_stroke_color);
}
void
@@ -228,6 +224,7 @@
{
g_assert (functions);
- functions->draw_arrow = unico_draw_arrow;
- functions->draw_expander = unico_draw_expander;
+ functions->draw_arrow = unico_draw_arrow;
+ functions->draw_expander = unico_draw_expander;
+ functions->draw_focus = unico_draw_focus;
}
=== modified file 'unico/unico-engine.c'
--- unico/unico-engine.c 2012-07-25 22:49:45 +0000
+++ unico/unico-engine.c 2012-08-06 15:06:54 +0000
@@ -74,6 +74,23 @@
style_functions->draw_expander (engine, cr, x, y, width, height);
}
+static void
+unico_engine_render_focus (GtkThemingEngine *engine,
+ cairo_t *cr,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height)
+{
+ UnicoStyleFunctions *style_functions;
+
+ UNICO_CAIRO_INIT
+
+ unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
+
+ style_functions->draw_focus (engine, cr, x, y, width, height);
+}
+
void
unico_engine_register_types (GTypeModule *module)
{
@@ -93,12 +110,31 @@
engine_class->render_arrow = unico_engine_render_arrow;
engine_class->render_expander = unico_engine_render_expander;
+ engine_class->render_focus = unico_engine_render_focus;
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
g_param_spec_boxed ("arrow-texture",
"Arrow texture",
"Arrow texture",
CAIRO_GOBJECT_TYPE_PATTERN, 0));
+
+ gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
+ g_param_spec_boxed ("focus-border-color",
+ "Focus border color",
+ "Focus border color",
+ GDK_TYPE_RGBA, 0));
+
+ gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
+ g_param_spec_int ("focus-border-radius",
+ "Focus border radius",
+ "Focus border radius",
+ 0, G_MAXINT, 0, 0));
+
+ gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
+ g_param_spec_boxed ("focus-fill-color",
+ "Focus fill color",
+ "Focus fill color",
+ GDK_TYPE_RGBA, 0));
}
static void
=== modified file 'unico/unico-support.c'
--- unico/unico-support.c 2011-08-09 21:27:07 +0000
+++ unico/unico-support.c 2012-08-08 14:02:40 +0000
@@ -26,38 +26,6 @@
#include "unico-support.h"
#include "unico-types.h"
-gboolean
-unico_gdk_rgba_is_default (GdkRGBA *color)
-{
- GdkRGBA default_color;
-
- /* pink is default GdkRGBA color set in gtk/gtkstyleproperty.c */
- gdk_rgba_parse (&default_color, "pink");
-
- return gdk_rgba_equal (&default_color, color);
-}
-
-void
-unico_get_line_width (GtkThemingEngine *engine,
- gdouble *line_width)
-{
- GtkBorder border;
- GtkStateFlags state;
-
- state = gtk_theming_engine_get_state (engine);
-
- gtk_theming_engine_get_border (engine, state, &border);
-
- *line_width = MIN (MIN (border.top, border.bottom),
- MIN (border.left, border.right));
-}
-
-gboolean
-unico_gtk_border_is_zero (GtkBorder *border)
-{
- return (border->top == 0) && (border->bottom == 0) && (border->left == 0) && (border->right == 0);
-}
-
void
unico_lookup_functions (UnicoEngine *engine,
UnicoStyleFunctions **functions)
@@ -67,23 +35,4 @@
* for example -unico-style, and assign new styles */
if (functions)
*functions = &engine->style_functions[UNICO_STYLE_DEFAULT];
-}
-
-void
-unico_trim_scale_allocation (GtkThemingEngine *engine,
- gdouble *x,
- gdouble *y,
- gdouble *width,
- gdouble *height)
-{
- if (!gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_VERTICAL))
- {
- *y += (gint) (*height / 2.0) - 2.0;
- *height = 5;
- }
- else
- {
- *x += (gint) (*width / 2.0) - 2.0;
- *width = 5;
- }
-}
+}
\ No newline at end of file
=== modified file 'unico/unico-support.h'
--- unico/unico-support.h 2011-08-09 21:27:07 +0000
+++ unico/unico-support.h 2012-08-08 14:02:40 +0000
@@ -30,22 +30,9 @@
G_BEGIN_DECLS
-G_GNUC_INTERNAL gboolean unico_gdk_rgba_is_default (GdkRGBA *color);
-
-G_GNUC_INTERNAL void unico_get_line_width (GtkThemingEngine *engine,
- gdouble *line_width);
-
-G_GNUC_INTERNAL gboolean unico_gtk_border_is_zero (GtkBorder *border);
-
G_GNUC_INTERNAL void unico_lookup_functions (UnicoEngine *engine,
UnicoStyleFunctions **functions);
-G_GNUC_INTERNAL void unico_trim_scale_allocation (GtkThemingEngine *engine,
- gdouble *x,
- gdouble *y,
- gdouble *width,
- gdouble *height);
-
G_END_DECLS
#endif /* UNICO_SUPPORT_H */
=== modified file 'unico/unico-types.h'
--- unico/unico-types.h 2012-07-25 22:49:45 +0000
+++ unico/unico-types.h 2012-08-06 14:46:54 +0000
@@ -58,6 +58,8 @@
gdouble size);
void (*draw_expander) (DRAW_ARGS);
+
+ void (*draw_focus) (DRAW_ARGS);
};
G_END_DECLS