… | |
… | |
26 | |
26 | |
27 | #include "../config.h" /* NECESSARY */ |
27 | #include "../config.h" /* NECESSARY */ |
28 | #include "rxvt.h" /* NECESSARY */ |
28 | #include "rxvt.h" /* NECESSARY */ |
29 | #include "rxvtperl.h" /* NECESSARY */ |
29 | #include "rxvtperl.h" /* NECESSARY */ |
30 | |
30 | |
31 | #include <X11/Xmd.h> /* get the typedef for CARD32 */ |
|
|
32 | |
|
|
33 | #include <inttypes.h> |
31 | #include <inttypes.h> |
34 | |
32 | |
35 | #include "salloc.C" // HACK, should be a seperate compile! |
33 | #include "salloc.C" // HACK, should be a seperate compile! |
36 | |
34 | |
37 | inline void fill_text (text_t *start, text_t value, int len) |
35 | inline void fill_text (text_t *start, text_t value, int len) |
… | |
… | |
47 | |
45 | |
48 | /* ------------------------------------------------------------------------- * |
46 | /* ------------------------------------------------------------------------- * |
49 | * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * |
47 | * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * |
50 | * ------------------------------------------------------------------------- */ |
48 | * ------------------------------------------------------------------------- */ |
51 | #define ZERO_SCROLLBACK() \ |
49 | #define ZERO_SCROLLBACK() \ |
52 | if (OPTION (Opt_scrollTtyOutput)) \ |
50 | if (option (Opt_scrollTtyOutput)) \ |
53 | view_start = 0 |
51 | view_start = 0 |
54 | #define CLEAR_SELECTION() \ |
52 | #define CLEAR_SELECTION() \ |
55 | selection.beg.row = selection.beg.col \ |
53 | selection.beg.row = selection.beg.col \ |
56 | = selection.end.row = selection.end.col = 0 |
54 | = selection.end.row = selection.end.col = 0 |
57 | #define CLEAR_ALL_SELECTION() \ |
55 | #define CLEAR_ALL_SELECTION() \ |
… | |
… | |
161 | { |
159 | { |
162 | #if ENABLE_OVERLAY |
160 | #if ENABLE_OVERLAY |
163 | scr_overlay_off (); |
161 | scr_overlay_off (); |
164 | #endif |
162 | #endif |
165 | |
163 | |
|
|
164 | rvideo_mode = false; |
166 | view_start = 0; |
165 | view_start = 0; |
167 | num_scr = 0; |
166 | num_scr = 0; |
168 | |
167 | |
169 | if (ncol == 0) |
168 | if (ncol == 0) |
170 | ncol = 80; |
169 | ncol = 80; |
… | |
… | |
237 | selection.text = NULL; |
236 | selection.text = NULL; |
238 | selection.len = 0; |
237 | selection.len = 0; |
239 | selection.op = SELECTION_CLEAR; |
238 | selection.op = SELECTION_CLEAR; |
240 | selection.screen = PRIMARY; |
239 | selection.screen = PRIMARY; |
241 | selection.clicks = 0; |
240 | selection.clicks = 0; |
242 | rvideo_state = rvideo_mode = false; |
|
|
243 | } |
241 | } |
244 | else |
242 | else |
245 | { |
243 | { |
246 | /* |
244 | /* |
247 | * add or delete rows as appropriate |
245 | * add or delete rows as appropriate |
… | |
… | |
510 | } |
508 | } |
511 | |
509 | |
512 | void |
510 | void |
513 | rxvt_term::scr_swap_screen () |
511 | rxvt_term::scr_swap_screen () |
514 | { |
512 | { |
515 | if (!OPTION (Opt_secondaryScreen)) |
513 | if (!option (Opt_secondaryScreen)) |
516 | return; |
514 | return; |
517 | |
515 | |
518 | for (int i = prev_nrow; i--; ) |
516 | for (int i = prev_nrow; i--; ) |
519 | ::swap (ROW(i), swap_buf [i]); |
517 | ::swap (ROW(i), swap_buf [i]); |
520 | |
518 | |
… | |
… | |
542 | selection_check (2); /* check for boundary cross */ |
540 | selection_check (2); /* check for boundary cross */ |
543 | |
541 | |
544 | int i = current_screen; current_screen = scrn; scrn = i; |
542 | int i = current_screen; current_screen = scrn; scrn = i; |
545 | |
543 | |
546 | #if NSCREENS |
544 | #if NSCREENS |
547 | if (OPTION (Opt_secondaryScreen)) |
545 | if (option (Opt_secondaryScreen)) |
548 | { |
546 | { |
549 | num_scr = 0; |
547 | num_scr = 0; |
550 | |
548 | |
551 | scr_swap_screen (); |
549 | scr_swap_screen (); |
552 | |
550 | |
… | |
… | |
555 | screen.flags |= Screen_VisibleCursor; |
553 | screen.flags |= Screen_VisibleCursor; |
556 | swap.flags |= Screen_VisibleCursor; |
554 | swap.flags |= Screen_VisibleCursor; |
557 | } |
555 | } |
558 | else |
556 | else |
559 | #endif |
557 | #endif |
560 | if (OPTION (Opt_secondaryScroll)) |
558 | if (option (Opt_secondaryScroll)) |
561 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
559 | scr_scroll_text (0, prev_nrow - 1, prev_nrow); |
562 | } |
560 | } |
563 | |
561 | |
564 | // clear WrapNext indicator, solidifying position on next line |
562 | // clear WrapNext indicator, solidifying position on next line |
565 | void |
563 | void |
… | |
… | |
624 | want_refresh = 1; |
622 | want_refresh = 1; |
625 | num_scr += count; |
623 | num_scr += count; |
626 | |
624 | |
627 | if (count > 0 |
625 | if (count > 0 |
628 | && row1 == 0 |
626 | && row1 == 0 |
629 | && (current_screen == PRIMARY || OPTION (Opt_secondaryScroll))) |
627 | && (current_screen == PRIMARY || option (Opt_secondaryScroll))) |
630 | { |
628 | { |
631 | top_row = max (top_row - count, -saveLines); |
629 | top_row = max (top_row - count, -saveLines); |
632 | |
630 | |
633 | // scroll everything up 'count' lines |
631 | // scroll everything up 'count' lines |
634 | term_start = (term_start + count) % total_rows; |
632 | term_start = (term_start + count) % total_rows; |
… | |
… | |
684 | selection.op = SELECTION_CLEAR; |
682 | selection.op = SELECTION_CLEAR; |
685 | } |
683 | } |
686 | } |
684 | } |
687 | |
685 | |
688 | // finally move the view window, if desired |
686 | // finally move the view window, if desired |
689 | if (OPTION (Opt_scrollWithBuffer) |
687 | if (option (Opt_scrollWithBuffer) |
690 | && view_start != 0 |
688 | && view_start != 0 |
691 | && view_start != -saveLines) |
689 | && view_start != -saveLines) |
692 | scr_page (UP, count); |
690 | scr_page (UP, count); |
693 | |
691 | |
694 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
692 | if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) |
… | |
… | |
1071 | if (count) |
1069 | if (count) |
1072 | x = ncol - 1; |
1070 | x = ncol - 1; |
1073 | |
1071 | |
1074 | // store horizontal tab commands as characters inside the text |
1072 | // store horizontal tab commands as characters inside the text |
1075 | // buffer so they can be selected and pasted. |
1073 | // buffer so they can be selected and pasted. |
1076 | if (ht && OPTION (Opt_pastableTabs)) |
1074 | if (ht && option (Opt_pastableTabs)) |
1077 | { |
1075 | { |
1078 | base_rend = SET_FONT (base_rend, 0); |
1076 | base_rend = SET_FONT (base_rend, 0); |
1079 | |
1077 | |
1080 | l.touch (x); |
1078 | l.touch (x); |
1081 | |
1079 | |
… | |
… | |
1648 | if (rvideo_state != on) |
1646 | if (rvideo_state != on) |
1649 | { |
1647 | { |
1650 | rvideo_state = on; |
1648 | rvideo_state = on; |
1651 | |
1649 | |
1652 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1650 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1653 | #if XPM_BACKGROUND |
1651 | #ifdef HAVE_BG_PIXMAP |
1654 | if (bgPixmap.pixmap == None) |
1652 | if (bgPixmap.pixmap == None) |
1655 | #endif |
1653 | #endif |
1656 | #if TRANSPARENT |
1654 | #if ENABLE_TRANSPARENCY |
1657 | if (!OPTION (Opt_transparent) || am_transparent == 0) |
1655 | if (!option (Opt_transparent) || am_transparent == 0) |
1658 | #endif |
1656 | #endif |
1659 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
1657 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
1660 | |
1658 | |
1661 | XGCValues gcvalue; |
1659 | XGCValues gcvalue; |
1662 | gcvalue.foreground = pix_colors[Color_fg]; |
1660 | gcvalue.foreground = pix_colors[Color_fg]; |
… | |
… | |
1886 | { |
1884 | { |
1887 | #ifndef NO_BELL |
1885 | #ifndef NO_BELL |
1888 | |
1886 | |
1889 | # ifndef NO_MAPALERT |
1887 | # ifndef NO_MAPALERT |
1890 | # ifdef MAPALERT_OPTION |
1888 | # ifdef MAPALERT_OPTION |
1891 | if (OPTION (Opt_mapAlert)) |
1889 | if (option (Opt_mapAlert)) |
1892 | # endif |
1890 | # endif |
1893 | XMapWindow (dpy, parent[0]); |
1891 | XMapWindow (dpy, parent[0]); |
1894 | # endif |
1892 | # endif |
|
|
1893 | # if ENABLE_FRILLS |
|
|
1894 | if (option (Opt_urgentOnBell)) |
|
|
1895 | { |
|
|
1896 | XWMHints *h; |
1895 | |
1897 | |
|
|
1898 | h = XGetWMHints(dpy, parent[0]); |
|
|
1899 | if (h != NULL) |
|
|
1900 | { |
|
|
1901 | h->flags |= XUrgencyHint; |
|
|
1902 | XSetWMHints(dpy, parent[0], h); |
|
|
1903 | } |
|
|
1904 | } |
|
|
1905 | # endif |
|
|
1906 | |
1896 | if (OPTION (Opt_visualBell)) |
1907 | if (option (Opt_visualBell)) |
1897 | { |
1908 | { |
1898 | rvideo_bell = true; |
1909 | rvideo_bell = true; |
1899 | scr_rvideo_mode (rvideo_mode); |
1910 | scr_rvideo_mode (rvideo_mode); |
1900 | display->flush (); |
1911 | display->flush (); |
1901 | |
1912 | |
1902 | bell_ev.start (NOW + VISUAL_BELL_DURATION); |
1913 | bell_ev.start (NOW + VISUAL_BELL_DURATION); |
1903 | } |
1914 | } |
1904 | else |
1915 | else |
1905 | XBell (dpy, 0); |
1916 | XBell (dpy, 0); |
1906 | |
|
|
1907 | #endif |
1917 | #endif |
1908 | } |
1918 | } |
1909 | |
1919 | |
1910 | /* ------------------------------------------------------------------------- */ |
1920 | /* ------------------------------------------------------------------------- */ |
1911 | /* ARGSUSED */ |
1921 | /* ARGSUSED */ |
… | |
… | |
1992 | * A: set up vars |
2002 | * A: set up vars |
1993 | */ |
2003 | */ |
1994 | have_bg = 0; |
2004 | have_bg = 0; |
1995 | refresh_count = 0; |
2005 | refresh_count = 0; |
1996 | |
2006 | |
1997 | #if XPM_BACKGROUND |
2007 | #ifdef HAVE_BG_PIXMAP |
1998 | have_bg |= bgPixmap.pixmap != None; |
2008 | have_bg |= bgPixmap.pixmap != None; |
1999 | #endif |
2009 | #endif |
2000 | #if TRANSPARENT |
2010 | #if ENABLE_TRANSPARENCY |
2001 | have_bg |= OPTION (Opt_transparent) && am_transparent; |
2011 | have_bg |= option (Opt_transparent) && am_transparent; |
2002 | #endif |
2012 | #endif |
2003 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2013 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2004 | |
2014 | |
2005 | /* |
2015 | /* |
2006 | * B: reverse any characters which are selected |
2016 | * B: reverse any characters which are selected |
… | |
… | |
2051 | ccol2 = Color_bg; |
2061 | ccol2 = Color_bg; |
2052 | #endif |
2062 | #endif |
2053 | |
2063 | |
2054 | if (showcursor && focus) |
2064 | if (showcursor && focus) |
2055 | { |
2065 | { |
2056 | if (OPTION (Opt_cursorUnderline)) |
2066 | if (option (Opt_cursorUnderline)) |
2057 | *crp ^= RS_Uline; |
2067 | *crp ^= RS_Uline; |
2058 | else |
2068 | else |
2059 | { |
2069 | { |
2060 | *crp ^= RS_RVid; |
2070 | *crp ^= RS_RVid; |
2061 | *crp = SET_FGCOLOR (*crp, ccol1); |
2071 | *crp = SET_FGCOLOR (*crp, ccol1); |
… | |
… | |
2394 | */ |
2404 | */ |
2395 | if (showcursor) |
2405 | if (showcursor) |
2396 | { |
2406 | { |
2397 | if (focus) |
2407 | if (focus) |
2398 | { |
2408 | { |
2399 | if (OPTION (Opt_cursorUnderline)) |
2409 | if (option (Opt_cursorUnderline)) |
2400 | *crp ^= RS_Uline; |
2410 | *crp ^= RS_Uline; |
2401 | else |
2411 | else |
2402 | { |
2412 | { |
2403 | *crp ^= RS_RVid; |
2413 | *crp ^= RS_RVid; |
2404 | #ifndef NO_CURSORCOLOR |
2414 | #ifndef NO_CURSORCOLOR |
… | |
… | |
2469 | |
2479 | |
2470 | void |
2480 | void |
2471 | rxvt_term::scr_recolour () NOTHROW |
2481 | rxvt_term::scr_recolour () NOTHROW |
2472 | { |
2482 | { |
2473 | if (1 |
2483 | if (1 |
2474 | #if TRANSPARENT |
2484 | #if ENABLE_TRANSPARENCY |
2475 | && !am_transparent |
2485 | && !am_transparent |
2476 | #endif |
2486 | #endif |
2477 | #if XPM_BACKGROUND |
2487 | #ifdef HAVE_BG_PIXMAP |
2478 | && !bgPixmap.pixmap |
2488 | && !bgPixmap.pixmap |
2479 | #endif |
2489 | #endif |
2480 | ) |
2490 | ) |
2481 | { |
2491 | { |
2482 | XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); |
2492 | XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); |
… | |
… | |
3414 | selection_delimit_word (DN, &selection.end, &selection.end); |
3424 | selection_delimit_word (DN, &selection.end, &selection.end); |
3415 | } |
3425 | } |
3416 | else if (selection.clicks == 3) |
3426 | else if (selection.clicks == 3) |
3417 | { |
3427 | { |
3418 | #if ENABLE_FRILLS |
3428 | #if ENABLE_FRILLS |
3419 | if (OPTION (Opt_tripleclickwords)) |
3429 | if (option (Opt_tripleclickwords)) |
3420 | { |
3430 | { |
3421 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3431 | selection_delimit_word (UP, &selection.beg, &selection.beg); |
3422 | |
3432 | |
3423 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3433 | for (int end_row = selection.mark.row; end_row < nrow; end_row++) |
3424 | { |
3434 | { |