… | |
… | |
1177 | } |
1177 | } |
1178 | |
1178 | |
1179 | void |
1179 | void |
1180 | rxvt_term::pointer_unblank () |
1180 | rxvt_term::pointer_unblank () |
1181 | { |
1181 | { |
1182 | XDefineCursor (xdisp, vt, TermWin_cursor); |
1182 | XDefineCursor (dpy, vt, TermWin_cursor); |
1183 | recolour_cursor (); |
1183 | recolour_cursor (); |
1184 | |
1184 | |
1185 | #ifdef POINTER_BLANK |
1185 | #ifdef POINTER_BLANK |
1186 | hidden_pointer = 0; |
1186 | hidden_pointer = 0; |
1187 | |
1187 | |
… | |
… | |
1195 | rxvt_term::pointer_blank () |
1195 | rxvt_term::pointer_blank () |
1196 | { |
1196 | { |
1197 | if (!OPTION (Opt_pointerBlank)) |
1197 | if (!OPTION (Opt_pointerBlank)) |
1198 | return; |
1198 | return; |
1199 | |
1199 | |
1200 | XDefineCursor (xdisp, vt, display->blank_cursor); |
1200 | XDefineCursor (dpy, vt, display->blank_cursor); |
1201 | XFlush (xdisp); |
1201 | XFlush (dpy); |
1202 | |
1202 | |
1203 | hidden_pointer = 1; |
1203 | hidden_pointer = 1; |
1204 | } |
1204 | } |
1205 | |
1205 | |
1206 | void |
1206 | void |
… | |
… | |
1285 | void |
1285 | void |
1286 | rxvt_term::x_cb (XEvent &ev) |
1286 | rxvt_term::x_cb (XEvent &ev) |
1287 | { |
1287 | { |
1288 | make_current (); |
1288 | make_current (); |
1289 | |
1289 | |
1290 | dLocal (Display *, xdisp); |
1290 | dLocal (Display *, dpy); |
1291 | |
1291 | |
1292 | if (ev.xany.window == vt |
1292 | if (ev.xany.window == vt |
1293 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1293 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1294 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1294 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1295 | return; |
1295 | return; |
… | |
… | |
1405 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1405 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1406 | destroy (); |
1406 | destroy (); |
1407 | } |
1407 | } |
1408 | #if ENABLE_EWMH |
1408 | #if ENABLE_EWMH |
1409 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1409 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1410 | XSendEvent (xdisp, ev.xclient.window = display->root, |
1410 | XSendEvent (dpy, ev.xclient.window = display->root, |
1411 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1411 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1412 | &ev); |
1412 | &ev); |
1413 | #endif |
1413 | #endif |
1414 | } |
1414 | } |
1415 | } |
1415 | } |
… | |
… | |
1463 | break; |
1463 | break; |
1464 | |
1464 | |
1465 | case ConfigureNotify: |
1465 | case ConfigureNotify: |
1466 | if (ev.xconfigure.window == parent[0]) |
1466 | if (ev.xconfigure.window == parent[0]) |
1467 | { |
1467 | { |
1468 | while (XCheckTypedWindowEvent (xdisp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1468 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1469 | ; |
1469 | ; |
1470 | |
1470 | |
1471 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1471 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1472 | { |
1472 | { |
1473 | seen_resize = 1; |
1473 | seen_resize = 1; |
… | |
… | |
1531 | if (ev.xany.window == vt) |
1531 | if (ev.xany.window == vt) |
1532 | { |
1532 | { |
1533 | do |
1533 | do |
1534 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1534 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1535 | ev.xexpose.width, ev.xexpose.height, False); |
1535 | ev.xexpose.width, ev.xexpose.height, False); |
1536 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)); |
1536 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1537 | |
1537 | |
1538 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1538 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1539 | |
1539 | |
1540 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)) |
1540 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
1541 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1541 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1542 | ev.xexpose.width, ev.xexpose.height, False); |
1542 | ev.xexpose.width, ev.xexpose.height, False); |
1543 | |
1543 | |
1544 | want_refresh = 1; |
1544 | want_refresh = 1; |
1545 | } |
1545 | } |
1546 | else |
1546 | else |
1547 | { |
1547 | { |
1548 | XEvent unused_event; |
1548 | XEvent unused_event; |
1549 | |
1549 | |
1550 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, Expose, &unused_event)) |
1550 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1551 | ; |
1551 | ; |
1552 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, GraphicsExpose, &unused_event)) |
1552 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1553 | ; |
1553 | ; |
1554 | |
1554 | |
1555 | if (isScrollbarWindow (ev.xany.window)) |
1555 | if (isScrollbarWindow (ev.xany.window)) |
1556 | { |
1556 | { |
1557 | scrollBar.setIdle (); |
1557 | scrollBar.setIdle (); |
1558 | scrollbar_show (0); |
1558 | scrollbar_show (0); |
1559 | } |
1559 | } |
1560 | |
1560 | |
1561 | #ifdef TRANSPARENT |
1561 | #ifdef TRANSPARENT |
1562 | if (am_transparent && ev.xany.window == parent[0]) |
1562 | if (am_transparent && ev.xany.window == parent[0]) |
1563 | XClearWindow (xdisp, ev.xany.window); |
1563 | XClearWindow (dpy, ev.xany.window); |
1564 | #endif |
1564 | #endif |
1565 | } |
1565 | } |
1566 | break; |
1566 | break; |
1567 | |
1567 | |
1568 | case MotionNotify: |
1568 | case MotionNotify: |
… | |
… | |
1578 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1578 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1579 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1579 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1580 | ; // nop |
1580 | ; // nop |
1581 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1581 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1582 | { |
1582 | { |
1583 | while (XCheckTypedWindowEvent (xdisp, vt, MotionNotify, &ev)) |
1583 | while (XCheckTypedWindowEvent (dpy, vt, MotionNotify, &ev)) |
1584 | ; |
1584 | ; |
1585 | |
1585 | |
1586 | XQueryPointer (xdisp, vt, |
1586 | XQueryPointer (dpy, vt, |
1587 | &unused_root, &unused_child, |
1587 | &unused_root, &unused_child, |
1588 | &unused_root_x, &unused_root_y, |
1588 | &unused_root_x, &unused_root_y, |
1589 | &ev.xbutton.x, &ev.xbutton.y, |
1589 | &ev.xbutton.x, &ev.xbutton.y, |
1590 | &ev.xbutton.state); |
1590 | &ev.xbutton.state); |
1591 | #ifdef MOUSE_THRESHOLD |
1591 | #ifdef MOUSE_THRESHOLD |
… | |
… | |
1655 | #endif |
1655 | #endif |
1656 | } |
1656 | } |
1657 | } |
1657 | } |
1658 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1658 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1659 | { |
1659 | { |
1660 | while (XCheckTypedWindowEvent (xdisp, scrollBar.win, |
1660 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1661 | MotionNotify, &ev)) |
1661 | MotionNotify, &ev)) |
1662 | ; |
1662 | ; |
1663 | |
1663 | |
1664 | XQueryPointer (xdisp, scrollBar.win, |
1664 | XQueryPointer (dpy, scrollBar.win, |
1665 | &unused_root, &unused_child, |
1665 | &unused_root, &unused_child, |
1666 | &unused_root_x, &unused_root_y, |
1666 | &unused_root_x, &unused_root_y, |
1667 | &ev.xbutton.x, &ev.xbutton.y, |
1667 | &ev.xbutton.x, &ev.xbutton.y, |
1668 | &unused_mask); |
1668 | &unused_mask); |
1669 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1669 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
… | |
… | |
2430 | pchanged = 0; |
2430 | pchanged = 0; |
2431 | |
2431 | |
2432 | if (!OPTION (Opt_transparent)) |
2432 | if (!OPTION (Opt_transparent)) |
2433 | return pchanged; /* Don't try any more */ |
2433 | return pchanged; /* Don't try any more */ |
2434 | |
2434 | |
2435 | XGetWindowAttributes (xdisp, display->root, &wrootattr); |
2435 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
2436 | rootdepth = wrootattr.depth; |
2436 | rootdepth = wrootattr.depth; |
2437 | |
2437 | |
2438 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
2438 | XGetWindowAttributes (dpy, parent[0], &wattr); |
2439 | |
2439 | |
2440 | if (rootdepth != wattr.depth) |
2440 | if (rootdepth != wattr.depth) |
2441 | { |
2441 | { |
2442 | if (am_transparent) |
2442 | if (am_transparent) |
2443 | { |
2443 | { |
2444 | pchanged = 1; |
2444 | pchanged = 1; |
2445 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2445 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
2446 | am_transparent = am_pixmap_trans = 0; |
2446 | am_transparent = am_pixmap_trans = 0; |
2447 | } |
2447 | } |
2448 | |
2448 | |
2449 | return pchanged; /* Don't try any more */ |
2449 | return pchanged; /* Don't try any more */ |
2450 | } |
2450 | } |
2451 | |
2451 | |
2452 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
2452 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
2453 | XSync (xdisp, False); |
2453 | XSync (dpy, False); |
2454 | |
2454 | |
2455 | /* |
2455 | /* |
2456 | * Make the frame window set by the window manager have |
2456 | * Make the frame window set by the window manager have |
2457 | * the root background. Some window managers put multiple nested frame |
2457 | * the root background. Some window managers put multiple nested frame |
2458 | * windows for each client, so we have to take care about that. |
2458 | * windows for each client, so we have to take care about that. |
2459 | */ |
2459 | */ |
2460 | i = (xa[XA_XROOTPMAP_ID] |
2460 | i = (xa[XA_XROOTPMAP_ID] |
2461 | && XGetWindowProperty (xdisp, display->root, xa[XA_XROOTPMAP_ID], |
2461 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
2462 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2462 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2463 | &nitems, &bytes_after, &prop) == Success); |
2463 | &nitems, &bytes_after, &prop) == Success); |
2464 | |
2464 | |
2465 | if (!i || prop == NULL) |
2465 | if (!i || prop == NULL) |
2466 | i = (xa[XA_ESETROOT_PMAP_ID] |
2466 | i = (xa[XA_ESETROOT_PMAP_ID] |
2467 | && XGetWindowProperty (xdisp, display->root, xa[XA_ESETROOT_PMAP_ID], |
2467 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
2468 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2468 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2469 | &nitems, &bytes_after, &prop) == Success); |
2469 | &nitems, &bytes_after, &prop) == Success); |
2470 | |
2470 | |
2471 | if (!i || prop == NULL |
2471 | if (!i || prop == NULL |
2472 | #if TINTING |
2472 | #if TINTING |
… | |
… | |
2491 | Window cr; |
2491 | Window cr; |
2492 | XImage *image; |
2492 | XImage *image; |
2493 | GC gc; |
2493 | GC gc; |
2494 | XGCValues gcvalue; |
2494 | XGCValues gcvalue; |
2495 | |
2495 | |
2496 | XTranslateCoordinates (xdisp, parent[0], display->root, |
2496 | XTranslateCoordinates (dpy, parent[0], display->root, |
2497 | 0, 0, &sx, &sy, &cr); |
2497 | 0, 0, &sx, &sy, &cr); |
2498 | nw = (unsigned int)szHint.width; |
2498 | nw = (unsigned int)szHint.width; |
2499 | nh = (unsigned int)szHint.height; |
2499 | nh = (unsigned int)szHint.height; |
2500 | nx = ny = 0; |
2500 | nx = ny = 0; |
2501 | |
2501 | |
… | |
… | |
2514 | } |
2514 | } |
2515 | |
2515 | |
2516 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2516 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2517 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2517 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2518 | |
2518 | |
2519 | XSync (xdisp, False); |
2519 | XSync (dpy, False); |
2520 | allowedxerror = -1; |
2520 | allowedxerror = -1; |
2521 | image = XGetImage (xdisp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2521 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2522 | |
2522 | |
2523 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2523 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2524 | /* XXX: may need a delay here? */ |
2524 | /* XXX: may need a delay here? */ |
2525 | allowedxerror = 0; |
2525 | allowedxerror = 0; |
2526 | |
2526 | |
… | |
… | |
2529 | if (am_transparent && am_pixmap_trans) |
2529 | if (am_transparent && am_pixmap_trans) |
2530 | { |
2530 | { |
2531 | pchanged = 1; |
2531 | pchanged = 1; |
2532 | if (pixmap != None) |
2532 | if (pixmap != None) |
2533 | { |
2533 | { |
2534 | XFreePixmap (xdisp, pixmap); |
2534 | XFreePixmap (dpy, pixmap); |
2535 | pixmap = None; |
2535 | pixmap = None; |
2536 | } |
2536 | } |
2537 | } |
2537 | } |
2538 | |
2538 | |
2539 | am_pixmap_trans = 0; |
2539 | am_pixmap_trans = 0; |
2540 | } |
2540 | } |
2541 | else |
2541 | else |
2542 | { |
2542 | { |
2543 | if (pixmap != None) |
2543 | if (pixmap != None) |
2544 | XFreePixmap (xdisp, pixmap); |
2544 | XFreePixmap (dpy, pixmap); |
2545 | |
2545 | |
2546 | #if TINTING |
2546 | #if TINTING |
2547 | if (ISSET_PIXCOLOR (Color_tint)) |
2547 | if (ISSET_PIXCOLOR (Color_tint)) |
2548 | { |
2548 | { |
2549 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2549 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
… | |
… | |
2553 | |
2553 | |
2554 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
2554 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
2555 | } |
2555 | } |
2556 | #endif |
2556 | #endif |
2557 | |
2557 | |
2558 | pixmap = XCreatePixmap (xdisp, vt, szHint.width, szHint.height, image->depth); |
2558 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
2559 | gc = XCreateGC (xdisp, vt, 0UL, &gcvalue); |
2559 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
2560 | XPutImage (xdisp, pixmap, gc, image, 0, 0, |
2560 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
2561 | nx, ny, image->width, image->height); |
2561 | nx, ny, image->width, image->height); |
2562 | XFreeGC (xdisp, gc); |
2562 | XFreeGC (dpy, gc); |
2563 | XDestroyImage (image); |
2563 | XDestroyImage (image); |
2564 | XSetWindowBackgroundPixmap (xdisp, parent[0], pixmap); |
2564 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
2565 | XClearWindow (xdisp, parent[0]); |
2565 | XClearWindow (dpy, parent[0]); |
2566 | |
2566 | |
2567 | if (!am_transparent || !am_pixmap_trans) |
2567 | if (!am_transparent || !am_pixmap_trans) |
2568 | pchanged = 1; |
2568 | pchanged = 1; |
2569 | |
2569 | |
2570 | am_transparent = am_pixmap_trans = 1; |
2570 | am_transparent = am_pixmap_trans = 1; |
2571 | } |
2571 | } |
2572 | } |
2572 | } |
2573 | |
2573 | |
2574 | if (am_pixmap_trans) |
2574 | if (am_pixmap_trans) |
2575 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
2575 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
2576 | else |
2576 | else |
2577 | { |
2577 | { |
2578 | unsigned int n; |
2578 | unsigned int n; |
2579 | /* |
2579 | /* |
2580 | * InheritPixmap transparency |
2580 | * InheritPixmap transparency |
2581 | */ |
2581 | */ |
2582 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2582 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2583 | { |
2583 | { |
2584 | oldp = parent[i]; |
2584 | oldp = parent[i]; |
2585 | XQueryTree (xdisp, parent[i - 1], &root, &parent[i], &list, &n); |
2585 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
2586 | XFree (list); |
2586 | XFree (list); |
2587 | |
2587 | |
2588 | if (parent[i] == display->root) |
2588 | if (parent[i] == display->root) |
2589 | { |
2589 | { |
2590 | if (oldp != None) |
2590 | if (oldp != None) |
… | |
… | |
2600 | n = 0; |
2600 | n = 0; |
2601 | |
2601 | |
2602 | if (pchanged) |
2602 | if (pchanged) |
2603 | for (; n < (unsigned int)i; n++) |
2603 | for (; n < (unsigned int)i; n++) |
2604 | { |
2604 | { |
2605 | XGetWindowAttributes (xdisp, parent[n], &wattr); |
2605 | XGetWindowAttributes (dpy, parent[n], &wattr); |
2606 | |
2606 | |
2607 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2607 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2608 | { |
2608 | { |
2609 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2609 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2610 | break; |
2610 | break; |
2611 | } |
2611 | } |
2612 | } |
2612 | } |
2613 | |
2613 | |
2614 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
2614 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
2615 | { |
2615 | { |
2616 | XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); |
2616 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
2617 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2617 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
2618 | am_transparent = 0; |
2618 | am_transparent = 0; |
2619 | /* XXX: also turn off Opt_transparent? */ |
2619 | /* XXX: also turn off Opt_transparent? */ |
2620 | } |
2620 | } |
2621 | else |
2621 | else |
2622 | { |
2622 | { |
2623 | for (n = 0; n < (unsigned int)i; n++) |
2623 | for (n = 0; n < (unsigned int)i; n++) |
2624 | { |
2624 | { |
2625 | XSetWindowBackgroundPixmap (xdisp, parent[n], ParentRelative); |
2625 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
2626 | XClearWindow (xdisp, parent[n]); |
2626 | XClearWindow (dpy, parent[n]); |
2627 | } |
2627 | } |
2628 | |
2628 | |
2629 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
2629 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
2630 | am_transparent = 1; |
2630 | am_transparent = 1; |
2631 | } |
2631 | } |
2632 | |
2632 | |
2633 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2633 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2634 | parent[i] = None; |
2634 | parent[i] = None; |
2635 | } |
2635 | } |
2636 | |
2636 | |
2637 | if (scrollBar.win) |
2637 | if (scrollBar.win) |
2638 | { |
2638 | { |
2639 | XSetWindowBackgroundPixmap (xdisp, scrollBar.win, ParentRelative); |
2639 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2640 | scrollBar.setIdle (); |
2640 | scrollBar.setIdle (); |
2641 | scrollbar_show (0); |
2641 | scrollbar_show (0); |
2642 | } |
2642 | } |
2643 | |
2643 | |
2644 | if (am_transparent) |
2644 | if (am_transparent) |
… | |
… | |
3535 | { |
3535 | { |
3536 | int x, y; |
3536 | int x, y; |
3537 | XWindowAttributes wattr; |
3537 | XWindowAttributes wattr; |
3538 | Window wdummy; |
3538 | Window wdummy; |
3539 | |
3539 | |
3540 | dLocal (Display *, xdisp); |
3540 | dLocal (Display *, dpy); |
3541 | |
3541 | |
3542 | if (nargs == 0) |
3542 | if (nargs == 0) |
3543 | return; |
3543 | return; |
3544 | |
3544 | |
3545 | switch (args[0]) |
3545 | switch (args[0]) |
3546 | { |
3546 | { |
3547 | /* |
3547 | /* |
3548 | * commands |
3548 | * commands |
3549 | */ |
3549 | */ |
3550 | case 1: /* deiconify window */ |
3550 | case 1: /* deiconify window */ |
3551 | XMapWindow (xdisp, parent[0]); |
3551 | XMapWindow (dpy, parent[0]); |
3552 | break; |
3552 | break; |
3553 | case 2: /* iconify window */ |
3553 | case 2: /* iconify window */ |
3554 | XIconifyWindow (xdisp, parent[0], display->screen); |
3554 | XIconifyWindow (dpy, parent[0], display->screen); |
3555 | break; |
3555 | break; |
3556 | case 3: /* set position (pixels) */ |
3556 | case 3: /* set position (pixels) */ |
3557 | XMoveWindow (xdisp, parent[0], args[1], args[2]); |
3557 | XMoveWindow (dpy, parent[0], args[1], args[2]); |
3558 | break; |
3558 | break; |
3559 | case 4: /* set size (pixels) */ |
3559 | case 4: /* set size (pixels) */ |
3560 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3560 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3561 | break; |
3561 | break; |
3562 | case 5: /* raise window */ |
3562 | case 5: /* raise window */ |
3563 | XRaiseWindow (xdisp, parent[0]); |
3563 | XRaiseWindow (dpy, parent[0]); |
3564 | break; |
3564 | break; |
3565 | case 6: /* lower window */ |
3565 | case 6: /* lower window */ |
3566 | XLowerWindow (xdisp, parent[0]); |
3566 | XLowerWindow (dpy, parent[0]); |
3567 | break; |
3567 | break; |
3568 | case 7: /* refresh window */ |
3568 | case 7: /* refresh window */ |
3569 | scr_touch (true); |
3569 | scr_touch (true); |
3570 | break; |
3570 | break; |
3571 | case 8: /* set size (chars) */ |
3571 | case 8: /* set size (chars) */ |
… | |
… | |
3582 | |
3582 | |
3583 | /* |
3583 | /* |
3584 | * reports - some output format copied from XTerm |
3584 | * reports - some output format copied from XTerm |
3585 | */ |
3585 | */ |
3586 | case 11: /* report window state */ |
3586 | case 11: /* report window state */ |
3587 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3587 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3588 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3588 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3589 | break; |
3589 | break; |
3590 | case 13: /* report window position */ |
3590 | case 13: /* report window position */ |
3591 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3591 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3592 | XTranslateCoordinates (xdisp, parent[0], wattr.root, |
3592 | XTranslateCoordinates (dpy, parent[0], wattr.root, |
3593 | -wattr.border_width, -wattr.border_width, |
3593 | -wattr.border_width, -wattr.border_width, |
3594 | &x, &y, &wdummy); |
3594 | &x, &y, &wdummy); |
3595 | tt_printf ("\033[3;%d;%dt", x, y); |
3595 | tt_printf ("\033[3;%d;%dt", x, y); |
3596 | break; |
3596 | break; |
3597 | case 14: /* report window size (pixels) */ |
3597 | case 14: /* report window size (pixels) */ |
3598 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3598 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3599 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3599 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3600 | break; |
3600 | break; |
3601 | case 18: /* report text area size (chars) */ |
3601 | case 18: /* report text area size (chars) */ |
3602 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3602 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3603 | break; |
3603 | break; |
… | |
… | |
3605 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3605 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3606 | break; |
3606 | break; |
3607 | case 20: /* report icon label */ |
3607 | case 20: /* report icon label */ |
3608 | { |
3608 | { |
3609 | char *s; |
3609 | char *s; |
3610 | XGetIconName (xdisp, parent[0], &s); |
3610 | XGetIconName (dpy, parent[0], &s); |
3611 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3611 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3612 | XFree (s); |
3612 | XFree (s); |
3613 | } |
3613 | } |
3614 | break; |
3614 | break; |
3615 | case 21: /* report window title */ |
3615 | case 21: /* report window title */ |
3616 | { |
3616 | { |
3617 | char *s; |
3617 | char *s; |
3618 | XFetchName (xdisp, parent[0], &s); |
3618 | XFetchName (dpy, parent[0], &s); |
3619 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3619 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3620 | XFree (s); |
3620 | XFree (s); |
3621 | } |
3621 | } |
3622 | break; |
3622 | break; |
3623 | } |
3623 | } |
… | |
… | |
3749 | int color; |
3749 | int color; |
3750 | char *buf, *name; |
3750 | char *buf, *name; |
3751 | bool query = str[0] == '?' && !str[1]; |
3751 | bool query = str[0] == '?' && !str[1]; |
3752 | int saveop = op; |
3752 | int saveop = op; |
3753 | |
3753 | |
3754 | dLocal (Display *, xdisp); |
3754 | dLocal (Display *, dpy); |
3755 | |
3755 | |
3756 | assert (str != NULL); |
3756 | assert (str != NULL); |
3757 | switch (op) |
3757 | switch (op) |
3758 | { |
3758 | { |
3759 | case XTerm_name: |
3759 | case XTerm_name: |
… | |
… | |
3775 | unsigned long bytes_after; |
3775 | unsigned long bytes_after; |
3776 | unsigned char *value = 0; |
3776 | unsigned char *value = 0; |
3777 | const char *str = ""; |
3777 | const char *str = ""; |
3778 | |
3778 | |
3779 | if (prop |
3779 | if (prop |
3780 | && XGetWindowProperty (xdisp, parent[0], |
3780 | && XGetWindowProperty (dpy, parent[0], |
3781 | prop, 0, 1<<16, 0, AnyPropertyType, |
3781 | prop, 0, 1<<16, 0, AnyPropertyType, |
3782 | &actual_type, &actual_format, |
3782 | &actual_type, &actual_format, |
3783 | &nitems, &bytes_after, &value) == Success |
3783 | &nitems, &bytes_after, &value) == Success |
3784 | && actual_type != None |
3784 | && actual_type != None |
3785 | && actual_format == 8) |
3785 | && actual_format == 8) |
… | |
… | |
3797 | { |
3797 | { |
3798 | *eq = 0; |
3798 | *eq = 0; |
3799 | set_utf8_property (display->atom (str), eq + 1); |
3799 | set_utf8_property (display->atom (str), eq + 1); |
3800 | } |
3800 | } |
3801 | else |
3801 | else |
3802 | XDeleteProperty (xdisp, parent[0], |
3802 | XDeleteProperty (dpy, parent[0], |
3803 | display->atom (str)); |
3803 | display->atom (str)); |
3804 | } |
3804 | } |
3805 | break; |
3805 | break; |
3806 | |
3806 | |
3807 | case XTerm_Color: |
3807 | case XTerm_Color: |