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.490 by sf-exg, Sat Jul 9 18:23:48 2011 UTC vs.
Revision 1.499 by root, Wed Nov 16 20:15:45 2011 UTC

1042 1042
1043#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1043#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1044void 1044void
1045rxvt_term::cont_scroll_cb (ev::timer &w, int revents) 1045rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1046{ 1046{
1047 if ((scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) 1047 if ((scrollBar.state == SB_STATE_UP || scrollBar.state == SB_STATE_DOWN)
1048 && scr_page (scrollBar.state == STATE_UP ? UP : DN, 1)) 1048 && scr_page (scrollBar.state == SB_STATE_UP ? UP : DN, 1))
1049 { 1049 {
1050 want_refresh = 1; 1050 want_refresh = 1;
1051 refresh_check (); 1051 refresh_check ();
1052 } 1052 }
1053 else 1053 else
1473 } 1473 }
1474 else 1474 else
1475 { 1475 {
1476#ifdef HAVE_BG_PIXMAP 1476#ifdef HAVE_BG_PIXMAP
1477 if (moved) 1477 if (moved)
1478 {
1479 if (mapped)
1480 update_background (); 1478 update_background ();
1481 else
1482 bg_invalidate ();
1483 }
1484#endif 1479#endif
1485 } 1480 }
1486 1481
1487 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1482 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1488 } 1483 }
1562 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1557 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1563 ; 1558 ;
1564 1559
1565 if (scrollBar.state && ev.xany.window == scrollBar.win) 1560 if (scrollBar.state && ev.xany.window == scrollBar.win)
1566 { 1561 {
1567 scrollBar.state = STATE_IDLE; 1562 scrollBar.state = SB_STATE_IDLE;
1568 scrollBar.show (0); 1563 scrollBar.show (0);
1569 } 1564 }
1570 } 1565 }
1571 break; 1566 break;
1572 1567
1660#ifdef MOUSE_THRESHOLD 1655#ifdef MOUSE_THRESHOLD
1661 } 1656 }
1662#endif 1657#endif
1663 } 1658 }
1664 } 1659 }
1665 else if (scrollBar.state == STATE_MOTION && ev.xany.window == scrollBar.win) 1660 else if (scrollBar.state == SB_STATE_MOTION && ev.xany.window == scrollBar.win)
1666 { 1661 {
1667 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1662 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1668 MotionNotify, &ev)) 1663 MotionNotify, &ev))
1669 ; 1664 ;
1670 1665
1671 XQueryPointer (dpy, scrollBar.win, 1666 XQueryPointer (dpy, scrollBar.win,
1672 &unused_root, &unused_child, 1667 &unused_root, &unused_child,
1673 &unused_root_x, &unused_root_y, 1668 &unused_root_x, &unused_root_y,
1674 &ev.xbutton.x, &ev.xbutton.y, 1669 &ev.xbutton.x, &ev.xbutton.y,
1675 &unused_mask); 1670 &unused_mask);
1676 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1671 scr_move_to (scrollBar.position (ev.xbutton.y) - csrO,
1677 scrollBar.size ()); 1672 scrollBar.size ());
1678 want_refresh = 1; 1673 want_refresh = 1;
1679 scrollBar.show (1); 1674 scrollBar.show (1);
1680 } 1675 }
1681 break; 1676 break;
1721 if (XWMHints *h = XGetWMHints (dpy, parent)) 1716 if (XWMHints *h = XGetWMHints (dpy, parent))
1722 { 1717 {
1723 h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); 1718 h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0);
1724 XSetWMHints (dpy, parent, h); 1719 XSetWMHints (dpy, parent, h);
1725 urgency_hint = enable; 1720 urgency_hint = enable;
1721 XFree (h);
1726 } 1722 }
1727} 1723}
1728#endif 1724#endif
1729 1725
1730void 1726void
1977 if (scrollBar.upButton (ev.y)) 1973 if (scrollBar.upButton (ev.y))
1978 direction = UP; /* up */ 1974 direction = UP; /* up */
1979 else if (scrollBar.dnButton (ev.y)) 1975 else if (scrollBar.dnButton (ev.y))
1980 direction = DN; /* down */ 1976 direction = DN; /* down */
1981 1977
1982 scrollBar.state = STATE_IDLE; 1978 scrollBar.state = SB_STATE_IDLE;
1983 /* 1979 /*
1984 * Rxvt-style scrollbar: 1980 * Rxvt-style scrollbar:
1985 * move up if mouse is above slider 1981 * move up if mouse is above slider
1986 * move dn if mouse is below slider 1982 * move dn if mouse is below slider
1987 * 1983 *
2026 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2022 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2027#endif 2023#endif
2028 if (scr_page (direction, 1)) 2024 if (scr_page (direction, 1))
2029 { 2025 {
2030 if (direction == UP) 2026 if (direction == UP)
2031 scrollBar.state = STATE_UP; 2027 scrollBar.state = SB_STATE_UP;
2032 else 2028 else
2033 scrollBar.state = STATE_DOWN; 2029 scrollBar.state = SB_STATE_DOWN;
2034 } 2030 }
2035 } 2031 }
2036 else 2032 else
2037 switch (ev.button) 2033 switch (ev.button)
2038 { 2034 {
2039 case Button2: 2035 case Button2:
2040 switch (scrollBar.align) 2036 switch (scrollBar.align)
2041 { 2037 {
2042 case R_SB_ALIGN_TOP: 2038 case SB_ALIGN_TOP:
2043 csrO = 0; 2039 csrO = 0;
2044 break; 2040 break;
2045 case R_SB_ALIGN_CENTRE: 2041 case SB_ALIGN_CENTRE:
2046 csrO = (scrollBar.bot - scrollBar.top) / 2; 2042 csrO = (scrollBar.bot - scrollBar.top) / 2;
2047 break; 2043 break;
2048 case R_SB_ALIGN_BOTTOM: 2044 case SB_ALIGN_BOTTOM:
2049 csrO = scrollBar.bot - scrollBar.top; 2045 csrO = scrollBar.bot - scrollBar.top;
2050 break; 2046 break;
2051 } 2047 }
2052 2048
2053 if (scrollBar.style == R_SB_XTERM 2049 if (scrollBar.style == SB_STYLE_XTERM
2054 || scrollbar_above_slider (ev.y) 2050 || scrollBar.above_slider (ev.y)
2055 || scrollbar_below_slider (ev.y)) 2051 || scrollBar.below_slider (ev.y))
2056 scr_move_to (scrollbar_position (ev.y) - csrO, scrollBar.size ()); 2052 scr_move_to (scrollBar.position (ev.y) - csrO, scrollBar.size ());
2057 2053
2058 scrollBar.state = STATE_MOTION; 2054 scrollBar.state = SB_STATE_MOTION;
2059 break; 2055 break;
2060 2056
2061 case Button1: 2057 case Button1:
2062 if (scrollBar.align == R_SB_ALIGN_CENTRE) 2058 if (scrollBar.align == SB_ALIGN_CENTRE)
2063 csrO = ev.y - scrollBar.top; 2059 csrO = ev.y - scrollBar.top;
2064 /* FALLTHROUGH */ 2060 /* FALLTHROUGH */
2065 2061
2066 case Button3: 2062 case Button3:
2067 if (scrollBar.style != R_SB_XTERM) 2063 if (scrollBar.style != SB_STYLE_XTERM)
2068 { 2064 {
2069 if (scrollbar_above_slider (ev.y)) 2065 if (scrollBar.above_slider (ev.y))
2070# ifdef RXVT_SCROLL_FULL 2066# ifdef RXVT_SCROLL_FULL
2071 scr_page (UP, nrow - 1); 2067 scr_page (UP, nrow - 1);
2072# else 2068# else
2073 scr_page (UP, nrow / 4); 2069 scr_page (UP, nrow / 4);
2074# endif 2070# endif
2075 else if (scrollbar_below_slider (ev.y)) 2071 else if (scrollBar.below_slider (ev.y))
2076# ifdef RXVT_SCROLL_FULL 2072# ifdef RXVT_SCROLL_FULL
2077 scr_page (DN, nrow - 1); 2073 scr_page (DN, nrow - 1);
2078# else 2074# else
2079 scr_page (DN, nrow / 4); 2075 scr_page (DN, nrow / 4);
2080# endif 2076# endif
2081 else 2077 else
2082 scrollBar.state = STATE_MOTION; 2078 scrollBar.state = SB_STATE_MOTION;
2083 } 2079 }
2084 else 2080 else
2085 { 2081 {
2086 scr_page ((ev.button == Button1 ? DN : UP), 2082 scr_page ((ev.button == Button1 ? DN : UP),
2087 (nrow 2083 (nrow
2088 * scrollbar_position (ev.y) 2084 * scrollBar.position (ev.y)
2089 / scrollBar.size ())); 2085 / scrollBar.size ()));
2090 } 2086 }
2091 2087
2092 break; 2088 break;
2093 } 2089 }
2104 2100
2105 csrO = 0; /* reset csr Offset */ 2101 csrO = 0; /* reset csr Offset */
2106 if (!bypass_keystate) 2102 if (!bypass_keystate)
2107 reportmode = !! (priv_modes & PrivMode_mouse_report); 2103 reportmode = !! (priv_modes & PrivMode_mouse_report);
2108 2104
2109 if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) 2105 if (scrollBar.state == SB_STATE_UP || scrollBar.state == SB_STATE_DOWN)
2110 { 2106 {
2111 scrollBar.state = STATE_IDLE; 2107 scrollBar.state = SB_STATE_IDLE;
2112 scrollBar.show (0); 2108 scrollBar.show (0);
2113 } 2109 }
2114 2110
2115#ifdef SELECTION_SCROLLING 2111#ifdef SELECTION_SCROLLING
2116 sel_scroll_ev.stop(); 2112 sel_scroll_ev.stop();
2595 break; 2591 break;
2596 case 'Z': /* identify the terminal type */ 2592 case 'Z': /* identify the terminal type */
2597 tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ 2593 tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */
2598 break; 2594 break;
2599 case '<': /* turn off VT52 mode */ 2595 case '<': /* turn off VT52 mode */
2600 set_privmode (PrivMode_vt52, 0); 2596 priv_modes &= ~PrivMode_vt52;
2601 break; 2597 break;
2602 case 'F': /* use special graphics character set */ 2598 case 'F': /* use special graphics character set */
2603 case 'G': /* use regular character set */ 2599 case 'G': /* use regular character set */
2604 /* unimplemented */ 2600 /* unimplemented */
2605 break; 2601 break;
2658 scr_forwardindex (); 2654 scr_forwardindex ();
2659 break; 2655 break;
2660#endif 2656#endif
2661 // DECPAM/DECPNM 2657 // DECPAM/DECPNM
2662 case '=': 2658 case '=':
2659 priv_modes |= PrivMode_aplKP;
2660 break;
2663 case '>': 2661 case '>':
2664 set_privmode (PrivMode_aplKP, ch == '='); 2662 priv_modes &= ~PrivMode_aplKP;
2665 break; 2663 break;
2666 2664
2667 case C1_40: 2665 case C1_40:
2668 cmd_getc (); 2666 cmd_getc ();
2669 break; 2667 break;
2888 } 2886 }
2889 break; 2887 break;
2890#endif 2888#endif
2891 2889
2892 case CSI_CUU: /* 8.3.22: (1) CURSOR UP */ 2890 case CSI_CUU: /* 8.3.22: (1) CURSOR UP */
2893 case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */ 2891 case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */
2894 arg[0] = -arg[0]; 2892 arg[0] = -arg[0];
2895 /* FALLTHROUGH */ 2893 /* FALLTHROUGH */
2896 case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */ 2894 case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */
2897 case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */ 2895 case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */
2898 scr_gotorc (arg[0], 0, RELATIVE); 2896 scr_gotorc (arg[0], 0, RELATIVE);
2899 break; 2897 break;
2900 2898
2901 case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */ 2899 case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */
2902 case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */ 2900 case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */
3453 min (h_align, 32767), min (v_align, 32767)); 3451 min (h_align, 32767), min (v_align, 32767));
3454 process_xterm_seq (XTerm_title, str, CHAR_ST); 3452 process_xterm_seq (XTerm_title, str, CHAR_ST);
3455 } 3453 }
3456 else 3454 else
3457 { 3455 {
3458 int changed = 0; 3456 bool changed = false;
3459 3457
3460 if (*str != ';') 3458 if (*str != ';')
3461 { 3459 {
3462 if (bg_set_file (str)) /* change pixmap */ 3460 if (bg_set_file (str)) /* change pixmap */
3463 {
3464 changed++; 3461 changed = true;
3465 str = strchr (str, ';');
3466 if (str == NULL)
3467 bg_set_default_geometry ();
3468 else
3469 bg_set_geometry (str+1);
3470 }
3471 } 3462 }
3472 else 3463 else
3473 { 3464 {
3474 str++; 3465 str++;
3475 if (bg_set_geometry (str, true)) 3466 if (bg_set_geometry (str, true))
3476 changed++; 3467 changed = true;
3477 } 3468 }
3478 3469
3479 if (changed) 3470 if (changed)
3480 { 3471 {
3481 if (bg_window_position_sensitive ()) 3472 if (bg_window_position_sensitive ())
3597 if (mode == 'r') 3588 if (mode == 'r')
3598 state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ 3589 state = (SavedModes & bit) ? 1 : 0; /* no overlapping */
3599 else 3590 else
3600 state = (mode == 't') ? ! (priv_modes & bit) : mode; 3591 state = (mode == 't') ? ! (priv_modes & bit) : mode;
3601 3592
3602 set_privmode (bit, state); 3593 if (state)
3594 priv_modes |= bit;
3595 else
3596 priv_modes &= ~bit;
3603 } 3597 }
3604 3598
3605 return state; 3599 return state;
3606} 3600}
3607 3601
3712 case 2: /* VT52 mode */ 3706 case 2: /* VT52 mode */
3713 /* oddball mode. should be set regardless of set/reset 3707 /* oddball mode. should be set regardless of set/reset
3714 * parameter. Return from VT52 mode with an ESC < from 3708 * parameter. Return from VT52 mode with an ESC < from
3715 * within VT52 mode 3709 * within VT52 mode
3716 */ 3710 */
3717 set_privmode (PrivMode_vt52, 1); 3711 priv_modes |= PrivMode_vt52;
3718 break; 3712 break;
3719 case 3: /* 80/132 */ 3713 case 3: /* 80/132 */
3720 if (priv_modes & PrivMode_132OK) 3714 if (priv_modes & PrivMode_132OK)
3721 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight); 3715 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight);
3722 break; 3716 break;
3737 if (state) /* orthogonal */ 3731 if (state) /* orthogonal */
3738 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3732 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3739 break; 3733 break;
3740#ifdef scrollBar_esc 3734#ifdef scrollBar_esc
3741 case scrollBar_esc: 3735 case scrollBar_esc:
3742 if (scrollBar.map (state)) 3736 scrollBar.map (state);
3743 {
3744 resize_all_windows (0, 0, 0); 3737 resize_all_windows (0, 0, 0);
3745 scr_touch (true); 3738 scr_touch (true);
3746 }
3747 break; 3739 break;
3748#endif 3740#endif
3749 case 25: /* visible/invisible cursor */ 3741 case 25: /* visible/invisible cursor */
3750 scr_cursor_visible (state); 3742 scr_cursor_visible (state);
3751 break; 3743 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines