Merge lp:~larsu/unico/remove-focus-attributes into lp:unico

Proposed by Lars Karlitski
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 151
Merged at revision: 151
Proposed branch: lp:~larsu/unico/remove-focus-attributes
Merge into: lp:unico
Diff against target: 54 lines (+9/-21)
2 files modified
unico/unico-draw.c (+9/-3)
unico/unico-engine.c (+0/-18)
To merge this branch: bzr merge lp:~larsu/unico/remove-focus-attributes
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+200813@code.launchpad.net

Commit message

Use outline attributes for focus to avoid custom attributes

Custom attributes are deprecated, slow, and are causing problems with gtk 3.10. Adwaita is using the same hack for some time now [1]. This patch is a bit more hacky in that it hard codes the a fill color.

[1] https://git.gnome.org/browse/gnome-themes-standard/commit/?id=6e641cf46cc70ce770482b3fc331b1fa3cd7af2b

Description of the change

Use outline attributes for focus to avoid custom attributes

Custom attributes are deprecated, slow, and are causing problems with gtk 3.10. Adwaita is using the same hack for some time now [1]. This patch is a bit more hacky in that it hard codes the a fill color.

[1] https://git.gnome.org/browse/gnome-themes-standard/commit/?id=6e641cf46cc70ce770482b3fc331b1fa3cd7af2b

To post a comment you must log in.
Revision history for this message
Andrea Cimitan (cimi) wrote :

Add a comment on the 0.2...

Revision history for this message
Andrea Cimitan (cimi) wrote :

actually just saw you added it on top :)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unico/unico-draw.c'
2--- unico/unico-draw.c 2012-12-11 14:08:58 +0000
3+++ unico/unico-draw.c 2014-01-08 11:59:42 +0000
4@@ -183,12 +183,18 @@
5 if (line_width < 1)
6 return;
7
8+ /* Use the outline attributes for the focus properties to avoid using
9+ * custom attributes. Outlines don't have a fill, so hardcode the fill
10+ * color to be the same color as the border, but with 20% of its alpha.
11+ */
12 gtk_theming_engine_get (engine, state,
13- "-unico-focus-border-color", &border_color,
14- "-unico-focus-border-radius", &radius,
15- "-unico-focus-fill-color", &fill_color,
16+ "outline-color", &border_color,
17+ "outline-offset", &radius,
18 NULL);
19
20+ fill_color = gdk_rgba_copy (border_color);
21+ fill_color->alpha = border_color->alpha * 0.2;
22+
23 x += focus_pad;
24 y += focus_pad;
25 width -= focus_pad * 2;
26
27=== modified file 'unico/unico-engine.c'
28--- unico/unico-engine.c 2012-12-11 14:08:58 +0000
29+++ unico/unico-engine.c 2014-01-08 11:59:42 +0000
30@@ -116,24 +116,6 @@
31 "Arrow texture",
32 "Arrow texture",
33 CAIRO_GOBJECT_TYPE_PATTERN, 0));
34-
35- gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
36- g_param_spec_boxed ("focus-border-color",
37- "Focus border color",
38- "Focus border color",
39- GDK_TYPE_RGBA, 0));
40-
41- gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
42- g_param_spec_int ("focus-border-radius",
43- "Focus border radius",
44- "Focus border radius",
45- 0, G_MAXINT, 0, 0));
46-
47- gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
48- g_param_spec_boxed ("focus-fill-color",
49- "Focus fill color",
50- "Focus fill color",
51- GDK_TYPE_RGBA, 0));
52 }
53
54 static void

Subscribers

People subscribed via source and target branches