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.191 by root, Wed Jan 26 07:08:15 2005 UTC vs.
Revision 1.194 by root, Mon Feb 14 10:44:50 2005 UTC

52 52
53#ifdef KEYSYM_RESOURCE 53#ifdef KEYSYM_RESOURCE
54# include "keyboard.h" 54# include "keyboard.h"
55#endif 55#endif
56 56
57#include <cwchar>
58#include <csignal> 57#include <csignal>
59 58
60/*----------------------------------------------------------------------*/ 59/*----------------------------------------------------------------------*/
61 60
62#define IS_CONTROL(ch) !((ch) & 0xffffff60UL) 61#define IS_CONTROL(ch) !((ch) & 0xffffff60UL)
1182 1181
1183/*{{{ process an X event */ 1182/*{{{ process an X event */
1184void 1183void
1185rxvt_term::x_cb (XEvent &ev) 1184rxvt_term::x_cb (XEvent &ev)
1186{ 1185{
1186 dDisp;
1187
1187 SET_R (this); 1188 SET_R (this);
1188 SET_LOCALE (locale); 1189 SET_LOCALE (locale);
1189 1190
1190#if defined(CURSOR_BLINK) 1191#if defined(CURSOR_BLINK)
1191 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1192 if ((options & Opt_cursorBlink) && ev.type == KeyPress)
1322 Atom ActualType; 1323 Atom ActualType;
1323 int ActualFormat; 1324 int ActualFormat;
1324 unsigned char *data; 1325 unsigned char *data;
1325 unsigned long Size, RemainingBytes; 1326 unsigned long Size, RemainingBytes;
1326 1327
1327 XGetWindowProperty (display->display, display->root, 1328 XGetWindowProperty (disp, display->root,
1328 xa[XA_DNDSELECTION], 1329 xa[XA_DNDSELECTION],
1329 0L, 1000000L, 1330 0L, 1000000L,
1330 False, AnyPropertyType, 1331 False, AnyPropertyType,
1331 &ActualType, &ActualFormat, 1332 &ActualType, &ActualFormat,
1332 &Size, &RemainingBytes, 1333 &Size, &RemainingBytes,
1333 &data); 1334 &data);
1334 set_string_property (XA_CUT_BUFFER0, data); 1335 set_string_property (XA_CUT_BUFFER0, data);
1335 XFree (data); 1336 XFree (data);
1336 selection_paste (display->root, XA_CUT_BUFFER0, true); 1337 selection_paste (display->root, XA_CUT_BUFFER0, true);
1337 XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime); 1338 XSetInputFocus (disp, display->root, RevertToNone, CurrentTime);
1338 } 1339 }
1339#endif /* OFFIX_DND */ 1340#endif /* OFFIX_DND */
1340 break; 1341 break;
1341 1342
1342 case MappingNotify: 1343 case MappingNotify:
1435 { /* Wrap lots of configures into one */ 1436 { /* Wrap lots of configures into one */
1436 width = ev.xconfigure.width; 1437 width = ev.xconfigure.width;
1437 height = ev.xconfigure.height; 1438 height = ev.xconfigure.height;
1438 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); 1439 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height));
1439 } 1440 }
1440 while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); 1441 while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev));
1441 1442
1442 if (szHint.width != width || szHint.height != height) 1443 if (szHint.width != width || szHint.height != height)
1443 { 1444 {
1444 seen_resize = 1; 1445 seen_resize = 1;
1445 resize_all_windows (width, height, 1); 1446 resize_all_windows (width, height, 1);
1497 if (ev.xany.window == TermWin.vt) 1498 if (ev.xany.window == TermWin.vt)
1498 { 1499 {
1499 do 1500 do
1500 scr_expose (ev.xexpose.x, ev.xexpose.y, 1501 scr_expose (ev.xexpose.x, ev.xexpose.y,
1501 ev.xexpose.width, ev.xexpose.height, False); 1502 ev.xexpose.width, ev.xexpose.height, False);
1502 while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev)); 1503 while (XCheckTypedWindowEvent (disp, TermWin.vt, ev.xany.type, &ev));
1503 1504
1504 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1505 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1505 1506
1506 while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev)) 1507 while (XCheckTypedWindowEvent (disp, TermWin.vt, ev.xany.type, &ev))
1507 scr_expose (ev.xexpose.x, ev.xexpose.y, 1508 scr_expose (ev.xexpose.x, ev.xexpose.y,
1508 ev.xexpose.width, ev.xexpose.height, False); 1509 ev.xexpose.width, ev.xexpose.height, False);
1509 1510
1510 scr_refresh (refresh_type); 1511 scr_refresh (refresh_type);
1511 } 1512 }
1512 else 1513 else
1513 { 1514 {
1514 XEvent unused_event; 1515 XEvent unused_event;
1515 1516
1516 while (XCheckTypedWindowEvent (display->display, ev.xany.window, Expose, &unused_event)) 1517 while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event))
1517 ; 1518 ;
1518 while (XCheckTypedWindowEvent (display->display, ev.xany.window, GraphicsExpose, &unused_event)) 1519 while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event))
1519 ; 1520 ;
1520 1521
1521 if (isScrollbarWindow (ev.xany.window)) 1522 if (isScrollbarWindow (ev.xany.window))
1522 { 1523 {
1523 scrollBar.setIdle (); 1524 scrollBar.setIdle ();
1528 menubar_expose (); 1529 menubar_expose ();
1529#endif 1530#endif
1530 1531
1531#ifdef TRANSPARENT 1532#ifdef TRANSPARENT
1532 if (am_transparent && ev.xany.window == TermWin.parent[0]) 1533 if (am_transparent && ev.xany.window == TermWin.parent[0])
1533 XClearWindow (display->display, ev.xany.window); 1534 XClearWindow (disp, ev.xany.window);
1534#endif 1535#endif
1535 } 1536 }
1536 break; 1537 break;
1537 1538
1538 case MotionNotify: 1539 case MotionNotify:
1552 1553
1553 if (ev.xany.window == TermWin.vt) 1554 if (ev.xany.window == TermWin.vt)
1554 { 1555 {
1555 if (ev.xbutton.state & (Button1Mask | Button3Mask)) 1556 if (ev.xbutton.state & (Button1Mask | Button3Mask))
1556 { 1557 {
1557 while (XCheckTypedWindowEvent (display->display, TermWin.vt, MotionNotify, &ev)) 1558 while (XCheckTypedWindowEvent (disp, TermWin.vt, MotionNotify, &ev))
1558 ; 1559 ;
1559 1560
1560 XQueryPointer (display->display, TermWin.vt, 1561 XQueryPointer (disp, TermWin.vt,
1561 &unused_root, &unused_child, 1562 &unused_root, &unused_child,
1562 &unused_root_x, &unused_root_y, 1563 &unused_root_x, &unused_root_y,
1563 &ev.xbutton.x, &ev.xbutton.y, 1564 &ev.xbutton.x, &ev.xbutton.y,
1564 &ev.xbutton.state); 1565 &ev.xbutton.state);
1565#ifdef MOUSE_THRESHOLD 1566#ifdef MOUSE_THRESHOLD
1629#endif 1630#endif
1630 } 1631 }
1631 } 1632 }
1632 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1633 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ())
1633 { 1634 {
1634 while (XCheckTypedWindowEvent (display->display, scrollBar.win, 1635 while (XCheckTypedWindowEvent (disp, scrollBar.win,
1635 MotionNotify, &ev)) 1636 MotionNotify, &ev))
1636 ; 1637 ;
1637 1638
1638 XQueryPointer (display->display, scrollBar.win, 1639 XQueryPointer (disp, scrollBar.win,
1639 &unused_root, &unused_child, 1640 &unused_root, &unused_child,
1640 &unused_root_x, &unused_root_y, 1641 &unused_root_x, &unused_root_y,
1641 &ev.xbutton.x, &ev.xbutton.y, 1642 &ev.xbutton.x, &ev.xbutton.y,
1642 &unused_mask); 1643 &unused_mask);
1643 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1644 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
2081 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; 2082 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
2082 unsigned int lower_lim_r, lower_lim_g, lower_lim_b; 2083 unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
2083 unsigned int upper_lim_r, upper_lim_g, upper_lim_b; 2084 unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
2084 int i; 2085 int i;
2085 2086
2086 Visual* visual = display->visual; 2087 Visual *visual = display->visual;
2087 2088
2088 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; 2089 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
2089 2090
2090 /* for convenience */ 2091 /* for convenience */
2091 mask_r = visual->red_mask; 2092 mask_r = visual->red_mask;
2312 Atom atype; 2313 Atom atype;
2313 unsigned char *prop = NULL; 2314 unsigned char *prop = NULL;
2314 Window root, oldp, *list; 2315 Window root, oldp, *list;
2315 Pixmap rootpixmap = None; 2316 Pixmap rootpixmap = None;
2316 XWindowAttributes wattr, wrootattr; 2317 XWindowAttributes wattr, wrootattr;
2318 dDisp;
2317 2319
2318 pchanged = 0; 2320 pchanged = 0;
2319 2321
2320 if (!(options & Opt_transparent)) 2322 if (!(options & Opt_transparent))
2321 return pchanged; /* Don't try any more */ 2323 return pchanged; /* Don't try any more */
2322 2324
2323 XGetWindowAttributes (display->display, display->root, &wrootattr); 2325 XGetWindowAttributes (disp, display->root, &wrootattr);
2324 rootdepth = wrootattr.depth; 2326 rootdepth = wrootattr.depth;
2325 2327
2326 XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); 2328 XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
2327 2329
2328 if (rootdepth != wattr.depth) 2330 if (rootdepth != wattr.depth)
2329 { 2331 {
2330 if (am_transparent) 2332 if (am_transparent)
2331 { 2333 {
2332 pchanged = 1; 2334 pchanged = 1;
2333 XSetWindowBackground (display->display, TermWin.vt, pix_colors_focused[Color_bg]); 2335 XSetWindowBackground (disp, TermWin.vt, pix_colors_focused[Color_bg]);
2334 am_transparent = am_pixmap_trans = 0; 2336 am_transparent = am_pixmap_trans = 0;
2335 } 2337 }
2336 2338
2337 return pchanged; /* Don't try any more */ 2339 return pchanged; /* Don't try any more */
2338 } 2340 }
2339 2341
2340 /* Get all X ops out of the queue so that our information is up-to-date. */ 2342 /* Get all X ops out of the queue so that our information is up-to-date. */
2341 XSync (display->display, False); 2343 XSync (disp, False);
2342 2344
2343 /* 2345 /*
2344 * Make the frame window set by the window manager have 2346 * Make the frame window set by the window manager have
2345 * the root background. Some window managers put multiple nested frame 2347 * the root background. Some window managers put multiple nested frame
2346 * windows for each client, so we have to take care about that. 2348 * windows for each client, so we have to take care about that.
2347 */ 2349 */
2348 i = (xa[XA_XROOTPMAP_ID] 2350 i = (xa[XA_XROOTPMAP_ID]
2349 && XGetWindowProperty (display->display, display->root, xa[XA_XROOTPMAP_ID], 2351 && XGetWindowProperty (disp, display->root, xa[XA_XROOTPMAP_ID],
2350 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2352 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2351 &nitems, &bytes_after, &prop) == Success); 2353 &nitems, &bytes_after, &prop) == Success);
2352 2354
2353 if (!i || prop == NULL) 2355 if (!i || prop == NULL)
2354 i = (xa[XA_ESETROOT_PMAP_ID] 2356 i = (xa[XA_ESETROOT_PMAP_ID]
2355 && XGetWindowProperty (display->display, display->root, xa[XA_ESETROOT_PMAP_ID], 2357 && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID],
2356 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2358 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2357 &nitems, &bytes_after, &prop) == Success); 2359 &nitems, &bytes_after, &prop) == Success);
2358 2360
2359 if (!i || prop == NULL 2361 if (!i || prop == NULL
2360#if TINTING 2362#if TINTING
2379 Window cr; 2381 Window cr;
2380 XImage *image; 2382 XImage *image;
2381 GC gc; 2383 GC gc;
2382 XGCValues gcvalue; 2384 XGCValues gcvalue;
2383 2385
2384 XTranslateCoordinates (display->display, TermWin.parent[0], display->root, 2386 XTranslateCoordinates (disp, TermWin.parent[0], display->root,
2385 0, 0, &sx, &sy, &cr); 2387 0, 0, &sx, &sy, &cr);
2386 nw = (unsigned int)szHint.width; 2388 nw = (unsigned int)szHint.width;
2387 nh = (unsigned int)szHint.height; 2389 nh = (unsigned int)szHint.height;
2388 nx = ny = 0; 2390 nx = ny = 0;
2389 2391
2402 } 2404 }
2403 2405
2404 MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); 2406 MIN_IT (nw, (unsigned int) (wrootattr.width - sx));
2405 MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); 2407 MIN_IT (nh, (unsigned int) (wrootattr.height - sy));
2406 2408
2407 XSync (display->display, False); 2409 XSync (disp, False);
2408 allowedxerror = -1; 2410 allowedxerror = -1;
2409 image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2411 image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2410 2412
2411 /* XXX: handle BadMatch - usually because we're outside the pixmap */ 2413 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2412 /* XXX: may need a delay here? */ 2414 /* XXX: may need a delay here? */
2413 allowedxerror = 0; 2415 allowedxerror = 0;
2414 2416
2417 if (am_transparent && am_pixmap_trans) 2419 if (am_transparent && am_pixmap_trans)
2418 { 2420 {
2419 pchanged = 1; 2421 pchanged = 1;
2420 if (TermWin.pixmap != None) 2422 if (TermWin.pixmap != None)
2421 { 2423 {
2422 XFreePixmap (display->display, TermWin.pixmap); 2424 XFreePixmap (disp, TermWin.pixmap);
2423 TermWin.pixmap = None; 2425 TermWin.pixmap = None;
2424 } 2426 }
2425 } 2427 }
2426 2428
2427 am_pixmap_trans = 0; 2429 am_pixmap_trans = 0;
2428 } 2430 }
2429 else 2431 else
2430 { 2432 {
2431 if (TermWin.pixmap != None) 2433 if (TermWin.pixmap != None)
2432 XFreePixmap (display->display, TermWin.pixmap); 2434 XFreePixmap (disp, TermWin.pixmap);
2433 2435
2434#if TINTING 2436#if TINTING
2435 if (ISSET_PIXCOLOR (Color_tint)) 2437 if (ISSET_PIXCOLOR (Color_tint))
2436 { 2438 {
2437 unsigned short rm, gm, bm; 2439 unsigned short rm, gm, bm;
2441 2443
2442 ShadeXImage (display, image, shade, rm, gm, bm); 2444 ShadeXImage (display, image, shade, rm, gm, bm);
2443 } 2445 }
2444#endif 2446#endif
2445 2447
2446 TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, 2448 TermWin.pixmap = XCreatePixmap (disp, TermWin.vt,
2447 szHint.width, szHint.height, image->depth); 2449 szHint.width, szHint.height, image->depth);
2448 gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue); 2450 gc = XCreateGC (disp, TermWin.vt, 0UL, &gcvalue);
2449 XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0, 2451 XPutImage (disp, TermWin.pixmap, gc, image, 0, 0,
2450 nx, ny, image->width, image->height); 2452 nx, ny, image->width, image->height);
2451 XFreeGC (display->display, gc); 2453 XFreeGC (disp, gc);
2452 XDestroyImage (image); 2454 XDestroyImage (image);
2453 XSetWindowBackgroundPixmap (display->display, TermWin.parent[0], TermWin.pixmap); 2455 XSetWindowBackgroundPixmap (disp, TermWin.parent[0], TermWin.pixmap);
2454 XClearWindow (display->display, TermWin.parent[0]); 2456 XClearWindow (disp, TermWin.parent[0]);
2455 2457
2456 if (!am_transparent || !am_pixmap_trans) 2458 if (!am_transparent || !am_pixmap_trans)
2457 pchanged = 1; 2459 pchanged = 1;
2458 2460
2459 am_transparent = am_pixmap_trans = 1; 2461 am_transparent = am_pixmap_trans = 1;
2460 } 2462 }
2461 } 2463 }
2462 2464
2463 if (am_pixmap_trans) 2465 if (am_pixmap_trans)
2464 XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); 2466 XSetWindowBackgroundPixmap (disp, TermWin.vt, ParentRelative);
2465 else 2467 else
2466 { 2468 {
2467 unsigned int n; 2469 unsigned int n;
2468 /* 2470 /*
2469 * InheritPixmap transparency 2471 * InheritPixmap transparency
2470 */ 2472 */
2471 for (i = 1; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) 2473 for (i = 1; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++)
2472 { 2474 {
2473 oldp = TermWin.parent[i]; 2475 oldp = TermWin.parent[i];
2474 XQueryTree (display->display, TermWin.parent[i - 1], &root, 2476 XQueryTree (disp, TermWin.parent[i - 1], &root,
2475 &TermWin.parent[i], &list, &n); 2477 &TermWin.parent[i], &list, &n);
2476 XFree (list); 2478 XFree (list);
2477 2479
2478 if (TermWin.parent[i] == display->root) 2480 if (TermWin.parent[i] == display->root)
2479 { 2481 {
2491 2493
2492 if (pchanged) 2494 if (pchanged)
2493 { 2495 {
2494 for (; n < (unsigned int)i; n++) 2496 for (; n < (unsigned int)i; n++)
2495 { 2497 {
2496 XGetWindowAttributes (display->display, TermWin.parent[n], &wattr); 2498 XGetWindowAttributes (disp, TermWin.parent[n], &wattr);
2497 if (wattr.depth != rootdepth || wattr.c_class == InputOnly) 2499 if (wattr.depth != rootdepth || wattr.c_class == InputOnly)
2498 { 2500 {
2499 n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1; 2501 n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1;
2500 break; 2502 break;
2501 } 2503 }
2502 } 2504 }
2503 } 2505 }
2504 2506
2505 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) 2507 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0])))
2506 { 2508 {
2507 XSetWindowBackground (display->display, TermWin.parent[0], pix_colors_focused[Color_fg]); 2509 XSetWindowBackground (disp, TermWin.parent[0], pix_colors_focused[Color_fg]);
2508 XSetWindowBackground (display->display, TermWin.vt, pix_colors_focused[Color_bg]); 2510 XSetWindowBackground (disp, TermWin.vt, pix_colors_focused[Color_bg]);
2509 am_transparent = 0; 2511 am_transparent = 0;
2510 /* XXX: also turn off Opt_transparent? */ 2512 /* XXX: also turn off Opt_transparent? */
2511 } 2513 }
2512 else 2514 else
2513 { 2515 {
2516 * needed for fvwm2.2.2 (and before?) */ 2518 * needed for fvwm2.2.2 (and before?) */
2517 sleep (1); 2519 sleep (1);
2518#endif 2520#endif
2519 for (n = 0; n < (unsigned int)i; n++) 2521 for (n = 0; n < (unsigned int)i; n++)
2520 { 2522 {
2521 XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative); 2523 XSetWindowBackgroundPixmap (disp, TermWin.parent[n], ParentRelative);
2522 XClearWindow (display->display, TermWin.parent[n]); 2524 XClearWindow (disp, TermWin.parent[n]);
2523 } 2525 }
2524 2526
2525 XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); 2527 XSetWindowBackgroundPixmap (disp, TermWin.vt, ParentRelative);
2526 am_transparent = 1; 2528 am_transparent = 1;
2527 } 2529 }
2528 2530
2529 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) 2531 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++)
2530 TermWin.parent[i] = None; 2532 TermWin.parent[i] = None;
2531 } 2533 }
2532 2534
2533 if (scrollBar.win) 2535 if (scrollBar.win)
2534 { 2536 {
2535 XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative); 2537 XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative);
2536 scrollBar.setIdle (); 2538 scrollBar.setIdle ();
2537 scrollbar_show (0); 2539 scrollbar_show (0);
2538 } 2540 }
2539 2541
2540 if (am_transparent) 2542 if (am_transparent)
3174 { 3176 {
3175 switch (priv) 3177 switch (priv)
3176 { 3178 {
3177 case '>': 3179 case '>':
3178 if (ch == CSI_DA) /* secondary device attributes */ 3180 if (ch == CSI_DA) /* secondary device attributes */
3179 tt_printf ("\033[>%d;%-.8s;0c", 'R', VSTRING); 3181 tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]);
3180 break; 3182 break;
3181 case '?': 3183 case '?':
3182 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 3184 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
3183 process_terminal_mode (ch, priv, nargs, arg); 3185 process_terminal_mode (ch, priv, nargs, arg);
3184 break; 3186 break;
3413rxvt_term::process_window_ops (const int *args, unsigned int nargs) 3415rxvt_term::process_window_ops (const int *args, unsigned int nargs)
3414{ 3416{
3415 int x, y; 3417 int x, y;
3416 XWindowAttributes wattr; 3418 XWindowAttributes wattr;
3417 Window wdummy; 3419 Window wdummy;
3420 dDisp;
3418 3421
3419 if (nargs == 0) 3422 if (nargs == 0)
3420 return; 3423 return;
3421 3424
3422 switch (args[0]) 3425 switch (args[0])
3423 { 3426 {
3424 /* 3427 /*
3425 * commands 3428 * commands
3426 */ 3429 */
3427 case 1: /* deiconify window */ 3430 case 1: /* deiconify window */
3428 XMapWindow (display->display, TermWin.parent[0]); 3431 XMapWindow (disp, TermWin.parent[0]);
3429 break; 3432 break;
3430 case 2: /* iconify window */ 3433 case 2: /* iconify window */
3431 XIconifyWindow (display->display, TermWin.parent[0], 3434 XIconifyWindow (disp, TermWin.parent[0], display->screen);
3432 DefaultScreen (display->display));
3433 break; 3435 break;
3434 case 3: /* set position (pixels) */ 3436 case 3: /* set position (pixels) */
3435 XMoveWindow (display->display, TermWin.parent[0], args[1], args[2]); 3437 XMoveWindow (disp, TermWin.parent[0], args[1], args[2]);
3436 break; 3438 break;
3437 case 4: /* set size (pixels) */ 3439 case 4: /* set size (pixels) */
3438 set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); 3440 set_widthheight ((unsigned int)args[2], (unsigned int)args[1]);
3439 break; 3441 break;
3440 case 5: /* raise window */ 3442 case 5: /* raise window */
3441 XRaiseWindow (display->display, TermWin.parent[0]); 3443 XRaiseWindow (disp, TermWin.parent[0]);
3442 break; 3444 break;
3443 case 6: /* lower window */ 3445 case 6: /* lower window */
3444 XLowerWindow (display->display, TermWin.parent[0]); 3446 XLowerWindow (disp, TermWin.parent[0]);
3445 break; 3447 break;
3446 case 7: /* refresh window */ 3448 case 7: /* refresh window */
3447 scr_touch (true); 3449 scr_touch (true);
3448 break; 3450 break;
3449 case 8: /* set size (chars) */ 3451 case 8: /* set size (chars) */
3461 3463
3462 /* 3464 /*
3463 * reports - some output format copied from XTerm 3465 * reports - some output format copied from XTerm
3464 */ 3466 */
3465 case 11: /* report window state */ 3467 case 11: /* report window state */
3466 XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); 3468 XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
3467 tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); 3469 tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2);
3468 break; 3470 break;
3469 case 13: /* report window position */ 3471 case 13: /* report window position */
3470 XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); 3472 XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
3471 XTranslateCoordinates (display->display, TermWin.parent[0], wattr.root, 3473 XTranslateCoordinates (disp, TermWin.parent[0], wattr.root,
3472 -wattr.border_width, -wattr.border_width, 3474 -wattr.border_width, -wattr.border_width,
3473 &x, &y, &wdummy); 3475 &x, &y, &wdummy);
3474 tt_printf ("\033[3;%d;%dt", x, y); 3476 tt_printf ("\033[3;%d;%dt", x, y);
3475 break; 3477 break;
3476 case 14: /* report window size (pixels) */ 3478 case 14: /* report window size (pixels) */
3477 XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); 3479 XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
3478 tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); 3480 tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width);
3479 break; 3481 break;
3480 case 18: /* report text area size (chars) */ 3482 case 18: /* report text area size (chars) */
3481 tt_printf ("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol); 3483 tt_printf ("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol);
3482 break; 3484 break;
3484 tt_printf ("\033[9;%d;%dt", TermWin.nrow, TermWin.ncol); 3486 tt_printf ("\033[9;%d;%dt", TermWin.nrow, TermWin.ncol);
3485 break; 3487 break;
3486 case 20: /* report icon label */ 3488 case 20: /* report icon label */
3487 { 3489 {
3488 char *s; 3490 char *s;
3489 XGetIconName (display->display, TermWin.parent[0], &s); 3491 XGetIconName (disp, TermWin.parent[0], &s);
3490 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3492 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */
3491 XFree (s); 3493 XFree (s);
3492 } 3494 }
3493 break; 3495 break;
3494 case 21: /* report window title */ 3496 case 21: /* report window title */
3495 { 3497 {
3496 char *s; 3498 char *s;
3497 XFetchName (display->display, TermWin.parent[0], &s); 3499 XFetchName (disp, TermWin.parent[0], &s);
3498 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3500 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */
3499 XFree (s); 3501 XFree (s);
3500 } 3502 }
3501 break; 3503 break;
3502 } 3504 }
3644 int changed = 0; 3646 int changed = 0;
3645 int color; 3647 int color;
3646 char *buf, *name; 3648 char *buf, *name;
3647 bool query = str[0] == '?' && !str[1]; 3649 bool query = str[0] == '?' && !str[1];
3648 int saveop = op; 3650 int saveop = op;
3651 dDisp;
3649 3652
3650 assert (str != NULL); 3653 assert (str != NULL);
3651 switch (op) 3654 switch (op)
3652 { 3655 {
3653 case XTerm_name: 3656 case XTerm_name:
3669 unsigned long bytes_after; 3672 unsigned long bytes_after;
3670 unsigned char *value = 0; 3673 unsigned char *value = 0;
3671 const char *str = ""; 3674 const char *str = "";
3672 3675
3673 if (prop 3676 if (prop
3674 && XGetWindowProperty (display->display, TermWin.parent[0], 3677 && XGetWindowProperty (disp, TermWin.parent[0],
3675 prop, 0, 1<<16, 0, AnyPropertyType, 3678 prop, 0, 1<<16, 0, AnyPropertyType,
3676 &actual_type, &actual_format, 3679 &actual_type, &actual_format,
3677 &nitems, &bytes_after, &value) == Success 3680 &nitems, &bytes_after, &value) == Success
3678 && actual_type != None 3681 && actual_type != None
3679 && actual_format == 8) 3682 && actual_format == 8)
3691 { 3694 {
3692 *eq = 0; 3695 *eq = 0;
3693 set_utf8_property (display->atom (str), eq + 1); 3696 set_utf8_property (display->atom (str), eq + 1);
3694 } 3697 }
3695 else 3698 else
3696 XDeleteProperty (display->display, TermWin.parent[0], 3699 XDeleteProperty (disp, TermWin.parent[0],
3697 display->atom (str)); 3700 display->atom (str));
3698 } 3701 }
3699 break; 3702 break;
3700 3703
3701 case XTerm_Color: 3704 case XTerm_Color:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines