diff options
author | runge <runge> | 2006-02-06 05:34:43 +0000 |
---|---|---|
committer | runge <runge> | 2006-02-06 05:34:43 +0000 |
commit | 94b092cd2221df953632ad484a141853efd6c4e8 (patch) | |
tree | cb84a27c6ffb7e7e28e1da6afcb186d5fcc1ce70 /x11vnc/win_utils.c | |
parent | d0ef1285b8fe0f8efd0e1d75fcfcbad175411e0f (diff) | |
download | libvncserver-94b092cd2221df953632ad484a141853efd6c4e8.zip libvncserver-94b092cd2221df953632ad484a141853efd6c4e8.tar.gz |
x11vnc: -8to24 more speedups; tunables for very slow machines.
Diffstat (limited to 'x11vnc/win_utils.c')
-rw-r--r-- | x11vnc/win_utils.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/x11vnc/win_utils.c b/x11vnc/win_utils.c index 327daae..aad1362 100644 --- a/x11vnc/win_utils.c +++ b/x11vnc/win_utils.c @@ -25,15 +25,25 @@ Window descend_pointer(int depth, Window start, char *name_info, int len); Window parent_window(Window win, char **name) { Window r, parent; Window *list; + XErrorHandler old_handler; unsigned int nchild; + int rc; if (name != NULL) { *name = NULL; } - if (! XQueryTree(dpy, win, &r, &parent, &list, &nchild)) { + old_handler = XSetErrorHandler(trap_xerror); + trapped_xerror = 0; + rc = XQueryTree(dpy, win, &r, &parent, &list, &nchild); + XSetErrorHandler(old_handler); + + if (! rc || trapped_xerror) { + trapped_xerror = 0; return None; } + trapped_xerror = 0; + if (list) { XFree(list); } @@ -59,8 +69,8 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) { return 0; } - trapped_xerror = 0; old_handler = XSetErrorHandler(trap_xerror); + trapped_xerror = 0; if (XGetWindowAttributes(dpy, win, pattr)) { ok = 1; } @@ -148,6 +158,7 @@ void snapshot_stack_list(int free_only, double allowed_age) { last_free = now; X_LOCK; + /* no need to trap error since rootwin */ rc = XQueryTree(dpy, rootwin, &r, &w, &list, &ui); num = (int) ui; |