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.303 by root, Tue Jan 31 21:47:56 2006 UTC vs.
Revision 1.305 by root, Thu Feb 2 18:04:45 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines