32#define X_ConfigureWindow 12
35#define MWM_HINTS_DECORATIONS (1L << 1)
36#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
55#define ON_ALL_SEAMLESS_WINDOWS(func, args) \
57 seamless_window *sw; \
59 if (!This->xwin.seamless_windows) break; \
60 for (sw = This->xwin.seamless_windows; sw; sw = sw->next) { \
61 rect.x = This->xwin.clip_rectangle.x - sw->xoffset; \
62 rect.y = This->xwin.clip_rectangle.y - sw->yoffset; \
63 rect.width = This->xwin.clip_rectangle.width; \
64 rect.height = This->xwin.clip_rectangle.height; \
65 XSetClipRectangles(This->display, This->xwin.gc, 0, 0, &rect, 1, YXBanded); \
68 XSetClipRectangles(This->display, This->xwin.gc, 0, 0, &This->xwin.clip_rectangle, 1, YXBanded); \
76 XFillPolygon(
This->display,
d,
This->xwin.gc,
points, npoints, Complex, CoordModePrevious);
86 XDrawLines(
This->display,
d,
This->xwin.gc,
points, npoints, CoordModePrevious);
91#define FILL_RECTANGLE(x,y,cx,cy)\
93 XFillRectangle(This->display, This->wnd, This->xwin.gc, x, y, cx, cy); \
94 ON_ALL_SEAMLESS_WINDOWS(XFillRectangle, (This->display, sw->wnd, This->xwin.gc, x-sw->xoffset, y-sw->yoffset, cx, cy)); \
95 if (This->ownbackstore) \
96 XFillRectangle(This->display, This->xwin.backstore, This->xwin.gc, x, y, cx, cy); \
99#define FILL_RECTANGLE_BACKSTORE(x,y,cx,cy)\
101 XFillRectangle(This->display, This->ownbackstore ? This->xwin.backstore : This->wnd, This->xwin.gc, x, y, cx, cy); \
104#define FILL_POLYGON(p,np)\
106 XFillPolygon(This->display, This->wnd, This->xwin.gc, p, np, Complex, CoordModePrevious); \
107 if (This->ownbackstore) \
108 XFillPolygon(This->display, This->xwin.backstore, This->xwin.gc, p, np, Complex, CoordModePrevious); \
109 ON_ALL_SEAMLESS_WINDOWS(seamless_XFillPolygon, (This, sw->wnd, p, np, sw->xoffset, sw->yoffset)); \
112#define DRAW_ELLIPSE(x,y,cx,cy,m)\
117 XDrawArc(This->display, This->wnd, This->xwin.gc, x, y, cx, cy, 0, 360*64); \
118 ON_ALL_SEAMLESS_WINDOWS(XDrawArc, (This->display, sw->wnd, This->xwin.gc, x-sw->xoffset, y-sw->yoffset, cx, cy, 0, 360*64)); \
119 if (This->ownbackstore) \
120 XDrawArc(This->display, This->xwin.backstore, This->xwin.gc, x, y, cx, cy, 0, 360*64); \
123 XFillArc(This->display, This->wnd, This->xwin.gc, x, y, cx, cy, 0, 360*64); \
124 ON_ALL_SEAMLESS_WINDOWS(XCopyArea, (This->display, This->ownbackstore ? This->xwin.backstore : This->wnd, sw->wnd, This->xwin.gc, \
125 x, y, cx, cy, x-sw->xoffset, y-sw->yoffset)); \
126 if (This->ownbackstore) \
127 XFillArc(This->display, This->xwin.backstore, This->xwin.gc, x, y, cx, cy, 0, 360*64); \
132#define TRANSLATE(col) ( This->server_depth != 8 ? translate_colour(This, col) : This->owncolmap ? col : This->xwin.colmap[col] )
133#define SET_FOREGROUND(col) XSetForeground(This->display, This->xwin.gc, TRANSLATE(col));
134#define SET_BACKGROUND(col) XSetBackground(This->display, This->xwin.gc, TRANSLATE(col));
155#define SET_FUNCTION(rop2) { if (rop2 != ROP2_COPY) XSetFunction(This->display, This->xwin.gc, rop2_map[rop2]); }
156#define RESET_FUNCTION(rop2) { if (rop2 != ROP2_COPY) XSetFunction(This->display, This->xwin.gc, GXcopy); }
158static seamless_window *
162 for (sw =
This->xwin.seamless_windows; sw; sw = sw->next)
171static seamless_window *
175 for (sw =
This->xwin.seamless_windows; sw; sw = sw->next)
187 seamless_window *sw, **prevnext = &
This->xwin.seamless_windows;
188 for (sw =
This->xwin.seamless_windows; sw; sw = sw->next)
192 *prevnext = sw->next;
194 if (sw->group->refcnt == 0)
196 XDestroyWindow(
This->display, sw->group->wnd);
199 xfree(sw->position_timer);
203 prevnext = &sw->next;
214 for (sw =
This->xwin.seamless_windows; sw; sw = sw->next)
218 if (sw->desktop != desktop)
221 sw->desktop = desktop;
231 XWindowAttributes wa;
236 XGetWindowAttributes(
This->display, sw->wnd, &wa);
237 XTranslateCoordinates(
This->display, sw->wnd, wa.root,
238 -wa.border_width, -wa.border_width, &
x, &
y, &child_return);
242 sw->outstanding_position =
True;
243 sw->outpos_serial =
serial;
245 sw->outpos_xoffset =
x;
246 sw->outpos_yoffset =
y;
247 sw->outpos_width = wa.width;
248 sw->outpos_height = wa.height;
260 for (sw =
This->xwin.seamless_windows; sw; sw = sw->next)
274 seamless_window *sw_above;
277 for (sw_above =
This->xwin.seamless_windows; sw_above; sw_above = sw_above->next)
279 if (sw_above->behind == sw->id)
284 sw_above->behind = sw->behind;
287 for (sw_above =
This->xwin.seamless_windows; sw_above; sw_above = sw_above->next)
289 if (sw_above->behind == behind)
294 sw_above->behind = sw->id;
305 unsigned int nchildren,
i;
306 seamless_window *sw_below;
308 status = XQueryTree(
This->display, RootWindowOfScreen(
This->xwin.screen),
310 if (!
status || !nchildren)
316 while (children[
i] != sw->wnd)
323 for (
i++;
i < nchildren;
i++)
330 if (!sw_below && !sw->behind)
332 if (sw_below && (sw_below->id == sw->behind))
351static seamless_group *
358 for (sw =
This->xwin.seamless_windows; sw; sw = sw->next)
360 if (sw->group->id ==
id)
367 sg =
xmalloc(
sizeof(seamless_group));
370 XCreateWindow(
This->display, RootWindowOfScreen(
This->xwin.screen), -1, -1, 1, 1, 0,
371 CopyFromParent, CopyFromParent, CopyFromParent, 0, &
attribs);
391 hintsatom = XInternAtom(
This->display,
"_MOTIF_WM_HINTS",
False);
394 warning(
"Failed to get atom _MOTIF_WM_HINTS: probably your window manager does not support MWM hints\n");
398 XChangeProperty(
This->display, wnd, hintsatom, hintsatom, 32, PropModeReplace,
403#define SPLITCOLOUR15(colour, rv) \
405 rv.red = ((colour >> 7) & 0xf8) | ((colour >> 12) & 0x7); \
406 rv.green = ((colour >> 2) & 0xf8) | ((colour >> 8) & 0x7); \
407 rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7); \
410#define SPLITCOLOUR16(colour, rv) \
412 rv.red = ((colour >> 8) & 0xf8) | ((colour >> 13) & 0x7); \
413 rv.green = ((colour >> 3) & 0xfc) | ((colour >> 9) & 0x3); \
414 rv.blue = ((colour << 3) & 0xf8) | ((colour >> 2) & 0x7); \
417#define SPLITCOLOUR24(colour, rv) \
419 rv.blue = (colour & 0xff0000) >> 16; \
420 rv.green = (colour & 0x00ff00) >> 8; \
421 rv.red = (colour & 0x0000ff); \
424#define MAKECOLOUR(pc) \
425 ((pc.red >> This->xwin.red_shift_r) << This->xwin.red_shift_l) \
426 | ((pc.green >> This->xwin.green_shift_r) << This->xwin.green_shift_l) \
427 | ((pc.blue >> This->xwin.blue_shift_r) << This->xwin.blue_shift_l) \
429#define BSWAP16(x) { x = (((x & 0xff) << 8) | (x >> 8)); }
430#define BSWAP24(x) { x = (((x & 0xff) << 16) | (x >> 16) | (x & 0xff00)); }
431#define BSWAP32(x) { x = (((x & 0xff00ff) << 8) | ((x >> 8) & 0xff00ff)); \
432 x = (x << 16) | (x >> 16); }
437#define BOUT16(o, x) { *(o++) = x >> 8; *(o++) = x; }
438#define BOUT24(o, x) { *(o++) = x >> 16; *(o++) = x >> 8; *(o++) = x; }
439#define BOUT32(o, x) { *(o++) = x >> 24; *(o++) = x >> 16; *(o++) = x >> 8; *(o++) = x; }
440#define LOUT16(o, x) { *(o++) = x; *(o++) = x >> 8; }
441#define LOUT24(o, x) { *(o++) = x; *(o++) = x >> 8; *(o++) = x >> 16; }
442#define LOUT32(o, x) { *(o++) = x; *(o++) = x >> 8; *(o++) = x >> 16; *(o++) = x >> 24; }
448 switch (
This->server_depth)
477#define UNROLL8(stm) { stm stm stm stm stm stm stm stm }
479#define REPEAT2(stm) \
481 while (out <= end - 8 * 2) \
487#define REPEAT3(stm) \
489 while (out <= end - 8 * 3) \
495#define REPEAT4(stm) \
497 while (out <= end - 8 * 4) \
516 if (
This->xwin.compatible_arch)
526 else if (
This->xwin.xserver_be)
550 if (
This->xwin.compatible_arch)
573 if (
This->xwin.compatible_arch)
583 else if (
This->xwin.xserver_be)
608 if (
This->xwin.xserver_be)
613 if (
This->xwin.host_be)
627 if (
This->xwin.host_be)
645 if (
This->xwin.compatible_arch)
658 else if (
This->xwin.xserver_be)
663 if (
This->xwin.host_be)
677 if (
This->xwin.host_be)
695 if (
This->xwin.compatible_arch)
709 else if (
This->xwin.xserver_be)
714 if (
This->xwin.host_be)
728 if (
This->xwin.host_be)
746 if (
This->xwin.xserver_be)
748 if (
This->xwin.host_be)
772 if (
This->xwin.host_be)
803 if (
This->xwin.compatible_arch)
816 else if (
This->xwin.xserver_be)
818 if (
This->xwin.host_be)
842 if (
This->xwin.host_be)
873 if (
This->xwin.compatible_arch)
887 else if (
This->xwin.xserver_be)
889 if (
This->xwin.host_be)
913 if (
This->xwin.host_be)
946 pixel = *(
data++) << 16;
947 pixel |= *(
data++) << 8;
951 if (
This->xwin.xserver_be)
969 if (
This->xwin.xserver_be)
973 pixel = *(
data++) << 16;
974 pixel |= *(
data++) << 8;
985 pixel = *(
data++) << 16;
986 pixel |= *(
data++) << 8;
1002 if (
This->xwin.compatible_arch)
1024 else if (
This->xwin.xserver_be)
1028 pixel = *(
data++) << 16;
1029 pixel |= *(
data++) << 8;
1040 pixel = *(
data++) << 16;
1041 pixel |= *(
data++) << 8;
1065 if (
This->xwin.no_translate_image)
1067 if ((
This->xwin.depth == 15 &&
This->server_depth == 15) ||
1068 (
This->xwin.depth == 16 &&
This->server_depth == 16) ||
1069 (
This->xwin.depth == 24 &&
This->server_depth == 24))
1077 switch (
This->server_depth)
1080 switch (
This->xwin.bpp)
1094 switch (
This->xwin.bpp)
1108 switch (
This->xwin.bpp)
1122 switch (
This->xwin.bpp)
1145 int modifierpos,
key, keysymMask = 0;
1148 KeyCode keycode = XKeysymToKeycode(
This->display, keysym);
1153 for (modifierpos = 0; modifierpos < 8; modifierpos++)
1155 offset =
This->xwin.mod_map->max_keypermod * modifierpos;
1157 for (
key = 0;
key <
This->xwin.mod_map->max_keypermod;
key++)
1159 if (
This->xwin.mod_map->modifiermap[
offset +
key] == keycode)
1160 keysymMask |= 1 << modifierpos;
1193 XPixmapFormatValues *pfm;
1194 int pixmap_formats_count, visuals_count;
1195 XVisualInfo *vmatches =
NULL;
1196 XVisualInfo
template;
1198 unsigned red_weight, blue_weight, green_weight;
1200 red_weight = blue_weight = green_weight = 0;
1202 if (
This->server_depth == -1)
1204 This->server_depth = DisplayPlanes(
This->display, DefaultScreen(
This->display));
1207 pfm = XListPixmapFormats(
This->display, &pixmap_formats_count);
1210 error(
"Unable to get list of pixmap formats from display.\n");
1211 XCloseDisplay(
This->display);
1216 template.class = TrueColor;
1217 vmatches = XGetVisualInfo(
This->display, VisualClassMask, &
template, &visuals_count);
1221 if (vmatches !=
NULL)
1223 for (
i = 0;
i < visuals_count; ++
i)
1225 XVisualInfo *visual_info = &vmatches[
i];
1231 if (!
This->xwin.xserver_be && (((visual_info->depth == 15) &&
1233 (visual_info->red_mask == 0x7c00) &&
1234 (visual_info->green_mask == 0x3e0) &&
1235 (visual_info->blue_mask == 0x1f)) ||
1236 ((visual_info->depth == 16) &&
1238 (visual_info->red_mask == 0xf800) &&
1239 (visual_info->green_mask == 0x7e0) &&
1240 (visual_info->blue_mask == 0x1f)) ||
1241 ((visual_info->depth == 24) &&
1243 (visual_info->red_mask == 0xff0000) &&
1244 (visual_info->green_mask == 0xff00) &&
1245 (visual_info->blue_mask == 0xff))))
1247 This->xwin.visual = visual_info->visual;
1248 This->xwin.depth = visual_info->depth;
1249 This->xwin.compatible_arch = !
This->xwin.host_be;
1250 This->xwin.no_translate_image = (visual_info->depth ==
This->server_depth);
1251 if (
This->xwin.no_translate_image)
1260 if (visual_info->depth > 24)
1271 for (
j = 0;
j < pixmap_formats_count; ++
j)
1273 if (pfm[
j].
depth == visual_info->depth)
1275 if ((pfm[
j].bits_per_pixel == 16) ||
1276 (pfm[
j].bits_per_pixel == 24) ||
1277 (pfm[
j].bits_per_pixel == 32))
1279 can_translate_to_bpp =
True;
1288 if (can_translate_to_bpp)
1290 unsigned vis_red_weight =
1292 unsigned vis_green_weight =
1294 unsigned vis_blue_weight =
1296 if ((vis_red_weight >= red_weight)
1297 && (vis_green_weight >= green_weight)
1298 && (vis_blue_weight >= blue_weight))
1300 red_weight = vis_red_weight;
1301 green_weight = vis_green_weight;
1302 blue_weight = vis_blue_weight;
1303 This->xwin.visual = visual_info->visual;
1304 This->xwin.depth = visual_info->depth;
1320 template.class = PseudoColor;
1322 template.colormap_size = 256;
1324 XGetVisualInfo(
This->display,
1325 VisualClassMask | VisualDepthMask | VisualColormapSizeMask,
1326 &
template, &visuals_count);
1327 if (vmatches ==
NULL)
1329 error(
"No usable TrueColor or PseudoColor visuals on this display.\n");
1330 XCloseDisplay(
This->display);
1337 This->xwin.visual = vmatches[0].visual;
1338 This->xwin.depth = vmatches[0].depth;
1342 for (
i = 0;
i < pixmap_formats_count; ++
i)
1344 XPixmapFormatValues *pf = &pfm[
i];
1345 if (pf->depth ==
This->xwin.depth)
1347 This->xwin.bpp = pf->bits_per_pixel;
1349 if (
This->xwin.no_translate_image)
1351 switch (
This->server_depth)
1355 if (
This->xwin.bpp != 16)
1362 if (
This->xwin.bpp != 24)
1403 This->display = XOpenDisplay(
NULL);
1406 error(
"Failed to open display: %s\n", XDisplayName(
NULL));
1411 uint16 endianess_test = 1;
1412 This->xwin.host_be = !(
BOOL) (*(
uint8 *) (&endianess_test));
1417 screen_num = DefaultScreen(
This->display);
1418 This->xwin.x_socket = ConnectionNumber(
This->display);
1419 This->xwin.screen = ScreenOfDisplay(
This->display, screen_num);
1420 This->xwin.depth = DefaultDepthOfScreen(
This->xwin.screen);
1425 if (
This->xwin.no_translate_image)
1427 DEBUG((
"Performance optimization possible: avoiding image translation (colour depth conversion).\n"));
1430 if (
This->server_depth >
This->xwin.bpp)
1432 warning(
"Remote desktop colour depth %d higher than display colour depth %d.\n",
1433 This->server_depth,
This->xwin.bpp);
1436 DEBUG((
"RDP depth: %d, display depth: %d, display bpp: %d, X server BE: %d, host BE: %d\n",
1437 This->server_depth,
This->xwin.depth,
This->xwin.bpp,
This->xwin.xserver_be,
This->xwin.host_be));
1439 if (!
This->owncolmap)
1441 This->xwin.xcolmap =
1442 XCreateColormap(
This->display, RootWindowOfScreen(
This->xwin.screen),
This->xwin.visual,
1444 if (
This->xwin.depth <= 8)
1445 warning(
"Display colour depth is %d bit: you may want to use -C for a private colourmap.\n",
This->xwin.depth);
1448 if ((!
This->ownbackstore) && (DoesBackingStore(
This->xwin.screen) != Always))
1450 warning(
"External BackingStore not available. Using internal.\n");
1457 if (
This->fullscreen)
1459 This->width = WidthOfScreen(
This->xwin.screen);
1460 This->height = HeightOfScreen(
This->xwin.screen);
1461 This->xwin.using_full_workarea =
True;
1463 else if (
This->width < 0)
1466 if (-
This->width >= 100)
1467 This->xwin.using_full_workarea =
True;
1468 This->height = HeightOfScreen(
This->xwin.screen) * (-
This->width) / 100;
1469 This->width = WidthOfScreen(
This->xwin.screen) * (-
This->width) / 100;
1471 else if (
This->width == 0)
1479 This->xwin.using_full_workarea =
True;
1483 warning(
"Failed to get workarea: probably your window manager does not support extended hints\n");
1484 This->width = WidthOfScreen(
This->xwin.screen);
1485 This->height = HeightOfScreen(
This->xwin.screen);
1490 This->width = (
This->width + 3) & ~3;
1492 This->xwin.mod_map = XGetModifierMapping(
This->display);
1496 if (
This->enable_compose)
1501 if (
This->seamless_rdp)
1504 DEBUG_RDP5((
"server bpp %d client bpp %d depth %d\n",
This->server_depth,
This->xwin.bpp,
This->xwin.depth));
1512 while (
This->xwin.seamless_windows)
1514 XDestroyWindow(
This->display,
This->xwin.seamless_windows->wnd);
1521 XCloseIM(
This->xwin.IM);
1523 if (
This->xwin.null_cursor !=
NULL)
1526 XFreeModifiermap(
This->xwin.mod_map);
1528 if (
This->ownbackstore)
1529 XFreePixmap(
This->display,
This->xwin.backstore);
1531 XFreeGC(
This->display,
This->xwin.gc);
1532 XCloseDisplay(
This->display);
1540 attribs->background_pixel = BlackPixelOfScreen(
This->xwin.screen);
1541 attribs->background_pixel = WhitePixelOfScreen(
This->xwin.screen);
1542 attribs->border_pixel = WhitePixelOfScreen(
This->xwin.screen);
1543 attribs->backing_store =
This->ownbackstore ? NotUseful : Always;
1551 *input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
1552 VisibilityChangeMask | FocusChangeMask | StructureNotifyMask;
1554 if (
This->sendmotion)
1555 *input_mask |= PointerMotionMask;
1556 if (
This->ownbackstore)
1557 *input_mask |= ExposureMask;
1558 if (
This->fullscreen ||
This->grab_keyboard)
1559 *input_mask |= EnterWindowMask;
1560 if (
This->grab_keyboard)
1561 *input_mask |= LeaveWindowMask;
1567 uint8 null_pointer_mask[1] = { 0x80 };
1568 uint8 null_pointer_data[24] = { 0x00 };
1571 XClassHint *classhints;
1572 XSizeHints *sizehints;
1573 int wndwidth, wndheight;
1574 long input_mask, ic_input_mask;
1577 wndwidth =
This->fullscreen ? WidthOfScreen(
This->xwin.screen) :
This->width;
1578 wndheight =
This->fullscreen ? HeightOfScreen(
This->xwin.screen) :
This->height;
1581 if (
This->xpos < 0 || (
This->xpos == 0 && (
This->pos & 2)))
1583 if (
This->ypos < 0 || (
This->ypos == 0 && (
This->pos & 4)))
1584 This->ypos = HeightOfScreen(
This->xwin.screen) +
This->ypos -
This->height;
1588 This->wnd = XCreateWindow(
This->display, RootWindowOfScreen(
This->xwin.screen),
This->xpos,
This->ypos, wndwidth,
1589 wndheight, 0,
This->xwin.depth, InputOutput,
This->xwin.visual,
1590 CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
1599 if (
This->xwin.create_bitmap_gc ==
NULL)
1600 This->xwin.create_bitmap_gc = XCreateGC(
This->display,
This->wnd, 0,
NULL);
1602 if ((
This->ownbackstore) && (
This->xwin.backstore == 0))
1607 XSetForeground(
This->display,
This->xwin.gc, BlackPixelOfScreen(
This->xwin.screen));
1608 XFillRectangle(
This->display,
This->xwin.backstore,
This->xwin.gc, 0, 0,
This->width,
This->height);
1613 if (
This->hide_decorations)
1616 classhints = XAllocClassHint();
1617 if (classhints !=
NULL)
1619 classhints->res_name = classhints->res_class =
"rdesktop";
1620 XSetClassHint(
This->display,
This->wnd, classhints);
1624 sizehints = XAllocSizeHints();
1627 sizehints->flags = PMinSize | PMaxSize;
1629 sizehints->flags |= PPosition;
1630 sizehints->min_width = sizehints->max_width =
This->width;
1631 sizehints->min_height = sizehints->max_height =
This->height;
1632 XSetWMNormalHints(
This->display,
This->wnd, sizehints);
1636 if (
This->embed_wnd)
1645 This->xwin.IC = XCreateIC(
This->xwin.IM, XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),
1646 XNClientWindow,
This->wnd, XNFocusWindow,
This->wnd,
NULL);
1649 && (XGetICValues(
This->xwin.IC, XNFilterEvents, &ic_input_mask,
NULL) ==
NULL))
1650 input_mask |= ic_input_mask;
1653 XSelectInput(
This->display,
This->wnd, input_mask);
1654 XMapWindow(
This->display,
This->wnd);
1659 XMaskEvent(
This->display, VisibilityChangeMask, &xevent);
1661 while (xevent.type != VisibilityNotify);
1662 This->Unobscured = xevent.xvisibility.state == VisibilityUnobscured;
1668 This->xwin.protocol_atom = XInternAtom(
This->display,
"WM_PROTOCOLS",
True);
1669 This->xwin.kill_atom = XInternAtom(
This->display,
"WM_DELETE_WINDOW",
True);
1670 XSetWMProtocols(
This->display,
This->wnd, &
This->xwin.kill_atom, 1);
1673 if (
This->xwin.null_cursor ==
NULL)
1682 XSizeHints *sizehints;
1685 sizehints = XAllocSizeHints();
1688 sizehints->flags = PMinSize | PMaxSize;
1689 sizehints->min_width = sizehints->max_width =
This->width;
1690 sizehints->min_height = sizehints->max_height =
This->height;
1691 XSetWMNormalHints(
This->display,
This->wnd, sizehints);
1695 if (!(
This->fullscreen ||
This->embed_wnd))
1701 if (
This->xwin.backstore != 0)
1704 XSetForeground(
This->display,
This->xwin.gc, BlackPixelOfScreen(
This->xwin.screen));
1706 XCopyArea(
This->display,
This->xwin.backstore,
bs,
This->xwin.gc, 0, 0,
This->width,
This->height, 0, 0);
1707 XFreePixmap(
This->display,
This->xwin.backstore);
1708 This->xwin.backstore =
bs;
1716 XDestroyIC(
This->xwin.IC);
1718 XDestroyWindow(
This->display,
This->wnd);
1726 if (
This->xwin.seamless_active)
1730 if (!
This->ownbackstore)
1738 This->fullscreen = !
This->fullscreen;
1741 XDefineCursor(
This->display,
This->wnd,
This->xwin.current_cursor);
1743 if (!
This->ownbackstore)
1754 This->last_gesturetime = xevent.xbutton.time;
1763 if (
This->xwin.moving_wnd && (xevent.type == ButtonRelease))
1767 if (xevent.xbutton.y <
This->win_button_size)
1770 if (xevent.xbutton.x >=
This->width -
This->win_button_size)
1775 else if (xevent.xbutton.x >=
This->width -
This->win_button_size * 2)
1781 if (xevent.type == ButtonPress)
1784 else if (xevent.xbutton.x >=
This->width -
This->win_button_size * 3)
1787 if (xevent.type == ButtonRelease)
1792 XIconifyWindow(
This->display,
This->wnd, DefaultScreen(
This->display));
1796 else if (xevent.xbutton.x <=
This->win_button_size)
1799 if (xevent.type == ButtonPress)
1805 if (xevent.type == ButtonPress)
1807 if (!
This->fullscreen &&
This->hide_decorations && !
This->xwin.using_full_workarea)
1810 This->xwin.move_x_offset = xevent.xbutton.x;
1811 This->xwin.move_y_offset = xevent.xbutton.y;
1818 if (xevent.xmotion.window ==
This->wnd)
1821 flags |
button, xevent.xbutton.x, xevent.xbutton.y);
1827 flags |
button, xevent.xbutton.x_root, xevent.xbutton.y_root);
1843 seamless_window *sw;
1845 while ((XPending(
This->display) > 0) &&
events++ < 20)
1847 XNextEvent(
This->display, &xevent);
1855 switch (xevent.type)
1857 case VisibilityNotify:
1858 if (xevent.xvisibility.window ==
This->wnd)
1860 xevent.xvisibility.state == VisibilityUnobscured;
1865 if ((xevent.xclient.message_type ==
This->xwin.protocol_atom)
1866 && ((
Atom) xevent.xclient.data.l[0] ==
This->xwin.kill_atom))
1872 This->last_gesturetime = xevent.xkey.time;
1876 XmbLookupString(
This->xwin.IC,
1877 &xevent.xkey,
str,
sizeof(
str), &keysym,
1879 if (!((
status == XLookupKeySym) || (
status == XLookupBoth)))
1881 error(
"XmbLookupString failed with status 0x%x\n",
1889 DEBUG_KBD((
"\nNo input context, using XLookupString\n"));
1890 XLookupString((XKeyEvent *) & xevent,
1894 DEBUG_KBD((
"KeyPress for keysym (0x%lx, %s)\n", keysym,
1906 This->last_gesturetime = xevent.xkey.time;
1907 XLookupString((XKeyEvent *) & xevent,
str,
1910 DEBUG_KBD((
"\nKeyRelease for keysym (0x%lx, %s)\n", keysym,
1930 if (
This->xwin.moving_wnd)
1932 XMoveWindow(
This->display,
This->wnd,
1933 xevent.xmotion.x_root -
This->xwin.move_x_offset,
1934 xevent.xmotion.y_root -
This->xwin.move_y_offset);
1938 if (
This->fullscreen && !
This->xwin.focused)
1939 XSetInputFocus(
This->display,
This->wnd, RevertToPointerRoot,
1942 if (xevent.xmotion.window ==
This->wnd)
1945 xevent.xmotion.x, xevent.xmotion.y);
1951 xevent.xmotion.x_root,
1952 xevent.xmotion.y_root);
1957 if (xevent.xfocus.mode == NotifyGrab)
1961 if (
This->grab_keyboard &&
This->xwin.mouse_in_wnd)
1963 GrabModeAsync, GrabModeAsync, CurrentTime);
1969 if (sw->id !=
This->xwin.seamless_focused)
1972 This->xwin.seamless_focused = sw->id;
1977 if (xevent.xfocus.mode == NotifyUngrab)
1980 if (xevent.xfocus.mode == NotifyWhileGrabbed)
1981 XUngrabKeyboard(
This->display, CurrentTime);
1988 if (
This->fullscreen)
1990 XSetInputFocus(
This->display,
This->wnd, RevertToPointerRoot,
1994 if (
This->xwin.focused)
1996 GrabModeAsync, GrabModeAsync, CurrentTime);
2002 XUngrabKeyboard(
This->display, CurrentTime);
2006 if (xevent.xexpose.window ==
This->wnd)
2008 XCopyArea(
This->display,
This->xwin.backstore, xevent.xexpose.window,
2010 xevent.xexpose.x, xevent.xexpose.y,
2011 xevent.xexpose.width, xevent.xexpose.height,
2012 xevent.xexpose.x, xevent.xexpose.y);
2019 XCopyArea(
This->display,
This->xwin.backstore,
2020 xevent.xexpose.window,
This->xwin.gc,
2021 xevent.xexpose.x + sw->xoffset,
2022 xevent.xexpose.y + sw->yoffset,
2023 xevent.xexpose.width,
2024 xevent.xexpose.height, xevent.xexpose.x,
2033 if (xevent.xmapping.request == MappingKeyboard
2034 || xevent.xmapping.request == MappingModifier)
2035 XRefreshKeyboardMapping(&xevent.xmapping);
2037 if (xevent.xmapping.request == MappingModifier)
2039 XFreeModifiermap(
This->xwin.mod_map);
2040 This->xwin.mod_map = XGetModifierMapping(
This->display);
2045 case SelectionNotify:
2048 case SelectionRequest:
2051 case SelectionClear:
2054 case PropertyNotify:
2056 if (xevent.xproperty.window ==
This->wnd)
2058 if (xevent.xproperty.window == DefaultRootWindow(
This->display))
2066 if ((xevent.xproperty.atom ==
This->net_wm_state_atom)
2067 && (xevent.xproperty.state == PropertyNewValue))
2073 if ((xevent.xproperty.atom ==
This->net_wm_desktop_atom)
2074 && (xevent.xproperty.state == PropertyNewValue))
2082 if (!
This->xwin.seamless_active)
2086 if (!
This->xwin.seamless_active)
2089 case ConfigureNotify:
2090 if (!
This->xwin.seamless_active)
2101 sw->position_timer->tv_usec +=
2103 sw->position_timer->tv_sec += 1;
2129 n = (rdp_socket >
This->xwin.x_socket) ? rdp_socket :
This->xwin.x_socket;
2135 if (
This->xwin.seamless_active)
2140 FD_SET(rdp_socket, &rfds);
2188 XWarpPointer(
This->display,
This->wnd,
This->wnd, 0, 0, 0, 0,
x,
y);
2199 if (
This->server_depth == 8)
2205 bitmap_pad =
This->xwin.bpp;
2207 if (
This->xwin.bpp == 24)
2213 image = XCreateImage(
This->display,
This->xwin.visual,
This->xwin.depth, ZPixmap, 0,
2231 if (
This->server_depth == 8)
2237 bitmap_pad =
This->xwin.bpp;
2239 if (
This->xwin.bpp == 24)
2244 image = XCreateImage(
This->display,
This->xwin.visual,
This->xwin.depth, ZPixmap, 0,
2247 if (
This->ownbackstore)
2253 x - sw->xoffset,
y - sw->yoffset));
2260 x - sw->xoffset,
y - sw->yoffset));
2271 XFreePixmap(
This->display, (Pixmap)
bmp);
2281 scanline = (
width + 7) / 8;
2284 if (
This->xwin.create_glyph_gc == 0)
2287 image = XCreateImage(
This->display,
This->xwin.visual, 1, ZPixmap, 0, (
char *)
data,
2302 XFreePixmap(
This->display, (Pixmap) glyph);
2309 HGLYPH maskglyph, cursorglyph;
2318 scanline = (
width + 7) / 8;
2334 for (
j = 0;
j < scanline;
j++)
2336 for (nextbit = 0x80; nextbit != 0; nextbit >>= 1)
2338 if (xormask[0] || xormask[1] || xormask[2])
2340 *pcursor |= (~(*andmask) & nextbit);
2345 *pcursor |= ((*andmask) & nextbit);
2346 *pmask |= (~(*andmask) & nextbit);
2358 fg.red = fg.blue = fg.green = 0xffff;
2359 bg.red = bg.blue = bg.green = 0x0000;
2360 fg.flags = bg.flags = DoRed | DoBlue | DoGreen;
2366 XCreatePixmapCursor(
This->display, (Pixmap) cursorglyph,
2367 (Pixmap) maskglyph, &fg, &bg,
x,
y);
2380 XDefineCursor(
This->display,
This->wnd,
This->xwin.current_cursor);
2396#define MAKE_XCOLOR(xc,c) \
2397 (xc)->red = ((c)->red << 8) | (c)->red; \
2398 (xc)->green = ((c)->green << 8) | (c)->green; \
2399 (xc)->blue = ((c)->blue << 8) | (c)->blue; \
2400 (xc)->flags = DoRed | DoGreen | DoBlue;
2408 if (!
This->owncolmap)
2412 XColor xc_cache[256];
2414 int colLookup = 256;
2415 for (
i = 0;
i < ncolours;
i++)
2420 if (XAllocColor(
This->display,
This->xwin.xcolmap, &xentry) == 0)
2424 int nMinDist = 3 * 256 * 256;
2425 long nDist = nMinDist;
2430 xc_cache[colLookup].pixel = colLookup;
2431 xc_cache[colLookup].red = xc_cache[colLookup].green =
2432 xc_cache[colLookup].blue = 0;
2433 xc_cache[colLookup].flags = 0;
2434 XQueryColor(
This->display,
2435 DefaultColormap(
This->display,
2436 DefaultScreen(
This->display)),
2437 &xc_cache[colLookup]);
2446 nDist = ((
long) (xc_cache[
j].
red >> 8) -
2447 (
long) (xentry.red >> 8)) *
2448 ((
long) (xc_cache[
j].red >> 8) -
2449 (
long) (xentry.red >> 8)) +
2451 (
long) (xentry.green >> 8)) *
2452 ((
long) (xc_cache[
j].green >> 8) -
2453 (
long) (xentry.green >> 8)) +
2455 (
long) (xentry.blue >> 8)) *
2456 ((
long) (xc_cache[
j].blue >> 8) -
2457 (
long) (xentry.blue >> 8));
2459 if (nDist < nMinDist)
2466 colour = xentry.pixel;
2469 if (xentry.pixel < 256)
2471 xc_cache[xentry.pixel].red = xentry.red;
2472 xc_cache[xentry.pixel].green = xentry.green;
2473 xc_cache[xentry.pixel].blue = xentry.blue;
2483 XColor *xcolours, *xentry;
2486 xcolours = (XColor *)
xmalloc(
sizeof(XColor) * ncolours);
2487 for (
i = 0;
i < ncolours;
i++)
2490 xentry = &xcolours[
i];
2495 map = XCreateColormap(
This->display,
This->wnd,
This->xwin.visual, AllocAll);
2496 XStoreColors(
This->display,
map, xcolours, ncolours);
2506 if (!
This->owncolmap)
2509 XFreeColormap(
This->display, (Colormap)
map);
2515 if (!
This->owncolmap)
2517 if (
This->xwin.colmap)
2524 XSetWindowColormap(
This->display,
This->wnd, (Colormap)
map);
2532 This->xwin.clip_rectangle.x =
x;
2533 This->xwin.clip_rectangle.y =
y;
2534 This->xwin.clip_rectangle.width =
cx;
2535 This->xwin.clip_rectangle.height =
cy;
2536 XSetClipRectangles(
This->display,
This->xwin.gc, 0, 0, &
This->xwin.clip_rectangle, 1, YXBanded);
2542 This->xwin.clip_rectangle.x = 0;
2543 This->xwin.clip_rectangle.y = 0;
2544 This->xwin.clip_rectangle.width =
This->width;
2545 This->xwin.clip_rectangle.height =
This->height;
2546 XSetClipRectangles(
This->display,
This->xwin.gc, 0, 0, &
This->xwin.clip_rectangle, 1, YXBanded);
2552 XBell(
This->display, 0);
2557 int x,
int y,
int cx,
int cy)
2565 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
2566 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
2567 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01,
2568 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
2569 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08,
2570 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81
2575 int x,
int y,
int cx,
int cy,
2576 BRUSH * brush,
int bgcolour,
int fgcolour)
2583 switch (brush->style)
2595 XSetFillStyle(
This->display,
This->xwin.gc, FillOpaqueStippled);
2597 XSetTSOrigin(
This->display,
This->xwin.gc, brush->xorigin, brush->yorigin);
2600 XSetTSOrigin(
This->display,
This->xwin.gc, 0, 0);
2605 for (
i = 0;
i != 8;
i++)
2606 ipattern[7 -
i] = brush->pattern[
i];
2610 XSetFillStyle(
This->display,
This->xwin.gc, FillOpaqueStippled);
2612 XSetTSOrigin(
This->display,
This->xwin.gc, brush->xorigin, brush->yorigin);
2615 XSetTSOrigin(
This->display,
This->xwin.gc, 0, 0);
2620 unimpl(
"brush %d\n", brush->style);
2625 if (
This->ownbackstore)
2629 x,
y,
cx,
cy,
x - sw->xoffset,
y - sw->yoffset));
2634 int x,
int y,
int cx,
int cy,
2638 if (
This->ownbackstore)
2640 XCopyArea(
This->display,
This->Unobscured ?
This->wnd :
This->xwin.backstore,
2642 XCopyArea(
This->display,
This->xwin.backstore,
This->xwin.backstore,
This->xwin.gc, srcx, srcy,
cx,
cy,
x,
y);
2651 sw->wnd,
This->xwin.gc,
x,
y,
cx,
cy,
x - sw->xoffset,
y - sw->yoffset));
2658 int x,
int y,
int cx,
int cy,
2664 (
This->display, (Pixmap)
src, sw->wnd,
This->xwin.gc,
2665 srcx, srcy,
cx,
cy,
x - sw->xoffset,
y - sw->yoffset));
2666 if (
This->ownbackstore)
2667 XCopyArea(
This->display, (Pixmap)
src,
This->xwin.backstore,
This->xwin.gc, srcx, srcy,
cx,
cy,
x,
y);
2673 int x,
int y,
int cx,
int cy,
2675 BRUSH * brush,
int bgcolour,
int fgcolour)
2699 unimpl(
"triblt 0x%x\n", opcode);
2706 int startx,
int starty,
int endx,
int endy,
2711 XDrawLine(
This->display,
This->wnd,
This->xwin.gc, startx, starty, endx, endy);
2713 startx - sw->xoffset, starty - sw->yoffset,
2714 endx - sw->xoffset, endy - sw->yoffset));
2715 if (
This->ownbackstore)
2716 XDrawLine(
This->display,
This->xwin.backstore,
This->xwin.gc, startx, starty, endx, endy);
2722 int x,
int y,
int cx,
int cy,
2733 BRUSH * brush,
int bgcolour,
int fgcolour)
2743 XSetFillRule(
This->display,
This->xwin.gc, EvenOddRule);
2746 XSetFillRule(
This->display,
This->xwin.gc, WindingRule);
2749 unimpl(
"fill mode %d\n", fillmode);
2753 style = brush->style;
2769 XSetFillStyle(
This->display,
This->xwin.gc, FillOpaqueStippled);
2771 XSetTSOrigin(
This->display,
This->xwin.gc, brush->xorigin, brush->yorigin);
2774 XSetTSOrigin(
This->display,
This->xwin.gc, 0, 0);
2779 for (
i = 0;
i != 8;
i++)
2780 ipattern[7 -
i] = brush->pattern[
i];
2784 XSetFillStyle(
This->display,
This->xwin.gc, FillOpaqueStippled);
2786 XSetTSOrigin(
This->display,
This->xwin.gc, brush->xorigin, brush->yorigin);
2789 XSetTSOrigin(
This->display,
This->xwin.gc, 0, 0);
2794 unimpl(
"brush %d\n", brush->style);
2808 XDrawLines(
This->display,
This->wnd,
This->xwin.gc, (XPoint *)
points, npoints, CoordModePrevious);
2809 if (
This->ownbackstore)
2810 XDrawLines(
This->display,
This->xwin.backstore,
This->xwin.gc, (XPoint *)
points, npoints,
2814 (
This, sw->wnd, (XPoint *)
points, npoints, sw->xoffset, sw->yoffset));
2822 int x,
int y,
int cx,
int cy,
2823 BRUSH * brush,
int bgcolour,
int fgcolour)
2831 style = brush->style;
2847 XSetFillStyle(
This->display,
This->xwin.gc, FillOpaqueStippled);
2849 XSetTSOrigin(
This->display,
This->xwin.gc, brush->xorigin, brush->yorigin);
2852 XSetTSOrigin(
This->display,
This->xwin.gc, 0, 0);
2857 for (
i = 0;
i != 8;
i++)
2858 ipattern[7 -
i] = brush->pattern[
i];
2862 XSetFillStyle(
This->display,
This->xwin.gc, FillOpaqueStippled);
2864 XSetTSOrigin(
This->display,
This->xwin.gc, brush->xorigin, brush->yorigin);
2867 XSetTSOrigin(
This->display,
This->xwin.gc, 0, 0);
2872 unimpl(
"brush %d\n", brush->style);
2881 int x,
int y,
int cx,
int cy,
2882 HGLYPH glyph,
int srcx,
int srcy,
2883 int bgcolour,
int fgcolour)
2888 XSetFillStyle(
This->display,
This->xwin.gc,
2890 XSetStipple(
This->display,
This->xwin.gc, (Pixmap) glyph);
2891 XSetTSOrigin(
This->display,
This->xwin.gc,
x,
y);
2898#define DO_GLYPH(ttext,idx) \
2900 glyph = cache_get_font (This, font, ttext[idx]);\
2901 if (!(flags & TEXT2_IMPLICIT_X))\
2903 xyoffset = ttext[++idx];\
2904 if ((xyoffset & 0x80))\
2906 if (flags & TEXT2_VERTICAL)\
2907 y += ttext[idx+1] | (ttext[idx+2] << 8);\
2909 x += ttext[idx+1] | (ttext[idx+2] << 8);\
2914 if (flags & TEXT2_VERTICAL)\
2922 x1 = x + glyph->offset;\
2923 y1 = y + glyph->baseline;\
2924 XSetStipple(This->display, This->xwin.gc, (Pixmap) glyph->pixmap);\
2925 XSetTSOrigin(This->display, This->xwin.gc, x1, y1);\
2926 FILL_RECTANGLE_BACKSTORE(x1, y1, glyph->width, glyph->height);\
2927 if (flags & TEXT2_IMPLICIT_X)\
2934 int clipx,
int clipy,
int clipcx,
int clipcy,
2935 int boxx,
int boxy,
int boxcx,
int boxcy,
BRUSH * brush,
2941 int i,
j, xyoffset,
x1,
y1;
2949 if (boxx + boxcx >
This->width)
2950 boxcx =
This->width - boxx;
2963 XSetFillStyle(
This->display,
This->xwin.gc, FillStippled);
2974 warning(
"Skipping short 0xff command:");
2993 warning(
"Skipping short 0xfe command:");
3033 if (
This->ownbackstore)
3037 XCopyArea(
This->display,
This->xwin.backstore,
This->wnd,
This->xwin.gc, boxx,
3038 boxy, boxcx, boxcy, boxx, boxy);
3040 (
This->display,
This->xwin.backstore, sw->wnd,
This->xwin.gc,
3043 boxx - sw->xoffset, boxy - sw->yoffset));
3047 XCopyArea(
This->display,
This->xwin.backstore,
This->wnd,
This->xwin.gc, clipx,
3048 clipy, clipcx, clipcy, clipx, clipy);
3050 (
This->display,
This->xwin.backstore, sw->wnd,
This->xwin.gc,
3052 clipcx, clipcy, clipx - sw->xoffset,
3053 clipy - sw->yoffset));
3064 if (
This->ownbackstore)
3072 image = XGetImage(
This->display, pix, 0, 0,
cx,
cy, AllPlanes, ZPixmap);
3073 XFreePixmap(
This->display, pix);
3079 XDestroyImage(
image);
3093 image = XCreateImage(
This->display,
This->xwin.visual,
This->xwin.depth, ZPixmap, 0,
3096 if (
This->ownbackstore)
3101 (
This->display,
This->xwin.backstore, sw->wnd,
This->xwin.gc,
3102 x,
y,
cx,
cy,
x - sw->xoffset,
y - sw->yoffset));
3109 x - sw->xoffset,
y - sw->yoffset));
3130 if (!
This->seamless_rdp)
3133 if (
This->xwin.seamless_started)
3136 This->xwin.seamless_started =
True;
3147 if (!
This->seamless_rdp)
3150 if (!
This->xwin.seamless_started)
3153 if (
This->xwin.seamless_active)
3163 if (!
This->seamless_rdp)
3166 if (!
This->xwin.seamless_started)
3178 if (!
This->seamless_rdp)
3181 if (!
This->xwin.seamless_started)
3184 if (
This->xwin.seamless_hidden)
3187 if (
This->xwin.seamless_active)
3190 while (
This->xwin.seamless_windows)
3192 XDestroyWindow(
This->display,
This->xwin.seamless_windows->wnd);
3195 XMapWindow(
This->display,
This->wnd);
3200 XUnmapWindow(
This->display,
This->wnd);
3204 This->xwin.seamless_active = !
This->xwin.seamless_active;
3210 unsigned long flags)
3214 XClassHint *classhints;
3215 XSizeHints *sizehints;
3218 seamless_window *sw, *sw_parent;
3220 if (!
This->xwin.seamless_active)
3229 wnd = XCreateWindow(
This->display, RootWindowOfScreen(
This->xwin.screen), -1, -1, 1, 1, 0,
This->xwin.depth,
3230 InputOutput,
This->xwin.visual,
3231 CWBackPixel | CWBackingStore | CWColormap | CWBorderPixel, &
attribs);
3233 XStoreName(
This->display, wnd,
"SeamlessRDP");
3238 classhints = XAllocClassHint();
3239 if (classhints !=
NULL)
3241 classhints->res_name =
"rdesktop";
3242 classhints->res_class =
"SeamlessRDP";
3243 XSetClassHint(
This->display, wnd, classhints);
3248 sizehints = XAllocSizeHints();
3249 if (sizehints !=
NULL)
3251 sizehints->flags = USPosition;
3252 XSetWMNormalHints(
This->display, wnd, sizehints);
3257 if (
parent == 0xFFFFFFFF)
3259 XSetTransientForHint(
This->display, wnd, RootWindowOfScreen(
This->xwin.screen));
3265 else if (
parent != 0x00000000)
3269 XSetTransientForHint(
This->display, wnd, sw_parent->wnd);
3271 warning(
"ui_seamless_create_window: No parent window 0x%lx\n",
parent);
3278 if (
parent == 0x00000000)
3279 XSetTransientForHint(
This->display, wnd, RootWindowOfScreen(
This->xwin.screen));
3286 input_mask |= PropertyChangeMask;
3288 XSelectInput(
This->display, wnd, input_mask);
3293 XSetWMProtocols(
This->display, wnd, &
This->xwin.kill_atom, 1);
3295 sw =
xmalloc(
sizeof(seamless_window));
3300 sw->group->refcnt++;
3310 sw->outstanding_position =
False;
3311 sw->outpos_serial = 0;
3312 sw->outpos_xoffset = sw->outpos_yoffset = 0;
3313 sw->outpos_width = sw->outpos_height = 0;
3315 sw->
next =
This->xwin.seamless_windows;
3316 This->xwin.seamless_windows = sw;
3319 wmhints = XAllocWMHints();
3322 wmhints->flags = WindowGroupHint;
3323 wmhints->window_group = sw->group->wnd;
3324 XSetWMHints(
This->display, sw->wnd, wmhints);
3333 seamless_window *sw;
3335 if (!
This->xwin.seamless_active)
3341 warning(
"ui_seamless_destroy_window: No information for window 0x%lx\n",
id);
3345 XDestroyWindow(
This->display, sw->wnd);
3353 seamless_window *sw, *sw_next;
3355 if (!
This->xwin.seamless_active)
3358 for (sw =
This->xwin.seamless_windows; sw; sw = sw_next)
3362 if (sw->group->id ==
id)
3364 XDestroyWindow(
This->display, sw->wnd);
3374 seamless_window *sw;
3376 if (!
This->xwin.seamless_active)
3382 warning(
"ui_seamless_move_window: No information for window 0x%lx\n",
id);
3387 if (sw->outstanding_position)
3409 XMoveResizeWindow(
This->display, sw->wnd, sw->xoffset, sw->yoffset, sw->width, sw->height);
3416 seamless_window *sw;
3418 if (!
This->xwin.seamless_active)
3424 warning(
"ui_seamless_restack_window: No information for window 0x%lx\n",
id);
3430 seamless_window *sw_behind;
3436 warning(
"ui_seamless_restack_window: No information for window 0x%lx\n",
3441 wnds[1] = sw_behind->wnd;
3444 XRestackWindows(
This->display,
wnds, 2);
3448 XRaiseWindow(
This->display, sw->wnd);
3458 seamless_window *sw;
3460 if (!
This->xwin.seamless_active)
3466 warning(
"ui_seamless_settitle: No information for window 0x%lx\n",
id);
3471 XStoreName(
This->display, sw->wnd,
title);
3479 seamless_window *sw;
3481 if (!
This->xwin.seamless_active)
3487 warning(
"ui_seamless_setstate: No information for window 0x%lx\n",
id);
3496 XMapWindow(
This->display, sw->wnd);
3507 hints = XGetWMHints(
This->display, sw->wnd);
3510 hints->flags |= StateHint;
3511 hints->initial_state = IconicState;
3512 XSetWMHints(
This->display, sw->wnd,
hints);
3515 XMapWindow(
This->display, sw->wnd);
3518 XIconifyWindow(
This->display, sw->wnd, DefaultScreen(
This->display));
3532 if (!
This->xwin.seamless_active)
3536 while (
This->xwin.seamless_windows)
3538 XDestroyWindow(
This->display,
This->xwin.seamless_windows->wnd);
3547 seamless_window *sw;
3548 for (sw =
This->xwin.seamless_windows; sw; sw = sw->next)
3550 if (sw->outstanding_position && (sw->outpos_serial ==
serial))
3552 sw->xoffset = sw->outpos_xoffset;
3553 sw->yoffset = sw->outpos_yoffset;
3554 sw->width = sw->outpos_width;
3555 sw->height = sw->outpos_height;
3556 sw->outstanding_position =
False;
3561 XCopyArea(
This->display,
This->xwin.backstore,
3562 sw->wnd,
This->xwin.gc,
3563 sw->xoffset, sw->yoffset, sw->width, sw->height, 0, 0);
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
#define gettimeofday(tv, tz)
void cache_put_text(uint8 cache_id, void *data, int length)
void cache_put_desktop(uint32 offset, int cx, int cy, int scanline, int bytes_per_pixel, uint8 *data)
DATABLOB * cache_get_text(uint8 cache_id)
uint8 * cache_get_desktop(uint32 offset, int cx, int cy, int bytes_per_pixel)
#define SEAMLESSRDP_CREATE_MODAL
#define SEAMLESSRDP_MAXIMIZED
#define SEAMLESSRDP_POSITION_TIMER
#define SEAMLESSRDP_MINIMIZED
#define SEAMLESSRDP_NOTYETMAPPED
#define SEAMLESSRDP_NORMAL
RD_BOOL handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, RD_BOOL pressed)
int get_current_workarea(uint32 *x, uint32 *y, uint32 *width, uint32 *height)
void rdpdr_check_fds(fd_set *rfds, fd_set *wfds, RD_BOOL timed_out)
void reset_modifier_keys(void)
void ui_seamless_hide_desktop(void)
RD_BOOL seamless_init(void)
char * get_ksname(uint32 keysym)
void ui_set_null_cursor(void)
void ui_destroy_window(void)
void ui_seamless_toggle(void)
void rdp_send_client_window_status(int status)
void ui_seamless_unhide_desktop(void)
void rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2)
RD_BOOL ui_create_window(void)
void unimpl(char *format,...)
unsigned int seamless_send_position(unsigned long id, int x, int y, int width, int height, unsigned long flags)
void xwin_toggle_fullscreen(void)
void xkeymap_send_keys(uint32 keysym, unsigned int keycode, unsigned int state, uint32 ev_time, RD_BOOL pressed, uint8 nesting)
unsigned int seamless_send_sync(void)
void ui_resize_window(void)
void rdpdr_add_fds(int *n, fd_set *rfds, fd_set *wfds, struct timeval *tv, RD_BOOL *timeout)
unsigned int seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags)
uint16 xkeymap_translate_button(unsigned int button)
unsigned int seamless_send_state(unsigned long id, unsigned int state, unsigned long flags)
void ui_begin_update(void)
void seamless_select_timeout(struct timeval *tv)
unsigned int seamless_send_focus(unsigned long id, unsigned long flags)
#define timercmp(tvp, uvp, cmp)
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
void ewmh_set_wm_name(RDPCLIENT *This, Window wnd, const char *title)
int ewmh_move_to_desktop(RDPCLIENT *This, Window wnd, unsigned int desktop)
int ewmh_set_window_modal(RDPCLIENT *This, Window wnd)
int ewmh_set_window_popup(RDPCLIENT *This, Window wnd)
int ewmh_change_state(RDPCLIENT *This, Window wnd, int state)
int ewmh_get_window_state(RDPCLIENT *This, Window w)
int ewmh_get_window_desktop(RDPCLIENT *This, Window wnd)
GLint GLint GLsizei GLsizei GLsizei depth
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLint GLint GLint yoffset
GLuint GLsizei GLsizei * length
GLsizei const GLfloat * points
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static struct msdos_boot_sector bs
static const char * contents
const char * strerror(int err)
static THRDCREATEWIN wnds[3]
_Out_opt_ int _Out_opt_ int * cy
namespace GUID const ADDRINFOEXW * hints
unsigned long decorations
BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
#define FD_ISSET(fd, set)
void xclip_handle_PropertyNotify(RDPCLIENT *This, XPropertyEvent *event)
void xclip_handle_SelectionRequest(RDPCLIENT *This, XSelectionRequestEvent *event)
void xclip_handle_SelectionNotify(RDPCLIENT *This, XSelectionEvent *event)
void xclip_handle_SelectionClear(RDPCLIENT *This)
void ui_draw_text(RDPCLIENT *This, uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, BRUSH *brush, int bgcolour, int fgcolour, uint8 *text, uint8 length)
void ui_line(RDPCLIENT *This, uint8 opcode, int startx, int starty, int endx, int endy, PEN *pen)
void ui_polygon(RDPCLIENT *This, uint8 opcode, uint8 fillmode, POINT *point, int npoints, BRUSH *brush, int bgcolour, int fgcolour)
void ui_desktop_save(RDPCLIENT *This, uint32 offset, int x, int y, int cx, int cy)
#define SET_BACKGROUND(col)
static void sw_update_position(RDPCLIENT *This, seamless_window *sw)
static void handle_button_event(RDPCLIENT *This, XEvent xevent, BOOL down)
#define MAKE_XCOLOR(xc, c)
void ui_move_pointer(RDPCLIENT *This, int x, int y)
static void sw_remove_window(RDPCLIENT *This, seamless_window *win)
static void translate24to32(RDPCLIENT *This, const uint8 *data, uint8 *out, uint8 *end)
static void translate8to8(RDPCLIENT *This, const uint8 *data, uint8 *out, uint8 *end)
#define SPLITCOLOUR24(colour, rv)
void ui_set_colourmap(RDPCLIENT *This, HCOLOURMAP map)
int ui_select(RDPCLIENT *This, int rdp_socket)
#define SPLITCOLOUR15(colour, rv)
#define DO_GLYPH(ttext, idx)
static const uint8 hatch_patterns[]
static void translate16to24(RDPCLIENT *This, const uint16 *data, uint8 *out, uint8 *end)
static void sw_restack_window(RDPCLIENT *This, seamless_window *sw, unsigned long behind)
#define ON_ALL_SEAMLESS_WINDOWS(func, args)
#define FILL_POLYGON(p, np)
static seamless_group * sw_find_group(RDPCLIENT *This, unsigned long id, BOOL dont_create)
static uint32 translate_colour(RDPCLIENT *This, uint32 colour)
static void get_window_attribs(RDPCLIENT *This, XSetWindowAttributes *attribs)
void ui_destroy_bitmap(RDPCLIENT *This, HBITMAP bmp)
void ui_draw_glyph(RDPCLIENT *This, int mixmode, int x, int y, int cx, int cy, HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour)
HCOLOURMAP ui_create_colourmap(RDPCLIENT *This, COLOURMAP *colours)
#define FILL_RECTANGLE(x, y, cx, cy)
void ui_screenblt(RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy)
void ui_seamless_destroy_window(RDPCLIENT *This, unsigned long id, unsigned long flags)
#define MWM_HINTS_DECORATIONS
static void translate16to16(RDPCLIENT *This, const uint16 *data, uint8 *out, uint8 *end)
void ui_patblt(RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
BOOL get_key_state(RDPCLIENT *This, unsigned int state, uint32 keysym)
void ui_seamless_setstate(RDPCLIENT *This, unsigned long id, unsigned int state, unsigned long flags)
static void translate15to24(RDPCLIENT *This, const uint16 *data, uint8 *out, uint8 *end)
void ui_seamless_create_window(RDPCLIENT *This, unsigned long id, unsigned long group, unsigned long parent, unsigned long flags)
static void seamless_XFillPolygon(RDPCLIENT *This, Drawable d, XPoint *points, int npoints, int xoffset, int yoffset)
void ui_destroy_colourmap(RDPCLIENT *This, HCOLOURMAP map)
static void sw_handle_restack(RDPCLIENT *This, seamless_window *sw)
static void translate24to24(RDPCLIENT *This, const uint8 *data, uint8 *out, uint8 *end)
void ui_paint_bitmap(RDPCLIENT *This, int x, int y, int cx, int cy, int width, int height, uint8 *data)
#define DRAW_ELLIPSE(x, y, cx, cy, m)
void ui_set_cursor(RDPCLIENT *This, HCURSOR cursor)
void ui_seamless_begin(RDPCLIENT *This, BOOL hidden)
void ui_seamless_move_window(RDPCLIENT *This, unsigned long id, int x, int y, int width, int height, unsigned long flags)
static void translate16to32(RDPCLIENT *This, const uint16 *data, uint8 *out, uint8 *end)
static BOOL select_visual(RDPCLIENT *This)
static void translate8to16(RDPCLIENT *This, const uint8 *data, uint8 *out, uint8 *end)
HBITMAP ui_create_bitmap(RDPCLIENT *This, int width, int height, uint8 *data)
void ui_seamless_restack_window(RDPCLIENT *This, unsigned long id, unsigned long behind, unsigned long flags)
void ui_set_clip(RDPCLIENT *This, int x, int y, int cx, int cy)
static void translate8to32(RDPCLIENT *This, const uint8 *data, uint8 *out, uint8 *end)
void ui_seamless_settitle(RDPCLIENT *This, unsigned long id, const char *title, unsigned long flags)
static void translate15to16(RDPCLIENT *This, const uint16 *data, uint8 *out, uint8 *end)
void ui_seamless_ack(RDPCLIENT *This, unsigned int serial)
#define SET_FUNCTION(rop2)
HCURSOR ui_create_cursor(RDPCLIENT *This, unsigned int x, unsigned int y, int width, int height, uint8 *andmask, uint8 *xormask)
#define FILL_RECTANGLE_BACKSTORE(x, y, cx, cy)
static void translate15to32(RDPCLIENT *This, const uint16 *data, uint8 *out, uint8 *end)
void ui_ellipse(RDPCLIENT *This, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH *brush, int bgcolour, int fgcolour)
#define SPLITCOLOUR16(colour, rv)
static void sw_all_to_desktop(RDPCLIENT *This, Window wnd, unsigned int desktop)
static void get_input_mask(RDPCLIENT *This, long *input_mask)
void ui_destblt(RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy)
void ui_desktop_restore(RDPCLIENT *This, uint32 offset, int x, int y, int cx, int cy)
static void translate8to24(RDPCLIENT *This, const uint8 *data, uint8 *out, uint8 *end)
#define PROP_MOTIF_WM_HINTS_ELEMENTS
static const int rop2_map[]
#define RESET_FUNCTION(rop2)
void ui_destroy_cursor(RDPCLIENT *This, HCURSOR cursor)
void ui_destroy_glyph(RDPCLIENT *This, HGLYPH glyph)
static void translate24to16(RDPCLIENT *This, const uint8 *data, uint8 *out, uint8 *end)
#define SET_FOREGROUND(col)
static int xwin_process_events(RDPCLIENT *This)
void ui_seamless_destroy_group(RDPCLIENT *This, unsigned long id, unsigned long flags)
static void mwm_hide_decorations(RDPCLIENT *This, Window wnd)
void ui_polyline(RDPCLIENT *This, uint8 opcode, POINT *points, int npoints, PEN *pen)
static void sw_check_timers(RDPCLIENT *This)
void ui_memblt(RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy)
HGLYPH ui_create_glyph(RDPCLIENT *This, int width, int height, const uint8 *data)
void ui_triblt(RDPCLIENT *This, uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy, BRUSH *brush, int bgcolour, int fgcolour)
static unsigned calculate_mask_weight(uint32 mask)
static seamless_window * sw_get_window_by_id(RDPCLIENT *This, unsigned long id)
void ui_rect(RDPCLIENT *This, int x, int y, int cx, int cy, int colour)
static void seamless_XDrawLines(RDPCLIENT *This, Drawable d, XPoint *points, int npoints, int xoffset, int yoffset)
void ui_seamless_syncbegin(RDPCLIENT *This, unsigned long flags)
static uint8 * translate_image(RDPCLIENT *This, int width, int height, uint8 *data)
static void calculate_shifts(uint32 mask, int *shift_r, int *shift_l)
static seamless_window * sw_get_window_by_wnd(RDPCLIENT *This, Window wnd)