aboutsummaryrefslogtreecommitdiffstats
path: root/apps.c
diff options
context:
space:
mode:
authorkraxel <kraxel>2006-07-03 12:00:31 +0000
committerkraxel <kraxel>2006-07-03 12:00:31 +0000
commit8f4db7fb5130a0b327154eddc62b161fb66af688 (patch)
treecb43a91e2fdd769e7285c8f7fa76e0a4e83173fb /apps.c
parenta27248c91a6a7a48ce794efc4ed51cc9a6e7172b (diff)
downloadxenwatch-8f4db7fb5130a0b327154eddc62b161fb66af688.tar.gz
xen screen management tool
Diffstat (limited to 'apps.c')
-rw-r--r--apps.c94
1 files changed, 7 insertions, 87 deletions
diff --git a/apps.c b/apps.c
index e8f39c0..fab3c4d 100644
--- a/apps.c
+++ b/apps.c
@@ -1,18 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/stat.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-#include <xs.h>
-
#include "list.h"
#include "apps.h"
@@ -23,11 +17,11 @@ char app_error[256];
/* ------------------------------------------------------------------ */
-static int debug = 1;
+static int debug = 0;
struct have_app {
char *name;
- gboolean present;
+ int present;
struct list_head next;
};
static LIST_HEAD(apps);
@@ -103,82 +97,6 @@ int have_application(char *name)
/* ------------------------------------------------------------------ */
-#if 0
-/* check_wm_capability(dpy, root, _NET_SUPPORTED, _NET_WM_whatever); */
-static int
-check_wm_capability(Display *dpy, Window root, Atom list, Atom wanted)
-{
- Atom type;
- int format;
- unsigned int i;
- unsigned long nitems, bytesafter;
- unsigned char *args;
- unsigned long *ldata;
- char *name;
- int retval = -1;
-
- if (Success != XGetWindowProperty
- (dpy, root, list, 0, (65536 / sizeof(long)), False,
- AnyPropertyType, &type, &format, &nitems, &bytesafter, &args))
- return -1;
- if (type != XA_ATOM)
- return -1;
- ldata = (unsigned long*)args;
- for (i = 0; i < nitems; i++) {
- if (ldata[i] == wanted)
- retval = 0;
- if (debug) {
- name = XGetAtomName(dpy,ldata[i]);
- fprintf(stderr,"wm cap: %s\n",name);
- XFree(name);
- }
- }
- XFree(ldata);
- return retval;
-}
-#endif
-
-static int
-check_atom_present(Display *dpy, Window root, Atom check)
-{
- Atom type;
- int format;
- unsigned long nitems, bytesafter;
- unsigned char *args;
-
- if (Success != XGetWindowProperty
- (dpy, root, check, 0, (65536 / sizeof(long)), False,
- AnyPropertyType, &type, &format, &nitems, &bytesafter, &args))
- return -1;
- if (NULL == args)
- return -1;
- return 0;
-}
-
-#define INIT_ATOM(dpy,atom) atom = XInternAtom(dpy,#atom,False)
-static Atom KWIN_RUNNING;
-static Atom _METACITY_SENTINEL;
-
-void detect_desktop(void)
-{
- Display *dpy = gdk_x11_display_get_xdisplay(gdk_display_get_default());
- Window root = DefaultRootWindow(dpy);
-
- INIT_ATOM(dpy, KWIN_RUNNING);
- INIT_ATOM(dpy, _METACITY_SENTINEL);
-
- if (0 == check_atom_present(dpy, root, KWIN_RUNNING)) {
- fprintf(stderr,"Desktop: KDE\n");
- desktop_type = DESKTOP_KDE;
- }
- if (0 == check_atom_present(dpy, root, _METACITY_SENTINEL)) {
- fprintf(stderr,"Desktop: Gnome\n");
- desktop_type = DESKTOP_GNOME;
- }
-}
-
-/* ------------------------------------------------------------------ */
-
int run_application_va(int do_wait, const char *app, char **argv)
{
int status, rc;
@@ -335,11 +253,13 @@ int open_vnc_session(char *host, int screen)
snprintf(vncurl, sizeof(vncurl), "vnc://%s:%d/", host, 5900 + screen);
/* --- try client apps --- */
+ if (have_application("vncviewer"))
+ return run_application(0, "vncviewer", "vncviewer",
+ "-xrm", "vncviewer*passwordDialog: true",
+ display, NULL);
if (have_application("krdc"))
/* KDE remote desktop client */
return run_application(0, "krdc", "krdc", display, NULL);
- if (have_application("vncviewer"))
- return run_application(0, "vncviewer", "vncviewer", display, NULL);
/* --- try web browser (java applet client) --- */
if (DESKTOP_KDE == desktop_type && have_application("kfmclient"))