diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-04-09 11:35:21 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-04-09 11:54:25 +0200 |
commit | 92dd6caa9f87a18ed2e985af44419cf9bf9991bb (patch) | |
tree | 0ecdd94610bf0e27585cf93b8046e14e0e7cf472 | |
parent | d6cae7fae17c875984612251fcc49d98c87bb68f (diff) | |
download | vd_agent-92dd6caa9f87a18ed2e985af44419cf9bf9991bb.tar.gz vd_agent-92dd6caa9f87a18ed2e985af44419cf9bf9991bb.tar.xz vd_agent-92dd6caa9f87a18ed2e985af44419cf9bf9991bb.zip |
vdagent-x11: Add a vdagent_x11_has_icons_on_desktop function
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | src/vdagent-x11.c | 26 | ||||
-rw-r--r-- | src/vdagent-x11.h | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c index 39f98cd..5e1cbb6 100644 --- a/src/vdagent-x11.c +++ b/src/vdagent-x11.c @@ -259,6 +259,9 @@ struct vdagent_x11 *vdagent_x11_create(struct udscs_connection *vdagentd, usleep(100000); vdagent_x11_get_wm_name(x11); } + if (x11->debug && x11->net_wm_name) + syslog(LOG_DEBUG, "net_wm_name: \"%s\", has icons: %d", + x11->net_wm_name, vdagent_x11_has_icons_on_desktop(x11)); /* Flush output buffers and consume any pending events */ vdagent_x11_do_read(x11); @@ -1245,3 +1248,26 @@ void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection) /* Flush output buffers and consume any pending events */ vdagent_x11_do_read(x11); } + +/* Function used to determine the default location to save file-xfers, + xdg desktop dir or xdg download dir. We error on the save side and use a + whitelist approach, so any unknown desktops will end up with saving + file-xfers to the xdg download dir, and opening the xdg download dir with + xdg-open when the file-xfer completes. */ +int vdagent_x11_has_icons_on_desktop(struct vdagent_x11 *x11) +{ + const char * const wms_with_icons_on_desktop[] = { + "Metacity", /* GNOME-2 or GNOME-3 fallback */ + "Xfwm4", /* XFCE */ + "Marco", /* Mate */ + NULL + }; + int i; + + if (x11->net_wm_name) + for (i = 0; wms_with_icons_on_desktop[i]; i++) + if (!strcmp(x11->net_wm_name, wms_with_icons_on_desktop[i])) + return 1; + + return 0; +} diff --git a/src/vdagent-x11.h b/src/vdagent-x11.h index 20e770a..baa4ce8 100644 --- a/src/vdagent-x11.h +++ b/src/vdagent-x11.h @@ -37,6 +37,7 @@ void vdagent_x11_do_read(struct vdagent_x11 *x11); void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11, VDAgentMonitorsConfig *mon_config, int fallback); + void vdagent_x11_clipboard_grab(struct vdagent_x11 *x11, uint8_t selection, uint32_t *types, uint32_t type_count); void vdagent_x11_clipboard_request(struct vdagent_x11 *x11, @@ -45,4 +46,6 @@ void vdagent_x11_clipboard_data(struct vdagent_x11 *x11, uint8_t selection, uint32_t type, uint8_t *data, uint32_t size); void vdagent_x11_clipboard_release(struct vdagent_x11 *x11, uint8_t selection); +int vdagent_x11_has_icons_on_desktop(struct vdagent_x11 *x11); + #endif |