ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.284 by root, Wed Jan 25 02:42:06 2006 UTC vs.
Revision 1.285 by root, Wed Jan 25 21:03:04 2006 UTC

1272void 1272void
1273rxvt_term::x_cb (XEvent &ev) 1273rxvt_term::x_cb (XEvent &ev)
1274{ 1274{
1275 make_current (); 1275 make_current ();
1276 1276
1277 dDisp; 1277 dLocal (Display *, xdisp);
1278 1278
1279 if (ev.xany.window == vt 1279 if (ev.xany.window == vt
1280 && SHOULD_INVOKE (HOOK_X_EVENT) 1280 && SHOULD_INVOKE (HOOK_X_EVENT)
1281 && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) 1281 && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END)))
1282 return; 1282 return;
1392 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)))
1393 destroy (); 1393 destroy ();
1394 } 1394 }
1395#if ENABLE_EWMH 1395#if ENABLE_EWMH
1396 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])
1397 XSendEvent (disp, ev.xclient.window = display->root, 1397 XSendEvent (xdisp, ev.xclient.window = display->root,
1398 False, SubstructureRedirectMask | SubstructureNotifyMask, 1398 False, SubstructureRedirectMask | SubstructureNotifyMask,
1399 &ev); 1399 &ev);
1400#endif 1400#endif
1401 } 1401 }
1402 } 1402 }
1450 break; 1450 break;
1451 1451
1452 case ConfigureNotify: 1452 case ConfigureNotify:
1453 if (ev.xconfigure.window == parent[0]) 1453 if (ev.xconfigure.window == parent[0])
1454 { 1454 {
1455 while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev)) 1455 while (XCheckTypedWindowEvent (xdisp, ev.xconfigure.window, ConfigureNotify, &ev))
1456 ; 1456 ;
1457 1457
1458 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1458 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1459 { 1459 {
1460 seen_resize = 1; 1460 seen_resize = 1;
1518 if (ev.xany.window == vt) 1518 if (ev.xany.window == vt)
1519 { 1519 {
1520 do 1520 do
1521 scr_expose (ev.xexpose.x, ev.xexpose.y, 1521 scr_expose (ev.xexpose.x, ev.xexpose.y,
1522 ev.xexpose.width, ev.xexpose.height, False); 1522 ev.xexpose.width, ev.xexpose.height, False);
1523 while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)); 1523 while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev));
1524 1524
1525 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1525 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1526 1526
1527 while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) 1527 while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev))
1528 scr_expose (ev.xexpose.x, ev.xexpose.y, 1528 scr_expose (ev.xexpose.x, ev.xexpose.y,
1529 ev.xexpose.width, ev.xexpose.height, False); 1529 ev.xexpose.width, ev.xexpose.height, False);
1530 1530
1531 want_refresh = 1; 1531 want_refresh = 1;
1532 } 1532 }
1533 else 1533 else
1534 { 1534 {
1535 XEvent unused_event; 1535 XEvent unused_event;
1536 1536
1537 while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event)) 1537 while (XCheckTypedWindowEvent (xdisp, ev.xany.window, Expose, &unused_event))
1538 ; 1538 ;
1539 while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event)) 1539 while (XCheckTypedWindowEvent (xdisp, ev.xany.window, GraphicsExpose, &unused_event))
1540 ; 1540 ;
1541 1541
1542 if (isScrollbarWindow (ev.xany.window)) 1542 if (isScrollbarWindow (ev.xany.window))
1543 { 1543 {
1544 scrollBar.setIdle (); 1544 scrollBar.setIdle ();
1545 scrollbar_show (0); 1545 scrollbar_show (0);
1546 } 1546 }
1547 1547
1548#ifdef TRANSPARENT 1548#ifdef TRANSPARENT
1549 if (am_transparent && ev.xany.window == parent[0]) 1549 if (am_transparent && ev.xany.window == parent[0])
1550 XClearWindow (disp, ev.xany.window); 1550 XClearWindow (xdisp, ev.xany.window);
1551#endif 1551#endif
1552 } 1552 }
1553 break; 1553 break;
1554 1554
1555 case MotionNotify: 1555 case MotionNotify:
1565 if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) 1565 if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY)
1566 && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) 1566 && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END)))
1567 ; // nop 1567 ; // nop
1568 else if (ev.xbutton.state & (Button1Mask | Button3Mask)) 1568 else if (ev.xbutton.state & (Button1Mask | Button3Mask))
1569 { 1569 {
1570 while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) 1570 while (XCheckTypedWindowEvent (xdisp, vt, MotionNotify, &ev))
1571 ; 1571 ;
1572 1572
1573 XQueryPointer (disp, vt, 1573 XQueryPointer (xdisp, vt,
1574 &unused_root, &unused_child, 1574 &unused_root, &unused_child,
1575 &unused_root_x, &unused_root_y, 1575 &unused_root_x, &unused_root_y,
1576 &ev.xbutton.x, &ev.xbutton.y, 1576 &ev.xbutton.x, &ev.xbutton.y,
1577 &ev.xbutton.state); 1577 &ev.xbutton.state);
1578#ifdef MOUSE_THRESHOLD 1578#ifdef MOUSE_THRESHOLD
1642#endif 1642#endif
1643 } 1643 }
1644 } 1644 }
1645 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1645 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ())
1646 { 1646 {
1647 while (XCheckTypedWindowEvent (disp, scrollBar.win, 1647 while (XCheckTypedWindowEvent (xdisp, scrollBar.win,
1648 MotionNotify, &ev)) 1648 MotionNotify, &ev))
1649 ; 1649 ;
1650 1650
1651 XQueryPointer (disp, scrollBar.win, 1651 XQueryPointer (xdisp, scrollBar.win,
1652 &unused_root, &unused_child, 1652 &unused_root, &unused_child,
1653 &unused_root_x, &unused_root_y, 1653 &unused_root_x, &unused_root_y,
1654 &ev.xbutton.x, &ev.xbutton.y, 1654 &ev.xbutton.x, &ev.xbutton.y,
1655 &unused_mask); 1655 &unused_mask);
1656 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1656 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
2171#if TINTING 2171#if TINTING
2172/* taken from aterm-0.4.2 */ 2172/* taken from aterm-0.4.2 */
2173 2173
2174typedef uint32_t RUINT32T; 2174typedef uint32_t RUINT32T;
2175 2175
2176void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm) 2176void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm)
2177{ 2177{
2178 int sh_r, sh_g, sh_b; 2178 int sh_r, sh_g, sh_b;
2179 RUINT32T mask_r, mask_g, mask_b; 2179 RUINT32T mask_r, mask_g, mask_b;
2180 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; 2180 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
2181 unsigned int lower_lim_r, lower_lim_g, lower_lim_b; 2181 unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
2182 unsigned int upper_lim_r, upper_lim_g, upper_lim_b; 2182 unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
2183 int i; 2183 int i;
2184 2184
2185 Visual *visual = display->visual; 2185 Visual *visual = term->visual;
2186 2186
2187 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; 2187 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
2188 2188
2189 /* for convenience */ 2189 /* for convenience */
2190 mask_r = visual->red_mask; 2190 mask_r = visual->red_mask;
2411 Atom atype; 2411 Atom atype;
2412 unsigned char *prop = NULL; 2412 unsigned char *prop = NULL;
2413 Window root, oldp, *list; 2413 Window root, oldp, *list;
2414 Pixmap rootpixmap = None; 2414 Pixmap rootpixmap = None;
2415 XWindowAttributes wattr, wrootattr; 2415 XWindowAttributes wattr, wrootattr;
2416 dDisp;
2417 2416
2418 pchanged = 0; 2417 pchanged = 0;
2419 2418
2420 if (!OPTION (Opt_transparent)) 2419 if (!OPTION (Opt_transparent))
2421 return pchanged; /* Don't try any more */ 2420 return pchanged; /* Don't try any more */
2422 2421
2423 XGetWindowAttributes (disp, display->root, &wrootattr); 2422 XGetWindowAttributes (xdisp, display->root, &wrootattr);
2424 rootdepth = wrootattr.depth; 2423 rootdepth = wrootattr.depth;
2425 2424
2426 XGetWindowAttributes (disp, parent[0], &wattr); 2425 XGetWindowAttributes (xdisp, parent[0], &wattr);
2427 2426
2428 if (rootdepth != wattr.depth) 2427 if (rootdepth != wattr.depth)
2429 { 2428 {
2430 if (am_transparent) 2429 if (am_transparent)
2431 { 2430 {
2432 pchanged = 1; 2431 pchanged = 1;
2433 XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); 2432 XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]);
2434 am_transparent = am_pixmap_trans = 0; 2433 am_transparent = am_pixmap_trans = 0;
2435 } 2434 }
2436 2435
2437 return pchanged; /* Don't try any more */ 2436 return pchanged; /* Don't try any more */
2438 } 2437 }
2439 2438
2440 /* 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. */
2441 XSync (disp, False); 2440 XSync (xdisp, False);
2442 2441
2443 /* 2442 /*
2444 * Make the frame window set by the window manager have 2443 * Make the frame window set by the window manager have
2445 * the root background. Some window managers put multiple nested frame 2444 * the root background. Some window managers put multiple nested frame
2446 * 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.
2447 */ 2446 */
2448 i = (xa[XA_XROOTPMAP_ID] 2447 i = (xa[XA_XROOTPMAP_ID]
2449 && XGetWindowProperty (disp, display->root, xa[XA_XROOTPMAP_ID], 2448 && XGetWindowProperty (xdisp, display->root, xa[XA_XROOTPMAP_ID],
2450 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2449 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2451 &nitems, &bytes_after, &prop) == Success); 2450 &nitems, &bytes_after, &prop) == Success);
2452 2451
2453 if (!i || prop == NULL) 2452 if (!i || prop == NULL)
2454 i = (xa[XA_ESETROOT_PMAP_ID] 2453 i = (xa[XA_ESETROOT_PMAP_ID]
2455 && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID], 2454 && XGetWindowProperty (xdisp, display->root, xa[XA_ESETROOT_PMAP_ID],
2456 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2455 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2457 &nitems, &bytes_after, &prop) == Success); 2456 &nitems, &bytes_after, &prop) == Success);
2458 2457
2459 if (!i || prop == NULL 2458 if (!i || prop == NULL
2460#if TINTING 2459#if TINTING
2479 Window cr; 2478 Window cr;
2480 XImage *image; 2479 XImage *image;
2481 GC gc; 2480 GC gc;
2482 XGCValues gcvalue; 2481 XGCValues gcvalue;
2483 2482
2484 XTranslateCoordinates (disp, parent[0], display->root, 2483 XTranslateCoordinates (xdisp, parent[0], display->root,
2485 0, 0, &sx, &sy, &cr); 2484 0, 0, &sx, &sy, &cr);
2486 nw = (unsigned int)szHint.width; 2485 nw = (unsigned int)szHint.width;
2487 nh = (unsigned int)szHint.height; 2486 nh = (unsigned int)szHint.height;
2488 nx = ny = 0; 2487 nx = ny = 0;
2489 2488
2502 } 2501 }
2503 2502
2504 min_it (nw, (unsigned int) (wrootattr.width - sx)); 2503 min_it (nw, (unsigned int) (wrootattr.width - sx));
2505 min_it (nh, (unsigned int) (wrootattr.height - sy)); 2504 min_it (nh, (unsigned int) (wrootattr.height - sy));
2506 2505
2507 XSync (disp, False); 2506 XSync (xdisp, False);
2508 allowedxerror = -1; 2507 allowedxerror = -1;
2509 image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2508 image = XGetImage (xdisp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2510 2509
2511 /* XXX: handle BadMatch - usually because we're outside the pixmap */ 2510 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2512 /* XXX: may need a delay here? */ 2511 /* XXX: may need a delay here? */
2513 allowedxerror = 0; 2512 allowedxerror = 0;
2514 2513
2517 if (am_transparent && am_pixmap_trans) 2516 if (am_transparent && am_pixmap_trans)
2518 { 2517 {
2519 pchanged = 1; 2518 pchanged = 1;
2520 if (pixmap != None) 2519 if (pixmap != None)
2521 { 2520 {
2522 XFreePixmap (disp, pixmap); 2521 XFreePixmap (xdisp, pixmap);
2523 pixmap = None; 2522 pixmap = None;
2524 } 2523 }
2525 } 2524 }
2526 2525
2527 am_pixmap_trans = 0; 2526 am_pixmap_trans = 0;
2528 } 2527 }
2529 else 2528 else
2530 { 2529 {
2531 if (pixmap != None) 2530 if (pixmap != None)
2532 XFreePixmap (disp, pixmap); 2531 XFreePixmap (xdisp, pixmap);
2533 2532
2534#if TINTING 2533#if TINTING
2535 if (ISSET_PIXCOLOR (Color_tint)) 2534 if (ISSET_PIXCOLOR (Color_tint))
2536 { 2535 {
2537 unsigned short rm, gm, bm; 2536 unsigned short rm, gm, bm;
2538 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; 2537 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2539 2538
2540 pix_colors_focused[Color_tint].get (display, rm, gm, bm); 2539 pix_colors_focused[Color_tint].get (this, rm, gm, bm);
2541 2540
2542 ShadeXImage (display, image, shade, rm, gm, bm); 2541 ShadeXImage (this, image, shade, rm, gm, bm);
2543 } 2542 }
2544#endif 2543#endif
2545 2544
2546 pixmap = XCreatePixmap (disp, vt, 2545 pixmap = XCreatePixmap (xdisp, vt, szHint.width, szHint.height, image->depth);
2547 szHint.width, szHint.height, image->depth);
2548 gc = XCreateGC (disp, vt, 0UL, &gcvalue); 2546 gc = XCreateGC (xdisp, vt, 0UL, &gcvalue);
2549 XPutImage (disp, pixmap, gc, image, 0, 0, 2547 XPutImage (xdisp, pixmap, gc, image, 0, 0,
2550 nx, ny, image->width, image->height); 2548 nx, ny, image->width, image->height);
2551 XFreeGC (disp, gc); 2549 XFreeGC (xdisp, gc);
2552 XDestroyImage (image); 2550 XDestroyImage (image);
2553 XSetWindowBackgroundPixmap (disp, parent[0], pixmap); 2551 XSetWindowBackgroundPixmap (xdisp, parent[0], pixmap);
2554 XClearWindow (disp, parent[0]); 2552 XClearWindow (xdisp, parent[0]);
2555 2553
2556 if (!am_transparent || !am_pixmap_trans) 2554 if (!am_transparent || !am_pixmap_trans)
2557 pchanged = 1; 2555 pchanged = 1;
2558 2556
2559 am_transparent = am_pixmap_trans = 1; 2557 am_transparent = am_pixmap_trans = 1;
2560 } 2558 }
2561 } 2559 }
2562 2560
2563 if (am_pixmap_trans) 2561 if (am_pixmap_trans)
2564 XSetWindowBackgroundPixmap (disp, vt, ParentRelative); 2562 XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative);
2565 else 2563 else
2566 { 2564 {
2567 unsigned int n; 2565 unsigned int n;
2568 /* 2566 /*
2569 * InheritPixmap transparency 2567 * InheritPixmap transparency
2570 */ 2568 */
2571 for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) 2569 for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2572 { 2570 {
2573 oldp = parent[i]; 2571 oldp = parent[i];
2574 XQueryTree (disp, parent[i - 1], &root, 2572 XQueryTree (xdisp, parent[i - 1], &root,
2575 &parent[i], &list, &n); 2573 &parent[i], &list, &n);
2576 XFree (list); 2574 XFree (list);
2577 2575
2578 if (parent[i] == display->root) 2576 if (parent[i] == display->root)
2579 { 2577 {
2591 2589
2592 if (pchanged) 2590 if (pchanged)
2593 { 2591 {
2594 for (; n < (unsigned int)i; n++) 2592 for (; n < (unsigned int)i; n++)
2595 { 2593 {
2596 XGetWindowAttributes (disp, parent[n], &wattr); 2594 XGetWindowAttributes (xdisp, parent[n], &wattr);
2597 if (wattr.depth != rootdepth || wattr.c_class == InputOnly) 2595 if (wattr.depth != rootdepth || wattr.c_class == InputOnly)
2598 { 2596 {
2599 n = (int) (sizeof (parent) / sizeof (Window)) + 1; 2597 n = (int) (sizeof (parent) / sizeof (Window)) + 1;
2600 break; 2598 break;
2601 } 2599 }
2602 } 2600 }
2603 } 2601 }
2604 2602
2605 if (n > (int) (sizeof (parent) / sizeof (parent[0]))) 2603 if (n > (int) (sizeof (parent) / sizeof (parent[0])))
2606 { 2604 {
2607 XSetWindowBackground (disp, parent[0], pix_colors_focused[Color_border]); 2605 XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]);
2608 XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); 2606 XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]);
2609 am_transparent = 0; 2607 am_transparent = 0;
2610 /* XXX: also turn off Opt_transparent? */ 2608 /* XXX: also turn off Opt_transparent? */
2611 } 2609 }
2612 else 2610 else
2613 { 2611 {
2614 for (n = 0; n < (unsigned int)i; n++) 2612 for (n = 0; n < (unsigned int)i; n++)
2615 { 2613 {
2616 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); 2614 XSetWindowBackgroundPixmap (xdisp, parent[n], ParentRelative);
2617 XClearWindow (disp, parent[n]); 2615 XClearWindow (xdisp, parent[n]);
2618 } 2616 }
2619 2617
2620 XSetWindowBackgroundPixmap (disp, vt, ParentRelative); 2618 XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative);
2621 am_transparent = 1; 2619 am_transparent = 1;
2622 } 2620 }
2623 2621
2624 for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) 2622 for (; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2625 parent[i] = None; 2623 parent[i] = None;
2626 } 2624 }
2627 2625
2628 if (scrollBar.win) 2626 if (scrollBar.win)
2629 { 2627 {
2630 XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative); 2628 XSetWindowBackgroundPixmap (xdisp, scrollBar.win, ParentRelative);
2631 scrollBar.setIdle (); 2629 scrollBar.setIdle ();
2632 scrollbar_show (0); 2630 scrollbar_show (0);
2633 } 2631 }
2634 2632
2635 if (am_transparent) 2633 if (am_transparent)
3525rxvt_term::process_window_ops (const int *args, unsigned int nargs) 3523rxvt_term::process_window_ops (const int *args, unsigned int nargs)
3526{ 3524{
3527 int x, y; 3525 int x, y;
3528 XWindowAttributes wattr; 3526 XWindowAttributes wattr;
3529 Window wdummy; 3527 Window wdummy;
3530 dDisp; 3528
3529 dLocal (Display *, xdisp);
3531 3530
3532 if (nargs == 0) 3531 if (nargs == 0)
3533 return; 3532 return;
3534 3533
3535 switch (args[0]) 3534 switch (args[0])
3536 { 3535 {
3537 /* 3536 /*
3538 * commands 3537 * commands
3539 */ 3538 */
3540 case 1: /* deiconify window */ 3539 case 1: /* deiconify window */
3541 XMapWindow (disp, parent[0]); 3540 XMapWindow (xdisp, parent[0]);
3542 break; 3541 break;
3543 case 2: /* iconify window */ 3542 case 2: /* iconify window */
3544 XIconifyWindow (disp, parent[0], display->screen); 3543 XIconifyWindow (xdisp, parent[0], display->screen);
3545 break; 3544 break;
3546 case 3: /* set position (pixels) */ 3545 case 3: /* set position (pixels) */
3547 XMoveWindow (disp, parent[0], args[1], args[2]); 3546 XMoveWindow (xdisp, parent[0], args[1], args[2]);
3548 break; 3547 break;
3549 case 4: /* set size (pixels) */ 3548 case 4: /* set size (pixels) */
3550 set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); 3549 set_widthheight ((unsigned int)args[2], (unsigned int)args[1]);
3551 break; 3550 break;
3552 case 5: /* raise window */ 3551 case 5: /* raise window */
3553 XRaiseWindow (disp, parent[0]); 3552 XRaiseWindow (xdisp, parent[0]);
3554 break; 3553 break;
3555 case 6: /* lower window */ 3554 case 6: /* lower window */
3556 XLowerWindow (disp, parent[0]); 3555 XLowerWindow (xdisp, parent[0]);
3557 break; 3556 break;
3558 case 7: /* refresh window */ 3557 case 7: /* refresh window */
3559 scr_touch (true); 3558 scr_touch (true);
3560 break; 3559 break;
3561 case 8: /* set size (chars) */ 3560 case 8: /* set size (chars) */
3573 3572
3574 /* 3573 /*
3575 * reports - some output format copied from XTerm 3574 * reports - some output format copied from XTerm
3576 */ 3575 */
3577 case 11: /* report window state */ 3576 case 11: /* report window state */
3578 XGetWindowAttributes (disp, parent[0], &wattr); 3577 XGetWindowAttributes (xdisp, parent[0], &wattr);
3579 tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); 3578 tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2);
3580 break; 3579 break;
3581 case 13: /* report window position */ 3580 case 13: /* report window position */
3582 XGetWindowAttributes (disp, parent[0], &wattr); 3581 XGetWindowAttributes (xdisp, parent[0], &wattr);
3583 XTranslateCoordinates (disp, parent[0], wattr.root, 3582 XTranslateCoordinates (xdisp, parent[0], wattr.root,
3584 -wattr.border_width, -wattr.border_width, 3583 -wattr.border_width, -wattr.border_width,
3585 &x, &y, &wdummy); 3584 &x, &y, &wdummy);
3586 tt_printf ("\033[3;%d;%dt", x, y); 3585 tt_printf ("\033[3;%d;%dt", x, y);
3587 break; 3586 break;
3588 case 14: /* report window size (pixels) */ 3587 case 14: /* report window size (pixels) */
3589 XGetWindowAttributes (disp, parent[0], &wattr); 3588 XGetWindowAttributes (xdisp, parent[0], &wattr);
3590 tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); 3589 tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width);
3591 break; 3590 break;
3592 case 18: /* report text area size (chars) */ 3591 case 18: /* report text area size (chars) */
3593 tt_printf ("\033[8;%d;%dt", nrow, ncol); 3592 tt_printf ("\033[8;%d;%dt", nrow, ncol);
3594 break; 3593 break;
3596 tt_printf ("\033[9;%d;%dt", nrow, ncol); 3595 tt_printf ("\033[9;%d;%dt", nrow, ncol);
3597 break; 3596 break;
3598 case 20: /* report icon label */ 3597 case 20: /* report icon label */
3599 { 3598 {
3600 char *s; 3599 char *s;
3601 XGetIconName (disp, parent[0], &s); 3600 XGetIconName (xdisp, parent[0], &s);
3602 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 */
3603 XFree (s); 3602 XFree (s);
3604 } 3603 }
3605 break; 3604 break;
3606 case 21: /* report window title */ 3605 case 21: /* report window title */
3607 { 3606 {
3608 char *s; 3607 char *s;
3609 XFetchName (disp, parent[0], &s); 3608 XFetchName (xdisp, parent[0], &s);
3610 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 */
3611 XFree (s); 3610 XFree (s);
3612 } 3611 }
3613 break; 3612 break;
3614 } 3613 }
3716rxvt_term::process_color_seq (int report, int color, const char *str, char resp) 3715rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
3717{ 3716{
3718 if (str[0] == '?' && !str[1]) 3717 if (str[0] == '?' && !str[1])
3719 { 3718 {
3720 unsigned short r, g, b; 3719 unsigned short r, g, b;
3721 pix_colors_focused[color].get (display, r, g, b); 3720 pix_colors_focused[color].get (this, r, g, b);
3722 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);
3723 } 3722 }
3724 else 3723 else
3725 set_window_color (color, str); 3724 set_window_color (color, str);
3726} 3725}
3733{ 3732{
3734 int color; 3733 int color;
3735 char *buf, *name; 3734 char *buf, *name;
3736 bool query = str[0] == '?' && !str[1]; 3735 bool query = str[0] == '?' && !str[1];
3737 int saveop = op; 3736 int saveop = op;
3738 dDisp; 3737
3738 dLocal (Display *, xdisp);
3739 3739
3740 assert (str != NULL); 3740 assert (str != NULL);
3741 switch (op) 3741 switch (op)
3742 { 3742 {
3743 case XTerm_name: 3743 case XTerm_name:
3759 unsigned long bytes_after; 3759 unsigned long bytes_after;
3760 unsigned char *value = 0; 3760 unsigned char *value = 0;
3761 const char *str = ""; 3761 const char *str = "";
3762 3762
3763 if (prop 3763 if (prop
3764 && XGetWindowProperty (disp, parent[0], 3764 && XGetWindowProperty (xdisp, parent[0],
3765 prop, 0, 1<<16, 0, AnyPropertyType, 3765 prop, 0, 1<<16, 0, AnyPropertyType,
3766 &actual_type, &actual_format, 3766 &actual_type, &actual_format,
3767 &nitems, &bytes_after, &value) == Success 3767 &nitems, &bytes_after, &value) == Success
3768 && actual_type != None 3768 && actual_type != None
3769 && actual_format == 8) 3769 && actual_format == 8)
3781 { 3781 {
3782 *eq = 0; 3782 *eq = 0;
3783 set_utf8_property (display->atom (str), eq + 1); 3783 set_utf8_property (display->atom (str), eq + 1);
3784 } 3784 }
3785 else 3785 else
3786 XDeleteProperty (disp, parent[0], 3786 XDeleteProperty (xdisp, parent[0],
3787 display->atom (str)); 3787 display->atom (str));
3788 } 3788 }
3789 break; 3789 break;
3790 3790
3791 case XTerm_Color: 3791 case XTerm_Color:
3804 *buf++ = '\0'; 3804 *buf++ = '\0';
3805 3805
3806 if (name[0] == '?' && !name[1]) 3806 if (name[0] == '?' && !name[1])
3807 { 3807 {
3808 unsigned short r, g, b; 3808 unsigned short r, g, b;
3809 pix_colors_focused[color].get (display, r, g, b); 3809 pix_colors_focused[color].get (this, r, g, b);
3810 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);
3811 } 3811 }
3812 else 3812 else
3813 set_window_color (color, name); 3813 set_window_color (color, name);
3814 } 3814 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines