From 8f4db7fb5130a0b327154eddc62b161fb66af688 Mon Sep 17 00:00:00 2001 From: kraxel Date: Mon, 3 Jul 2006 12:00:31 +0000 Subject: xen screen management tool --- apps.c | 94 +++++------------------------------------------------------------- 1 file changed, 7 insertions(+), 87 deletions(-) (limited to 'apps.c') diff --git a/apps.c b/apps.c index e8f39c0..fab3c4d 100644 --- a/apps.c +++ b/apps.c @@ -1,18 +1,12 @@ #include #include +#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include - #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")) -- cgit