… | |
… | |
1164 | } |
1164 | } |
1165 | |
1165 | |
1166 | void |
1166 | void |
1167 | rxvt_term::pointer_unblank () |
1167 | rxvt_term::pointer_unblank () |
1168 | { |
1168 | { |
1169 | XDefineCursor (display->display, vt, TermWin_cursor); |
1169 | XDefineCursor (xdisp, vt, TermWin_cursor); |
1170 | recolour_cursor (); |
1170 | recolour_cursor (); |
1171 | |
1171 | |
1172 | #ifdef POINTER_BLANK |
1172 | #ifdef POINTER_BLANK |
1173 | hidden_pointer = 0; |
1173 | hidden_pointer = 0; |
1174 | |
1174 | |
… | |
… | |
1182 | rxvt_term::pointer_blank () |
1182 | rxvt_term::pointer_blank () |
1183 | { |
1183 | { |
1184 | if (!OPTION (Opt_pointerBlank)) |
1184 | if (!OPTION (Opt_pointerBlank)) |
1185 | return; |
1185 | return; |
1186 | |
1186 | |
1187 | XDefineCursor (display->display, vt, display->blank_cursor); |
1187 | XDefineCursor (xdisp, vt, display->blank_cursor); |
1188 | XFlush (display->display); |
1188 | XFlush (xdisp); |
1189 | |
1189 | |
1190 | hidden_pointer = 1; |
1190 | hidden_pointer = 1; |
1191 | } |
1191 | } |
1192 | |
1192 | |
1193 | void |
1193 | void |
… | |
… | |
1266 | (32 + button_number + key_state), |
1266 | (32 + button_number + key_state), |
1267 | (32 + x + 1), |
1267 | (32 + x + 1), |
1268 | (32 + y + 1)); |
1268 | (32 + y + 1)); |
1269 | } |
1269 | } |
1270 | |
1270 | |
1271 | #ifdef USING_W11LIB |
|
|
1272 | void |
|
|
1273 | rxvt_W11_process_x_event (XEvent *ev) |
|
|
1274 | { |
|
|
1275 | rxvt_t *r = rxvt_get_r (); |
|
|
1276 | |
|
|
1277 | x_cb (*ev); |
|
|
1278 | } |
|
|
1279 | #endif |
|
|
1280 | |
|
|
1281 | /*{{{ process an X event */ |
1271 | /*{{{ process an X event */ |
1282 | void |
1272 | void |
1283 | rxvt_term::x_cb (XEvent &ev) |
1273 | rxvt_term::x_cb (XEvent &ev) |
1284 | { |
1274 | { |
1285 | make_current (); |
1275 | make_current (); |
1286 | |
1276 | |
1287 | dDisp; |
1277 | dLocal (Display *, xdisp); |
1288 | |
1278 | |
1289 | if (ev.xany.window == vt |
1279 | if (ev.xany.window == vt |
1290 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1280 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1291 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1281 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1292 | return; |
1282 | return; |
… | |
… | |
1402 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1392 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1403 | destroy (); |
1393 | destroy (); |
1404 | } |
1394 | } |
1405 | #if ENABLE_EWMH |
1395 | #if ENABLE_EWMH |
1406 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1396 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1407 | XSendEvent (disp, ev.xclient.window = display->root, |
1397 | XSendEvent (xdisp, ev.xclient.window = display->root, |
1408 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1398 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1409 | &ev); |
1399 | &ev); |
1410 | #endif |
1400 | #endif |
1411 | } |
1401 | } |
1412 | } |
1402 | } |
… | |
… | |
1460 | break; |
1450 | break; |
1461 | |
1451 | |
1462 | case ConfigureNotify: |
1452 | case ConfigureNotify: |
1463 | if (ev.xconfigure.window == parent[0]) |
1453 | if (ev.xconfigure.window == parent[0]) |
1464 | { |
1454 | { |
1465 | while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1455 | while (XCheckTypedWindowEvent (xdisp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1466 | ; |
1456 | ; |
1467 | |
1457 | |
1468 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1458 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1469 | { |
1459 | { |
1470 | seen_resize = 1; |
1460 | seen_resize = 1; |
… | |
… | |
1528 | if (ev.xany.window == vt) |
1518 | if (ev.xany.window == vt) |
1529 | { |
1519 | { |
1530 | do |
1520 | do |
1531 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1521 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1532 | ev.xexpose.width, ev.xexpose.height, False); |
1522 | ev.xexpose.width, ev.xexpose.height, False); |
1533 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)); |
1523 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)); |
1534 | |
1524 | |
1535 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1525 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1536 | |
1526 | |
1537 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1527 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)) |
1538 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1528 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1539 | ev.xexpose.width, ev.xexpose.height, False); |
1529 | ev.xexpose.width, ev.xexpose.height, False); |
1540 | |
1530 | |
1541 | want_refresh = 1; |
1531 | want_refresh = 1; |
1542 | } |
1532 | } |
1543 | else |
1533 | else |
1544 | { |
1534 | { |
1545 | XEvent unused_event; |
1535 | XEvent unused_event; |
1546 | |
1536 | |
1547 | while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event)) |
1537 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, Expose, &unused_event)) |
1548 | ; |
1538 | ; |
1549 | while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event)) |
1539 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, GraphicsExpose, &unused_event)) |
1550 | ; |
1540 | ; |
1551 | |
1541 | |
1552 | if (isScrollbarWindow (ev.xany.window)) |
1542 | if (isScrollbarWindow (ev.xany.window)) |
1553 | { |
1543 | { |
1554 | scrollBar.setIdle (); |
1544 | scrollBar.setIdle (); |
1555 | scrollbar_show (0); |
1545 | scrollbar_show (0); |
1556 | } |
1546 | } |
1557 | |
1547 | |
1558 | #ifdef TRANSPARENT |
1548 | #ifdef TRANSPARENT |
1559 | if (am_transparent && ev.xany.window == parent[0]) |
1549 | if (am_transparent && ev.xany.window == parent[0]) |
1560 | XClearWindow (disp, ev.xany.window); |
1550 | XClearWindow (xdisp, ev.xany.window); |
1561 | #endif |
1551 | #endif |
1562 | } |
1552 | } |
1563 | break; |
1553 | break; |
1564 | |
1554 | |
1565 | case MotionNotify: |
1555 | case MotionNotify: |
… | |
… | |
1575 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1565 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1576 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1566 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1577 | ; // nop |
1567 | ; // nop |
1578 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1568 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1579 | { |
1569 | { |
1580 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1570 | while (XCheckTypedWindowEvent (xdisp, vt, MotionNotify, &ev)) |
1581 | ; |
1571 | ; |
1582 | |
1572 | |
1583 | XQueryPointer (disp, vt, |
1573 | XQueryPointer (xdisp, vt, |
1584 | &unused_root, &unused_child, |
1574 | &unused_root, &unused_child, |
1585 | &unused_root_x, &unused_root_y, |
1575 | &unused_root_x, &unused_root_y, |
1586 | &ev.xbutton.x, &ev.xbutton.y, |
1576 | &ev.xbutton.x, &ev.xbutton.y, |
1587 | &ev.xbutton.state); |
1577 | &ev.xbutton.state); |
1588 | #ifdef MOUSE_THRESHOLD |
1578 | #ifdef MOUSE_THRESHOLD |
… | |
… | |
1652 | #endif |
1642 | #endif |
1653 | } |
1643 | } |
1654 | } |
1644 | } |
1655 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1645 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1656 | { |
1646 | { |
1657 | while (XCheckTypedWindowEvent (disp, scrollBar.win, |
1647 | while (XCheckTypedWindowEvent (xdisp, scrollBar.win, |
1658 | MotionNotify, &ev)) |
1648 | MotionNotify, &ev)) |
1659 | ; |
1649 | ; |
1660 | |
1650 | |
1661 | XQueryPointer (disp, scrollBar.win, |
1651 | XQueryPointer (xdisp, scrollBar.win, |
1662 | &unused_root, &unused_child, |
1652 | &unused_root, &unused_child, |
1663 | &unused_root_x, &unused_root_y, |
1653 | &unused_root_x, &unused_root_y, |
1664 | &ev.xbutton.x, &ev.xbutton.y, |
1654 | &ev.xbutton.x, &ev.xbutton.y, |
1665 | &unused_mask); |
1655 | &unused_mask); |
1666 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1656 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
… | |
… | |
2181 | #if TINTING |
2171 | #if TINTING |
2182 | /* taken from aterm-0.4.2 */ |
2172 | /* taken from aterm-0.4.2 */ |
2183 | |
2173 | |
2184 | typedef uint32_t RUINT32T; |
2174 | typedef uint32_t RUINT32T; |
2185 | |
2175 | |
2186 | void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm) |
2176 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
2187 | { |
2177 | { |
2188 | int sh_r, sh_g, sh_b; |
2178 | int sh_r, sh_g, sh_b; |
2189 | RUINT32T mask_r, mask_g, mask_b; |
2179 | RUINT32T mask_r, mask_g, mask_b; |
2190 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
2180 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
2191 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
2181 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
2192 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
2182 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
2193 | int i; |
2183 | int i; |
2194 | |
2184 | |
2195 | Visual *visual = display->visual; |
2185 | Visual *visual = term->visual; |
2196 | |
2186 | |
2197 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
2187 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
2198 | |
2188 | |
2199 | /* for convenience */ |
2189 | /* for convenience */ |
2200 | mask_r = visual->red_mask; |
2190 | mask_r = visual->red_mask; |
… | |
… | |
2421 | Atom atype; |
2411 | Atom atype; |
2422 | unsigned char *prop = NULL; |
2412 | unsigned char *prop = NULL; |
2423 | Window root, oldp, *list; |
2413 | Window root, oldp, *list; |
2424 | Pixmap rootpixmap = None; |
2414 | Pixmap rootpixmap = None; |
2425 | XWindowAttributes wattr, wrootattr; |
2415 | XWindowAttributes wattr, wrootattr; |
2426 | dDisp; |
|
|
2427 | |
2416 | |
2428 | pchanged = 0; |
2417 | pchanged = 0; |
2429 | |
2418 | |
2430 | if (!OPTION (Opt_transparent)) |
2419 | if (!OPTION (Opt_transparent)) |
2431 | return pchanged; /* Don't try any more */ |
2420 | return pchanged; /* Don't try any more */ |
2432 | |
2421 | |
2433 | XGetWindowAttributes (disp, display->root, &wrootattr); |
2422 | XGetWindowAttributes (xdisp, display->root, &wrootattr); |
2434 | rootdepth = wrootattr.depth; |
2423 | rootdepth = wrootattr.depth; |
2435 | |
2424 | |
2436 | XGetWindowAttributes (disp, parent[0], &wattr); |
2425 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
2437 | |
2426 | |
2438 | if (rootdepth != wattr.depth) |
2427 | if (rootdepth != wattr.depth) |
2439 | { |
2428 | { |
2440 | if (am_transparent) |
2429 | if (am_transparent) |
2441 | { |
2430 | { |
2442 | pchanged = 1; |
2431 | pchanged = 1; |
2443 | XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); |
2432 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2444 | am_transparent = am_pixmap_trans = 0; |
2433 | am_transparent = am_pixmap_trans = 0; |
2445 | } |
2434 | } |
2446 | |
2435 | |
2447 | return pchanged; /* Don't try any more */ |
2436 | return pchanged; /* Don't try any more */ |
2448 | } |
2437 | } |
2449 | |
2438 | |
2450 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
2439 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
2451 | XSync (disp, False); |
2440 | XSync (xdisp, False); |
2452 | |
2441 | |
2453 | /* |
2442 | /* |
2454 | * Make the frame window set by the window manager have |
2443 | * Make the frame window set by the window manager have |
2455 | * the root background. Some window managers put multiple nested frame |
2444 | * the root background. Some window managers put multiple nested frame |
2456 | * windows for each client, so we have to take care about that. |
2445 | * windows for each client, so we have to take care about that. |
2457 | */ |
2446 | */ |
2458 | i = (xa[XA_XROOTPMAP_ID] |
2447 | i = (xa[XA_XROOTPMAP_ID] |
2459 | && XGetWindowProperty (disp, display->root, xa[XA_XROOTPMAP_ID], |
2448 | && XGetWindowProperty (xdisp, display->root, xa[XA_XROOTPMAP_ID], |
2460 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2449 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2461 | &nitems, &bytes_after, &prop) == Success); |
2450 | &nitems, &bytes_after, &prop) == Success); |
2462 | |
2451 | |
2463 | if (!i || prop == NULL) |
2452 | if (!i || prop == NULL) |
2464 | i = (xa[XA_ESETROOT_PMAP_ID] |
2453 | i = (xa[XA_ESETROOT_PMAP_ID] |
2465 | && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID], |
2454 | && XGetWindowProperty (xdisp, display->root, xa[XA_ESETROOT_PMAP_ID], |
2466 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2455 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2467 | &nitems, &bytes_after, &prop) == Success); |
2456 | &nitems, &bytes_after, &prop) == Success); |
2468 | |
2457 | |
2469 | if (!i || prop == NULL |
2458 | if (!i || prop == NULL |
2470 | #if TINTING |
2459 | #if TINTING |
… | |
… | |
2489 | Window cr; |
2478 | Window cr; |
2490 | XImage *image; |
2479 | XImage *image; |
2491 | GC gc; |
2480 | GC gc; |
2492 | XGCValues gcvalue; |
2481 | XGCValues gcvalue; |
2493 | |
2482 | |
2494 | XTranslateCoordinates (disp, parent[0], display->root, |
2483 | XTranslateCoordinates (xdisp, parent[0], display->root, |
2495 | 0, 0, &sx, &sy, &cr); |
2484 | 0, 0, &sx, &sy, &cr); |
2496 | nw = (unsigned int)szHint.width; |
2485 | nw = (unsigned int)szHint.width; |
2497 | nh = (unsigned int)szHint.height; |
2486 | nh = (unsigned int)szHint.height; |
2498 | nx = ny = 0; |
2487 | nx = ny = 0; |
2499 | |
2488 | |
… | |
… | |
2512 | } |
2501 | } |
2513 | |
2502 | |
2514 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2503 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2515 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2504 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2516 | |
2505 | |
2517 | XSync (disp, False); |
2506 | XSync (xdisp, False); |
2518 | allowedxerror = -1; |
2507 | allowedxerror = -1; |
2519 | image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2508 | image = XGetImage (xdisp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2520 | |
2509 | |
2521 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2510 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2522 | /* XXX: may need a delay here? */ |
2511 | /* XXX: may need a delay here? */ |
2523 | allowedxerror = 0; |
2512 | allowedxerror = 0; |
2524 | |
2513 | |
… | |
… | |
2527 | if (am_transparent && am_pixmap_trans) |
2516 | if (am_transparent && am_pixmap_trans) |
2528 | { |
2517 | { |
2529 | pchanged = 1; |
2518 | pchanged = 1; |
2530 | if (pixmap != None) |
2519 | if (pixmap != None) |
2531 | { |
2520 | { |
2532 | XFreePixmap (disp, pixmap); |
2521 | XFreePixmap (xdisp, pixmap); |
2533 | pixmap = None; |
2522 | pixmap = None; |
2534 | } |
2523 | } |
2535 | } |
2524 | } |
2536 | |
2525 | |
2537 | am_pixmap_trans = 0; |
2526 | am_pixmap_trans = 0; |
2538 | } |
2527 | } |
2539 | else |
2528 | else |
2540 | { |
2529 | { |
2541 | if (pixmap != None) |
2530 | if (pixmap != None) |
2542 | XFreePixmap (disp, pixmap); |
2531 | XFreePixmap (xdisp, pixmap); |
2543 | |
2532 | |
2544 | #if TINTING |
2533 | #if TINTING |
2545 | if (ISSET_PIXCOLOR (Color_tint)) |
2534 | if (ISSET_PIXCOLOR (Color_tint)) |
2546 | { |
2535 | { |
2547 | unsigned short rm, gm, bm; |
2536 | unsigned short rm, gm, bm; |
2548 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2537 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2549 | |
2538 | |
2550 | pix_colors_focused[Color_tint].get (display, rm, gm, bm); |
2539 | pix_colors_focused[Color_tint].get (this, rm, gm, bm); |
2551 | |
2540 | |
2552 | ShadeXImage (display, image, shade, rm, gm, bm); |
2541 | ShadeXImage (this, image, shade, rm, gm, bm); |
2553 | } |
2542 | } |
2554 | #endif |
2543 | #endif |
2555 | |
2544 | |
2556 | pixmap = XCreatePixmap (disp, vt, |
2545 | pixmap = XCreatePixmap (xdisp, vt, szHint.width, szHint.height, image->depth); |
2557 | szHint.width, szHint.height, image->depth); |
|
|
2558 | gc = XCreateGC (disp, vt, 0UL, &gcvalue); |
2546 | gc = XCreateGC (xdisp, vt, 0UL, &gcvalue); |
2559 | XPutImage (disp, pixmap, gc, image, 0, 0, |
2547 | XPutImage (xdisp, pixmap, gc, image, 0, 0, |
2560 | nx, ny, image->width, image->height); |
2548 | nx, ny, image->width, image->height); |
2561 | XFreeGC (disp, gc); |
2549 | XFreeGC (xdisp, gc); |
2562 | XDestroyImage (image); |
2550 | XDestroyImage (image); |
2563 | XSetWindowBackgroundPixmap (disp, parent[0], pixmap); |
2551 | XSetWindowBackgroundPixmap (xdisp, parent[0], pixmap); |
2564 | XClearWindow (disp, parent[0]); |
2552 | XClearWindow (xdisp, parent[0]); |
2565 | |
2553 | |
2566 | if (!am_transparent || !am_pixmap_trans) |
2554 | if (!am_transparent || !am_pixmap_trans) |
2567 | pchanged = 1; |
2555 | pchanged = 1; |
2568 | |
2556 | |
2569 | am_transparent = am_pixmap_trans = 1; |
2557 | am_transparent = am_pixmap_trans = 1; |
2570 | } |
2558 | } |
2571 | } |
2559 | } |
2572 | |
2560 | |
2573 | if (am_pixmap_trans) |
2561 | if (am_pixmap_trans) |
2574 | XSetWindowBackgroundPixmap (disp, vt, ParentRelative); |
2562 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
2575 | else |
2563 | else |
2576 | { |
2564 | { |
2577 | unsigned int n; |
2565 | unsigned int n; |
2578 | /* |
2566 | /* |
2579 | * InheritPixmap transparency |
2567 | * InheritPixmap transparency |
2580 | */ |
2568 | */ |
2581 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2569 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2582 | { |
2570 | { |
2583 | oldp = parent[i]; |
2571 | oldp = parent[i]; |
2584 | XQueryTree (disp, parent[i - 1], &root, |
2572 | XQueryTree (xdisp, parent[i - 1], &root, |
2585 | &parent[i], &list, &n); |
2573 | &parent[i], &list, &n); |
2586 | XFree (list); |
2574 | XFree (list); |
2587 | |
2575 | |
2588 | if (parent[i] == display->root) |
2576 | if (parent[i] == display->root) |
2589 | { |
2577 | { |
… | |
… | |
2601 | |
2589 | |
2602 | if (pchanged) |
2590 | if (pchanged) |
2603 | { |
2591 | { |
2604 | for (; n < (unsigned int)i; n++) |
2592 | for (; n < (unsigned int)i; n++) |
2605 | { |
2593 | { |
2606 | XGetWindowAttributes (disp, parent[n], &wattr); |
2594 | XGetWindowAttributes (xdisp, parent[n], &wattr); |
2607 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2595 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2608 | { |
2596 | { |
2609 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2597 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2610 | break; |
2598 | break; |
2611 | } |
2599 | } |
2612 | } |
2600 | } |
2613 | } |
2601 | } |
2614 | |
2602 | |
2615 | if (n > (int) (sizeof (parent) / sizeof (parent[0]))) |
2603 | if (n > (int) (sizeof (parent) / sizeof (parent[0]))) |
2616 | { |
2604 | { |
2617 | XSetWindowBackground (disp, parent[0], pix_colors_focused[Color_border]); |
2605 | XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); |
2618 | XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); |
2606 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2619 | am_transparent = 0; |
2607 | am_transparent = 0; |
2620 | /* XXX: also turn off Opt_transparent? */ |
2608 | /* XXX: also turn off Opt_transparent? */ |
2621 | } |
2609 | } |
2622 | else |
2610 | else |
2623 | { |
2611 | { |
2624 | for (n = 0; n < (unsigned int)i; n++) |
2612 | for (n = 0; n < (unsigned int)i; n++) |
2625 | { |
2613 | { |
2626 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2614 | XSetWindowBackgroundPixmap (xdisp, parent[n], ParentRelative); |
2627 | XClearWindow (disp, parent[n]); |
2615 | XClearWindow (xdisp, parent[n]); |
2628 | } |
2616 | } |
2629 | |
2617 | |
2630 | XSetWindowBackgroundPixmap (disp, vt, ParentRelative); |
2618 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
2631 | am_transparent = 1; |
2619 | am_transparent = 1; |
2632 | } |
2620 | } |
2633 | |
2621 | |
2634 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2622 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2635 | parent[i] = None; |
2623 | parent[i] = None; |
2636 | } |
2624 | } |
2637 | |
2625 | |
2638 | if (scrollBar.win) |
2626 | if (scrollBar.win) |
2639 | { |
2627 | { |
2640 | XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative); |
2628 | XSetWindowBackgroundPixmap (xdisp, scrollBar.win, ParentRelative); |
2641 | scrollBar.setIdle (); |
2629 | scrollBar.setIdle (); |
2642 | scrollbar_show (0); |
2630 | scrollbar_show (0); |
2643 | } |
2631 | } |
2644 | |
2632 | |
2645 | if (am_transparent) |
2633 | if (am_transparent) |
… | |
… | |
3290 | { |
3278 | { |
3291 | case '>': |
3279 | case '>': |
3292 | if (ch == CSI_DA) /* secondary device attributes */ |
3280 | if (ch == CSI_DA) /* secondary device attributes */ |
3293 | { |
3281 | { |
3294 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
3282 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
3295 | // 'U' for rxvt-unicode <= 7.2, and Mm85 (e.g. 7385 for 7.3) for later versions. |
3283 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
3296 | // |
3284 | // |
3297 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
3285 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
3298 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
3286 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
3299 | // that we do not support xterm mouse reporting (should be 95 when we do). |
3287 | // that we do not support xterm mouse reporting (should be 95 when we do). |
3300 | // |
3288 | // |
3301 | tt_printf ("\033[>%c%c85;94;0c", VERSION[0], VERSION[1]); |
3289 | tt_printf ("\033[>%d;94;0c", 'U'); |
3302 | } |
3290 | } |
3303 | break; |
3291 | break; |
3304 | case '?': |
3292 | case '?': |
3305 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3293 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3306 | process_terminal_mode (ch, priv, nargs, arg); |
3294 | process_terminal_mode (ch, priv, nargs, arg); |
… | |
… | |
3535 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
3523 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
3536 | { |
3524 | { |
3537 | int x, y; |
3525 | int x, y; |
3538 | XWindowAttributes wattr; |
3526 | XWindowAttributes wattr; |
3539 | Window wdummy; |
3527 | Window wdummy; |
3540 | dDisp; |
3528 | |
|
|
3529 | dLocal (Display *, xdisp); |
3541 | |
3530 | |
3542 | if (nargs == 0) |
3531 | if (nargs == 0) |
3543 | return; |
3532 | return; |
3544 | |
3533 | |
3545 | switch (args[0]) |
3534 | switch (args[0]) |
3546 | { |
3535 | { |
3547 | /* |
3536 | /* |
3548 | * commands |
3537 | * commands |
3549 | */ |
3538 | */ |
3550 | case 1: /* deiconify window */ |
3539 | case 1: /* deiconify window */ |
3551 | XMapWindow (disp, parent[0]); |
3540 | XMapWindow (xdisp, parent[0]); |
3552 | break; |
3541 | break; |
3553 | case 2: /* iconify window */ |
3542 | case 2: /* iconify window */ |
3554 | XIconifyWindow (disp, parent[0], display->screen); |
3543 | XIconifyWindow (xdisp, parent[0], display->screen); |
3555 | break; |
3544 | break; |
3556 | case 3: /* set position (pixels) */ |
3545 | case 3: /* set position (pixels) */ |
3557 | XMoveWindow (disp, parent[0], args[1], args[2]); |
3546 | XMoveWindow (xdisp, parent[0], args[1], args[2]); |
3558 | break; |
3547 | break; |
3559 | case 4: /* set size (pixels) */ |
3548 | case 4: /* set size (pixels) */ |
3560 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3549 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3561 | break; |
3550 | break; |
3562 | case 5: /* raise window */ |
3551 | case 5: /* raise window */ |
3563 | XRaiseWindow (disp, parent[0]); |
3552 | XRaiseWindow (xdisp, parent[0]); |
3564 | break; |
3553 | break; |
3565 | case 6: /* lower window */ |
3554 | case 6: /* lower window */ |
3566 | XLowerWindow (disp, parent[0]); |
3555 | XLowerWindow (xdisp, parent[0]); |
3567 | break; |
3556 | break; |
3568 | case 7: /* refresh window */ |
3557 | case 7: /* refresh window */ |
3569 | scr_touch (true); |
3558 | scr_touch (true); |
3570 | break; |
3559 | break; |
3571 | case 8: /* set size (chars) */ |
3560 | case 8: /* set size (chars) */ |
… | |
… | |
3583 | |
3572 | |
3584 | /* |
3573 | /* |
3585 | * reports - some output format copied from XTerm |
3574 | * reports - some output format copied from XTerm |
3586 | */ |
3575 | */ |
3587 | case 11: /* report window state */ |
3576 | case 11: /* report window state */ |
3588 | XGetWindowAttributes (disp, parent[0], &wattr); |
3577 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3589 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3578 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3590 | break; |
3579 | break; |
3591 | case 13: /* report window position */ |
3580 | case 13: /* report window position */ |
3592 | XGetWindowAttributes (disp, parent[0], &wattr); |
3581 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3593 | XTranslateCoordinates (disp, parent[0], wattr.root, |
3582 | XTranslateCoordinates (xdisp, parent[0], wattr.root, |
3594 | -wattr.border_width, -wattr.border_width, |
3583 | -wattr.border_width, -wattr.border_width, |
3595 | &x, &y, &wdummy); |
3584 | &x, &y, &wdummy); |
3596 | tt_printf ("\033[3;%d;%dt", x, y); |
3585 | tt_printf ("\033[3;%d;%dt", x, y); |
3597 | break; |
3586 | break; |
3598 | case 14: /* report window size (pixels) */ |
3587 | case 14: /* report window size (pixels) */ |
3599 | XGetWindowAttributes (disp, parent[0], &wattr); |
3588 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3600 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3589 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3601 | break; |
3590 | break; |
3602 | case 18: /* report text area size (chars) */ |
3591 | case 18: /* report text area size (chars) */ |
3603 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3592 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3604 | break; |
3593 | break; |
… | |
… | |
3606 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3595 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3607 | break; |
3596 | break; |
3608 | case 20: /* report icon label */ |
3597 | case 20: /* report icon label */ |
3609 | { |
3598 | { |
3610 | char *s; |
3599 | char *s; |
3611 | XGetIconName (disp, parent[0], &s); |
3600 | XGetIconName (xdisp, parent[0], &s); |
3612 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3601 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3613 | XFree (s); |
3602 | XFree (s); |
3614 | } |
3603 | } |
3615 | break; |
3604 | break; |
3616 | case 21: /* report window title */ |
3605 | case 21: /* report window title */ |
3617 | { |
3606 | { |
3618 | char *s; |
3607 | char *s; |
3619 | XFetchName (disp, parent[0], &s); |
3608 | XFetchName (xdisp, parent[0], &s); |
3620 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3609 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3621 | XFree (s); |
3610 | XFree (s); |
3622 | } |
3611 | } |
3623 | break; |
3612 | break; |
3624 | } |
3613 | } |
… | |
… | |
3726 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3715 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3727 | { |
3716 | { |
3728 | if (str[0] == '?' && !str[1]) |
3717 | if (str[0] == '?' && !str[1]) |
3729 | { |
3718 | { |
3730 | unsigned short r, g, b; |
3719 | unsigned short r, g, b; |
3731 | pix_colors_focused[color].get (display, r, g, b); |
3720 | pix_colors_focused[color].get (this, r, g, b); |
3732 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); |
3721 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); |
3733 | } |
3722 | } |
3734 | else |
3723 | else |
3735 | set_window_color (color, str); |
3724 | set_window_color (color, str); |
3736 | } |
3725 | } |
… | |
… | |
3743 | { |
3732 | { |
3744 | int color; |
3733 | int color; |
3745 | char *buf, *name; |
3734 | char *buf, *name; |
3746 | bool query = str[0] == '?' && !str[1]; |
3735 | bool query = str[0] == '?' && !str[1]; |
3747 | int saveop = op; |
3736 | int saveop = op; |
3748 | dDisp; |
3737 | |
|
|
3738 | dLocal (Display *, xdisp); |
3749 | |
3739 | |
3750 | assert (str != NULL); |
3740 | assert (str != NULL); |
3751 | switch (op) |
3741 | switch (op) |
3752 | { |
3742 | { |
3753 | case XTerm_name: |
3743 | case XTerm_name: |
… | |
… | |
3769 | unsigned long bytes_after; |
3759 | unsigned long bytes_after; |
3770 | unsigned char *value = 0; |
3760 | unsigned char *value = 0; |
3771 | const char *str = ""; |
3761 | const char *str = ""; |
3772 | |
3762 | |
3773 | if (prop |
3763 | if (prop |
3774 | && XGetWindowProperty (disp, parent[0], |
3764 | && XGetWindowProperty (xdisp, parent[0], |
3775 | prop, 0, 1<<16, 0, AnyPropertyType, |
3765 | prop, 0, 1<<16, 0, AnyPropertyType, |
3776 | &actual_type, &actual_format, |
3766 | &actual_type, &actual_format, |
3777 | &nitems, &bytes_after, &value) == Success |
3767 | &nitems, &bytes_after, &value) == Success |
3778 | && actual_type != None |
3768 | && actual_type != None |
3779 | && actual_format == 8) |
3769 | && actual_format == 8) |
… | |
… | |
3791 | { |
3781 | { |
3792 | *eq = 0; |
3782 | *eq = 0; |
3793 | set_utf8_property (display->atom (str), eq + 1); |
3783 | set_utf8_property (display->atom (str), eq + 1); |
3794 | } |
3784 | } |
3795 | else |
3785 | else |
3796 | XDeleteProperty (disp, parent[0], |
3786 | XDeleteProperty (xdisp, parent[0], |
3797 | display->atom (str)); |
3787 | display->atom (str)); |
3798 | } |
3788 | } |
3799 | break; |
3789 | break; |
3800 | |
3790 | |
3801 | case XTerm_Color: |
3791 | case XTerm_Color: |
… | |
… | |
3814 | *buf++ = '\0'; |
3804 | *buf++ = '\0'; |
3815 | |
3805 | |
3816 | if (name[0] == '?' && !name[1]) |
3806 | if (name[0] == '?' && !name[1]) |
3817 | { |
3807 | { |
3818 | unsigned short r, g, b; |
3808 | unsigned short r, g, b; |
3819 | pix_colors_focused[color].get (display, r, g, b); |
3809 | pix_colors_focused[color].get (this, r, g, b); |
3820 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3810 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3821 | } |
3811 | } |
3822 | else |
3812 | else |
3823 | set_window_color (color, name); |
3813 | set_window_color (color, name); |
3824 | } |
3814 | } |
… | |
… | |
3938 | |
3928 | |
3939 | res = strdup (str); |
3929 | res = strdup (str); |
3940 | allocated.push_back ((void *)res); |
3930 | allocated.push_back ((void *)res); |
3941 | set_fonts (); |
3931 | set_fonts (); |
3942 | } |
3932 | } |
|
|
3933 | break; |
|
|
3934 | |
|
|
3935 | case URxvt_version: |
|
|
3936 | if (query) |
|
|
3937 | tt_printf ("\33]%d;rxvt-unicode;%-.20s;%c;%c%c", |
|
|
3938 | URxvt_version, |
|
|
3939 | rs[Rs_name], |
|
|
3940 | VERSION[0], VERSION[2], |
|
|
3941 | resp); |
3943 | break; |
3942 | break; |
3944 | |
3943 | |
3945 | #if ENABLE_FRILLS |
3944 | #if ENABLE_FRILLS |
3946 | case URxvt_locale: |
3945 | case URxvt_locale: |
3947 | if (query) |
3946 | if (query) |