Merge lp:~jassmith/window-picker-applet/desat into lp:window-picker-applet

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

Desaturates non-active task-items to create a more obvious active task. Desaturation is currently 100% however can be backed down to make effect less severe.

95. By Jason Smith <jason@t500>

src/task-item.c : Saturate urgent items also

Revision history for this message
Mirco Müller (macslow) wrote :

> Desaturates non-active task-items to create a more obvious active task.
> Desaturation is currently 100% however can be backed down to make effect less
> severe.

Before using desat after gdk_pixbuf_new() you should check that it's not NULL and handle this possible error-case. Apart from that the patch looks good.

review: Needs Fixing
Revision history for this message
Jason Smith (jassmith) wrote :

> > Desaturates non-active task-items to create a more obvious active task.
> > Desaturation is currently 100% however can be backed down to make effect
> less
> > severe.
>
> Before using desat after gdk_pixbuf_new() you should check that it's not NULL
> and handle this possible error-case. Apart from that the patch looks good.

Done

96. By Jason Smith <jason@t500>

Handle out of memory error condition

Revision history for this message
Mirco Müller (macslow) wrote :

> > > Desaturates non-active task-items to create a more obvious active task.
> > > Desaturation is currently 100% however can be backed down to make effect
> > less
> > > severe.
> >
> > Before using desat after gdk_pixbuf_new() you should check that it's not
> NULL
> > and handle this possible error-case. Apart from that the patch looks good.
>
> Done

Good.

review: Approve
Revision history for this message
Jason Smith (jassmith) wrote :

I am going to wait for Neil to give a thumbs up here also.

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

Looks good. Approved.

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-09-01 08:05:33 +0000
3+++ src/task-item.c 2009-09-01 09:27:32 +0000
4@@ -240,6 +240,8 @@
5 TaskItem *item;
6 GdkRectangle area;
7 TaskItemPrivate *priv;
8+ GdkPixbuf *desat;
9+ GdkPixbuf *pbuf;
10
11 g_return_val_if_fail (widget != NULL, FALSE);
12 g_return_val_if_fail (TASK_IS_ITEM (widget), FALSE);
13@@ -253,7 +255,8 @@
14 area = priv->area;
15 cr = gdk_cairo_create (event->window);
16
17- GdkPixbuf *pbuf = priv->pixbuf;
18+ pbuf = priv->pixbuf;
19+ desat = NULL;
20
21 gint size = MIN (area.height, area.width);
22 gboolean active = wnck_window_is_active (priv->window);
23@@ -282,11 +285,30 @@
24 pbuf = task_item_sized_pixbuf_for_window (item, priv->window, size);
25 }
26
27- gdk_cairo_set_source_pixbuf (cr,
28- pbuf,
29- (area.x + (area.width - gdk_pixbuf_get_width (pbuf)) / 2),
30- (area.y + (area.height - gdk_pixbuf_get_height (pbuf)) / 2));
31-
32+ if (active || priv->mouse_over)
33+ {
34+ gdk_cairo_set_source_pixbuf (cr,
35+ pbuf,
36+ (area.x + (area.width - gdk_pixbuf_get_width (pbuf)) / 2),
37+ (area.y + (area.height - gdk_pixbuf_get_height (pbuf)) / 2));
38+ }
39+ else
40+ {
41+ desat = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
42+ TRUE,
43+ gdk_pixbuf_get_bits_per_sample (pbuf),
44+ gdk_pixbuf_get_width (pbuf),
45+ gdk_pixbuf_get_height (pbuf));
46+
47+ gdk_pixbuf_saturate_and_pixelate (pbuf,
48+ desat,
49+ 0,
50+ FALSE);
51+ gdk_cairo_set_source_pixbuf (cr,
52+ desat,
53+ (area.x + (area.width - gdk_pixbuf_get_width (desat)) / 2),
54+ (area.y + (area.height - gdk_pixbuf_get_height (desat)) / 2));
55+ }
56 if (!priv->mouse_over && wnck_window_or_transient_needs_attention (priv->window)) /* urgent */
57 {
58 GTimeVal current_time;
59@@ -307,6 +329,9 @@
60 cairo_paint_with_alpha (cr, .65);
61 }
62
63+ if (GDK_IS_PIXBUF (desat))
64+ g_object_unref (desat);
65+
66 cairo_destroy (cr);
67
68 return FALSE;

Subscribers

People subscribed via source and target branches

to all changes: