From c62186d0ddd1e9431808ae6a58fffd24d5232eb2 Mon Sep 17 00:00:00 2001 From: Eric Wertz Date: Fri, 7 Oct 2016 11:48:00 -0400 Subject: [PATCH] Fixed up clock rendering and icons --- clock.h | 8 ++++---- dock_icon.h | 3 +++ main.c | 1 + pager_item.h | 8 +++++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/clock.h b/clock.h index a82c2af..0692d89 100644 --- a/clock.h +++ b/clock.h @@ -96,14 +96,14 @@ void clock_draw_timestring(cairo_t* cr, double x, double y, int blurpass) sprintf(timestring,"%i:%02i%s",hour, minute, ampm); cairo_text_extents(cr,timestring,&extents); text_x-=extents.x_advance; - cairo_move_to(cr,text_x, y + extents.y_bearing + extents.height - SCALE_VALUE( 2.0 ) ); + cairo_move_to(cr,text_x, y - SCALE_VALUE( 4.0 ) ); cairo_text_path(cr,timestring); - sprintf(timestring,"%02i/%02i/%02i", - timeinfo->tm_mon, timeinfo->tm_mday, timeinfo->tm_year + 1900 ); + sprintf(timestring,"%i/%02i/%02i", + timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_year + 1900 ); cairo_text_extents(cr,timestring,&extents); text_x = x - extents.x_advance; - cairo_move_to(cr,text_x, y - extents.y_bearing + SCALE_VALUE( 2.0 ) ); + cairo_move_to(cr,text_x, y - extents.y_bearing + SCALE_VALUE( 4.0 ) ); cairo_text_path(cr,timestring); //sprintf(timestring,"%s, %s %i, %i",weekday_names[timeinfo->tm_wday],month_names[timeinfo->tm_mon],timeinfo->tm_mday,timeinfo->tm_year+1900); diff --git a/dock_icon.h b/dock_icon.h index 2f376f6..16a18df 100644 --- a/dock_icon.h +++ b/dock_icon.h @@ -110,6 +110,9 @@ void dock_icon_activate( dock_icon* icon, Time time, int from_click ) wnck_window_activate( item->window, time ); tooltip_window_hide(); } + + if( icon->icon_state == ICON_STATE_ALERT ) + icon->icon_state = ICON_STATE_NORMAL; } void dock_icon_mouse_down( dock_icon* icon, double mx, double my, Time time ) diff --git a/main.c b/main.c index b8c1ee8..c55b765 100644 --- a/main.c +++ b/main.c @@ -18,6 +18,7 @@ #define ICON_STATE_NORMAL 0 #define ICON_STATE_HOVER 1 #define ICON_STATE_ACTIVE 2 +#define ICON_STATE_ALERT 3 GList* dock_icons = NULL; eric_window* dock_window = NULL; diff --git a/pager_item.h b/pager_item.h index 7121ba4..eb56e78 100644 --- a/pager_item.h +++ b/pager_item.h @@ -32,6 +32,11 @@ void pager_item_icon_changed( WnckWindow* window, pager_item* item ) item->icon_pixbuf = wnck_window_get_mini_icon( window ); } +void pager_item_state_changed( WnckWindow* window, WnckWindowState changed_mask, WnckWindowState new_state, pager_item* item ) +{ + //item->icon_pixbuf = wnck_window_get_mini_icon( window ); +} + pager_item* pager_item_create( WnckWindow* window ) { pager_item* item = malloc( sizeof( pager_item ) ); @@ -41,7 +46,8 @@ pager_item* pager_item_create( WnckWindow* window ) item->icon_state = ICON_STATE_NORMAL; g_signal_connect( G_OBJECT( window ), "name-changed", G_CALLBACK( pager_item_name_changed ), (gpointer)item ); - g_signal_connect( G_OBJECT( window ), "icon-changed", G_CALLBACK( pager_item_name_changed ), (gpointer)item ); + g_signal_connect( G_OBJECT( window ), "icon-changed", G_CALLBACK( pager_item_icon_changed ), (gpointer)item ); + g_signal_connect( G_OBJECT( window ), "state-changed", G_CALLBACK( pager_item_state_changed ), (gpointer)item ); item->width = SCALE_VALUE( 320 ); item->height = SCALE_VALUE( 24.0 ); -- 2.47.0