[gnome-applets/wip/segeiger/windowpicker: 11/15] windowpicker: declare variables at top
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/segeiger/windowpicker: 11/15] windowpicker: declare variables at top
- Date: Sun, 13 Oct 2019 12:18:51 +0000 (UTC)
commit 3b2b25aa3c7257ae90d592b545e9ea1d3b376fc9
Author: Sebastian Geiger <sbastig gmx net>
Date: Sat Oct 12 15:17:58 2019 +0200
windowpicker: declare variables at top
windowpicker/src/task-item.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/windowpicker/src/task-item.c b/windowpicker/src/task-item.c
index a74636bc6..cc3da16cb 100644
--- a/windowpicker/src/task-item.c
+++ b/windowpicker/src/task-item.c
@@ -264,20 +264,27 @@ static gboolean task_item_draw (
cairo_t *cr,
WpApplet* windowPickerApplet)
{
+ TaskItem *item;
+ GdkRectangle area;
+ GdkPixbuf *pbuf;
+ gint size;
+ gboolean active;
+ gboolean icons_greyscale;
+ gboolean attention;
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (TASK_IS_ITEM (widget), FALSE);
- TaskItem *item = TASK_ITEM (widget);
+ item = TASK_ITEM (widget);
g_return_val_if_fail (WNCK_IS_WINDOW (item->window), FALSE);
cr = gdk_cairo_create (gtk_widget_get_window(widget));
- GdkRectangle area;
- GdkPixbuf *pbuf;
area = item->area;
pbuf = item->pixbuf;
- gint size = MIN (area.height, area.width) - 8;
- gboolean active = wnck_window_is_active (item->window);
+ size = MIN (area.height, area.width) - 8;
+ active = wnck_window_is_active (item->window);
/* load the GSettings key for gray icons */
- gboolean icons_greyscale = wp_applet_get_icons_greyscale (item->windowPickerApplet);
- gboolean attention = wnck_window_or_transient_needs_attention (item->window);
+ icons_greyscale = wp_applet_get_icons_greyscale (item->windowPickerApplet);
+ attention = wnck_window_or_transient_needs_attention (item->window);
+
if (GDK_IS_PIXBUF (pbuf) &&
gdk_pixbuf_get_width (pbuf) != size &&
gdk_pixbuf_get_height (pbuf) != size)
@@ -350,11 +357,14 @@ static gboolean task_item_draw (
}
if (!item->mouse_over && attention) { /* urgent */
GTimeVal current_time;
+ gdouble ms;
+ gdouble alpha;
+
g_get_current_time (¤t_time);
- gdouble ms = (
+ ms = (
current_time.tv_sec - item->urgent_time.tv_sec) * 1000 +
(current_time.tv_usec - item->urgent_time.tv_usec) / 1000;
- gdouble alpha = .66 + (cos (3.15 * ms / 600) / 3);
+ alpha = .66 + (cos (3.15 * ms / 600) / 3);
cairo_paint_with_alpha (cr, alpha);
} else if (item->mouse_over || active || !icons_greyscale) { /* focused */
cairo_paint (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]