summaryrefslogtreecommitdiffstats
path: root/x11vnc/remote.c
diff options
context:
space:
mode:
authorrunge <runge@karlrunge.com>2009-05-21 10:57:03 -0400
committerrunge <runge@karlrunge.com>2009-05-21 10:57:03 -0400
commit94d058b35f075cec2d6e8b6e37ee1a94086ea3f8 (patch)
tree6cec0620ab70b5db6b33645dbcac1071f3c7a556 /x11vnc/remote.c
parent804335f9d296440bb708ca844f5d89b58b50b0c6 (diff)
downloadlibtdevnc-94d058b35f075cec2d6e8b6e37ee1a94086ea3f8.tar.gz
libtdevnc-94d058b35f075cec2d6e8b6e37ee1a94086ea3f8.zip
Thread safety. Fix -clip -in -rawfb. Try to avoid Xorg stuck
key bug.
Diffstat (limited to 'x11vnc/remote.c')
-rw-r--r--x11vnc/remote.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/x11vnc/remote.c b/x11vnc/remote.c
index b46e06b..d5ae366 100644
--- a/x11vnc/remote.c
+++ b/x11vnc/remote.c
@@ -929,12 +929,14 @@ char *process_remote_cmd(char *cmd, int stringonly) {
ok = 1;
}
if (ok) {
+ X_LOCK;
if (twin && ! valid_window(twin, NULL, 0)) {
- rfbLog("skipping invalid sub-window: 0x%lx\n",
- twin);
+ rfbLog("skipping invalid sub-window: 0x%lx\n", twin);
+ X_UNLOCK;
} else {
subwin = twin;
rootshift = 0;
+ X_UNLOCK;
check_black_fb();
do_new_fb(1);
}
@@ -968,12 +970,14 @@ char *process_remote_cmd(char *cmd, int stringonly) {
ok = 1;
}
if (ok) {
+ X_LOCK;
if (twin && ! valid_window(twin, NULL, 0)) {
- rfbLog("skipping invalid sub-window: 0x%lx\n",
- twin);
+ rfbLog("skipping invalid sub-window: 0x%lx\n", twin);
+ X_UNLOCK;
} else {
subwin = twin;
rootshift = 1;
+ X_UNLOCK;
check_black_fb();
do_new_fb(1);
}
@@ -2394,7 +2398,9 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
rfbLog("remote_cmd: enabling -clear_mods mode.\n");
clear_mods = 1;
+ if (use_threads) {X_LOCK;}
clear_modifiers(0);
+ if (use_threads) {X_UNLOCK;}
goto done;
}
if (!strcmp(p, "noclear_mods")) {
@@ -2415,7 +2421,9 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
rfbLog("remote_cmd: enabling -clear_keys mode.\n");
clear_mods = 2;
+ if (use_threads) {X_LOCK;}
clear_keys();
+ if (use_threads) {X_UNLOCK;}
goto done;
}
if (!strcmp(p, "noclear_keys")) {
@@ -2436,14 +2444,18 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
rfbLog("remote_cmd: doing clear_all action.\n");
clear_mods = 3;
+ if (use_threads) {X_LOCK;}
clear_keys();
clear_locks();
+ if (use_threads) {X_UNLOCK;}
goto done;
}
if (!strcmp(p, "clear_locks")) {
NOTAPP
rfbLog("remote_cmd: doing clear_locks action.\n");
+ if (use_threads) {X_LOCK;}
clear_locks();
+ if (use_threads) {X_UNLOCK;}
goto done;
}
if (!strcmp(p, "keystate")) {
@@ -2452,7 +2464,9 @@ char *process_remote_cmd(char *cmd, int stringonly) {
for (i=0; i<256; i++) {
state[i] = 0;
}
+ if (use_threads) {X_LOCK;}
get_keystate(state);
+ if (use_threads) {X_UNLOCK;}
for (i=0; i<256; i++) {
fprintf(stderr, "keystate[%03d] %d\n", i, state[i]);
}