From 5d9370f9e552fa144d98e794cd3ef10fa1b3113c Mon Sep 17 00:00:00 2001 From: Eric Wertz Date: Fri, 17 Nov 2017 09:06:39 -0500 Subject: [PATCH] Trying to fix crashes with icons --- dock_icon.c | 7 ++++++- main.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dock_icon.c b/dock_icon.c index c56a71b..4e6666e 100644 --- a/dock_icon.c +++ b/dock_icon.c @@ -121,12 +121,16 @@ gchar* get_icon_from_desktop( const char* name ) { GKeyFile* key_file = g_key_file_new(); gchar file[256]; + gchar* out; sprintf( file, "/usr/share/applications/%s.desktop", name ); if( !g_key_file_load_from_file( key_file, file, G_KEY_FILE_NONE, NULL ) ) return NULL; - return g_key_file_get_string( key_file, G_KEY_FILE_DESKTOP_GROUP, "Icon", NULL ); + out = g_key_file_get_string( key_file, G_KEY_FILE_DESKTOP_GROUP, "Icon", NULL ); + g_key_file_free( key_file ); + + return out; } /* Gets the pixbuf from a desktop file's icon name. Based on the same function * from matchbox-desktop @@ -186,6 +190,7 @@ GdkPixbuf* get_icon( WnckWindow* window, guint size ) pixbuf = wnck_window_get_icon( window ); unref = 0; } + if (pixbuf == NULL) { pixbuf = gtk_icon_theme_load_icon(theme, "application-x-executable", diff --git a/main.c b/main.c index 8c4009e..bcd5730 100644 --- a/main.c +++ b/main.c @@ -109,6 +109,10 @@ GdkFilterReturn handle_x11_event( GdkXEvent *xevent, GdkEvent *event, gpointer d { system( "/home/eric/EricOS/ericlock/ericlock" ); } + if( xev->xkey.keycode == 39 ) + { + system( "/home/eric/EricOS/ericsnip/ericsnip" ); + } } } if( xev->type == KeyRelease ) -- 2.47.0