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.202 by root, Sat Mar 12 23:35:14 2005 UTC vs.
Revision 1.209 by root, Tue Dec 20 19:30:59 2005 UTC

135rxvt_term::iso14755_54 (int x, int y) 135rxvt_term::iso14755_54 (int x, int y)
136{ 136{
137 x = Pixel2Col (x); 137 x = Pixel2Col (x);
138 y = Pixel2Row (y); 138 y = Pixel2Row (y);
139 139
140 if (x < 0 || x >= TermWin.ncol 140 if (x < 0 || x >= ncol
141 || y < 0 || y >= TermWin.nrow) 141 || y < 0 || y >= nrow)
142 return; 142 return;
143 143
144 for (;;) 144 for (;;)
145 { 145 {
146 text_t t = screen.text[y + TermWin.saveLines - TermWin.view_start][x]; 146 const line_t &l = save[y + saveLines - view_start];
147
148 text_t t = l.t[x];
147 149
148 if (t != NOCHAR || !x) 150 if (t != NOCHAR || !x)
149 { 151 {
150 iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x], 152 iso14755_51 (l.t[x], l.r[x]);
151 screen.rend[y + TermWin.saveLines - TermWin.view_start][x]);
152 iso14755buf = ISO_14755_54; 153 iso14755buf = ISO_14755_54;
153 break; 154 break;
154 } 155 }
155 156
156 x--; 157 x--;
163void 164void
164rxvt_term::iso14755_51 (unicode_t ch, rend_t r) 165rxvt_term::iso14755_51 (unicode_t ch, rend_t r)
165{ 166{
166 rxvt_fontset *fs = FONTSET (r); 167 rxvt_fontset *fs = FONTSET (r);
167 rxvt_font *f = (*fs)[fs->find_font (ch)]; 168 rxvt_font *f = (*fs)[fs->find_font (ch)];
168 wchar_t *chr, *alloc, ch2; 169 wchar_t *chr, *alloc, ch2, *fname;
169 int len; 170 int len;
171
172 fname = rxvt_utf8towcs (f->name);
170 173
171#if ENABLE_COMBINING 174#if ENABLE_COMBINING
172 if (IS_COMPOSE (ch)) 175 if (IS_COMPOSE (ch))
173 { 176 {
174 len = rxvt_composite.expand (ch, 0); 177 len = rxvt_composite.expand (ch, 0);
183 alloc = 0; 186 alloc = 0;
184 chr = &ch2; 187 chr = &ch2;
185 len = 1; 188 len = 1;
186 } 189 }
187 190
188 int width = strlen (f->name); 191 int width = wcswidth (fname, wcslen (fname));
189 192
190 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); 193 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1);
191 194
192 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 195 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
193 196
206#endif 209#endif
207 scr_overlay_set (11, y, ch, r); 210 scr_overlay_set (11, y, ch, r);
208 scr_overlay_set (12, y, NOCHAR, r); 211 scr_overlay_set (12, y, NOCHAR, r);
209 } 212 }
210 213
211 scr_overlay_set (0, len, f->name); 214 scr_overlay_set (0, len, fname);
215
216 free (fname);
212 217
213#if ENABLE_COMBINING 218#if ENABLE_COMBINING
214 if (alloc) 219 if (alloc)
215 delete [] alloc; 220 delete [] alloc;
216#endif 221#endif
362#ifdef KEYSYM_RESOURCE 367#ifdef KEYSYM_RESOURCE
363 if (keyboard->dispatch (this, keysym, ev.state)) 368 if (keyboard->dispatch (this, keysym, ev.state))
364 return; 369 return;
365#endif 370#endif
366 371
367 if (TermWin.saveLines) 372 if (saveLines)
368 { 373 {
369#ifdef UNSHIFTED_SCROLLKEYS 374#ifdef UNSHIFTED_SCROLLKEYS
370 if (!ctrl && !meta) 375 if (!ctrl && !meta)
371#else 376#else
372 if (IS_SCROLL_MOD) 377 if (IS_SCROLL_MOD)
373#endif 378#endif
374 { 379 {
375 int lnsppg; 380 int lnsppg;
376 381
377#ifdef PAGING_CONTEXT_LINES 382#ifdef PAGING_CONTEXT_LINES
378 lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES; 383 lnsppg = nrow - PAGING_CONTEXT_LINES;
379#else 384#else
380 lnsppg = TermWin.nrow * 4 / 5; 385 lnsppg = nrow * 4 / 5;
381#endif 386#endif
382 if (keysym == XK_Prior) 387 if (keysym == XK_Prior)
383 { 388 {
384 scr_page (UP, lnsppg); 389 scr_page (UP, lnsppg);
385 return; 390 return;
841 846
842 if (len <= 0) 847 if (len <= 0)
843 return; /* not mapped */ 848 return; /* not mapped */
844 849
845 if (options & Opt_scrollTtyKeypress) 850 if (options & Opt_scrollTtyKeypress)
846 if (TermWin.view_start) 851 if (view_start)
847 { 852 {
848 TermWin.view_start = 0; 853 view_start = 0;
849 want_refresh = 1; 854 want_refresh = 1;
850 } 855 }
851 856
852 /* 857 /*
853 * these modifications only affect the static keybuffer 858 * these modifications only affect the static keybuffer
1030{ 1035{
1031 if (mouse_slip_wheel_speed == 0 1036 if (mouse_slip_wheel_speed == 0
1032 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) 1037 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1033 : scr_page (UP, mouse_slip_wheel_speed)) 1038 : scr_page (UP, mouse_slip_wheel_speed))
1034 { 1039 {
1035 if (TermWin.view_start == TermWin.nscrolled || 1040 if (view_start == nsaved ||
1036 TermWin.view_start == 0) 1041 view_start == 0)
1037 mouse_slip_wheel_speed = 0; 1042 mouse_slip_wheel_speed = 0;
1038 1043
1039 refresh_type |= SMOOTH_REFRESH; 1044 refresh_type |= SMOOTH_REFRESH;
1040 want_refresh = 1; 1045 want_refresh = 1;
1041 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1046 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1088} 1093}
1089 1094
1090void 1095void
1091rxvt_term::pointer_unblank () 1096rxvt_term::pointer_unblank ()
1092{ 1097{
1093 XDefineCursor (display->display, TermWin.vt, TermWin_cursor); 1098 XDefineCursor (display->display, vt, TermWin_cursor);
1094 recolour_cursor (); 1099 recolour_cursor ();
1095 1100
1096#ifdef POINTER_BLANK 1101#ifdef POINTER_BLANK
1097 hidden_pointer = 0; 1102 hidden_pointer = 0;
1098 1103
1106rxvt_term::pointer_blank () 1111rxvt_term::pointer_blank ()
1107{ 1112{
1108 if (! (options & Opt_pointerBlank)) 1113 if (! (options & Opt_pointerBlank))
1109 return; 1114 return;
1110 1115
1111 XDefineCursor (display->display, TermWin.vt, display->blank_cursor); 1116 XDefineCursor (display->display, vt, display->blank_cursor);
1112 XFlush (display->display); 1117 XFlush (display->display);
1113 1118
1114 hidden_pointer = 1; 1119 hidden_pointer = 1;
1115} 1120}
1116 1121
1418 case FocusOut: 1423 case FocusOut:
1419 focus_out (); 1424 focus_out ();
1420 break; 1425 break;
1421 1426
1422 case ConfigureNotify: 1427 case ConfigureNotify:
1423 if (ev.xconfigure.window == TermWin.parent[0]) 1428 if (ev.xconfigure.window == parent[0])
1424 { 1429 {
1425 int height, width;
1426
1427 do
1428 { /* Wrap lots of configures into one */
1429 width = ev.xconfigure.width;
1430 height = ev.xconfigure.height;
1431 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height));
1432 }
1433 while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev)); 1430 while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev))
1431 ;
1434 1432
1435 if (szHint.width != width || szHint.height != height) 1433 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1436 { 1434 {
1437 seen_resize = 1; 1435 seen_resize = 1;
1438 resize_all_windows (width, height, 1); 1436 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1439 } 1437 }
1440 1438
1441#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1439#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1442 if (options & Opt_transparent) 1440 if (options & Opt_transparent)
1443 check_our_parents (); 1441 check_our_parents ();
1464 case SelectionRequest: 1462 case SelectionRequest:
1465 selection_send (ev.xselectionrequest); 1463 selection_send (ev.xselectionrequest);
1466 break; 1464 break;
1467 1465
1468 case UnmapNotify: 1466 case UnmapNotify:
1469 TermWin.mapped = 0; 1467 mapped = 0;
1470#ifdef TEXT_BLINK 1468#ifdef TEXT_BLINK
1471 text_blink_ev.stop (); 1469 text_blink_ev.stop ();
1472#endif 1470#endif
1473 break; 1471 break;
1474 1472
1475 case MapNotify: 1473 case MapNotify:
1476 TermWin.mapped = 1; 1474 mapped = 1;
1477#ifdef TEXT_BLINK 1475#ifdef TEXT_BLINK
1478 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 1476 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL);
1479#endif 1477#endif
1480 break; 1478 break;
1481 1479
1485 break; 1483 break;
1486#endif /* TRANSPARENT */ 1484#endif /* TRANSPARENT */
1487 1485
1488 case GraphicsExpose: 1486 case GraphicsExpose:
1489 case Expose: 1487 case Expose:
1490 if (ev.xany.window == TermWin.vt) 1488 if (ev.xany.window == vt)
1491 { 1489 {
1492 do 1490 do
1493 scr_expose (ev.xexpose.x, ev.xexpose.y, 1491 scr_expose (ev.xexpose.x, ev.xexpose.y,
1494 ev.xexpose.width, ev.xexpose.height, False); 1492 ev.xexpose.width, ev.xexpose.height, False);
1495 while (XCheckTypedWindowEvent (disp, TermWin.vt, ev.xany.type, &ev)); 1493 while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev));
1496 1494
1497 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1495 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1498 1496
1499 while (XCheckTypedWindowEvent (disp, TermWin.vt, ev.xany.type, &ev)) 1497 while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev))
1500 scr_expose (ev.xexpose.x, ev.xexpose.y, 1498 scr_expose (ev.xexpose.x, ev.xexpose.y,
1501 ev.xexpose.width, ev.xexpose.height, False); 1499 ev.xexpose.width, ev.xexpose.height, False);
1502 1500
1503 scr_refresh (refresh_type); 1501 scr_refresh (refresh_type);
1504 } 1502 }
1520 if (menubar_visible () && isMenuBarWindow (ev.xany.window)) 1518 if (menubar_visible () && isMenuBarWindow (ev.xany.window))
1521 menubar_expose (); 1519 menubar_expose ();
1522#endif 1520#endif
1523 1521
1524#ifdef TRANSPARENT 1522#ifdef TRANSPARENT
1525 if (am_transparent && ev.xany.window == TermWin.parent[0]) 1523 if (am_transparent && ev.xany.window == parent[0])
1526 XClearWindow (disp, ev.xany.window); 1524 XClearWindow (disp, ev.xany.window);
1527#endif 1525#endif
1528 } 1526 }
1529 break; 1527 break;
1530 1528
1541 } 1539 }
1542#endif 1540#endif
1543 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1541 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1544 break; 1542 break;
1545 1543
1546 if (ev.xany.window == TermWin.vt) 1544 if (ev.xany.window == vt)
1547 { 1545 {
1548 if (ev.xbutton.state & (Button1Mask | Button3Mask)) 1546 if (ev.xbutton.state & (Button1Mask | Button3Mask))
1549 { 1547 {
1550 while (XCheckTypedWindowEvent (disp, TermWin.vt, MotionNotify, &ev)) 1548 while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev))
1551 ; 1549 ;
1552 1550
1553 XQueryPointer (disp, TermWin.vt, 1551 XQueryPointer (disp, vt,
1554 &unused_root, &unused_child, 1552 &unused_root, &unused_child,
1555 &unused_root_x, &unused_root_y, 1553 &unused_root_x, &unused_root_y,
1556 &ev.xbutton.x, &ev.xbutton.y, 1554 &ev.xbutton.x, &ev.xbutton.y,
1557 &ev.xbutton.state); 1555 &ev.xbutton.state);
1558#ifdef MOUSE_THRESHOLD 1556#ifdef MOUSE_THRESHOLD
1570#endif 1568#endif
1571 selection_extend (ev.xbutton.x, ev.xbutton.y, 1569 selection_extend (ev.xbutton.x, ev.xbutton.y,
1572 ev.xbutton.state & Button3Mask ? 2 : 0); 1570 ev.xbutton.state & Button3Mask ? 2 : 0);
1573 1571
1574#ifdef SELECTION_SCROLLING 1572#ifdef SELECTION_SCROLLING
1575 if (ev.xbutton.y < TermWin.int_bwidth 1573 if (ev.xbutton.y < int_bwidth
1576 || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) 1574 || Pixel2Row (ev.xbutton.y) > (nrow-1))
1577 { 1575 {
1578 int dist; 1576 int dist;
1579 1577
1580 /* don't clobber the current delay if we are 1578 /* don't clobber the current delay if we are
1581 * already in the middle of scrolling. 1579 * already in the middle of scrolling.
1589 selection_save_x = ev.xbutton.x; 1587 selection_save_x = ev.xbutton.x;
1590 selection_save_y = ev.xbutton.y; 1588 selection_save_y = ev.xbutton.y;
1591 selection_save_state = (ev.xbutton.state & Button3Mask) ? 2 : 0; 1589 selection_save_state = (ev.xbutton.state & Button3Mask) ? 2 : 0;
1592 1590
1593 /* calc number of lines to scroll */ 1591 /* calc number of lines to scroll */
1594 if (ev.xbutton.y < TermWin.int_bwidth) 1592 if (ev.xbutton.y < int_bwidth)
1595 { 1593 {
1596 scroll_selection_dir = UP; 1594 scroll_selection_dir = UP;
1597 dist = TermWin.int_bwidth - ev.xbutton.y; 1595 dist = int_bwidth - ev.xbutton.y;
1598 } 1596 }
1599 else 1597 else
1600 { 1598 {
1601 scroll_selection_dir = DN; 1599 scroll_selection_dir = DN;
1602 dist = ev.xbutton.y - (TermWin.int_bwidth + TermWin.height); 1600 dist = ev.xbutton.y - (int_bwidth + height);
1603 } 1601 }
1604 1602
1605 scroll_selection_lines = Pixel2Height (dist) 1603 scroll_selection_lines = Pixel2Height (dist)
1606 / SELECTION_SCROLL_LINE_SPEEDUP 1604 / SELECTION_SCROLL_LINE_SPEEDUP
1607 + 1; 1605 + 1;
1644} 1642}
1645 1643
1646void 1644void
1647rxvt_term::focus_in () 1645rxvt_term::focus_in ()
1648{ 1646{
1649 if (!TermWin.focus) 1647 if (!focus)
1650 { 1648 {
1651 TermWin.focus = 1; 1649 focus = 1;
1652 want_refresh = 1; 1650 want_refresh = 1;
1653#ifdef USE_XIM 1651#if USE_XIM
1654 if (Input_Context != NULL) 1652 if (Input_Context != NULL)
1655 { 1653 {
1656 IMSetStatusPosition (); 1654 IMSetStatusPosition ();
1657 XSetICFocus (Input_Context); 1655 XSetICFocus (Input_Context);
1658 } 1656 }
1659#endif 1657#endif
1660#ifdef CURSOR_BLINK 1658#if CURSOR_BLINK
1661 if (options & Opt_cursorBlink) 1659 if (options & Opt_cursorBlink)
1662 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1660 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1663#endif 1661#endif
1664#ifdef OFF_FOCUS_FADING 1662#if OFF_FOCUS_FADING
1665 if (rs[Rs_fade]) 1663 if (rs[Rs_fade])
1666 { 1664 {
1667 pix_colors = pix_colors_focused; 1665 pix_colors = pix_colors_focused;
1668 scr_recolour (); 1666 scr_recolour ();
1669 } 1667 }
1672} 1670}
1673 1671
1674void 1672void
1675rxvt_term::focus_out () 1673rxvt_term::focus_out ()
1676{ 1674{
1677 if (TermWin.focus) 1675 if (focus)
1678 { 1676 {
1679 TermWin.focus = 0; 1677 focus = 0;
1680 want_refresh = 1; 1678 want_refresh = 1;
1681 1679
1682#if ENABLE_FRILLS || ISO_14755 1680#if ENABLE_FRILLS || ISO_14755
1683 iso14755buf = 0; 1681 iso14755buf = 0;
1684#endif 1682#endif
1685#if ENABLE_OVERLAY 1683#if ENABLE_OVERLAY
1686 scr_overlay_off (); 1684 scr_overlay_off ();
1687#endif 1685#endif
1688#ifdef USE_XIM 1686#if USE_XIM
1689 if (Input_Context != NULL) 1687 if (Input_Context != NULL)
1690 XUnsetICFocus (Input_Context); 1688 XUnsetICFocus (Input_Context);
1691#endif 1689#endif
1692#ifdef CURSOR_BLINK 1690#if CURSOR_BLINK
1693 if (options & Opt_cursorBlink) 1691 if (options & Opt_cursorBlink)
1694 cursor_blink_ev.stop (); 1692 cursor_blink_ev.stop ();
1695 hidden_cursor = 0; 1693 hidden_cursor = 0;
1696#endif 1694#endif
1697#ifdef OFF_FOCUS_FADING 1695#if OFF_FOCUS_FADING
1698 if (rs[Rs_fade]) 1696 if (rs[Rs_fade])
1699 { 1697 {
1700 pix_colors = pix_colors_unfocused; 1698 pix_colors = pix_colors_unfocused;
1701 scr_recolour (); 1699 scr_recolour ();
1702 } 1700 }
1741 reportmode = !! (priv_modes & PrivMode_mouse_report); 1739 reportmode = !! (priv_modes & PrivMode_mouse_report);
1742 1740
1743 /* 1741 /*
1744 * VT window processing of button press 1742 * VT window processing of button press
1745 */ 1743 */
1746 if (ev.window == TermWin.vt) 1744 if (ev.window == vt)
1747 { 1745 {
1748#if ISO_14755 1746#if ISO_14755
1749 // 5.4 1747 // 5.4
1750 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 1748 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
1751 { 1749 {
1956 case Button3: 1954 case Button3:
1957 if (scrollBar.style != R_SB_XTERM) 1955 if (scrollBar.style != R_SB_XTERM)
1958 { 1956 {
1959 if (scrollbar_above_slider (ev.y)) 1957 if (scrollbar_above_slider (ev.y))
1960# ifdef RXVT_SCROLL_FULL 1958# ifdef RXVT_SCROLL_FULL
1961 scr_page (UP, TermWin.nrow - 1); 1959 scr_page (UP, nrow - 1);
1962# else 1960# else
1963 scr_page (UP, TermWin.nrow / 4); 1961 scr_page (UP, nrow / 4);
1964# endif 1962# endif
1965 else if (scrollbar_below_slider (ev.y)) 1963 else if (scrollbar_below_slider (ev.y))
1966# ifdef RXVT_SCROLL_FULL 1964# ifdef RXVT_SCROLL_FULL
1967 scr_page (DN, TermWin.nrow - 1); 1965 scr_page (DN, nrow - 1);
1968# else 1966# else
1969 scr_page (DN, TermWin.nrow / 4); 1967 scr_page (DN, nrow / 4);
1970# endif 1968# endif
1971 else 1969 else
1972 scrollBar.setMotion (); 1970 scrollBar.setMotion ();
1973 } 1971 }
1974 else 1972 else
1975 { 1973 {
1976 scr_page ((ev.button == Button1 ? DN : UP), 1974 scr_page ((ev.button == Button1 ? DN : UP),
1977 (TermWin.nrow 1975 (nrow
1978 * scrollbar_position (ev.y) 1976 * scrollbar_position (ev.y)
1979 / scrollbar_size ())); 1977 / scrollbar_size ()));
1980 } 1978 }
1981 1979
1982 break; 1980 break;
2014#ifdef SELECTION_SCROLLING 2012#ifdef SELECTION_SCROLLING
2015 if (sel_scroll_ev.active) 2013 if (sel_scroll_ev.active)
2016 sel_scroll_ev.stop(); 2014 sel_scroll_ev.stop();
2017#endif 2015#endif
2018 2016
2019 if (ev.window == TermWin.vt) 2017 if (ev.window == vt)
2020 { 2018 {
2021#if ISO_14755 2019#if ISO_14755
2022 // 5.4 2020 // 5.4
2023 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 2021 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
2024 return; 2022 return;
2075 v = ev.button == Button4 ? UP : DN; 2073 v = ev.button == Button4 ? UP : DN;
2076 2074
2077 if (ev.state & ShiftMask) 2075 if (ev.state & ShiftMask)
2078 i = 1; 2076 i = 1;
2079 else if (options & Opt_mouseWheelScrollPage) 2077 else if (options & Opt_mouseWheelScrollPage)
2080 i = TermWin.nrow - 1; 2078 i = nrow - 1;
2081 else 2079 else
2082 i = 5; 2080 i = 5;
2083 2081
2084# ifdef MOUSE_SLIP_WHEELING 2082# ifdef MOUSE_SLIP_WHEELING
2085 if (ev.state & ControlMask) 2083 if (ev.state & ControlMask)
2086 { 2084 {
2087 mouse_slip_wheel_speed += v ? -1 : 1; 2085 mouse_slip_wheel_speed += v ? -1 : 1;
2088 if (mouse_slip_wheel_speed < -TermWin.nrow) mouse_slip_wheel_speed = -TermWin.nrow; 2086 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2089 if (mouse_slip_wheel_speed > +TermWin.nrow) mouse_slip_wheel_speed = +TermWin.nrow; 2087 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2090 2088
2091 if (slip_wheel_ev.at < NOW) 2089 if (slip_wheel_ev.at < NOW)
2092 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; 2090 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY;
2093 2091
2094 slip_wheel_ev.start (); 2092 slip_wheel_ev.start ();
2376 return pchanged; /* Don't try any more */ 2374 return pchanged; /* Don't try any more */
2377 2375
2378 XGetWindowAttributes (disp, display->root, &wrootattr); 2376 XGetWindowAttributes (disp, display->root, &wrootattr);
2379 rootdepth = wrootattr.depth; 2377 rootdepth = wrootattr.depth;
2380 2378
2381 XGetWindowAttributes (disp, TermWin.parent[0], &wattr); 2379 XGetWindowAttributes (disp, parent[0], &wattr);
2382 2380
2383 if (rootdepth != wattr.depth) 2381 if (rootdepth != wattr.depth)
2384 { 2382 {
2385 if (am_transparent) 2383 if (am_transparent)
2386 { 2384 {
2387 pchanged = 1; 2385 pchanged = 1;
2388 XSetWindowBackground (disp, TermWin.vt, pix_colors_focused[Color_bg]); 2386 XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]);
2389 am_transparent = am_pixmap_trans = 0; 2387 am_transparent = am_pixmap_trans = 0;
2390 } 2388 }
2391 2389
2392 return pchanged; /* Don't try any more */ 2390 return pchanged; /* Don't try any more */
2393 } 2391 }
2434 Window cr; 2432 Window cr;
2435 XImage *image; 2433 XImage *image;
2436 GC gc; 2434 GC gc;
2437 XGCValues gcvalue; 2435 XGCValues gcvalue;
2438 2436
2439 XTranslateCoordinates (disp, TermWin.parent[0], display->root, 2437 XTranslateCoordinates (disp, parent[0], display->root,
2440 0, 0, &sx, &sy, &cr); 2438 0, 0, &sx, &sy, &cr);
2441 nw = (unsigned int)szHint.width; 2439 nw = (unsigned int)szHint.width;
2442 nh = (unsigned int)szHint.height; 2440 nh = (unsigned int)szHint.height;
2443 nx = ny = 0; 2441 nx = ny = 0;
2444 2442
2470 if (image == NULL) 2468 if (image == NULL)
2471 { 2469 {
2472 if (am_transparent && am_pixmap_trans) 2470 if (am_transparent && am_pixmap_trans)
2473 { 2471 {
2474 pchanged = 1; 2472 pchanged = 1;
2475 if (TermWin.pixmap != None) 2473 if (pixmap != None)
2476 { 2474 {
2477 XFreePixmap (disp, TermWin.pixmap); 2475 XFreePixmap (disp, pixmap);
2478 TermWin.pixmap = None; 2476 pixmap = None;
2479 } 2477 }
2480 } 2478 }
2481 2479
2482 am_pixmap_trans = 0; 2480 am_pixmap_trans = 0;
2483 } 2481 }
2484 else 2482 else
2485 { 2483 {
2486 if (TermWin.pixmap != None) 2484 if (pixmap != None)
2487 XFreePixmap (disp, TermWin.pixmap); 2485 XFreePixmap (disp, pixmap);
2488 2486
2489#if TINTING 2487#if TINTING
2490 if (ISSET_PIXCOLOR (Color_tint)) 2488 if (ISSET_PIXCOLOR (Color_tint))
2491 { 2489 {
2492 unsigned short rm, gm, bm; 2490 unsigned short rm, gm, bm;
2496 2494
2497 ShadeXImage (display, image, shade, rm, gm, bm); 2495 ShadeXImage (display, image, shade, rm, gm, bm);
2498 } 2496 }
2499#endif 2497#endif
2500 2498
2501 TermWin.pixmap = XCreatePixmap (disp, TermWin.vt, 2499 pixmap = XCreatePixmap (disp, vt,
2502 szHint.width, szHint.height, image->depth); 2500 szHint.width, szHint.height, image->depth);
2503 gc = XCreateGC (disp, TermWin.vt, 0UL, &gcvalue); 2501 gc = XCreateGC (disp, vt, 0UL, &gcvalue);
2504 XPutImage (disp, TermWin.pixmap, gc, image, 0, 0, 2502 XPutImage (disp, pixmap, gc, image, 0, 0,
2505 nx, ny, image->width, image->height); 2503 nx, ny, image->width, image->height);
2506 XFreeGC (disp, gc); 2504 XFreeGC (disp, gc);
2507 XDestroyImage (image); 2505 XDestroyImage (image);
2508 XSetWindowBackgroundPixmap (disp, TermWin.parent[0], TermWin.pixmap); 2506 XSetWindowBackgroundPixmap (disp, parent[0], pixmap);
2509 XClearWindow (disp, TermWin.parent[0]); 2507 XClearWindow (disp, parent[0]);
2510 2508
2511 if (!am_transparent || !am_pixmap_trans) 2509 if (!am_transparent || !am_pixmap_trans)
2512 pchanged = 1; 2510 pchanged = 1;
2513 2511
2514 am_transparent = am_pixmap_trans = 1; 2512 am_transparent = am_pixmap_trans = 1;
2515 } 2513 }
2516 } 2514 }
2517 2515
2518 if (am_pixmap_trans) 2516 if (am_pixmap_trans)
2519 XSetWindowBackgroundPixmap (disp, TermWin.vt, ParentRelative); 2517 XSetWindowBackgroundPixmap (disp, vt, ParentRelative);
2520 else 2518 else
2521 { 2519 {
2522 unsigned int n; 2520 unsigned int n;
2523 /* 2521 /*
2524 * InheritPixmap transparency 2522 * InheritPixmap transparency
2525 */ 2523 */
2526 for (i = 1; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) 2524 for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2527 { 2525 {
2528 oldp = TermWin.parent[i]; 2526 oldp = parent[i];
2529 XQueryTree (disp, TermWin.parent[i - 1], &root, 2527 XQueryTree (disp, parent[i - 1], &root,
2530 &TermWin.parent[i], &list, &n); 2528 &parent[i], &list, &n);
2531 XFree (list); 2529 XFree (list);
2532 2530
2533 if (TermWin.parent[i] == display->root) 2531 if (parent[i] == display->root)
2534 { 2532 {
2535 if (oldp != None) 2533 if (oldp != None)
2536 pchanged = 1; 2534 pchanged = 1;
2537 2535
2538 break; 2536 break;
2539 } 2537 }
2540 2538
2541 if (oldp != TermWin.parent[i]) 2539 if (oldp != parent[i])
2542 pchanged = 1; 2540 pchanged = 1;
2543 } 2541 }
2544 2542
2545 n = 0; 2543 n = 0;
2546 2544
2547 if (pchanged) 2545 if (pchanged)
2548 { 2546 {
2549 for (; n < (unsigned int)i; n++) 2547 for (; n < (unsigned int)i; n++)
2550 { 2548 {
2551 XGetWindowAttributes (disp, TermWin.parent[n], &wattr); 2549 XGetWindowAttributes (disp, parent[n], &wattr);
2552 if (wattr.depth != rootdepth || wattr.c_class == InputOnly) 2550 if (wattr.depth != rootdepth || wattr.c_class == InputOnly)
2553 { 2551 {
2554 n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1; 2552 n = (int) (sizeof (parent) / sizeof (Window)) + 1;
2555 break; 2553 break;
2556 } 2554 }
2557 } 2555 }
2558 } 2556 }
2559 2557
2560 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) 2558 if (n > (int) (sizeof (parent) / sizeof (parent[0])))
2561 { 2559 {
2562 XSetWindowBackground (disp, TermWin.parent[0], pix_colors_focused[Color_fg]); 2560 XSetWindowBackground (disp, parent[0], pix_colors_focused[Color_border]);
2563 XSetWindowBackground (disp, TermWin.vt, pix_colors_focused[Color_bg]); 2561 XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]);
2564 am_transparent = 0; 2562 am_transparent = 0;
2565 /* XXX: also turn off Opt_transparent? */ 2563 /* XXX: also turn off Opt_transparent? */
2566 } 2564 }
2567 else 2565 else
2568 { 2566 {
2571 * needed for fvwm2.2.2 (and before?) */ 2569 * needed for fvwm2.2.2 (and before?) */
2572 sleep (1); 2570 sleep (1);
2573#endif 2571#endif
2574 for (n = 0; n < (unsigned int)i; n++) 2572 for (n = 0; n < (unsigned int)i; n++)
2575 { 2573 {
2576 XSetWindowBackgroundPixmap (disp, TermWin.parent[n], ParentRelative); 2574 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative);
2577 XClearWindow (disp, TermWin.parent[n]); 2575 XClearWindow (disp, parent[n]);
2578 } 2576 }
2579 2577
2580 XSetWindowBackgroundPixmap (disp, TermWin.vt, ParentRelative); 2578 XSetWindowBackgroundPixmap (disp, vt, ParentRelative);
2581 am_transparent = 1; 2579 am_transparent = 1;
2582 } 2580 }
2583 2581
2584 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) 2582 for (; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2585 TermWin.parent[i] = None; 2583 parent[i] = None;
2586 } 2584 }
2587 2585
2588 if (scrollBar.win) 2586 if (scrollBar.win)
2589 { 2587 {
2590 XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative); 2588 XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative);
2642 /* Read a text string from the input buffer */ 2640 /* Read a text string from the input buffer */
2643 unicode_t buf[UBUFSIZ]; 2641 unicode_t buf[UBUFSIZ];
2644 bool refreshnow = false; 2642 bool refreshnow = false;
2645 int nlines = 0; 2643 int nlines = 0;
2646 unicode_t *str = buf; 2644 unicode_t *str = buf;
2645 unicode_t *eol = str + min (ncol, UBUFSIZ);
2647 2646
2648 for (;;) 2647 for (;;)
2649 { 2648 {
2650 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) 2649 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))
2651 break; 2650 break;
2652 2651
2653 *str++ = ch; 2652 *str++ = ch;
2654 2653
2655 if (ch == C0_LF) 2654 if (ch == C0_LF || str >= eol)
2656 { 2655 {
2656 if (ch == C0_LF)
2657 nlines++; 2657 nlines++;
2658
2658 refresh_count++; 2659 refresh_count++;
2659 2660
2660 if (!(options & Opt_jumpScroll) 2661 if (!(options & Opt_jumpScroll)
2661 || (refresh_count >= refresh_limit * (TermWin.nrow - 1))) 2662 || (refresh_count >= refresh_limit * (nrow - 1)))
2662 { 2663 {
2663 refreshnow = true; 2664 refreshnow = true;
2664 ch = NOCHAR; 2665 ch = NOCHAR;
2665 break; 2666 break;
2666 } 2667 }
2667 2668
2668 // scr_add_lines only works for nlines <= TermWin.nrow - 1. 2669 // scr_add_lines only works for nlines <= nrow - 1.
2669 if (nlines >= TermWin.nrow - 1) 2670 if (nlines >= nrow - 1)
2670 { 2671 {
2671 scr_add_lines (buf, nlines, str - buf); 2672 scr_add_lines (buf, nlines, str - buf);
2672 nlines = 0; 2673 nlines = 0;
2673 str = buf; 2674 str = buf;
2675 eol = str + min (ncol, UBUFSIZ);
2674 } 2676 }
2675 }
2676 2677
2677 if (str >= buf + UBUFSIZ) 2678 if (str >= eol)
2678 { 2679 {
2680 if (eol >= buf + UBUFSIZ)
2681 {
2679 ch = NOCHAR; 2682 ch = NOCHAR;
2680 break; 2683 break;
2684 }
2685 else
2686 eol = min (eol + ncol, buf + UBUFSIZ);
2687 }
2688
2681 } 2689 }
2682 2690
2683 seq_begin = cmdbuf_ptr; 2691 seq_begin = cmdbuf_ptr;
2684 ch = next_char (); 2692 ch = next_char ();
2685 } 2693 }
3479 { 3487 {
3480 /* 3488 /*
3481 * commands 3489 * commands
3482 */ 3490 */
3483 case 1: /* deiconify window */ 3491 case 1: /* deiconify window */
3484 XMapWindow (disp, TermWin.parent[0]); 3492 XMapWindow (disp, parent[0]);
3485 break; 3493 break;
3486 case 2: /* iconify window */ 3494 case 2: /* iconify window */
3487 XIconifyWindow (disp, TermWin.parent[0], display->screen); 3495 XIconifyWindow (disp, parent[0], display->screen);
3488 break; 3496 break;
3489 case 3: /* set position (pixels) */ 3497 case 3: /* set position (pixels) */
3490 XMoveWindow (disp, TermWin.parent[0], args[1], args[2]); 3498 XMoveWindow (disp, parent[0], args[1], args[2]);
3491 break; 3499 break;
3492 case 4: /* set size (pixels) */ 3500 case 4: /* set size (pixels) */
3493 set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); 3501 set_widthheight ((unsigned int)args[2], (unsigned int)args[1]);
3494 break; 3502 break;
3495 case 5: /* raise window */ 3503 case 5: /* raise window */
3496 XRaiseWindow (disp, TermWin.parent[0]); 3504 XRaiseWindow (disp, parent[0]);
3497 break; 3505 break;
3498 case 6: /* lower window */ 3506 case 6: /* lower window */
3499 XLowerWindow (disp, TermWin.parent[0]); 3507 XLowerWindow (disp, parent[0]);
3500 break; 3508 break;
3501 case 7: /* refresh window */ 3509 case 7: /* refresh window */
3502 scr_touch (true); 3510 scr_touch (true);
3503 break; 3511 break;
3504 case 8: /* set size (chars) */ 3512 case 8: /* set size (chars) */
3505 set_widthheight ((unsigned int) (args[2] * TermWin.fwidth), 3513 set_widthheight ((unsigned int) (args[2] * fwidth),
3506 (unsigned int) (args[1] * TermWin.fheight)); 3514 (unsigned int) (args[1] * fheight));
3507 break; 3515 break;
3508 3516
3509 //case 9: NYI, TODO, restore maximized window or maximize window 3517 //case 9: NYI, TODO, restore maximized window or maximize window
3510 default: 3518 default:
3511 if (args[0] >= 24) /* set height (chars) */ 3519 if (args[0] >= 24) /* set height (chars) */
3512 set_widthheight ((unsigned int)TermWin.width, 3520 set_widthheight ((unsigned int)width,
3513 (unsigned int) (args[1] * TermWin.fheight)); 3521 (unsigned int) (args[1] * fheight));
3514 break; 3522 break;
3515 3523
3516 3524
3517 /* 3525 /*
3518 * reports - some output format copied from XTerm 3526 * reports - some output format copied from XTerm
3519 */ 3527 */
3520 case 11: /* report window state */ 3528 case 11: /* report window state */
3521 XGetWindowAttributes (disp, TermWin.parent[0], &wattr); 3529 XGetWindowAttributes (disp, parent[0], &wattr);
3522 tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); 3530 tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2);
3523 break; 3531 break;
3524 case 13: /* report window position */ 3532 case 13: /* report window position */
3525 XGetWindowAttributes (disp, TermWin.parent[0], &wattr); 3533 XGetWindowAttributes (disp, parent[0], &wattr);
3526 XTranslateCoordinates (disp, TermWin.parent[0], wattr.root, 3534 XTranslateCoordinates (disp, parent[0], wattr.root,
3527 -wattr.border_width, -wattr.border_width, 3535 -wattr.border_width, -wattr.border_width,
3528 &x, &y, &wdummy); 3536 &x, &y, &wdummy);
3529 tt_printf ("\033[3;%d;%dt", x, y); 3537 tt_printf ("\033[3;%d;%dt", x, y);
3530 break; 3538 break;
3531 case 14: /* report window size (pixels) */ 3539 case 14: /* report window size (pixels) */
3532 XGetWindowAttributes (disp, TermWin.parent[0], &wattr); 3540 XGetWindowAttributes (disp, parent[0], &wattr);
3533 tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); 3541 tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width);
3534 break; 3542 break;
3535 case 18: /* report text area size (chars) */ 3543 case 18: /* report text area size (chars) */
3536 tt_printf ("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol); 3544 tt_printf ("\033[8;%d;%dt", nrow, ncol);
3537 break; 3545 break;
3538 case 19: /* report window size (chars) */ 3546 case 19: /* report window size (chars) */
3539 tt_printf ("\033[9;%d;%dt", TermWin.nrow, TermWin.ncol); 3547 tt_printf ("\033[9;%d;%dt", nrow, ncol);
3540 break; 3548 break;
3541 case 20: /* report icon label */ 3549 case 20: /* report icon label */
3542 { 3550 {
3543 char *s; 3551 char *s;
3544 XGetIconName (disp, TermWin.parent[0], &s); 3552 XGetIconName (disp, parent[0], &s);
3545 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3553 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */
3546 XFree (s); 3554 XFree (s);
3547 } 3555 }
3548 break; 3556 break;
3549 case 21: /* report window title */ 3557 case 21: /* report window title */
3550 { 3558 {
3551 char *s; 3559 char *s;
3552 XFetchName (disp, TermWin.parent[0], &s); 3560 XFetchName (disp, parent[0], &s);
3553 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3561 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */
3554 XFree (s); 3562 XFree (s);
3555 } 3563 }
3556 break; 3564 break;
3557 } 3565 }
3703 unsigned long bytes_after; 3711 unsigned long bytes_after;
3704 unsigned char *value = 0; 3712 unsigned char *value = 0;
3705 const char *str = ""; 3713 const char *str = "";
3706 3714
3707 if (prop 3715 if (prop
3708 && XGetWindowProperty (disp, TermWin.parent[0], 3716 && XGetWindowProperty (disp, parent[0],
3709 prop, 0, 1<<16, 0, AnyPropertyType, 3717 prop, 0, 1<<16, 0, AnyPropertyType,
3710 &actual_type, &actual_format, 3718 &actual_type, &actual_format,
3711 &nitems, &bytes_after, &value) == Success 3719 &nitems, &bytes_after, &value) == Success
3712 && actual_type != None 3720 && actual_type != None
3713 && actual_format == 8) 3721 && actual_format == 8)
3725 { 3733 {
3726 *eq = 0; 3734 *eq = 0;
3727 set_utf8_property (display->atom (str), eq + 1); 3735 set_utf8_property (display->atom (str), eq + 1);
3728 } 3736 }
3729 else 3737 else
3730 XDeleteProperty (disp, TermWin.parent[0], 3738 XDeleteProperty (disp, parent[0],
3731 display->atom (str)); 3739 display->atom (str));
3732 } 3740 }
3733 break; 3741 break;
3734 3742
3735 case XTerm_Color: 3743 case XTerm_Color:
3860 case URxvt_italicFont: 3868 case URxvt_italicFont:
3861 case URxvt_boldItalicFont: 3869 case URxvt_boldItalicFont:
3862#endif 3870#endif
3863 if (query) 3871 if (query)
3864 tt_printf ("\33]%d;%-.250s%c", saveop, 3872 tt_printf ("\33]%d;%-.250s%c", saveop,
3865 (options & Opt_insecure) && TermWin.fontset[op - URxvt_font]->fontdesc 3873 (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc
3866 ? TermWin.fontset[op - URxvt_font]->fontdesc : "", 3874 ? fontset[op - URxvt_font]->fontdesc : "",
3867 resp); 3875 resp);
3868 else 3876 else
3869 { 3877 {
3870 const char *&res = rs[Rs_font + (op - URxvt_font)]; 3878 const char *&res = rs[Rs_font + (op - URxvt_font)];
3871 3879
4038 */ 4046 */
4039 PrivMode (1, PrivMode_vt52); 4047 PrivMode (1, PrivMode_vt52);
4040 break; 4048 break;
4041 case 3: /* 80/132 */ 4049 case 3: /* 80/132 */
4042 if (priv_modes & PrivMode_132OK) 4050 if (priv_modes & PrivMode_132OK)
4043 set_widthheight (((state ? 132 : 80) * TermWin.fwidth), TermWin.height); 4051 set_widthheight (((state ? 132 : 80) * fwidth), height);
4044 break; 4052 break;
4045 case 4: /* smooth scrolling */ 4053 case 4: /* smooth scrolling */
4046 if (state) 4054 if (state)
4047 options &= ~Opt_jumpScroll; 4055 options &= ~Opt_jumpScroll;
4048 else 4056 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines