summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ca75974)
raw | patch | inline | side by side (parent: ca75974)
author | Eric Wertz <ericdwertz@gmail.com> | |
Thu, 6 Jul 2017 14:02:26 +0000 (10:02 -0400) | ||
committer | Eric Wertz <ericdwertz@gmail.com> | |
Thu, 6 Jul 2017 14:02:26 +0000 (10:02 -0400) |
dock_icon.c | patch | blob | history | |
main.c | patch | blob | history | |
pager_item.c | patch | blob | history |
diff --git a/dock_icon.c b/dock_icon.c
index 5edc24868edfc54725a8b1d07eb1f75f46721c5a..c56a71b3f4a5e9419e8481e5ac5d3bc1bcf38241 100644 (file)
--- a/dock_icon.c
+++ b/dock_icon.c
{
static GtkIconTheme* theme = NULL;
GdkPixbuf* pixbuf = NULL;
+ GdkPixbuf* copy = NULL;
gchar* stripped = NULL;
const gchar* class_name = wnck_window_get_class_group_name( window );
const gchar* instance_name = wnck_window_get_class_instance_name( window );
gchar instance_lower[256] = {0};
gchar class_lower[256] = {0};
gint width, height;
+ int unref = 0;
if (theme == NULL) {
if( strcmp( class_lower, instance_lower ) != 0 )
{
pixbuf = wnck_window_get_icon( window );
+ unref = 0;
}
}
{
gchar* icon_name = get_icon_from_desktop( instance_name );
if( icon_name != NULL )
+ {
pixbuf = gtk_icon_theme_load_icon( theme, icon_name,
size, GTK_ICON_LOOKUP_FORCE_SIZE, NULL );
+ unref = 1;
+ }
}
/* Always try and send back something */
if (pixbuf == NULL)
+ {
pixbuf = wnck_window_get_icon( window );
+ unref = 0;
+ }
if (pixbuf == NULL)
+ {
pixbuf = gtk_icon_theme_load_icon(theme, "application-x-executable",
size, 0, NULL);
+ unref = 1;
+ }
width = gdk_pixbuf_get_width(pixbuf);
height = gdk_pixbuf_get_height(pixbuf);
size,
size,
GDK_INTERP_HYPER);
- g_object_unref(temp);
+ if( unref )
+ g_object_unref(temp);
}
g_free(stripped);
- return gdk_pixbuf_copy( pixbuf );
+ copy = gdk_pixbuf_copy( pixbuf );
+ if( unref )
+ g_object_unref( pixbuf );
+ return copy;
}
/* From matchbox-desktop */
char* strip_extension (const char *file)
{
- char *stripped, *p;
+ char *stripped, *p;
- stripped = g_strdup (file);
+ stripped = g_strdup (file);
- p = strrchr (stripped, '.');
- if (p &&
- (!strcmp (p, ".png") ||
- !strcmp (p, ".svg") ||
- !strcmp (p, ".xpm")))
- *p = 0;
+ p = strrchr (stripped, '.');
+ if (p &&
+ (!strcmp (p, ".png") ||
+ !strcmp (p, ".svg") ||
+ !strcmp (p, ".xpm")))
+ *p = 0;
- return stripped;
+ return stripped;
}
index f8b08f824f121c45945d76e477a138a0d6ca2a0c..8c4009ec2a538acbbacb19e5f7531ac5a7821ed5 100644 (file)
--- a/main.c
+++ b/main.c
@@ -166,6 +166,7 @@ static gboolean draw_dock_window( GtkWidget* widget, cairo_t* cr, eric_window* w
}
if( !GDK_IS_PIXBUF( icon->icon_pixbuf ) )
{
+ printf( "Trying to draw without an icon\n" );
icon->icon_pixbuf = gdk_pixbuf_copy( wnck_class_group_get_icon( icon->class_group ) );
}
gdk_cairo_set_source_pixbuf( cr, icon->icon_pixbuf, x+SCALE_VALUE( 4.0 ), y );
@@ -176,10 +177,21 @@ static gboolean draw_dock_window( GtkWidget* widget, cairo_t* cr, eric_window* w
{
//Draw rectangles
width = (SCALE_VALUE(32.0) / pager_count );
- rx = x + SCALE_VALUE(4.0);
ry = y + SCALE_VALUE(34.0);
w->text_color.alpha = 0.5;
+
+ //Shadow pass
+ cairo_set_source_rgba( cr, 1.0 - w->text_color.red, 1.0 - w->text_color.green, 1.0 - w->text_color.blue, w->text_color.alpha*0.5 );
+ rx = x + SCALE_VALUE(4.0);
+ for( i = 0; i < pager_count; i++ )
+ {
+ cairo_rectangle( cr, rx+SCALE_VALUE( 2.0 ), ry+SCALE_VALUE( 1.0 ), width-SCALE_VALUE( 2.0 ), SCALE_VALUE( 4.0 ) );
+ rx += width;
+ }
+ cairo_fill( cr );
+
gdk_cairo_set_source_rgba( cr, &w->text_color );
+ rx = x + SCALE_VALUE(4.0);
for( i = 0; i < pager_count; i++ )
{
cairo_rectangle( cr, rx+SCALE_VALUE( 1.0 ), ry, width-SCALE_VALUE( 2.0 ), SCALE_VALUE( 4.0 ) );
@@ -330,9 +342,6 @@ static void wnck_window_closed( WnckScreen* screen, WnckWindow* window, gpointer
item = (pager_item*)pager_list->data;
if( item->window == window )
{
- if( GDK_IS_PIXBUF( item->icon_pixbuf ) )
- g_object_unref( item->icon_pixbuf );
-
icon->pager_items = g_list_remove( icon->pager_items, item );
free( item );
printf( "Removed pager item\n" );
diff --git a/pager_item.c b/pager_item.c
index ac30af9b8b904ab861214036c79097bc75875e96..d213daa31c90acfbb5b3f3f39e3548676a2f3341 100644 (file)
--- a/pager_item.c
+++ b/pager_item.c
void pager_item_icon_changed( WnckWindow* window, pager_item* item )
{
- if( item->icon_pixbuf && GDK_IS_PIXBUF( item->icon_pixbuf ) )
+ if( item->icon_pixbuf != NULL && !GDK_IS_PIXBUF( item->icon_pixbuf ) )
{
- g_object_unref( item->icon_pixbuf );
item->icon_pixbuf = NULL;
}
void pager_item_state_changed( WnckWindow* window, WnckWindowState changed_mask, WnckWindowState new_state, pager_item* item )
{
+ printf( "Item state changed %s\n", item->name );
//item->icon_pixbuf = wnck_window_get_mini_icon( window );
}
void pager_item_draw( pager_item* item, cairo_t* cr, eric_window* w, cairo_pattern_t* pattern )
{
- if( item->icon_pixbuf && !GDK_IS_PIXBUF( item->icon_pixbuf ) )
+ if( item->icon_pixbuf != NULL && !GDK_IS_PIXBUF( item->icon_pixbuf ) )
{
item->icon_pixbuf = get_icon( item->window, (int)SCALE_VALUE( 16.0 ) );
if( !GDK_IS_PIXBUF( item->icon_pixbuf ) )