32 |
extern BOOL sendmotion; |
extern BOOL sendmotion; |
33 |
extern BOOL fullscreen; |
extern BOOL fullscreen; |
34 |
extern BOOL grab_keyboard; |
extern BOOL grab_keyboard; |
35 |
|
extern char title[]; |
36 |
|
|
37 |
Display *display = NULL; |
Display *display; |
38 |
static int x_socket; |
static int x_socket; |
39 |
|
static Screen *screen; |
40 |
static Window wnd; |
static Window wnd; |
41 |
static GC gc; |
static GC gc; |
42 |
static Visual *visual; |
static Visual *visual; |
43 |
static int depth; |
static int depth; |
44 |
static int bpp; |
static int bpp; |
45 |
|
static int dpy_width; |
46 |
|
static int dpy_height; |
47 |
|
|
48 |
/* endianness */ |
/* endianness */ |
49 |
static BOOL host_be; |
static BOOL host_be; |
63 |
/* colour maps */ |
/* colour maps */ |
64 |
static BOOL owncolmap; |
static BOOL owncolmap; |
65 |
static Colormap xcolmap; |
static Colormap xcolmap; |
|
static uint32 white; |
|
66 |
static uint32 *colmap; |
static uint32 *colmap; |
|
static XIM IM = NULL; |
|
|
static XIC IC = NULL; |
|
67 |
|
|
68 |
/* Compose support */ |
/* Compose support */ |
69 |
BOOL enable_compose = False; |
BOOL enable_compose = False; |
70 |
|
static XIM IM = NULL; |
71 |
|
static XIC IC = NULL; |
72 |
|
|
73 |
|
/* toggle fullscreen globals */ |
74 |
|
static unsigned long input_mask; |
75 |
|
|
76 |
#define TRANSLATE(col) ( owncolmap ? col : translate_colour(colmap[col]) ) |
#define TRANSLATE(col) ( owncolmap ? col : translate_colour(colmap[col]) ) |
77 |
#define SET_FOREGROUND(col) XSetForeground(display, gc, TRANSLATE(col)); |
#define SET_FOREGROUND(col) XSetForeground(display, gc, TRANSLATE(col)); |
223 |
It seems to work alright anyway, though. */ |
It seems to work alright anyway, though. */ |
224 |
if (IC != NULL) |
if (IC != NULL) |
225 |
{ |
{ |
226 |
if (XGetICValues(IC, XNFilterEvents, &filtered_events, NULL) |
if (XGetICValues(IC, XNFilterEvents, &filtered_events, NULL) != NULL) |
|
!= NULL) |
|
227 |
{ |
{ |
228 |
error("Failed to obtain XNFilterEvents value from IC\n"); |
error("Failed to obtain XNFilterEvents value from IC\n"); |
229 |
filtered_events = 0; |
filtered_events = 0; |
246 |
} |
} |
247 |
} |
} |
248 |
|
|
249 |
|
BOOL |
250 |
|
get_key_state(int keysym) |
251 |
|
{ |
252 |
|
int keysymMask = 0, modifierpos, key; |
253 |
|
Window wDummy1, wDummy2; |
254 |
|
int iDummy3, iDummy4, iDummy5, iDummy6; |
255 |
|
unsigned int current_state; |
256 |
|
int offset; |
257 |
|
|
258 |
|
XModifierKeymap *map = XGetModifierMapping(display); |
259 |
|
KeyCode keycode = XKeysymToKeycode(display, keysym); |
260 |
|
|
261 |
|
if (keycode == NoSymbol) |
262 |
|
return False; |
263 |
|
|
264 |
|
for (modifierpos = 0; modifierpos < 8; modifierpos++) |
265 |
|
{ |
266 |
|
offset = map->max_keypermod * modifierpos; |
267 |
|
|
268 |
|
for (key = 0; key < map->max_keypermod; key++) |
269 |
|
{ |
270 |
|
if (map->modifiermap[offset + key] == keycode) |
271 |
|
keysymMask = 1 << modifierpos; |
272 |
|
} |
273 |
|
} |
274 |
|
|
275 |
|
XQueryPointer(display, DefaultRootWindow(display), &wDummy1, |
276 |
|
&wDummy2, &iDummy3, &iDummy4, &iDummy5, &iDummy6, ¤t_state); |
277 |
|
|
278 |
|
XFreeModifiermap(map); |
279 |
|
|
280 |
|
return (current_state & keysymMask) ? True : False; |
281 |
|
} |
282 |
|
|
283 |
|
|
284 |
BOOL |
BOOL |
285 |
ui_create_window(char *title) |
ui_init() |
286 |
{ |
{ |
|
XSetWindowAttributes attribs; |
|
|
XClassHint *classhints; |
|
|
XSizeHints *sizehints; |
|
|
unsigned long input_mask; |
|
287 |
XPixmapFormatValues *pfm; |
XPixmapFormatValues *pfm; |
|
Screen *screen; |
|
288 |
uint16 test; |
uint16 test; |
289 |
int i; |
int i; |
290 |
|
|
291 |
display = XOpenDisplay(NULL); |
display = XOpenDisplay(NULL); |
|
|
|
292 |
if (display == NULL) |
if (display == NULL) |
293 |
{ |
{ |
294 |
error("Failed to open display\n"); |
error("Failed to open display\n"); |
307 |
desirable, e.g. 24 bits->32 bits. */ |
desirable, e.g. 24 bits->32 bits. */ |
308 |
while (i--) |
while (i--) |
309 |
{ |
{ |
310 |
if ((pfm[i].depth == depth) |
if ((pfm[i].depth == depth) && (pfm[i].bits_per_pixel > bpp)) |
|
&& (pfm[i].bits_per_pixel > bpp)) |
|
311 |
{ |
{ |
312 |
bpp = pfm[i].bits_per_pixel; |
bpp = pfm[i].bits_per_pixel; |
313 |
} |
} |
327 |
else |
else |
328 |
xcolmap = DefaultColormapOfScreen(screen); |
xcolmap = DefaultColormapOfScreen(screen); |
329 |
|
|
330 |
|
if (DoesBackingStore(screen) == NotUseful) |
331 |
|
ownbackstore = True; |
332 |
|
|
333 |
test = 1; |
test = 1; |
334 |
host_be = !(BOOL) (*(uint8 *) (&test)); |
host_be = !(BOOL) (*(uint8 *) (&test)); |
335 |
xserver_be = (ImageByteOrder(display) == MSBFirst); |
xserver_be = (ImageByteOrder(display) == MSBFirst); |
336 |
|
|
|
white = WhitePixelOfScreen(screen); |
|
|
attribs.background_pixel = BlackPixelOfScreen(screen); |
|
|
attribs.backing_store = DoesBackingStore(screen); |
|
|
|
|
|
if (attribs.backing_store == NotUseful) |
|
|
ownbackstore = True; |
|
|
|
|
337 |
if (fullscreen) |
if (fullscreen) |
338 |
{ |
{ |
|
attribs.override_redirect = True; |
|
339 |
width = WidthOfScreen(screen); |
width = WidthOfScreen(screen); |
340 |
height = HeightOfScreen(screen); |
height = HeightOfScreen(screen); |
341 |
} |
} |
|
else |
|
|
{ |
|
|
attribs.override_redirect = False; |
|
|
} |
|
342 |
|
|
343 |
width = (width + 3) & ~3; /* make width a multiple of 32 bits */ |
xkeymap_init(); |
344 |
|
return True; |
345 |
|
} |
346 |
|
|
347 |
wnd = XCreateWindow(display, RootWindowOfScreen(screen), |
BOOL |
348 |
0, 0, width, height, 0, CopyFromParent, |
ui_create_window() |
349 |
InputOutput, CopyFromParent, |
{ |
350 |
CWBackingStore | CWBackPixel | CWOverrideRedirect, |
XSetWindowAttributes attribs; |
351 |
&attribs); |
XClassHint *classhints; |
352 |
|
XSizeHints *sizehints; |
353 |
|
XEvent xevent; |
354 |
|
|
355 |
|
attribs.background_pixel = BlackPixelOfScreen(screen); |
356 |
|
attribs.backing_store = ownbackstore ? NotUseful : Always; |
357 |
|
attribs.override_redirect = fullscreen; |
358 |
|
wnd = XCreateWindow(display, RootWindowOfScreen(screen), 0, 0, width, height, |
359 |
|
0, CopyFromParent, InputOutput, CopyFromParent, |
360 |
|
CWBackPixel | CWBackingStore | CWOverrideRedirect, &attribs); |
361 |
|
|
362 |
XStoreName(display, wnd, title); |
XStoreName(display, wnd, title); |
363 |
|
|
379 |
XFree(sizehints); |
XFree(sizehints); |
380 |
} |
} |
381 |
|
|
382 |
xkeymap_init2(); |
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |
383 |
|
VisibilityChangeMask | FocusChangeMask; |
384 |
|
|
|
input_mask = |
|
|
KeyPressMask | KeyReleaseMask | ButtonPressMask | |
|
|
ButtonReleaseMask; |
|
385 |
if (grab_keyboard) |
if (grab_keyboard) |
386 |
input_mask |= EnterWindowMask | LeaveWindowMask; |
input_mask |= EnterWindowMask | LeaveWindowMask; |
387 |
if (sendmotion) |
if (sendmotion) |
388 |
input_mask |= PointerMotionMask; |
input_mask |= PointerMotionMask; |
|
|
|
389 |
if (ownbackstore) |
if (ownbackstore) |
390 |
input_mask |= ExposureMask; |
input_mask |= ExposureMask; |
|
|
|
391 |
if (enable_compose) |
if (enable_compose) |
392 |
input_mask |= init_inputmethod(); |
input_mask |= init_inputmethod(); |
393 |
|
|
395 |
|
|
396 |
gc = XCreateGC(display, wnd, 0, NULL); |
gc = XCreateGC(display, wnd, 0, NULL); |
397 |
|
|
398 |
|
XMapWindow(display, wnd); |
399 |
|
|
400 |
|
/* Wait for VisibilityNotify Event */ |
401 |
|
for (;;) |
402 |
|
{ |
403 |
|
XNextEvent(display, &xevent); |
404 |
|
if (xevent.type == VisibilityNotify) |
405 |
|
break; |
406 |
|
} |
407 |
|
|
408 |
if (ownbackstore) |
if (ownbackstore) |
409 |
backstore = XCreatePixmap(display, wnd, width, height, depth); |
backstore = XCreatePixmap(display, wnd, width, height, depth); |
410 |
|
|
411 |
XMapWindow(display, wnd); |
/* clear the window so that cached data is not viewed upon start... */ |
412 |
|
XSetBackground(display, gc, 0); |
413 |
|
XSetForeground(display, gc, 0); |
414 |
|
FILL_RECTANGLE(0, 0, width, height); |
415 |
|
/* make sure the window is focused */ |
416 |
|
XSetInputFocus(display, wnd, RevertToPointerRoot, CurrentTime); |
417 |
|
|
418 |
return True; |
return True; |
419 |
} |
} |
433 |
display = NULL; |
display = NULL; |
434 |
} |
} |
435 |
|
|
436 |
|
void |
437 |
|
reset_keys() |
438 |
|
{ |
439 |
|
/* reset keys */ |
440 |
|
uint32 ev_time; |
441 |
|
ev_time = time(NULL); |
442 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LCTRL); |
443 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LALT); |
444 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LSHIFT); |
445 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RCTRL); |
446 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RALT); |
447 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RSHIFT); |
448 |
|
} |
449 |
|
|
450 |
|
void |
451 |
|
toggle_fullscreen() |
452 |
|
{ |
453 |
|
/* save window contents */ |
454 |
|
Pixmap pixmap; |
455 |
|
pixmap = XCreatePixmap(display, wnd, width, height, depth); |
456 |
|
if (ownbackstore) |
457 |
|
XCopyArea(display, backstore, pixmap, gc, 0, 0, width, height, 0, 0); |
458 |
|
else |
459 |
|
XCopyArea(display, wnd, pixmap, gc, 0, 0, width, height, 0, 0); |
460 |
|
fullscreen = fullscreen ? False : True; |
461 |
|
close_inputmethod(); |
462 |
|
if (ownbackstore) |
463 |
|
XFreePixmap(display, backstore); |
464 |
|
XFreeGC(display, gc); |
465 |
|
XDestroyWindow(display, wnd); |
466 |
|
ui_create_window(); |
467 |
|
ui_set_cursor(cache_get_cursor(0)); |
468 |
|
ui_move_pointer(width / 2, height / 2); |
469 |
|
reset_keys(); |
470 |
|
/* restore window contents */ |
471 |
|
if (ownbackstore) |
472 |
|
XCopyArea(display, pixmap, backstore, gc, 0, 0, width, height, 0, 0); |
473 |
|
XCopyArea(display, pixmap, wnd, gc, 0, 0, width, height, 0, 0); |
474 |
|
XFreePixmap(display, pixmap); |
475 |
|
} |
476 |
|
|
477 |
|
/* Process all events in Xlib queue */ |
478 |
static void |
static void |
479 |
xwin_process_events() |
xwin_process_events() |
480 |
{ |
{ |
488 |
char str[256]; |
char str[256]; |
489 |
Status status; |
Status status; |
490 |
|
|
|
/* Refresh keyboard mapping if it has changed. This is important for |
|
|
Xvnc, since it allocates keycodes dynamically */ |
|
|
if (XCheckTypedEvent(display, MappingNotify, &xevent)) |
|
|
{ |
|
|
if (xevent.xmapping.request == MappingKeyboard |
|
|
|| xevent.xmapping.request == MappingModifier) |
|
|
XRefreshKeyboardMapping(&xevent.xmapping); |
|
|
} |
|
|
|
|
491 |
while (XCheckMaskEvent(display, ~0, &xevent)) |
while (XCheckMaskEvent(display, ~0, &xevent)) |
492 |
{ |
{ |
493 |
if (enable_compose && (XFilterEvent(&xevent, None) == True)) |
if (enable_compose && (XFilterEvent(&xevent, None) == True)) |
494 |
{ |
{ |
495 |
DEBUG_KBD("Filtering event\n"); |
DEBUG_KBD(("Filtering event\n")); |
496 |
continue; |
continue; |
497 |
} |
} |
498 |
|
|
507 |
{ |
{ |
508 |
XmbLookupString(IC, |
XmbLookupString(IC, |
509 |
(XKeyPressedEvent *) & |
(XKeyPressedEvent *) & |
510 |
xevent, str, |
xevent, str, sizeof(str), &keysym, &status); |
511 |
sizeof(str), &keysym, |
if (!((status == XLookupKeySym) || (status == XLookupBoth))) |
|
&status); |
|
|
if (! |
|
|
((status == XLookupKeySym) |
|
|
|| (status == XLookupBoth))) |
|
512 |
{ |
{ |
513 |
error("XmbLookupString failed with status 0x%x\n", status); |
error("XmbLookupString failed with status 0x%x\n", |
514 |
|
status); |
515 |
break; |
break; |
516 |
} |
} |
517 |
} |
} |
518 |
else |
else |
519 |
{ |
{ |
520 |
/* Plain old XLookupString */ |
/* Plain old XLookupString */ |
521 |
DEBUG_KBD |
DEBUG_KBD(("No input context, using XLookupString\n")); |
|
("No input context, using XLookupString\n"); |
|
522 |
XLookupString((XKeyEvent *) & xevent, |
XLookupString((XKeyEvent *) & xevent, |
523 |
str, sizeof(str), |
str, sizeof(str), &keysym, NULL); |
|
&keysym, NULL); |
|
524 |
} |
} |
525 |
|
|
526 |
ksname = get_ksname(keysym); |
ksname = get_ksname(keysym); |
527 |
DEBUG_KBD |
DEBUG_KBD(("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname)); |
|
("\nKeyPress for (keysym 0x%lx, %s)\n", |
|
|
keysym, ksname); |
|
528 |
|
|
529 |
if (inhibit_key(keysym)) |
if (handle_special_keys(keysym, ev_time, True)) |
|
{ |
|
|
DEBUG_KBD("Inhibiting key\n"); |
|
530 |
break; |
break; |
|
} |
|
531 |
|
|
532 |
tr = xkeymap_translate_key(keysym, |
tr = xkeymap_translate_key(keysym, |
533 |
xevent.xkey. |
xevent.xkey.keycode, xevent.xkey.state); |
|
keycode, |
|
|
xevent.xkey.state); |
|
|
|
|
|
ensure_remote_modifiers(ev_time, tr); |
|
534 |
|
|
535 |
if (tr.scancode == 0) |
if (tr.scancode == 0) |
536 |
break; |
break; |
537 |
|
|
538 |
rdp_send_scancode(ev_time, RDP_KEYPRESS, |
ensure_remote_modifiers(ev_time, tr); |
539 |
tr.scancode); |
|
540 |
|
rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode); |
541 |
break; |
break; |
542 |
case KeyRelease: |
case KeyRelease: |
543 |
XLookupString((XKeyEvent *) & xevent, str, |
XLookupString((XKeyEvent *) & xevent, str, |
544 |
sizeof(str), &keysym, NULL); |
sizeof(str), &keysym, NULL); |
545 |
|
|
546 |
ksname = get_ksname(keysym); |
ksname = get_ksname(keysym); |
547 |
DEBUG_KBD |
DEBUG_KBD(("\nKeyRelease for (keysym 0x%lx, %s)\n", keysym, |
548 |
("\nKeyRelease for (keysym 0x%lx, %s)\n", |
ksname)); |
|
keysym, ksname); |
|
549 |
|
|
550 |
if (inhibit_key(keysym)) |
if (handle_special_keys(keysym, ev_time, False)) |
551 |
break; |
break; |
552 |
|
|
553 |
tr = xkeymap_translate_key(keysym, |
tr = xkeymap_translate_key(keysym, |
554 |
xevent.xkey. |
xevent.xkey.keycode, xevent.xkey.state); |
|
keycode, |
|
|
xevent.xkey.state); |
|
555 |
|
|
556 |
if (tr.scancode == 0) |
if (tr.scancode == 0) |
557 |
break; |
break; |
558 |
|
|
559 |
rdp_send_scancode(ev_time, RDP_KEYRELEASE, |
rdp_send_scancode(ev_time, RDP_KEYRELEASE, tr.scancode); |
|
tr.scancode); |
|
560 |
break; |
break; |
561 |
|
|
562 |
case ButtonPress: |
case ButtonPress: |
564 |
/* fall through */ |
/* fall through */ |
565 |
|
|
566 |
case ButtonRelease: |
case ButtonRelease: |
567 |
button = xkeymap_translate_button(xevent. |
button = xkeymap_translate_button(xevent.xbutton.button); |
|
xbutton. |
|
|
button); |
|
568 |
if (button == 0) |
if (button == 0) |
569 |
break; |
break; |
570 |
|
|
571 |
rdp_send_input(ev_time, RDP_INPUT_MOUSE, |
rdp_send_input(ev_time, RDP_INPUT_MOUSE, |
572 |
flags | button, |
flags | button, xevent.xbutton.x, xevent.xbutton.y); |
|
xevent.xbutton.x, |
|
|
xevent.xbutton.y); |
|
573 |
break; |
break; |
574 |
|
|
575 |
case MotionNotify: |
case MotionNotify: |
576 |
rdp_send_input(ev_time, RDP_INPUT_MOUSE, |
rdp_send_input(ev_time, RDP_INPUT_MOUSE, |
577 |
MOUSE_FLAG_MOVE, |
MOUSE_FLAG_MOVE, xevent.xmotion.x, xevent.xmotion.y); |
|
xevent.xmotion.x, |
|
|
xevent.xmotion.y); |
|
578 |
break; |
break; |
579 |
|
|
580 |
case FocusIn: |
case FocusIn: |
582 |
case EnterNotify: |
case EnterNotify: |
583 |
if (grab_keyboard) |
if (grab_keyboard) |
584 |
XGrabKeyboard(display, wnd, True, |
XGrabKeyboard(display, wnd, True, |
585 |
GrabModeAsync, |
GrabModeAsync, GrabModeAsync, CurrentTime); |
|
GrabModeAsync, |
|
|
CurrentTime); |
|
586 |
break; |
break; |
587 |
|
|
588 |
case FocusOut: |
case FocusOut: |
589 |
/* reset keys */ |
reset_keys(); |
|
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, |
|
|
KBD_FLAG_DOWN | KBD_FLAG_UP, |
|
|
SCANCODE_CHAR_LCTRL, 0); |
|
|
rdp_send_input(ev_time, RDP_INPUT_SCANCODE, |
|
|
KBD_FLAG_DOWN | KBD_FLAG_UP, |
|
|
SCANCODE_CHAR_LALT, 0); |
|
590 |
/* fall through */ |
/* fall through */ |
591 |
case LeaveNotify: |
case LeaveNotify: |
592 |
if (grab_keyboard) |
if (grab_keyboard) |
600 |
xevent.xexpose.height, |
xevent.xexpose.height, |
601 |
xevent.xexpose.x, xevent.xexpose.y); |
xevent.xexpose.x, xevent.xexpose.y); |
602 |
break; |
break; |
603 |
|
|
604 |
|
case MappingNotify: |
605 |
|
/* Refresh keyboard mapping if it has changed. This is important for |
606 |
|
Xvnc, since it allocates keycodes dynamically */ |
607 |
|
if (xevent.xmapping.request == MappingKeyboard |
608 |
|
|| xevent.xmapping.request == MappingModifier) |
609 |
|
XRefreshKeyboardMapping(&xevent.xmapping); |
610 |
|
break; |
611 |
|
|
612 |
} |
} |
613 |
} |
} |
614 |
} |
} |
623 |
|
|
624 |
while (True) |
while (True) |
625 |
{ |
{ |
626 |
|
/* Process any events already waiting */ |
627 |
|
XFlush(display); |
628 |
|
xwin_process_events(); |
629 |
|
|
630 |
FD_ZERO(&rfds); |
FD_ZERO(&rfds); |
631 |
FD_SET(rdp_socket, &rfds); |
FD_SET(rdp_socket, &rfds); |
632 |
if (display != NULL) |
FD_SET(x_socket, &rfds); |
|
{ |
|
|
FD_SET(x_socket, &rfds); |
|
|
XFlush(display); |
|
|
} |
|
633 |
|
|
634 |
switch (select(n, &rfds, NULL, NULL, NULL)) |
switch (select(n, &rfds, NULL, NULL, NULL)) |
635 |
{ |
{ |
640 |
continue; |
continue; |
641 |
} |
} |
642 |
|
|
|
if (FD_ISSET(x_socket, &rfds)) |
|
|
xwin_process_events(); |
|
|
|
|
643 |
if (FD_ISSET(rdp_socket, &rfds)) |
if (FD_ISSET(rdp_socket, &rfds)) |
644 |
return; |
return; |
645 |
} |
} |
672 |
} |
} |
673 |
|
|
674 |
void |
void |
675 |
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) |
|
676 |
{ |
{ |
677 |
XImage *image; |
XImage *image; |
678 |
uint8 *tdata; |
uint8 *tdata; |
863 |
if (XAllocColor(display, xcolmap, &xentry) != 0) |
if (XAllocColor(display, xcolmap, &xentry) != 0) |
864 |
colour = xentry.pixel; |
colour = xentry.pixel; |
865 |
else |
else |
866 |
colour = white; |
colour = WhitePixelOfScreen(screen); |
867 |
|
|
868 |
/* byte swap here to make translate_image faster */ |
/* byte swap here to make translate_image faster */ |
869 |
map[i] = translate_colour(colour); |
map[i] = translate_colour(colour); |
956 |
SET_BACKGROUND(fgcolour); |
SET_BACKGROUND(fgcolour); |
957 |
XSetFillStyle(display, gc, FillOpaqueStippled); |
XSetFillStyle(display, gc, FillOpaqueStippled); |
958 |
XSetStipple(display, gc, fill); |
XSetStipple(display, gc, fill); |
959 |
XSetTSOrigin(display, gc, brush->xorigin, |
XSetTSOrigin(display, gc, brush->xorigin, brush->yorigin); |
|
brush->yorigin); |
|
960 |
|
|
961 |
FILL_RECTANGLE(x, y, cx, cy); |
FILL_RECTANGLE(x, y, cx, cy); |
962 |
|
|
980 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
981 |
XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y); |
XCopyArea(display, wnd, wnd, gc, srcx, srcy, cx, cy, x, y); |
982 |
if (ownbackstore) |
if (ownbackstore) |
983 |
XCopyArea(display, backstore, backstore, gc, srcx, srcy, cx, |
XCopyArea(display, backstore, backstore, gc, srcx, srcy, cx, cy, x, y); |
|
cy, x, y); |
|
984 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
985 |
} |
} |
986 |
|
|
992 |
SET_FUNCTION(opcode); |
SET_FUNCTION(opcode); |
993 |
XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y); |
XCopyArea(display, (Pixmap) src, wnd, gc, srcx, srcy, cx, cy, x, y); |
994 |
if (ownbackstore) |
if (ownbackstore) |
995 |
XCopyArea(display, (Pixmap) src, backstore, gc, srcx, srcy, |
XCopyArea(display, (Pixmap) src, backstore, gc, srcx, srcy, cx, cy, x, y); |
|
cx, cy, x, y); |
|
996 |
RESET_FUNCTION(opcode); |
RESET_FUNCTION(opcode); |
997 |
} |
} |
998 |
|
|
1009 |
{ |
{ |
1010 |
case 0x69: /* PDSxxn */ |
case 0x69: /* PDSxxn */ |
1011 |
ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy); |
ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy); |
1012 |
ui_patblt(ROP2_NXOR, x, y, cx, cy, brush, bgcolour, |
ui_patblt(ROP2_NXOR, x, y, cx, cy, brush, bgcolour, fgcolour); |
|
fgcolour); |
|
1013 |
break; |
break; |
1014 |
|
|
1015 |
case 0xb8: /* PSDPxax */ |
case 0xb8: /* PSDPxax */ |
1016 |
ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, |
ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour); |
|
fgcolour); |
|
1017 |
ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy); |
ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy); |
1018 |
ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, |
ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour); |
|
fgcolour); |
|
1019 |
break; |
break; |
1020 |
|
|
1021 |
case 0xc0: /* PSa */ |
case 0xc0: /* PSa */ |
1022 |
ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy); |
ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy); |
1023 |
ui_patblt(ROP2_AND, x, y, cx, cy, brush, bgcolour, |
ui_patblt(ROP2_AND, x, y, cx, cy, brush, bgcolour, fgcolour); |
|
fgcolour); |
|
1024 |
break; |
break; |
1025 |
|
|
1026 |
default: |
default: |
1061 |
SET_BACKGROUND(bgcolour); |
SET_BACKGROUND(bgcolour); |
1062 |
|
|
1063 |
XSetFillStyle(display, gc, |
XSetFillStyle(display, gc, |
1064 |
(mixmode == |
(mixmode == MIX_TRANSPARENT) ? FillStippled : FillOpaqueStippled); |
|
MIX_TRANSPARENT) ? FillStippled : FillOpaqueStippled); |
|
1065 |
XSetStipple(display, gc, (Pixmap) glyph); |
XSetStipple(display, gc, (Pixmap) glyph); |
1066 |
XSetTSOrigin(display, gc, x, y); |
XSetTSOrigin(display, gc, x, y); |
1067 |
|
|
1131 |
{ |
{ |
1132 |
case 0xff: |
case 0xff: |
1133 |
if (i + 2 < length) |
if (i + 2 < length) |
1134 |
cache_put_text(text[i + 1], text, |
cache_put_text(text[i + 1], text, text[i + 2]); |
|
text[i + 2]); |
|
1135 |
else |
else |
1136 |
{ |
{ |
1137 |
error("this shouldn't be happening\n"); |
error("this shouldn't be happening\n"); |
1148 |
if (entry != NULL) |
if (entry != NULL) |
1149 |
{ |
{ |
1150 |
if ((((uint8 *) (entry->data))[1] == |
if ((((uint8 *) (entry->data))[1] == |
1151 |
0) |
0) && (!(flags & TEXT2_IMPLICIT_X))) |
|
&& (!(flags & TEXT2_IMPLICIT_X))) |
|
1152 |
{ |
{ |
1153 |
if (flags & TEXT2_VERTICAL) |
if (flags & TEXT2_VERTICAL) |
1154 |
y += text[i + 2]; |
y += text[i + 2]; |
1164 |
text = &(text[i]); |
text = &(text[i]); |
1165 |
i = 0; |
i = 0; |
1166 |
for (j = 0; j < entry->size; j++) |
for (j = 0; j < entry->size; j++) |
1167 |
DO_GLYPH(((uint8 *) (entry-> |
DO_GLYPH(((uint8 *) (entry->data)), j); |
|
data)), |
|
|
j); |
|
1168 |
} |
} |
1169 |
break; |
break; |
1170 |
|
|
1186 |
|
|
1187 |
if (ownbackstore) |
if (ownbackstore) |
1188 |
{ |
{ |
1189 |
image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes, |
image = XGetImage(display, backstore, x, y, cx, cy, AllPlanes, ZPixmap); |
|
ZPixmap); |
|
1190 |
} |
} |
1191 |
else |
else |
1192 |
{ |
{ |
1193 |
pix = XCreatePixmap(display, wnd, cx, cy, depth); |
pix = XCreatePixmap(display, wnd, cx, cy, depth); |
1194 |
XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0); |
XCopyArea(display, wnd, pix, gc, x, y, cx, cy, 0, 0); |
1195 |
image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, |
image = XGetImage(display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap); |
|
ZPixmap); |
|
1196 |
XFreePixmap(display, pix); |
XFreePixmap(display, pix); |
1197 |
} |
} |
1198 |
|
|
1199 |
offset *= bpp / 8; |
offset *= bpp / 8; |
1200 |
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); |
|
1201 |
|
|
1202 |
XDestroyImage(image); |
XDestroyImage(image); |
1203 |
} |
} |
1214 |
return; |
return; |
1215 |
|
|
1216 |
image = XCreateImage(display, visual, depth, ZPixmap, 0, |
image = XCreateImage(display, visual, depth, ZPixmap, 0, |
1217 |
(char *) data, cx, cy, BitmapPad(display), |
(char *) data, cx, cy, BitmapPad(display), cx * bpp / 8); |
|
cx * bpp / 8); |
|
1218 |
|
|
1219 |
if (ownbackstore) |
if (ownbackstore) |
1220 |
{ |
{ |