From 5dbc254039d1fd79ad587c6c98e9e8428495a0de Mon Sep 17 00:00:00 2001 From: Javier Date: Wed, 21 Jan 2015 00:43:40 +0100 Subject: right button menu and other features --- libmdock/app-id.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'libmdock/app-id.c') diff --git a/libmdock/app-id.c b/libmdock/app-id.c index b54ed6c..6ea456a 100644 --- a/libmdock/app-id.c +++ b/libmdock/app-id.c @@ -49,10 +49,15 @@ void app_id_destroy(AppId *appid) g_slice_free(AppId, appid); } +static inline guint str_hash0(const gchar *s) +{ + return s ? g_str_hash(s) : 0; +} + guint app_id_hash(gconstpointer appid_pointer) { const AppId *appid = appid_pointer; - return g_str_hash(appid->host) + appid->uid + g_str_hash(appid->executable) + g_str_hash(appid->wm_class_class) + g_str_hash(appid->wm_class_name); + return str_hash0(appid->host) + appid->uid + str_hash0(appid->executable) + str_hash0(appid->wm_class_class) + str_hash0(appid->wm_class_name); } gboolean app_id_equal(gconstpointer ap, gconstpointer bp) @@ -155,3 +160,12 @@ AppId * app_id_from_window(WnckWindow *window) return appid; } + +gboolean app_id_is_local_user(AppId *appid) +{ + if (appid->host && !is_local_host(appid->host)) { + return FALSE; + } + + return appid->uid == getuid(); +} -- cgit v1.2.3