summaryrefslogtreecommitdiffstats
path: root/x11vnc/xwrappers.c
diff options
context:
space:
mode:
authorrunge <runge>2006-11-21 22:16:23 +0000
committerrunge <runge>2006-11-21 22:16:23 +0000
commit27a884d2f3775cf4d97ea8f3d7433cbe2deebbfc (patch)
treea4b7c9f0ae519b0afa0d14b646abca3ad01b35a8 /x11vnc/xwrappers.c
parent05ba45f72e70b4372ef05a8aca34a3bddcfaeb71 (diff)
downloadlibtdevnc-27a884d2f3775cf4d97ea8f3d7433cbe2deebbfc.tar.gz
libtdevnc-27a884d2f3775cf4d97ea8f3d7433cbe2deebbfc.zip
x11vnc: Mac OS X fb fixes and cuttext, -nodpms option, local user wireframing
Diffstat (limited to 'x11vnc/xwrappers.c')
-rw-r--r--x11vnc/xwrappers.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c
index 77f3016..cc48b4a 100644
--- a/x11vnc/xwrappers.c
+++ b/x11vnc/xwrappers.c
@@ -385,6 +385,7 @@ static void copy_raw_fb_24_to_32(XImage *dest, int x, int y, unsigned int w,
} else if (! raw_fb_seek) {
/* mmap */
+ bpl = raw_fb_bytes_per_line;
src = raw_fb_addr + raw_fb_offset + bpl*y + 3*x;
dst = dest->data;
@@ -408,7 +409,9 @@ static void copy_raw_fb_24_to_32(XImage *dest, int x, int y, unsigned int w,
} else {
/* lseek */
- off_t off = (off_t) (raw_fb_offset + bpl*y + 3*x);
+ off_t off;
+ bpl = raw_fb_bytes_per_line;
+ off = (off_t) (raw_fb_offset + bpl*y + 3*x);
lseek(raw_fb_fd, off, SEEK_SET);
dst = dest->data;
@@ -478,6 +481,7 @@ void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h) {
} else if (! raw_fb_seek) {
/* mmap */
+ bpl = raw_fb_bytes_per_line;
src = raw_fb_addr + raw_fb_offset + bpl*y + pixelsize*x;
dst = dest->data;
@@ -490,7 +494,9 @@ void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h) {
} else {
/* lseek */
int n, len, del, sz = w * pixelsize;
- off_t off = (off_t) (raw_fb_offset + bpl*y + pixelsize*x);
+ off_t off;
+ bpl = raw_fb_bytes_per_line;
+ off = (off_t) (raw_fb_offset + bpl*y + pixelsize*x);
lseek(raw_fb_fd, off, SEEK_SET);
dst = dest->data;
@@ -1063,9 +1069,18 @@ int XCloseDisplay_wr(Display *display) {
#endif /* NO_X11 */
}
+static unsigned int Bmask = (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask);
+static unsigned int Mmask = (ShiftMask|LockMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask);
+
+static unsigned int last_local_button_mask = 0;
+static unsigned int last_local_mod_mask = 0;
+static int last_local_x = 0;
+static int last_local_y = 0;
+
Bool XQueryPointer_wr(Display *display, Window w, Window *root_return,
Window *child_return, int *root_x_return, int *root_y_return,
int *win_x_return, int *win_y_return, unsigned int *mask_return) {
+ Bool rc;
#if NO_X11
return False;
@@ -1073,9 +1088,24 @@ Bool XQueryPointer_wr(Display *display, Window w, Window *root_return,
if (! display) {
return False;
}
- return XQueryPointer(display, w, root_return, child_return,
+ rc = XQueryPointer(display, w, root_return, child_return,
root_x_return, root_y_return, win_x_return, win_y_return,
mask_return);
+ if (rc) {
+ display_button_mask = (*mask_return) & Bmask;
+ display_mod_mask = (*mask_return) & Mmask;
+ if (last_local_button_mask != display_button_mask) {
+ got_local_pointer_input++;
+ } else if (*root_x_return != last_local_x ||
+ *root_y_return != last_local_y) {
+ got_local_pointer_input++;
+ }
+ last_local_button_mask = display_button_mask;
+ last_local_mod_mask = display_mod_mask;
+ last_local_x = *root_x_return;
+ last_local_y = *root_y_return;
+ }
+ return rc;
#endif /* NO_X11 */
}
@@ -1085,7 +1115,7 @@ Status XQueryTree_wr(Display *display, Window w, Window *root_return,
unsigned int *nchildren_return) {
#ifdef MACOSX
- if (! display) {
+ if (macosx_console) {
return macosx_xquerytree(w, root_return, parent_return,
children_return, nchildren_return);
}