|
Lines 286-309
PointerEvent::PointerEvent(int b, int _x, int _y) :
Link Here
|
| 286 |
initialized = true; |
286 |
initialized = true; |
| 287 |
dpy = tqt_xdisplay(); |
287 |
dpy = tqt_xdisplay(); |
| 288 |
buttonMask = 0; |
288 |
buttonMask = 0; |
|
|
289 |
|
| 290 |
// Set up default map in case XGetPointerMapping fails |
| 291 |
for (int i=0; i<MAX_BUTTONS; i++) { |
| 292 |
map[i] = i+1; |
| 293 |
} |
| 294 |
XGetPointerMapping(dpy, map, MAX_BUTTONS); |
| 295 |
printf("[krfb] [DEBUG] Pointer mapping: %d %d %d %d %d\n", map[0], map[1], map[2], map[3], map[4]); fflush(stdout); |
| 289 |
} |
296 |
} |
| 290 |
} |
297 |
} |
| 291 |
|
298 |
|
| 292 |
void PointerEvent::exec() { |
299 |
void PointerEvent::exec() { |
|
|
300 |
if (buttonMask != button_mask) printf("[krfb] [DEBUG] Entering PointerEvent::exec()\n"); fflush(stdout); |
| 293 |
TQDesktopWidget *desktopWidget = TQApplication::desktop(); |
301 |
TQDesktopWidget *desktopWidget = TQApplication::desktop(); |
| 294 |
|
302 |
|
| 295 |
int screen = desktopWidget->screenNumber(); |
303 |
int screen = desktopWidget->screenNumber(); |
| 296 |
if (screen < 0) |
304 |
if (screen < 0) { |
| 297 |
screen = 0; |
305 |
screen = 0; |
|
|
306 |
} |
| 298 |
XTestFakeMotionEvent(dpy, screen, x, y, CurrentTime); |
307 |
XTestFakeMotionEvent(dpy, screen, x, y, CurrentTime); |
| 299 |
for(int i = 0; i < 5; i++) |
308 |
for(int i = 0; i < MAX_BUTTONS; i++) { |
| 300 |
if ((buttonMask&(1<<i))!=(button_mask&(1<<i))) |
309 |
if ((buttonMask&(1<<i))!=(button_mask&(1<<i))) { |
|
|
310 |
int localButton = i+1; |
| 311 |
printf("[krfb] [DEBUG] PointerEvent::exec() remote requested button %d\n", localButton); fflush(stdout); |
| 312 |
for (int j=0; j<MAX_BUTTONS; j++) { |
| 313 |
if (map[j] == localButton) { |
| 314 |
localButton = j+1; |
| 315 |
break; |
| 316 |
} |
| 317 |
} |
| 318 |
printf("[krfb] [DEBUG] PointerEvent::exec() using local button %d\n", localButton); fflush(stdout); |
| 301 |
XTestFakeButtonEvent(dpy, |
319 |
XTestFakeButtonEvent(dpy, |
| 302 |
i+1, |
320 |
localButton, |
| 303 |
(button_mask&(1<<i))?True:False, |
321 |
(button_mask&(1<<i))?True:False, |
| 304 |
CurrentTime); |
322 |
CurrentTime); |
|
|
323 |
} |
| 324 |
} |
| 305 |
|
325 |
|
| 306 |
buttonMask = button_mask; |
326 |
buttonMask = button_mask; |
|
|
327 |
if (buttonMask != button_mask) printf("[krfb] [DEBUG] Exiting PointerEvent::exec()\n"); fflush(stdout); |
| 307 |
} |
328 |
} |
| 308 |
|
329 |
|
| 309 |
|
330 |
|