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.203 by root, Sat Jun 18 09:02:37 2005 UTC

25 * - extensive modifications 25 * - extensive modifications
26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
27 * Copyright (c) 2001 Marius Gedminas 27 * Copyright (c) 2001 Marius Gedminas
28 * - Ctrl/Mod4+Tab works like Meta+Tab (options) 28 * - Ctrl/Mod4+Tab works like Meta+Tab (options)
29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> 29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org>
30 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 30 * Copyright (c) 2003-2005 Marc Lehmann <pcg@goof.com>
31 * 31 *
32 * This program is free software; you can redistribute it and/or modify 32 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by 33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 2 of the License, or 34 * the Free Software Foundation; either version 2 of the License, or
35 * (at your option) any later version. 35 * (at your option) any later version.
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)
118 XK_Escape, 0x238b, 117 XK_Escape, 0x238b,
119 XK_Undo, 0x238c, 118 XK_Undo, 0x238c,
120 XK_Print, 0x2399, 119 XK_Print, 0x2399,
121 120
122 XK_space, 0x2423, 121 XK_space, 0x2423,
122
123#ifdef XK_KP_Begin
124 XK_KP_Prior, 0x21de,
125 XK_KP_Next, 0x21df,
126 XK_KP_Begin, 0x2320,
127 XK_KP_Insert, 0x2380,
128 XK_KP_Delete, 0x2326,
123 XK_KP_Space, 0x2422, 129 XK_KP_Space, 0x2422,
130#endif
124 0, 131 0,
125}; 132};
126 133
127void 134void
128rxvt_term::iso14755_54 (int x, int y) 135rxvt_term::iso14755_54 (int x, int y)
156void 163void
157rxvt_term::iso14755_51 (unicode_t ch, rend_t r) 164rxvt_term::iso14755_51 (unicode_t ch, rend_t r)
158{ 165{
159 rxvt_fontset *fs = FONTSET (r); 166 rxvt_fontset *fs = FONTSET (r);
160 rxvt_font *f = (*fs)[fs->find_font (ch)]; 167 rxvt_font *f = (*fs)[fs->find_font (ch)];
161 wchar_t *chr, *alloc, ch2; 168 wchar_t *chr, *alloc, ch2, *fname;
162 int len; 169 int len;
170
171 fname = rxvt_utf8towcs (f->name);
163 172
164#if ENABLE_COMBINING 173#if ENABLE_COMBINING
165 if (IS_COMPOSE (ch)) 174 if (IS_COMPOSE (ch))
166 { 175 {
167 len = rxvt_composite.expand (ch, 0); 176 len = rxvt_composite.expand (ch, 0);
176 alloc = 0; 185 alloc = 0;
177 chr = &ch2; 186 chr = &ch2;
178 len = 1; 187 len = 1;
179 } 188 }
180 189
181 int width = strlen (f->name); 190 int width = wcswidth (fname, wcslen (fname));
182 191
183 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); 192 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1);
184 193
185 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 194 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
186 195
199#endif 208#endif
200 scr_overlay_set (11, y, ch, r); 209 scr_overlay_set (11, y, ch, r);
201 scr_overlay_set (12, y, NOCHAR, r); 210 scr_overlay_set (12, y, NOCHAR, r);
202 } 211 }
203 212
204 scr_overlay_set (0, len, f->name); 213 scr_overlay_set (0, len, fname);
214
215 free (fname);
205 216
206#if ENABLE_COMBINING 217#if ENABLE_COMBINING
207 if (alloc) 218 if (alloc)
208 delete [] alloc; 219 delete [] alloc;
209#endif 220#endif
277 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an 288 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an
278 * escape sequence to toggle the Keypad. 289 * escape sequence to toggle the Keypad.
279 * 290 *
280 * Always permit `shift' to override the current setting 291 * Always permit `shift' to override the current setting
281 */ 292 */
282 shft = (ev.state & ShiftMask); 293 shft = ev.state & ShiftMask;
283 ctrl = (ev.state & ControlMask); 294 ctrl = ev.state & ControlMask;
284 meta = (ev.state & ModMetaMask); 295 meta = ev.state & ModMetaMask;
285 296
286 if (numlock_state || (ev.state & ModNumLockMask)) 297 if (numlock_state || (ev.state & ModNumLockMask))
287 { 298 {
288 numlock_state = (ev.state & ModNumLockMask); 299 numlock_state = (ev.state & ModNumLockMask);
289 PrivMode ((!numlock_state), PrivMode_aplKP); 300 PrivMode ((!numlock_state), PrivMode_aplKP);
309 320
310 // the XOpenIM manpage lies about hardcoding the locale 321 // the XOpenIM manpage lies about hardcoding the locale
311 // at the point of XOpenIM, so temporarily switch locales 322 // at the point of XOpenIM, so temporarily switch locales
312 if (rs[Rs_imLocale]) 323 if (rs[Rs_imLocale])
313 SET_LOCALE (rs[Rs_imLocale]); 324 SET_LOCALE (rs[Rs_imLocale]);
325
314 // assume wchar_t == unicode or better 326 // assume wchar_t == unicode or better
315 len = XwcLookupString (Input_Context, &ev, wkbuf, 327 len = XwcLookupString (Input_Context, &ev, wkbuf,
316 KBUFSZ, &keysym, &status_return); 328 KBUFSZ, &keysym, &status_return);
329
317 if (rs[Rs_imLocale]) 330 if (rs[Rs_imLocale])
318 SET_LOCALE (locale); 331 SET_LOCALE (locale);
319 332
320 if (status_return == XLookupChars 333 if (status_return == XLookupChars
321 || status_return == XLookupBoth) 334 || status_return == XLookupBoth)
513 else 526 else
514 strcpy (kbuf, key_backspace); 527 strcpy (kbuf, key_backspace);
515 break; 528 break;
516#endif 529#endif
517#ifndef NO_DELETE_KEY 530#ifndef NO_DELETE_KEY
531# ifdef XK_KP_Prior
532 case XK_KP_Delete:
533 /* allow shift to override */
534 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
535 {
536 strcpy (kbuf, "\033On");
537 break;
538 }
539 /* FALLTHROUGH */
540# endif
518 case XK_Delete: 541 case XK_Delete:
519 strcpy (kbuf, key_delete); 542 strcpy (kbuf, key_delete);
520 break; 543 break;
521#endif 544#endif
522 case XK_Tab: 545 case XK_Tab:
625#ifdef XK_KP_Begin 648#ifdef XK_KP_Begin
626 case XK_KP_Begin: 649 case XK_KP_Begin:
627 strcpy (kbuf, "\033Ou"); 650 strcpy (kbuf, "\033Ou");
628 break; 651 break;
629 652
630 case XK_KP_Insert:
631 strcpy (kbuf, "\033Op");
632 break;
633
634 case XK_KP_Delete:
635 strcpy (kbuf, "\033On");
636 break;
637#endif 653#endif
638 case XK_KP_F1: /* "\033OP" */ 654 case XK_KP_F1: /* "\033OP" */
639 case XK_KP_F2: /* "\033OQ" */ 655 case XK_KP_F2: /* "\033OQ" */
640 case XK_KP_F3: /* "\033OR" */ 656 case XK_KP_F3: /* "\033OR" */
641 case XK_KP_F4: /* "\033OS" */ 657 case XK_KP_F4: /* "\033OS" */
673 break; 689 break;
674 690
675 case XK_Find: 691 case XK_Find:
676 strcpy (kbuf, "\033[1~"); 692 strcpy (kbuf, "\033[1~");
677 break; 693 break;
694
695#ifdef XK_KP_End
696 case XK_KP_Insert:
697 /* allow shift to override */
698 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
699 {
700 strcpy (kbuf, "\033Op");
701 break;
702 }
703 /* FALLTHROUGH */
704#endif
678 case XK_Insert: 705 case XK_Insert:
679 strcpy (kbuf, "\033[2~"); 706 strcpy (kbuf, "\033[2~");
680 break; 707 break;
681#ifdef DXK_Remove /* support for DEC remove like key */ 708#ifdef DXK_Remove /* support for DEC remove like key */
682 case DXK_Remove: 709 case DXK_Remove:
1182 1209
1183/*{{{ process an X event */ 1210/*{{{ process an X event */
1184void 1211void
1185rxvt_term::x_cb (XEvent &ev) 1212rxvt_term::x_cb (XEvent &ev)
1186{ 1213{
1214 dDisp;
1215
1187 SET_R (this); 1216 SET_R (this);
1188 SET_LOCALE (locale); 1217 SET_LOCALE (locale);
1189 1218
1190#if defined(CURSOR_BLINK) 1219#if defined(CURSOR_BLINK)
1191 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1220 if ((options & Opt_cursorBlink) && ev.type == KeyPress)
1307 button_release (ev.xbutton); 1336 button_release (ev.xbutton);
1308 break; 1337 break;
1309 1338
1310 case ClientMessage: 1339 case ClientMessage:
1311 if (ev.xclient.format == 32 1340 if (ev.xclient.format == 32
1341 && ev.xclient.message_type == xa[XA_WM_PROTOCOLS])
1342 {
1312 && (Atom)ev.xclient.data.l[0] == xa[XA_WMDELETEWINDOW]) 1343 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW])
1313 destroy (); 1344 destroy ();
1345#if ENABLE_EWMH
1346 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING])
1347 XSendEvent (disp, ev.xclient.window = display->root,
1348 False, SubstructureRedirectMask | SubstructureNotifyMask,
1349 &ev);
1350#endif
1351 }
1352#if ENABLE_XEMBED
1353 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1354 {
1355 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1356 focus_in ();
1357 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1358 focus_out ();
1359 }
1360#endif
1314#ifdef OFFIX_DND 1361#ifdef OFFIX_DND
1315 /* OffiX Dnd (drag 'n' drop) protocol */ 1362 /* OffiX Dnd (drag 'n' drop) protocol */
1316 else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] 1363 else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL]
1317 && (ev.xclient.data.l[0] == DndFile 1364 && (ev.xclient.data.l[0] == DndFile
1318 || ev.xclient.data.l[0] == DndDir 1365 || ev.xclient.data.l[0] == DndDir
1319 || ev.xclient.data.l[0] == DndLink)) 1366 || ev.xclient.data.l[0] == DndLink))
1320 { 1367 {
1321 /* Get Dnd data */ 1368 /* Get Dnd data */
1322 Atom ActualType; 1369 Atom ActualType;
1323 int ActualFormat; 1370 int ActualFormat;
1324 unsigned char *data; 1371 unsigned char *data;
1325 unsigned long Size, RemainingBytes; 1372 unsigned long Size, RemainingBytes;
1326 1373
1327 XGetWindowProperty (display->display, display->root, 1374 XGetWindowProperty (disp, display->root,
1328 xa[XA_DNDSELECTION], 1375 xa[XA_DNDSELECTION],
1329 0L, 1000000L, 1376 0L, 1000000L,
1330 False, AnyPropertyType, 1377 False, AnyPropertyType,
1331 &ActualType, &ActualFormat, 1378 &ActualType, &ActualFormat,
1332 &Size, &RemainingBytes, 1379 &Size, &RemainingBytes,
1333 &data); 1380 &data);
1334 set_string_property (XA_CUT_BUFFER0, data); 1381 set_string_property (XA_CUT_BUFFER0, data);
1335 XFree (data); 1382 XFree (data);
1336 selection_paste (display->root, XA_CUT_BUFFER0, true); 1383 selection_paste (display->root, XA_CUT_BUFFER0, true);
1337 XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime); 1384 XSetInputFocus (disp, display->root, RevertToNone, CurrentTime);
1338 } 1385 }
1339#endif /* OFFIX_DND */ 1386#endif /* OFFIX_DND */
1340 break; 1387 break;
1341 1388
1342 case MappingNotify: 1389 case MappingNotify:
1367 break; 1414 break;
1368 } 1415 }
1369 break; 1416 break;
1370 1417
1371 case FocusIn: 1418 case FocusIn:
1372 if (!TermWin.focus) 1419 focus_in ();
1373 {
1374 TermWin.focus = 1;
1375 want_refresh = 1;
1376#ifdef USE_XIM
1377 if (Input_Context != NULL)
1378 {
1379 IMSetStatusPosition ();
1380 XSetICFocus (Input_Context);
1381 }
1382#endif
1383#ifdef CURSOR_BLINK
1384 if (options & Opt_cursorBlink)
1385 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1386#endif
1387#ifdef OFF_FOCUS_FADING
1388 if (rs[Rs_fade])
1389 {
1390 pix_colors = pix_colors_focused;
1391 scr_recolour ();
1392 }
1393#endif
1394
1395 }
1396 break; 1420 break;
1397 1421
1398 case FocusOut: 1422 case FocusOut:
1399 if (TermWin.focus) 1423 focus_out ();
1400 {
1401 TermWin.focus = 0;
1402 want_refresh = 1;
1403
1404#if ENABLE_FRILLS || ISO_14755
1405 iso14755buf = 0;
1406#endif
1407#if ENABLE_OVERLAY
1408 scr_overlay_off ();
1409#endif
1410#ifdef USE_XIM
1411 if (Input_Context != NULL)
1412 XUnsetICFocus (Input_Context);
1413#endif
1414#ifdef CURSOR_BLINK
1415 if (options & Opt_cursorBlink)
1416 cursor_blink_ev.stop ();
1417 hidden_cursor = 0;
1418#endif
1419#ifdef OFF_FOCUS_FADING
1420 if (rs[Rs_fade])
1421 {
1422 pix_colors = pix_colors_unfocused;
1423 scr_recolour ();
1424 }
1425#endif
1426 }
1427 break; 1424 break;
1428 1425
1429 case ConfigureNotify: 1426 case ConfigureNotify:
1430 if (ev.xconfigure.window == TermWin.parent[0]) 1427 if (ev.xconfigure.window == TermWin.parent[0])
1431 { 1428 {
1435 { /* Wrap lots of configures into one */ 1432 { /* Wrap lots of configures into one */
1436 width = ev.xconfigure.width; 1433 width = ev.xconfigure.width;
1437 height = ev.xconfigure.height; 1434 height = ev.xconfigure.height;
1438 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); 1435 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height));
1439 } 1436 }
1440 while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); 1437 while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev));
1441 1438
1442 if (szHint.width != width || szHint.height != height) 1439 if (szHint.width != width || szHint.height != height)
1443 { 1440 {
1444 seen_resize = 1; 1441 seen_resize = 1;
1445 resize_all_windows (width, height, 1); 1442 resize_all_windows (width, height, 1);
1497 if (ev.xany.window == TermWin.vt) 1494 if (ev.xany.window == TermWin.vt)
1498 { 1495 {
1499 do 1496 do
1500 scr_expose (ev.xexpose.x, ev.xexpose.y, 1497 scr_expose (ev.xexpose.x, ev.xexpose.y,
1501 ev.xexpose.width, ev.xexpose.height, False); 1498 ev.xexpose.width, ev.xexpose.height, False);
1502 while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev)); 1499 while (XCheckTypedWindowEvent (disp, TermWin.vt, ev.xany.type, &ev));
1503 1500
1504 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1501 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1505 1502
1506 while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev)) 1503 while (XCheckTypedWindowEvent (disp, TermWin.vt, ev.xany.type, &ev))
1507 scr_expose (ev.xexpose.x, ev.xexpose.y, 1504 scr_expose (ev.xexpose.x, ev.xexpose.y,
1508 ev.xexpose.width, ev.xexpose.height, False); 1505 ev.xexpose.width, ev.xexpose.height, False);
1509 1506
1510 scr_refresh (refresh_type); 1507 scr_refresh (refresh_type);
1511 } 1508 }
1512 else 1509 else
1513 { 1510 {
1514 XEvent unused_event; 1511 XEvent unused_event;
1515 1512
1516 while (XCheckTypedWindowEvent (display->display, ev.xany.window, Expose, &unused_event)) 1513 while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event))
1517 ; 1514 ;
1518 while (XCheckTypedWindowEvent (display->display, ev.xany.window, GraphicsExpose, &unused_event)) 1515 while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event))
1519 ; 1516 ;
1520 1517
1521 if (isScrollbarWindow (ev.xany.window)) 1518 if (isScrollbarWindow (ev.xany.window))
1522 { 1519 {
1523 scrollBar.setIdle (); 1520 scrollBar.setIdle ();
1528 menubar_expose (); 1525 menubar_expose ();
1529#endif 1526#endif
1530 1527
1531#ifdef TRANSPARENT 1528#ifdef TRANSPARENT
1532 if (am_transparent && ev.xany.window == TermWin.parent[0]) 1529 if (am_transparent && ev.xany.window == TermWin.parent[0])
1533 XClearWindow (display->display, ev.xany.window); 1530 XClearWindow (disp, ev.xany.window);
1534#endif 1531#endif
1535 } 1532 }
1536 break; 1533 break;
1537 1534
1538 case MotionNotify: 1535 case MotionNotify:
1552 1549
1553 if (ev.xany.window == TermWin.vt) 1550 if (ev.xany.window == TermWin.vt)
1554 { 1551 {
1555 if (ev.xbutton.state & (Button1Mask | Button3Mask)) 1552 if (ev.xbutton.state & (Button1Mask | Button3Mask))
1556 { 1553 {
1557 while (XCheckTypedWindowEvent (display->display, TermWin.vt, MotionNotify, &ev)) 1554 while (XCheckTypedWindowEvent (disp, TermWin.vt, MotionNotify, &ev))
1558 ; 1555 ;
1559 1556
1560 XQueryPointer (display->display, TermWin.vt, 1557 XQueryPointer (disp, TermWin.vt,
1561 &unused_root, &unused_child, 1558 &unused_root, &unused_child,
1562 &unused_root_x, &unused_root_y, 1559 &unused_root_x, &unused_root_y,
1563 &ev.xbutton.x, &ev.xbutton.y, 1560 &ev.xbutton.x, &ev.xbutton.y,
1564 &ev.xbutton.state); 1561 &ev.xbutton.state);
1565#ifdef MOUSE_THRESHOLD 1562#ifdef MOUSE_THRESHOLD
1629#endif 1626#endif
1630 } 1627 }
1631 } 1628 }
1632 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1629 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ())
1633 { 1630 {
1634 while (XCheckTypedWindowEvent (display->display, scrollBar.win, 1631 while (XCheckTypedWindowEvent (disp, scrollBar.win,
1635 MotionNotify, &ev)) 1632 MotionNotify, &ev))
1636 ; 1633 ;
1637 1634
1638 XQueryPointer (display->display, scrollBar.win, 1635 XQueryPointer (disp, scrollBar.win,
1639 &unused_root, &unused_child, 1636 &unused_root, &unused_child,
1640 &unused_root_x, &unused_root_y, 1637 &unused_root_x, &unused_root_y,
1641 &ev.xbutton.x, &ev.xbutton.y, 1638 &ev.xbutton.x, &ev.xbutton.y,
1642 &unused_mask); 1639 &unused_mask);
1643 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1640 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
1645 scr_refresh (refresh_type); 1642 scr_refresh (refresh_type);
1646 refresh_limit = 0; 1643 refresh_limit = 0;
1647 scrollbar_show (1); 1644 scrollbar_show (1);
1648 } 1645 }
1649 break; 1646 break;
1647 }
1648}
1649
1650void
1651rxvt_term::focus_in ()
1652{
1653 if (!TermWin.focus)
1654 {
1655 TermWin.focus = 1;
1656 want_refresh = 1;
1657#ifdef USE_XIM
1658 if (Input_Context != NULL)
1659 {
1660 IMSetStatusPosition ();
1661 XSetICFocus (Input_Context);
1662 }
1663#endif
1664#ifdef CURSOR_BLINK
1665 if (options & Opt_cursorBlink)
1666 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1667#endif
1668#ifdef OFF_FOCUS_FADING
1669 if (rs[Rs_fade])
1670 {
1671 pix_colors = pix_colors_focused;
1672 scr_recolour ();
1673 }
1674#endif
1675 }
1676}
1677
1678void
1679rxvt_term::focus_out ()
1680{
1681 if (TermWin.focus)
1682 {
1683 TermWin.focus = 0;
1684 want_refresh = 1;
1685
1686#if ENABLE_FRILLS || ISO_14755
1687 iso14755buf = 0;
1688#endif
1689#if ENABLE_OVERLAY
1690 scr_overlay_off ();
1691#endif
1692#ifdef USE_XIM
1693 if (Input_Context != NULL)
1694 XUnsetICFocus (Input_Context);
1695#endif
1696#ifdef CURSOR_BLINK
1697 if (options & Opt_cursorBlink)
1698 cursor_blink_ev.stop ();
1699 hidden_cursor = 0;
1700#endif
1701#ifdef OFF_FOCUS_FADING
1702 if (rs[Rs_fade])
1703 {
1704 pix_colors = pix_colors_unfocused;
1705 scr_recolour ();
1706 }
1707#endif
1650 } 1708 }
1651} 1709}
1652 1710
1653#if TRANSPARENT 1711#if TRANSPARENT
1654void 1712void
2081 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; 2139 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
2082 unsigned int lower_lim_r, lower_lim_g, lower_lim_b; 2140 unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
2083 unsigned int upper_lim_r, upper_lim_g, upper_lim_b; 2141 unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
2084 int i; 2142 int i;
2085 2143
2086 Visual* visual = display->visual; 2144 Visual *visual = display->visual;
2087 2145
2088 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; 2146 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
2089 2147
2090 /* for convenience */ 2148 /* for convenience */
2091 mask_r = visual->red_mask; 2149 mask_r = visual->red_mask;
2312 Atom atype; 2370 Atom atype;
2313 unsigned char *prop = NULL; 2371 unsigned char *prop = NULL;
2314 Window root, oldp, *list; 2372 Window root, oldp, *list;
2315 Pixmap rootpixmap = None; 2373 Pixmap rootpixmap = None;
2316 XWindowAttributes wattr, wrootattr; 2374 XWindowAttributes wattr, wrootattr;
2375 dDisp;
2317 2376
2318 pchanged = 0; 2377 pchanged = 0;
2319 2378
2320 if (!(options & Opt_transparent)) 2379 if (!(options & Opt_transparent))
2321 return pchanged; /* Don't try any more */ 2380 return pchanged; /* Don't try any more */
2322 2381
2323 XGetWindowAttributes (display->display, display->root, &wrootattr); 2382 XGetWindowAttributes (disp, display->root, &wrootattr);
2324 rootdepth = wrootattr.depth; 2383 rootdepth = wrootattr.depth;
2325 2384
2326 XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); 2385 XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
2327 2386
2328 if (rootdepth != wattr.depth) 2387 if (rootdepth != wattr.depth)
2329 { 2388 {
2330 if (am_transparent) 2389 if (am_transparent)
2331 { 2390 {
2332 pchanged = 1; 2391 pchanged = 1;
2333 XSetWindowBackground (display->display, TermWin.vt, pix_colors_focused[Color_bg]); 2392 XSetWindowBackground (disp, TermWin.vt, pix_colors_focused[Color_bg]);
2334 am_transparent = am_pixmap_trans = 0; 2393 am_transparent = am_pixmap_trans = 0;
2335 } 2394 }
2336 2395
2337 return pchanged; /* Don't try any more */ 2396 return pchanged; /* Don't try any more */
2338 } 2397 }
2339 2398
2340 /* Get all X ops out of the queue so that our information is up-to-date. */ 2399 /* Get all X ops out of the queue so that our information is up-to-date. */
2341 XSync (display->display, False); 2400 XSync (disp, False);
2342 2401
2343 /* 2402 /*
2344 * Make the frame window set by the window manager have 2403 * Make the frame window set by the window manager have
2345 * the root background. Some window managers put multiple nested frame 2404 * the root background. Some window managers put multiple nested frame
2346 * windows for each client, so we have to take care about that. 2405 * windows for each client, so we have to take care about that.
2347 */ 2406 */
2348 i = (xa[XA_XROOTPMAP_ID] 2407 i = (xa[XA_XROOTPMAP_ID]
2349 && XGetWindowProperty (display->display, display->root, xa[XA_XROOTPMAP_ID], 2408 && XGetWindowProperty (disp, display->root, xa[XA_XROOTPMAP_ID],
2350 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2409 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2351 &nitems, &bytes_after, &prop) == Success); 2410 &nitems, &bytes_after, &prop) == Success);
2352 2411
2353 if (!i || prop == NULL) 2412 if (!i || prop == NULL)
2354 i = (xa[XA_ESETROOT_PMAP_ID] 2413 i = (xa[XA_ESETROOT_PMAP_ID]
2355 && XGetWindowProperty (display->display, display->root, xa[XA_ESETROOT_PMAP_ID], 2414 && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID],
2356 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2415 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2357 &nitems, &bytes_after, &prop) == Success); 2416 &nitems, &bytes_after, &prop) == Success);
2358 2417
2359 if (!i || prop == NULL 2418 if (!i || prop == NULL
2360#if TINTING 2419#if TINTING
2379 Window cr; 2438 Window cr;
2380 XImage *image; 2439 XImage *image;
2381 GC gc; 2440 GC gc;
2382 XGCValues gcvalue; 2441 XGCValues gcvalue;
2383 2442
2384 XTranslateCoordinates (display->display, TermWin.parent[0], display->root, 2443 XTranslateCoordinates (disp, TermWin.parent[0], display->root,
2385 0, 0, &sx, &sy, &cr); 2444 0, 0, &sx, &sy, &cr);
2386 nw = (unsigned int)szHint.width; 2445 nw = (unsigned int)szHint.width;
2387 nh = (unsigned int)szHint.height; 2446 nh = (unsigned int)szHint.height;
2388 nx = ny = 0; 2447 nx = ny = 0;
2389 2448
2402 } 2461 }
2403 2462
2404 MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); 2463 MIN_IT (nw, (unsigned int) (wrootattr.width - sx));
2405 MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); 2464 MIN_IT (nh, (unsigned int) (wrootattr.height - sy));
2406 2465
2407 XSync (display->display, False); 2466 XSync (disp, False);
2408 allowedxerror = -1; 2467 allowedxerror = -1;
2409 image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2468 image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2410 2469
2411 /* XXX: handle BadMatch - usually because we're outside the pixmap */ 2470 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2412 /* XXX: may need a delay here? */ 2471 /* XXX: may need a delay here? */
2413 allowedxerror = 0; 2472 allowedxerror = 0;
2414 2473
2417 if (am_transparent && am_pixmap_trans) 2476 if (am_transparent && am_pixmap_trans)
2418 { 2477 {
2419 pchanged = 1; 2478 pchanged = 1;
2420 if (TermWin.pixmap != None) 2479 if (TermWin.pixmap != None)
2421 { 2480 {
2422 XFreePixmap (display->display, TermWin.pixmap); 2481 XFreePixmap (disp, TermWin.pixmap);
2423 TermWin.pixmap = None; 2482 TermWin.pixmap = None;
2424 } 2483 }
2425 } 2484 }
2426 2485
2427 am_pixmap_trans = 0; 2486 am_pixmap_trans = 0;
2428 } 2487 }
2429 else 2488 else
2430 { 2489 {
2431 if (TermWin.pixmap != None) 2490 if (TermWin.pixmap != None)
2432 XFreePixmap (display->display, TermWin.pixmap); 2491 XFreePixmap (disp, TermWin.pixmap);
2433 2492
2434#if TINTING 2493#if TINTING
2435 if (ISSET_PIXCOLOR (Color_tint)) 2494 if (ISSET_PIXCOLOR (Color_tint))
2436 { 2495 {
2437 unsigned short rm, gm, bm; 2496 unsigned short rm, gm, bm;
2441 2500
2442 ShadeXImage (display, image, shade, rm, gm, bm); 2501 ShadeXImage (display, image, shade, rm, gm, bm);
2443 } 2502 }
2444#endif 2503#endif
2445 2504
2446 TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, 2505 TermWin.pixmap = XCreatePixmap (disp, TermWin.vt,
2447 szHint.width, szHint.height, image->depth); 2506 szHint.width, szHint.height, image->depth);
2448 gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue); 2507 gc = XCreateGC (disp, TermWin.vt, 0UL, &gcvalue);
2449 XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0, 2508 XPutImage (disp, TermWin.pixmap, gc, image, 0, 0,
2450 nx, ny, image->width, image->height); 2509 nx, ny, image->width, image->height);
2451 XFreeGC (display->display, gc); 2510 XFreeGC (disp, gc);
2452 XDestroyImage (image); 2511 XDestroyImage (image);
2453 XSetWindowBackgroundPixmap (display->display, TermWin.parent[0], TermWin.pixmap); 2512 XSetWindowBackgroundPixmap (disp, TermWin.parent[0], TermWin.pixmap);
2454 XClearWindow (display->display, TermWin.parent[0]); 2513 XClearWindow (disp, TermWin.parent[0]);
2455 2514
2456 if (!am_transparent || !am_pixmap_trans) 2515 if (!am_transparent || !am_pixmap_trans)
2457 pchanged = 1; 2516 pchanged = 1;
2458 2517
2459 am_transparent = am_pixmap_trans = 1; 2518 am_transparent = am_pixmap_trans = 1;
2460 } 2519 }
2461 } 2520 }
2462 2521
2463 if (am_pixmap_trans) 2522 if (am_pixmap_trans)
2464 XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); 2523 XSetWindowBackgroundPixmap (disp, TermWin.vt, ParentRelative);
2465 else 2524 else
2466 { 2525 {
2467 unsigned int n; 2526 unsigned int n;
2468 /* 2527 /*
2469 * InheritPixmap transparency 2528 * InheritPixmap transparency
2470 */ 2529 */
2471 for (i = 1; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) 2530 for (i = 1; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++)
2472 { 2531 {
2473 oldp = TermWin.parent[i]; 2532 oldp = TermWin.parent[i];
2474 XQueryTree (display->display, TermWin.parent[i - 1], &root, 2533 XQueryTree (disp, TermWin.parent[i - 1], &root,
2475 &TermWin.parent[i], &list, &n); 2534 &TermWin.parent[i], &list, &n);
2476 XFree (list); 2535 XFree (list);
2477 2536
2478 if (TermWin.parent[i] == display->root) 2537 if (TermWin.parent[i] == display->root)
2479 { 2538 {
2491 2550
2492 if (pchanged) 2551 if (pchanged)
2493 { 2552 {
2494 for (; n < (unsigned int)i; n++) 2553 for (; n < (unsigned int)i; n++)
2495 { 2554 {
2496 XGetWindowAttributes (display->display, TermWin.parent[n], &wattr); 2555 XGetWindowAttributes (disp, TermWin.parent[n], &wattr);
2497 if (wattr.depth != rootdepth || wattr.c_class == InputOnly) 2556 if (wattr.depth != rootdepth || wattr.c_class == InputOnly)
2498 { 2557 {
2499 n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1; 2558 n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1;
2500 break; 2559 break;
2501 } 2560 }
2502 } 2561 }
2503 } 2562 }
2504 2563
2505 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) 2564 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0])))
2506 { 2565 {
2507 XSetWindowBackground (display->display, TermWin.parent[0], pix_colors_focused[Color_fg]); 2566 XSetWindowBackground (disp, TermWin.parent[0], pix_colors_focused[Color_fg]);
2508 XSetWindowBackground (display->display, TermWin.vt, pix_colors_focused[Color_bg]); 2567 XSetWindowBackground (disp, TermWin.vt, pix_colors_focused[Color_bg]);
2509 am_transparent = 0; 2568 am_transparent = 0;
2510 /* XXX: also turn off Opt_transparent? */ 2569 /* XXX: also turn off Opt_transparent? */
2511 } 2570 }
2512 else 2571 else
2513 { 2572 {
2516 * needed for fvwm2.2.2 (and before?) */ 2575 * needed for fvwm2.2.2 (and before?) */
2517 sleep (1); 2576 sleep (1);
2518#endif 2577#endif
2519 for (n = 0; n < (unsigned int)i; n++) 2578 for (n = 0; n < (unsigned int)i; n++)
2520 { 2579 {
2521 XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative); 2580 XSetWindowBackgroundPixmap (disp, TermWin.parent[n], ParentRelative);
2522 XClearWindow (display->display, TermWin.parent[n]); 2581 XClearWindow (disp, TermWin.parent[n]);
2523 } 2582 }
2524 2583
2525 XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); 2584 XSetWindowBackgroundPixmap (disp, TermWin.vt, ParentRelative);
2526 am_transparent = 1; 2585 am_transparent = 1;
2527 } 2586 }
2528 2587
2529 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) 2588 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++)
2530 TermWin.parent[i] = None; 2589 TermWin.parent[i] = None;
2531 } 2590 }
2532 2591
2533 if (scrollBar.win) 2592 if (scrollBar.win)
2534 { 2593 {
2535 XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative); 2594 XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative);
2536 scrollBar.setIdle (); 2595 scrollBar.setIdle ();
2537 scrollbar_show (0); 2596 scrollbar_show (0);
2538 } 2597 }
2539 2598
2540 if (am_transparent) 2599 if (am_transparent)
2578 // some window managers resize the window early, and these programs 2637 // some window managers resize the window early, and these programs
2579 // then sometimes get the size wrong. 2638 // then sometimes get the size wrong.
2580 // unfortunately other programs are even more buggy and dislike 2639 // unfortunately other programs are even more buggy and dislike
2581 // being sent SIGWINCH, so only do it when we were in fact being 2640 // being sent SIGWINCH, so only do it when we were in fact being
2582 // resized. 2641 // resized.
2583 if (seen_resize) 2642 if (seen_resize && cmd_pid)
2584 kill (-cmd_pid, SIGWINCH); 2643 kill (-cmd_pid, SIGWINCH);
2585 } 2644 }
2586 2645
2587 /* Read a text string from the input buffer */ 2646 /* Read a text string from the input buffer */
2588 unicode_t buf[UBUFSIZ]; 2647 unicode_t buf[UBUFSIZ];
3174 { 3233 {
3175 switch (priv) 3234 switch (priv)
3176 { 3235 {
3177 case '>': 3236 case '>':
3178 if (ch == CSI_DA) /* secondary device attributes */ 3237 if (ch == CSI_DA) /* secondary device attributes */
3179 tt_printf ("\033[>%d;%-.8s;0c", 'R', VSTRING); 3238 tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]);
3180 break; 3239 break;
3181 case '?': 3240 case '?':
3182 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 3241 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
3183 process_terminal_mode (ch, priv, nargs, arg); 3242 process_terminal_mode (ch, priv, nargs, arg);
3184 break; 3243 break;
3413rxvt_term::process_window_ops (const int *args, unsigned int nargs) 3472rxvt_term::process_window_ops (const int *args, unsigned int nargs)
3414{ 3473{
3415 int x, y; 3474 int x, y;
3416 XWindowAttributes wattr; 3475 XWindowAttributes wattr;
3417 Window wdummy; 3476 Window wdummy;
3477 dDisp;
3418 3478
3419 if (nargs == 0) 3479 if (nargs == 0)
3420 return; 3480 return;
3421 3481
3422 switch (args[0]) 3482 switch (args[0])
3423 { 3483 {
3424 /* 3484 /*
3425 * commands 3485 * commands
3426 */ 3486 */
3427 case 1: /* deiconify window */ 3487 case 1: /* deiconify window */
3428 XMapWindow (display->display, TermWin.parent[0]); 3488 XMapWindow (disp, TermWin.parent[0]);
3429 break; 3489 break;
3430 case 2: /* iconify window */ 3490 case 2: /* iconify window */
3431 XIconifyWindow (display->display, TermWin.parent[0], 3491 XIconifyWindow (disp, TermWin.parent[0], display->screen);
3432 DefaultScreen (display->display));
3433 break; 3492 break;
3434 case 3: /* set position (pixels) */ 3493 case 3: /* set position (pixels) */
3435 XMoveWindow (display->display, TermWin.parent[0], args[1], args[2]); 3494 XMoveWindow (disp, TermWin.parent[0], args[1], args[2]);
3436 break; 3495 break;
3437 case 4: /* set size (pixels) */ 3496 case 4: /* set size (pixels) */
3438 set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); 3497 set_widthheight ((unsigned int)args[2], (unsigned int)args[1]);
3439 break; 3498 break;
3440 case 5: /* raise window */ 3499 case 5: /* raise window */
3441 XRaiseWindow (display->display, TermWin.parent[0]); 3500 XRaiseWindow (disp, TermWin.parent[0]);
3442 break; 3501 break;
3443 case 6: /* lower window */ 3502 case 6: /* lower window */
3444 XLowerWindow (display->display, TermWin.parent[0]); 3503 XLowerWindow (disp, TermWin.parent[0]);
3445 break; 3504 break;
3446 case 7: /* refresh window */ 3505 case 7: /* refresh window */
3447 scr_touch (true); 3506 scr_touch (true);
3448 break; 3507 break;
3449 case 8: /* set size (chars) */ 3508 case 8: /* set size (chars) */
3461 3520
3462 /* 3521 /*
3463 * reports - some output format copied from XTerm 3522 * reports - some output format copied from XTerm
3464 */ 3523 */
3465 case 11: /* report window state */ 3524 case 11: /* report window state */
3466 XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); 3525 XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
3467 tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); 3526 tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2);
3468 break; 3527 break;
3469 case 13: /* report window position */ 3528 case 13: /* report window position */
3470 XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); 3529 XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
3471 XTranslateCoordinates (display->display, TermWin.parent[0], wattr.root, 3530 XTranslateCoordinates (disp, TermWin.parent[0], wattr.root,
3472 -wattr.border_width, -wattr.border_width, 3531 -wattr.border_width, -wattr.border_width,
3473 &x, &y, &wdummy); 3532 &x, &y, &wdummy);
3474 tt_printf ("\033[3;%d;%dt", x, y); 3533 tt_printf ("\033[3;%d;%dt", x, y);
3475 break; 3534 break;
3476 case 14: /* report window size (pixels) */ 3535 case 14: /* report window size (pixels) */
3477 XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); 3536 XGetWindowAttributes (disp, TermWin.parent[0], &wattr);
3478 tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); 3537 tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width);
3479 break; 3538 break;
3480 case 18: /* report text area size (chars) */ 3539 case 18: /* report text area size (chars) */
3481 tt_printf ("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol); 3540 tt_printf ("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol);
3482 break; 3541 break;
3484 tt_printf ("\033[9;%d;%dt", TermWin.nrow, TermWin.ncol); 3543 tt_printf ("\033[9;%d;%dt", TermWin.nrow, TermWin.ncol);
3485 break; 3544 break;
3486 case 20: /* report icon label */ 3545 case 20: /* report icon label */
3487 { 3546 {
3488 char *s; 3547 char *s;
3489 XGetIconName (display->display, TermWin.parent[0], &s); 3548 XGetIconName (disp, TermWin.parent[0], &s);
3490 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3549 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */
3491 XFree (s); 3550 XFree (s);
3492 } 3551 }
3493 break; 3552 break;
3494 case 21: /* report window title */ 3553 case 21: /* report window title */
3495 { 3554 {
3496 char *s; 3555 char *s;
3497 XFetchName (display->display, TermWin.parent[0], &s); 3556 XFetchName (disp, TermWin.parent[0], &s);
3498 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3557 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */
3499 XFree (s); 3558 XFree (s);
3500 } 3559 }
3501 break; 3560 break;
3502 } 3561 }
3535 else if (ch < 0x20) 3594 else if (ch < 0x20)
3536 return NULL; /* other control character - exit */ 3595 return NULL; /* other control character - exit */
3537 3596
3538 seen_esc = false; 3597 seen_esc = false;
3539 3598
3540 if (n >= sizeof (string) - 1) 3599 if (n >= STRING_MAX - 1)
3541 // stop at some sane length 3600 // stop at some sane length
3542 return NULL; 3601 return NULL;
3543 3602
3544 if (ch == C0_SYN) 3603 if (ch == C0_SYN)
3545 string[n++] = cmd_get8 (); 3604 string[n++] = cmd_get8 ();
3613 set_window_color (color, str); 3672 set_window_color (color, str);
3614} 3673}
3615 3674
3616/* 3675/*
3617 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) 3676 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL)
3618 * 0 = change iconName/title
3619 * 1 = change iconName
3620 * 2 = change title
3621 * 4 = change color
3622 * 10 = change fg color
3623 * 11 = change bg color
3624 * 12 = change text color
3625 * 13 = change mouse foreground color
3626 * 17 = change highlight character colour
3627 * 18 = change bold character color
3628 * 19 = change underlined character color
3629 * 46 = change logfile (not implemented)
3630 * 50 = change font
3631 *
3632 * rxvt extensions:
3633 * 20 = bg pixmap
3634 * 39 = change default fg color
3635 * 49 = change default bg color
3636 * 55 = dump scrollback buffer and all of screen
3637 * 701 = change locale
3638 * 702 = find font
3639 * 703 = menu
3640 */ 3677 */
3641void 3678void
3642rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) 3679rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp)
3643{ 3680{
3644 int changed = 0; 3681 int changed = 0;
3645 int color; 3682 int color;
3646 char *buf, *name; 3683 char *buf, *name;
3647 bool query = str[0] == '?' && !str[1]; 3684 bool query = str[0] == '?' && !str[1];
3648 int saveop = op; 3685 int saveop = op;
3686 dDisp;
3649 3687
3650 assert (str != NULL); 3688 assert (str != NULL);
3651 switch (op) 3689 switch (op)
3652 { 3690 {
3653 case XTerm_name: 3691 case XTerm_name:
3669 unsigned long bytes_after; 3707 unsigned long bytes_after;
3670 unsigned char *value = 0; 3708 unsigned char *value = 0;
3671 const char *str = ""; 3709 const char *str = "";
3672 3710
3673 if (prop 3711 if (prop
3674 && XGetWindowProperty (display->display, TermWin.parent[0], 3712 && XGetWindowProperty (disp, TermWin.parent[0],
3675 prop, 0, 1<<16, 0, AnyPropertyType, 3713 prop, 0, 1<<16, 0, AnyPropertyType,
3676 &actual_type, &actual_format, 3714 &actual_type, &actual_format,
3677 &nitems, &bytes_after, &value) == Success 3715 &nitems, &bytes_after, &value) == Success
3678 && actual_type != None 3716 && actual_type != None
3679 && actual_format == 8) 3717 && actual_format == 8)
3691 { 3729 {
3692 *eq = 0; 3730 *eq = 0;
3693 set_utf8_property (display->atom (str), eq + 1); 3731 set_utf8_property (display->atom (str), eq + 1);
3694 } 3732 }
3695 else 3733 else
3696 XDeleteProperty (display->display, TermWin.parent[0], 3734 XDeleteProperty (disp, TermWin.parent[0],
3697 display->atom (str)); 3735 display->atom (str));
3698 } 3736 }
3699 break; 3737 break;
3700 3738
3701 case XTerm_Color: 3739 case XTerm_Color:
3742 break; 3780 break;
3743#ifndef NO_BOLD_UNDERLINE_REVERSE 3781#ifndef NO_BOLD_UNDERLINE_REVERSE
3744 case XTerm_Color_BD: 3782 case XTerm_Color_BD:
3745 process_color_seq (XTerm_Color_BD, Color_BD, str, resp); 3783 process_color_seq (XTerm_Color_BD, Color_BD, str, resp);
3746 break; 3784 break;
3747 case XTerm_Color_IT:
3748 process_color_seq (XTerm_Color_IT, Color_IT, str, resp);
3749 break;
3750 case XTerm_Color_UL: 3785 case XTerm_Color_UL:
3751 process_color_seq (XTerm_Color_UL, Color_UL, str, resp); 3786 process_color_seq (XTerm_Color_UL, Color_UL, str, resp);
3752 break; 3787 break;
3753 case XTerm_Color_RV: 3788 case XTerm_Color_RV:
3754 process_color_seq (XTerm_Color_RV, Color_RV, str, resp); 3789 process_color_seq (XTerm_Color_RV, Color_RV, str, resp);
3755 break; 3790 break;
3791 case URxvt_Color_IT:
3792 process_color_seq (URxvt_Color_IT, Color_IT, str, resp);
3793 break;
3756#endif 3794#endif
3757#if TRANSPARENT && TINTING 3795#if TRANSPARENT && TINTING
3758 case XTerm_Color_tint: 3796 case URxvt_Color_tint:
3759 process_color_seq (XTerm_Color_tint, Color_tint, str, resp); 3797 process_color_seq (URxvt_Color_tint, Color_tint, str, resp);
3760 check_our_parents (); 3798 check_our_parents ();
3761 if (am_transparent) 3799 if (am_transparent)
3762 want_full_refresh = want_refresh = 1; 3800 want_full_refresh = want_refresh = 1;
3763 break; 3801 break;
3764#endif 3802#endif
3798 3836
3799 case XTerm_logfile: 3837 case XTerm_logfile:
3800 // TODO, when secure mode? 3838 // TODO, when secure mode?
3801 break; 3839 break;
3802 3840
3841#ifdef MENUBAR
3842 case URxvt_Menu:
3843 if (options & Opt_insecure)
3844 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3845 break;
3846#endif
3847#if 0
3848 case XTerm_dumpscreen: /* no error notices */
3849 {
3850 int fd;
3851 if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0)
3852 {
3853 scr_dump (fd);
3854 close (fd);
3855 }
3856 }
3857 break;
3858#endif
3803 case XTerm_font: 3859 case XTerm_font:
3804 op = URxvt_font; 3860 op = URxvt_font;
3805 case URxvt_font: 3861 case URxvt_font:
3806#if ENABLE_STYLES 3862#if ENABLE_STYLES
3807 case URxvt_boldFont: 3863 case URxvt_boldFont:
3822 set_fonts (); 3878 set_fonts ();
3823 } 3879 }
3824 break; 3880 break;
3825 3881
3826#if ENABLE_FRILLS 3882#if ENABLE_FRILLS
3827 case XTerm_locale: 3883 case URxvt_locale:
3828 if (query) 3884 if (query)
3829 tt_printf ("\33]%d;%-.250s%c", XTerm_locale, (options & Opt_insecure) ? locale : "", resp); 3885 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp);
3830 else 3886 else
3831 { 3887 {
3832 set_locale (str); 3888 set_locale (str);
3833 pty.set_utf8_mode (enc_utf8); 3889 pty.set_utf8_mode (enc_utf8);
3834# ifdef USE_XIM
3835 im_cb (); 3890 init_xlocale ();
3836# endif
3837 } 3891 }
3838 break; 3892 break;
3839#endif
3840 3893
3841#ifdef MENUBAR 3894 case URxvt_view_up:
3842 case XTerm_Menu: 3895 case URxvt_view_down:
3843 if (options & Opt_insecure) 3896 int lines = atoi (str);
3844 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3897
3845 break; 3898 if (lines)
3846#endif 3899 scr_page (op == URxvt_view_up ? UP : DN, lines);
3847#if 0
3848 case XTerm_dumpscreen: /* no error notices */
3849 { 3900 else
3850 int fd;
3851 if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0)
3852 { 3901 {
3853 scr_dump (fd); 3902 scr_erase_savelines ();
3854 close (fd);
3855 } 3903 }
3856 } 3904
3857 break; 3905 break;
3858#endif 3906#endif
3859 } 3907 }
3860} 3908}
3861/*----------------------------------------------------------------------*/ 3909/*----------------------------------------------------------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines