217 |
It seems to work alright anyway, though. */ |
It seems to work alright anyway, though. */ |
218 |
if (IC != NULL) |
if (IC != NULL) |
219 |
{ |
{ |
220 |
if (XGetICValues(IC, XNFilterEvents, &filtered_events, NULL) |
if (XGetICValues(IC, XNFilterEvents, &filtered_events, NULL) != NULL) |
|
!= NULL) |
|
221 |
{ |
{ |
222 |
error("Failed to obtain XNFilterEvents value from IC\n"); |
error("Failed to obtain XNFilterEvents value from IC\n"); |
223 |
filtered_events = 0; |
filtered_events = 0; |
250 |
error("Failed to open display\n"); |
error("Failed to open display\n"); |
251 |
return False; |
return False; |
252 |
} |
} |
253 |
if(fullscreen) |
if (fullscreen) |
254 |
{ |
{ |
255 |
screen = DefaultScreenOfDisplay(display); |
screen = DefaultScreenOfDisplay(display); |
256 |
width = WidthOfScreen(screen); |
width = WidthOfScreen(screen); |
283 |
desirable, e.g. 24 bits->32 bits. */ |
desirable, e.g. 24 bits->32 bits. */ |
284 |
while (i--) |
while (i--) |
285 |
{ |
{ |
286 |
if ((pfm[i].depth == depth) |
if ((pfm[i].depth == depth) && (pfm[i].bits_per_pixel > bpp)) |
|
&& (pfm[i].bits_per_pixel > bpp)) |
|
287 |
{ |
{ |
288 |
bpp = pfm[i].bits_per_pixel; |
bpp = pfm[i].bits_per_pixel; |
289 |
} |
} |
330 |
wnd = XCreateWindow(display, RootWindowOfScreen(screen), |
wnd = XCreateWindow(display, RootWindowOfScreen(screen), |
331 |
0, 0, width, height, 0, CopyFromParent, |
0, 0, width, height, 0, CopyFromParent, |
332 |
InputOutput, CopyFromParent, |
InputOutput, CopyFromParent, |
333 |
CWBackingStore | CWBackPixel | CWOverrideRedirect, |
CWBackingStore | CWBackPixel | CWOverrideRedirect, &attribs); |
|
&attribs); |
|
334 |
|
|
335 |
XStoreName(display, wnd, title); |
XStoreName(display, wnd, title); |
336 |
|
|
354 |
|
|
355 |
xkeymap_init2(); |
xkeymap_init2(); |
356 |
|
|
357 |
input_mask = |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; |
|
KeyPressMask | KeyReleaseMask | ButtonPressMask | |
|
|
ButtonReleaseMask; |
|
358 |
if (grab_keyboard) |
if (grab_keyboard) |
359 |
input_mask |= EnterWindowMask | LeaveWindowMask; |
input_mask |= EnterWindowMask | LeaveWindowMask; |
360 |
if (sendmotion) |
if (sendmotion) |
434 |
{ |
{ |
435 |
XmbLookupString(IC, |
XmbLookupString(IC, |
436 |
(XKeyPressedEvent *) & |
(XKeyPressedEvent *) & |
437 |
xevent, str, |
xevent, str, sizeof(str), &keysym, &status); |
438 |
sizeof(str), &keysym, |
if (!((status == XLookupKeySym) || (status == XLookupBoth))) |
|
&status); |
|
|
if (! |
|
|
((status == XLookupKeySym) |
|
|
|| (status == XLookupBoth))) |
|
439 |
{ |
{ |
440 |
error("XmbLookupString failed with status 0x%x\n", status); |
error("XmbLookupString failed with status 0x%x\n", |
441 |
|
status); |
442 |
break; |
break; |
443 |
} |
} |
444 |
} |
} |
445 |
else |
else |
446 |
{ |
{ |
447 |
/* Plain old XLookupString */ |
/* Plain old XLookupString */ |
448 |
DEBUG_KBD |
DEBUG_KBD("No input context, using XLookupString\n"); |
|
("No input context, using XLookupString\n"); |
|
449 |
XLookupString((XKeyEvent *) & xevent, |
XLookupString((XKeyEvent *) & xevent, |
450 |
str, sizeof(str), |
str, sizeof(str), &keysym, NULL); |
|
&keysym, NULL); |
|
451 |
} |
} |
452 |
|
|
453 |
ksname = get_ksname(keysym); |
ksname = get_ksname(keysym); |
454 |
DEBUG_KBD |
DEBUG_KBD("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname); |
|
("\nKeyPress for (keysym 0x%lx, %s)\n", |
|
|
keysym, ksname); |
|
455 |
|
|
456 |
if (inhibit_key(keysym)) |
if (inhibit_key(keysym)) |
457 |
{ |
{ |
460 |
} |
} |
461 |
|
|
462 |
tr = xkeymap_translate_key(keysym, |
tr = xkeymap_translate_key(keysym, |
463 |
xevent.xkey. |
xevent.xkey.keycode, xevent.xkey.state); |
|
keycode, |
|
|
xevent.xkey.state); |
|
464 |
|
|
465 |
ensure_remote_modifiers(ev_time, tr); |
ensure_remote_modifiers(ev_time, tr); |
466 |
|
|
467 |
if (tr.scancode == 0) |
if (tr.scancode == 0) |
468 |
break; |
break; |
469 |
|
|
470 |
rdp_send_scancode(ev_time, RDP_KEYPRESS, |
rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode); |
|
tr.scancode); |
|
471 |
break; |
break; |
472 |
case KeyRelease: |
case KeyRelease: |
473 |
XLookupString((XKeyEvent *) & xevent, str, |
XLookupString((XKeyEvent *) & xevent, str, |
474 |
sizeof(str), &keysym, NULL); |
sizeof(str), &keysym, NULL); |
475 |
|
|
476 |
ksname = get_ksname(keysym); |
ksname = get_ksname(keysym); |
477 |
DEBUG_KBD |
DEBUG_KBD("\nKeyRelease for (keysym 0x%lx, %s)\n", keysym, ksname); |
|
("\nKeyRelease for (keysym 0x%lx, %s)\n", |
|
|
keysym, ksname); |
|
478 |
|
|
479 |
if (inhibit_key(keysym)) |
if (inhibit_key(keysym)) |
480 |
break; |
break; |
481 |
|
|
482 |
tr = xkeymap_translate_key(keysym, |
tr = xkeymap_translate_key(keysym, |
483 |
xevent.xkey. |
xevent.xkey.keycode, xevent.xkey.state); |
|
keycode, |
|
|
xevent.xkey.state); |
|
484 |
|
|
485 |
if (tr.scancode == 0) |
if (tr.scancode == 0) |
486 |
break; |
break; |
487 |
|
|
488 |
rdp_send_scancode(ev_time, RDP_KEYRELEASE, |
rdp_send_scancode(ev_time, RDP_KEYRELEASE, tr.scancode); |
|
tr.scancode); |
|
489 |
break; |
break; |
490 |
|
|
491 |
case ButtonPress: |
case ButtonPress: |
493 |
/* fall through */ |
/* fall through */ |
494 |
|
|
495 |
case ButtonRelease: |
case ButtonRelease: |
496 |
button = xkeymap_translate_button(xevent. |
button = xkeymap_translate_button(xevent.xbutton.button); |
|
xbutton. |
|
|
button); |
|
497 |
if (button == 0) |
if (button == 0) |
498 |
break; |
break; |
499 |
|
|
500 |
rdp_send_input(ev_time, RDP_INPUT_MOUSE, |
rdp_send_input(ev_time, RDP_INPUT_MOUSE, |
501 |
flags | button, |
flags | button, xevent.xbutton.x, xevent.xbutton.y); |
|
xevent.xbutton.x, |
|
|
xevent.xbutton.y); |
|
502 |
break; |
break; |
503 |
|
|
504 |
case MotionNotify: |
case MotionNotify: |
505 |
rdp_send_input(ev_time, RDP_INPUT_MOUSE, |
rdp_send_input(ev_time, RDP_INPUT_MOUSE, |
506 |
MOUSE_FLAG_MOVE, |
MOUSE_FLAG_MOVE, xevent.xmotion.x, xevent.xmotion.y); |
|
xevent.xmotion.x, |
|
|
xevent.xmotion.y); |
|
507 |
break; |
break; |
508 |
|
|
509 |
case FocusIn: |
case FocusIn: |
511 |
case EnterNotify: |
case EnterNotify: |
512 |
if (grab_keyboard) |
if (grab_keyboard) |
513 |
XGrabKeyboard(display, wnd, True, |
XGrabKeyboard(display, wnd, True, |
514 |
GrabModeAsync, |
GrabModeAsync, GrabModeAsync, CurrentTime); |
|
GrabModeAsync, |
|
|
CurrentTime); |
|
515 |
break; |
break; |
516 |
|
|
517 |
case FocusOut: |
case FocusOut: |
518 |
/* reset keys */ |
/* reset keys */ |
519 |
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, |
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, |
520 |
KBD_FLAG_DOWN | KBD_FLAG_UP, |
KBD_FLAG_DOWN | KBD_FLAG_UP, SCANCODE_CHAR_LCTRL, 0); |
|
SCANCODE_CHAR_LCTRL, 0); |
|
521 |
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, |
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, |
522 |
KBD_FLAG_DOWN | KBD_FLAG_UP, |
KBD_FLAG_DOWN | KBD_FLAG_UP, SCANCODE_CHAR_LALT, 0); |
|
SCANCODE_CHAR_LALT, 0); |
|
523 |
/* fall through */ |
/* fall through */ |
524 |
case LeaveNotify: |
case LeaveNotify: |
525 |
if (grab_keyboard) |
if (grab_keyboard) |
599 |
} |
} |
600 |
|
|
601 |
void |
void |
602 |
ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, |
ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data) |
|
uint8 * data) |
|
603 |
{ |
{ |
604 |
XImage *image; |
XImage *image; |
605 |
uint8 *tdata; |
uint8 *tdata; |
883 |
SET_BACKGROUND(fgcolour); |
SET_BACKGROUND(fgcolour); |
884 |
XSetFillStyle(display, gc, FillOpaqueStippled); |
XSetFillStyle(display, gc, FillOpaqueStippled); |
885 |
XSetStipple(display, gc, fill); |
XSetStipple(display, gc, fill); |
886 |
XSetTSOrigin(display, gc, brush->xorigin, |
XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin); |
|
brush->yorigin); |
|
887 |
|
|
888 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE(x, y, cx, cy); |
889 |
|
|
907 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
908 |
XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y); |
XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y); |
909 |
if (ownbackstore) |
if (ownbackstore) |
910 |
XCopyArea(display, backstore, backstore, gc, srcx, srcy, cx, |
XCopyArea(display, backstore, backstore, gc, srcx, srcy, cx, cy, x, y); |
|
cy, x, y); |
|
911 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
912 |
} |
} |
913 |
|
|
919 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
920 |
XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y); |
XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y); |
921 |
if (ownbackstore) |
if (ownbackstore) |
922 |
XCopyArea(display, (Pixmap) src, backstore, gc, srcx, srcy, |
XCopyArea(display, (Pixmap) src, backstore, gc, srcx, srcy, cx, cy, x, y); |
|
cx, cy, x, y); |
|
923 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
924 |
} |
} |
925 |
|
|
936 |
{ |
{ |
937 |
case 0x69: /* PDSxxn */ |
case 0x69: /* PDSxxn */ |
938 |
ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy); |
ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy); |
939 |
ui_patblt(ROP2_NXOR, x, y, cx, cy, brush, bgcolour, |
ui_patblt(ROP2_NXOR, x, y, cx, cy, brush, bgcolour, fgcolour); |
|
fgcolour); |
|
940 |
break; |
break; |
941 |
|
|
942 |
case 0xb8: /* PSDPxax */ |
case 0xb8: /* PSDPxax */ |
943 |
ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, |
ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour); |
|
fgcolour); |
|
944 |
ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy); |
ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy); |
945 |
ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, |
ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour); |
|
fgcolour); |
|
946 |
break; |
break; |
947 |
|
|
948 |
case 0xc0: /* PSa */ |
case 0xc0: /* PSa */ |
949 |
ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy); |
ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy); |
950 |
ui_patblt(ROP2_AND, x, y, cx, cy, brush, bgcolour, |
ui_patblt(ROP2_AND, x, y, cx, cy, brush, bgcolour, fgcolour); |
|
fgcolour); |
|
951 |
break; |
break; |
952 |
|
|
953 |
default: |
default: |
988 |
SET_BACKGROUND(bgcolour); |
SET_BACKGROUND(bgcolour); |
989 |
|
|
990 |
XSetFillStyle(display, gc, |
XSetFillStyle(display, gc, |
991 |
(mixmode == |
(mixmode == MIX_TRANSPARENT) ? FillStippled : FillOpaqueStippled); |
|
MIX_TRANSPARENT) ? FillStippled : FillOpaqueStippled); |
|
992 |
XSetStipple(display, gc, (Pixmap) glyph); |
XSetStipple(display, gc, (Pixmap) glyph); |
993 |
XSetTSOrigin(display, gc, x, y); |
XSetTSOrigin(display, gc, x, y); |
994 |
|
|
1058 |
{ |
{ |
1059 |
case 0xff: |
case 0xff: |
1060 |
if (i + 2 < length) |
if (i + 2 < length) |
1061 |
cache_put_text(text[i + 1], text, |
cache_put_text(text[i + 1], text, text[i + 2]); |
|
text[i + 2]); |
|
1062 |
else |
else |
1063 |
{ |
{ |
1064 |
error("this shouldn't be happening\n"); |
error("this shouldn't be happening\n"); |
1075 |
if (entry != NULL) |
if (entry != NULL) |
1076 |
{ |
{ |
1077 |
if ((((uint8 *) (entry->data))[1] == |
if ((((uint8 *) (entry->data))[1] == |
1078 |
0) |
0) && (!(flags & TEXT2_IMPLICIT_X))) |
|
&& (!(flags & TEXT2_IMPLICIT_X))) |
|
1079 |
{ |
{ |
1080 |
if (flags & TEXT2_VERTICAL) |
if (flags & TEXT2_VERTICAL) |
1081 |
y += text[i + 2]; |
y += text[i + 2]; |
1091 |
text = &(text[i]); |
text = &(text[i]); |
1092 |
i = 0; |
i = 0; |
1093 |
for (j = 0; j < entry->size; j++) |
for (j = 0; j < entry->size; j++) |
1094 |
DO_GLYPH(((uint8 *) (entry-> |
DO_GLYPH(((uint8 *) (entry->data)), j); |
|
data)), |
|
|
j); |
|
1095 |
} |
} |
1096 |
break; |
break; |
1097 |
|
|
1113 |
|
|
1114 |
if (ownbackstore) |
if (ownbackstore) |
1115 |
{ |
{ |
1116 |
image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes, |
image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes, ZPixmap); |
|
ZPixmap); |
|
1117 |
} |
} |
1118 |
else |
else |
1119 |
{ |
{ |
1120 |
pix = XCreatePixmap(display, wnd, cx, cy, depth); |
pix = XCreatePixmap(display, wnd, cx, cy, depth); |
1121 |
XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0); |
XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0); |
1122 |
image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, |
image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap); |
|
ZPixmap); |
|
1123 |
XFreePixmap(display, pix); |
XFreePixmap(display, pix); |
1124 |
} |
} |
1125 |
|
|
1126 |
offset *= bpp / 8; |
offset *= bpp / 8; |
1127 |
cache_put_desktop(offset, cx, cy, image->bytes_per_line, bpp / 8, |
cache_put_desktop(offset, cx, cy, image->bytes_per_line, bpp / 8, (uint8 *) image->data); |
|
(uint8 *) image->data); |
|
1128 |
|
|
1129 |
XDestroyImage(image); |
XDestroyImage(image); |
1130 |
} |
} |
1141 |
return; |
return; |
1142 |
|
|
1143 |
image = XCreateImage(display, visual, depth, ZPixmap, 0, |
image = XCreateImage(display, visual, depth, ZPixmap, 0, |
1144 |
(char *) data, cx, cy, BitmapPad(display), |
(char *) data, cx, cy, BitmapPad(display), cx * bpp / 8); |
|
cx * bpp / 8); |
|
1145 |
|
|
1146 |
if (ownbackstore) |
if (ownbackstore) |
1147 |
{ |
{ |