Merge lp:~jassmith/window-picker-applet/active-icon into lp:window-picker-applet

Proposed by Jason Smith
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jassmith/window-picker-applet/active-icon
Merge into: lp:window-picker-applet
Diff against target: None lines
To merge this branch: bzr merge lp:~jassmith/window-picker-applet/active-icon
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+10788@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

Beautify the active window indicator on window-picker-applet. Somewhat inspired from Docky.
Image: http://dl.getdropbox.com/u/269345/wpa_active_window.png

93. By Jason Smith <jason@t500>

task-list.c : remove spacing from list. task-items now have their own internal buffer

94. By Jason Smith <jason@t500>

task-item.c : Soften edges

Revision history for this message
Neil J. Patel (njpatel) wrote :

I like it...looks nice with Dust. Approve.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/task-item.c'
2--- src/task-item.c 2009-08-25 19:11:59 +0000
3+++ src/task-item.c 2009-08-27 05:29:40 +0000
4@@ -219,24 +219,12 @@
5 gint width = gdk_pixbuf_get_width (pbuf);
6 gint height = gdk_pixbuf_get_height (pbuf);
7
8- if (width > size || height > size)
9+ if (MAX (width, height) != size)
10 {
11- gdouble scale;
12- if (width > size)
13- {
14- scale = (gdouble) size / (gdouble) width;
15- width = size;
16- height = (int) (height * scale);
17- }
18- if (height > size)
19- {
20- scale = (gdouble) size / (gdouble) height;
21- height = size;
22- width = (int) (width * scale);
23- }
24+ gdouble scale = (gdouble) size / (gdouble) MAX (width, height);
25
26 GdkPixbuf *tmp = pbuf;
27- pbuf = gdk_pixbuf_scale_simple (tmp, width, height, GDK_INTERP_HYPER);
28+ pbuf = gdk_pixbuf_scale_simple (tmp, (gint) (width * scale), (gint) (height * scale), GDK_INTERP_HYPER);
29
30 g_object_unref (tmp);
31 }
32@@ -259,7 +247,7 @@
33 item = TASK_ITEM (widget);
34 priv = item->priv;
35
36- g_return_val_if_fail (WNCK_IS_WINDOW (item->priv->window), FALSE);
37+ g_return_val_if_fail (WNCK_IS_WINDOW (priv->window), FALSE);
38
39 area = priv->area;
40 cr = gdk_cairo_create (event->window);
41@@ -267,14 +255,27 @@
42 GdkPixbuf *pbuf = priv->pixbuf;
43
44 gint size = MIN (area.height, area.width);
45+ gboolean active = wnck_window_is_active (priv->window);
46
47- if (GDK_IS_PIXBUF (pbuf) && (gdk_pixbuf_get_width (pbuf) > size ||
48- gdk_pixbuf_get_height (pbuf) > size))
49+ if (GDK_IS_PIXBUF (pbuf) &&
50+ gdk_pixbuf_get_width (pbuf) != size &&
51+ gdk_pixbuf_get_height (pbuf) != size)
52 {
53 g_object_unref (pbuf);
54 pbuf = NULL;
55 }
56
57+ if (active)
58+ {
59+ cairo_rectangle (cr, area.x + .5, area.y - 4, area.width - 1, area.height + 8);
60+ cairo_set_source_rgba (cr, .8, .8, .8, .2);
61+ cairo_fill_preserve (cr);
62+
63+ cairo_set_line_width (cr, 1);
64+ cairo_set_source_rgba (cr, 1, 1, 1, .5);
65+ cairo_stroke (cr);
66+ }
67+
68 if (!pbuf)
69 {
70 pbuf = task_item_sized_pixbuf_for_window (item, priv->window, size);
71@@ -287,7 +288,7 @@
72
73 g_object_unref (pbuf);
74
75- if (!priv->mouse_over && wnck_window_or_transient_needs_attention (priv->window))
76+ if (!priv->mouse_over && wnck_window_or_transient_needs_attention (priv->window)) /* urgent */
77 {
78 GTimeVal current_time;
79 g_get_current_time (&current_time);
80@@ -298,13 +299,13 @@
81 gdouble alpha = .75 + (cos (ms / 500) / 4);
82 cairo_paint_with_alpha (cr, alpha);
83 }
84- else if (priv->mouse_over || wnck_window_is_active (priv->window))
85+ else if (priv->mouse_over || active) /* focused */
86 {
87 cairo_paint (cr);
88 }
89- else
90+ else /* not focused */
91 {
92- cairo_paint_with_alpha (cr, .6);
93+ cairo_paint_with_alpha (cr, .65);
94 }
95
96 cairo_destroy (cr);
97@@ -319,8 +320,8 @@
98 {
99 TaskItemPrivate *priv;
100
101- if (allocation->width != allocation->height)
102- gtk_widget_set_size_request (widget, allocation->height, -1);
103+ if (allocation->width != allocation->height + 6)
104+ gtk_widget_set_size_request (widget, allocation->height + 6, -1);
105
106 g_return_if_fail (TASK_IS_ITEM (item));
107

Subscribers

People subscribed via source and target branches

to all changes: