From: pcg Date: Sun, 9 May 2004 18:19:49 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=9289a9479d280d00866b6e120ca4e9c82b8eab7c;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/src/command.C b/src/command.C index 1ad4771e..24cb2ab7 100644 --- a/src/command.C +++ b/src/command.C @@ -1171,7 +1171,7 @@ rxvt_term::x_cb (XEvent &ev) scr_expose (ev.xexpose.x, ev.xexpose.y, ev.xexpose.width, ev.xexpose.height, False); #else - // don't understand this, so commented it out + // I don't understand this, so I changed it :) scr_expose (ev.xexpose.x, ev.xexpose.y, ev.xexpose.width, ev.xexpose.height, False); //scr_expose (ev.xexpose.x, 0, @@ -1183,12 +1183,11 @@ rxvt_term::x_cb (XEvent &ev) { XEvent unused_event; - while (XCheckTypedWindowEvent (display->display, ev.xany.window, - Expose, - &unused_event)) ; - while (XCheckTypedWindowEvent (display->display, ev.xany.window, - GraphicsExpose, - &unused_event)) ; + while (XCheckTypedWindowEvent (display->display, ev.xany.window, Expose, &unused_event)) + ; + while (XCheckTypedWindowEvent (display->display, ev.xany.window, GraphicsExpose, &unused_event)) + ; + if (isScrollbarWindow (ev.xany.window)) { scrollBar.setIdle (); @@ -2663,7 +2662,7 @@ rxvt_term::process_escape_seq () /* *INDENT-OFF* */ enum { CSI_ICH = 0x40, - CSI_CUU, CSI_CUD, CSI_CUF, CSI_CUB, CSI_CNL, CSI_CPL, CSI_CHA, + CSI_CUU, CSI_CUD, CSI_CUF, CSI_CUB, CSI_CNL, CSI_CPL, CSI_CHA, CSI_CUP, CSI_CHT, CSI_ED , CSI_EL , CSI_IL , CSI_DL , CSI_EF , CSI_EA , CSI_DCH, CSI_SEE, CSI_CPR, CSI_SU , CSI_SD , CSI_NP , CSI_PP , CSI_CTC, CSI_ECH, CSI_CVT, CSI_CBT, CSI_SRS, CSI_PTX, CSI_SDS, CSI_SIMD, CSI_5F, diff --git a/src/init.C b/src/init.C index 27ecb1b0..a90f53a1 100644 --- a/src/init.C +++ b/src/init.C @@ -1074,11 +1074,11 @@ rxvt_term::get_ourmods () void rxvt_term::create_windows (int argc, const char *const *argv) { - XClassHint classHint; - XWMHints wmHint; - XGCValues gcvalue; - long vt_emask; - + XClassHint classHint; + XWMHints wmHint; + XGCValues gcvalue; + long vt_emask; + XSetWindowAttributes attributes; XWindowAttributes gattr; if (Options & Opt_transparent) @@ -1101,14 +1101,10 @@ rxvt_term::create_windows (int argc, const char *const *argv) old_width = szHint.width; old_height = szHint.height; - /* parent window - reverse video so we can see placement errors - * sub-window placement & size in rxvt_resize_subwindows () - */ + /* sub-window placement & size in rxvt_resize_subwindows () */ #ifdef PREFER_24BIT - XSetWindowAttributes attributes; - - attributes.background_pixel = PixColors[Color_fg]; + attributes.background_pixel = PixColors[Color_bg]; attributes.border_pixel = PixColors[Color_border]; attributes.colormap = display->cmap; TermWin.parent[0] = XCreateWindow (display->display, DefaultRootWindow (display->display), @@ -1117,15 +1113,14 @@ rxvt_term::create_windows (int argc, const char *const *argv) TermWin.ext_bwidth, display->depth, InputOutput, display->visual, - CWBackPixel | CWBorderPixel | CWColormap, &attributes); + CWColormap | CWBackPixel | CWBorderPixel, &attributes); #else TermWin.parent[0] = XCreateSimpleWindow (display->display, DefaultRootWindow (display->display), - szHint.x, szHint.y, - szHint.width, - szHint.height, - TermWin.ext_bwidth, - PixColors[Color_border], - PixColors[Color_fg]); + szHint.x, szHint.y, + szHint.width, szHint.height, + TermWin.ext_bwidth, + PixColors[Color_border], + PixColors[Color_bg]); #endif process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); @@ -1134,10 +1129,9 @@ rxvt_term::create_windows (int argc, const char *const *argv) classHint.res_name = (char *)rs[Rs_name]; classHint.res_class = (char *)RESCLASS; - wmHint.flags = (InputHint | StateHint | WindowGroupHint); + wmHint.flags = InputHint | StateHint | WindowGroupHint; wmHint.input = True; - wmHint.initial_state = (Options & Opt_iconic ? IconicState - : NormalState); + wmHint.initial_state = Options & Opt_iconic ? IconicState : NormalState; wmHint.window_group = TermWin.parent[0]; XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, @@ -1193,17 +1187,19 @@ rxvt_term::create_windows (int argc, const char *const *argv) XStoreName (display->display, TermWin.vt, "vt window"); #endif - vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask - | PropertyChangeMask); + attributes.bit_gravity = NorthWestGravity; + XChangeWindowAttributes (display->display, TermWin.vt, CWBitGravity, &attributes); + + vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; #ifdef POINTER_BLANK pointer_unblank (); - if ((Options & Opt_pointerBlank)) + if (Options & Opt_pointerBlank) vt_emask |= PointerMotionMask; else #endif - vt_emask |= (Button1MotionMask | Button3MotionMask); + vt_emask |= Button1MotionMask | Button3MotionMask; XSelectInput (display->display, TermWin.vt, vt_emask); vt_ev.start (display, TermWin.vt); diff --git a/src/main.C b/src/main.C index 415e94fe..207d6a43 100644 --- a/src/main.C +++ b/src/main.C @@ -743,6 +743,7 @@ rxvt_term::window_calc (unsigned int width, unsigned int height) sb_w = mb_h = 0; window_vt_x = window_vt_y = 0; + if (scrollbar_visible ()) { sb_w = scrollbar_TotalWidth (); @@ -750,12 +751,14 @@ rxvt_term::window_calc (unsigned int width, unsigned int height) if (! (Options & Opt_scrollBar_right)) window_vt_x = sb_w; } + if (menubar_visible ()) { mb_h = menuBar_TotalHeight (); szHint.base_height += mb_h; window_vt_y = mb_h; } + szHint.width_inc = TermWin.fwidth; szHint.height_inc = TermWin.fheight; szHint.min_width = szHint.base_width + szHint.width_inc; @@ -771,6 +774,7 @@ rxvt_term::window_calc (unsigned int width, unsigned int height) MIN_IT (TermWin.width, max_width); szHint.width = szHint.base_width + TermWin.width; } + if (height && height - szHint.base_height < max_height) { szHint.height = height; @@ -781,6 +785,7 @@ rxvt_term::window_calc (unsigned int width, unsigned int height) MIN_IT (TermWin.height, max_height); szHint.height = szHint.base_height + TermWin.height; } + if (scrollbar_visible () && (Options & Opt_scrollBar_right)) window_sb_x = szHint.width - sb_w; @@ -1081,6 +1086,7 @@ rxvt_term::resize_all_windows (unsigned int width, unsigned int height, int igno window_calc (width, height); XSetWMNormalHints (display->display, TermWin.parent[0], &szHint); + if (!ignoreparent) { #ifdef SMART_RESIZE @@ -1125,36 +1131,34 @@ rxvt_term::resize_all_windows (unsigned int width, unsigned int height, int igno XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy, szHint.width, szHint.height); #else - XResizeWindow (display->display, TermWin.parent[0], szHint.width, - szHint.height); + XResizeWindow (display->display, TermWin.parent[0], szHint.width, szHint.height); #endif - } - fix_screen = (TermWin.ncol != prev_ncol - || TermWin.nrow != prev_nrow); + fix_screen = TermWin.ncol != prev_ncol || TermWin.nrow != prev_nrow; if (fix_screen || width != old_width || height != old_height) { if (scrollbar_visible ()) { - XMoveResizeWindow (display->display, scrollBar.win, window_sb_x, - 0, scrollbar_TotalWidth (), szHint.height); + XMoveResizeWindow (display->display, scrollBar.win, + window_sb_x, 0, + scrollbar_TotalWidth (), szHint.height); resize_scrollbar (); } if (menubar_visible ()) - XMoveResizeWindow (display->display, menuBar.win, window_vt_x, - 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); - - XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, - window_vt_y, TermWin_TotalWidth (), - TermWin_TotalHeight ()); - scr_clear (height != old_height); + XMoveResizeWindow (display->display, menuBar.win, + window_vt_x, 0, + TermWin_TotalWidth (), menuBar_TotalHeight ()); + + XMoveResizeWindow (display->display, TermWin.vt, + window_vt_x, window_vt_y, + TermWin_TotalWidth (), TermWin_TotalHeight ()); + scr_clear (); #ifdef XPM_BACKGROUND resize_pixmap (); #endif - } if (fix_screen || old_height == 0) diff --git a/src/rxvt.h b/src/rxvt.h index fd17288f..5862e718 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -1212,7 +1212,7 @@ struct rxvt_term : rxvt_vars { void scr_reset (); void scr_reset_realloc (); void scr_release (); - void scr_clear (bool really = true); + void scr_clear (bool really = false); void scr_refresh (unsigned char refresh_type); bool scr_refresh_rend (rend_t mask, rend_t value); void scr_erase_screen (int mode); diff --git a/src/salloc.C b/src/salloc.C index 8e12d992..e229932e 100644 --- a/src/salloc.C +++ b/src/salloc.C @@ -70,6 +70,22 @@ rxvt_salloc::alloc () return r; } +void * +rxvt_salloc::alloc (void *data, unsigned int datalen) +{ + void *s = alloc (); + + if (datalen < size) + { + memcpy (s, data, datalen); + memset ((unsigned char *)s + datalen, 0, size - datalen); // not strictly required for screen.C + } + else + memcpy (s, data, size); + + return s; +} + void rxvt_salloc::free (void *data) { diff --git a/src/salloc.h b/src/salloc.h index d66a3c59..991d4386 100644 --- a/src/salloc.h +++ b/src/salloc.h @@ -19,6 +19,7 @@ struct rxvt_salloc { ~rxvt_salloc (); void *alloc (); + void *alloc (void *data, unsigned int datalen); void free (void *data); }; diff --git a/src/screen.C b/src/screen.C index c10449f2..608b38c5 100644 --- a/src/screen.C +++ b/src/screen.C @@ -191,7 +191,7 @@ rxvt_term::scr_reset () if (prev_nrow == 0) { /* - * first time called so just malloc everything : don't rely on realloc + * first time called so just malloc everything: don't rely on realloc * Note: this is still needed so that all the scrollback lines are NULL */ screen.text = (text_t **)rxvt_calloc (total_rows, sizeof (text_t *)); @@ -258,6 +258,7 @@ rxvt_term::scr_reset () for (p = nrow; p < prev_nrow; p++) { q = p + TermWin.saveLines; + if (screen.text[q]) { #ifdef DEBUG_STRICT @@ -266,6 +267,7 @@ rxvt_term::scr_reset () talloc->free (screen.text[q]); ralloc->free (screen.rend[q]); } + if (swap.text[p]) { #ifdef DEBUG_STRICT @@ -274,6 +276,7 @@ rxvt_term::scr_reset () talloc->free (swap.text[p]); ralloc->free (swap.rend[p]); } + #ifdef DEBUG_STRICT assert (drawn_text[p] && drawn_rend[p]); #endif @@ -313,7 +316,7 @@ rxvt_term::scr_reset () swap.rend[p] = NULL; drawn_text[p] = NULL; drawn_rend[p] = NULL; - scr_blank_screen_mem (swap.text, swap.rend, p, setrstyle); + scr_blank_screen_mem (swap.text, swap.rend, p, setrstyle); scr_blank_screen_mem (drawn_text, drawn_rend, p, setrstyle); } @@ -338,7 +341,6 @@ rxvt_term::scr_reset () /* resize columns */ if (ncol != prev_ncol) { - int common = min (prev_ncol, ncol); rxvt_salloc *ta = new rxvt_salloc (ncol * sizeof (text_t)); rxvt_salloc *ra = new rxvt_salloc (ncol * sizeof (rend_t)); @@ -346,39 +348,38 @@ rxvt_term::scr_reset () { if (screen.text[p]) { - text_t *t = (text_t *)ta->alloc (); memcpy (t, screen.text[p], common * sizeof (text_t)); screen.text[p] = t; - rend_t *r = (rend_t *)ra->alloc (); memcpy (r, screen.rend[p], common * sizeof (rend_t)); screen.rend[p] = r; + screen.text[p] = (text_t *)ta->alloc (screen.text[p], prev_ncol * sizeof (text_t)); + screen.rend[p] = (rend_t *)ra->alloc (screen.rend[p], prev_ncol * sizeof (rend_t)); MIN_IT (screen.tlen[p], (int16_t)ncol); if (ncol > prev_ncol) - scr_blank_line (& (screen.text[p][prev_ncol]), - & (screen.rend[p][prev_ncol]), - ncol - prev_ncol, - setrstyle); + scr_blank_line (&screen.text[p][prev_ncol], + &screen.rend[p][prev_ncol], + ncol - prev_ncol, setrstyle); } } for (p = 0; p < nrow; p++) { - text_t *t = (text_t *)ta->alloc (); memcpy (t, drawn_text[p], common * sizeof (text_t)); drawn_text[p] = t; - rend_t *r = (rend_t *)ra->alloc (); memcpy (r, drawn_rend[p], common * sizeof (rend_t)); drawn_rend[p] = r; + drawn_text[p] = (text_t *)ta->alloc (drawn_text[p], prev_ncol * sizeof (text_t)); + drawn_rend[p] = (rend_t *)ra->alloc (drawn_rend[p], prev_ncol * sizeof (rend_t)); if (ncol > prev_ncol) - scr_blank_line (& (drawn_text[p][prev_ncol]), - & (drawn_rend[p][prev_ncol]), + scr_blank_line (&drawn_text[p][prev_ncol], + &drawn_rend[p][prev_ncol], ncol - prev_ncol, setrstyle); if (swap.text[p]) { - text_t *t = (text_t *)ta->alloc (); memcpy (t, swap.text[p], common * sizeof (text_t)); swap.text[p] = t; - rend_t *r = (rend_t *)ra->alloc (); memcpy (r, swap.rend[p], common * sizeof (rend_t)); swap.rend[p] = r; + swap.text[p] = (text_t *)ta->alloc (swap.text[p], prev_ncol * sizeof (text_t)); + swap.rend[p] = (rend_t *)ra->alloc (swap.rend[p], prev_ncol * sizeof (rend_t)); MIN_IT (swap.tlen[p], (int16_t)ncol); if (ncol > prev_ncol) - scr_blank_line (& (swap.text[p][prev_ncol]), - & (swap.rend[p][prev_ncol]), + scr_blank_line (&swap.text[p][prev_ncol], + &swap.rend[p][prev_ncol], ncol - prev_ncol, setrstyle); } @@ -478,7 +479,7 @@ rxvt_term::scr_poweron () prev_nrow = prev_ncol = 0; scr_reset (); - scr_clear (); + scr_clear (true); scr_refresh (SLOW_REFRESH); } @@ -711,6 +712,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) buf_text[i] = screen.text[j]; buf_rend[i] = screen.rend[j]; } + /* A2: Rotate lines */ for (j = row1, i = j + count; i <= row2; i++, j++) { @@ -718,6 +720,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) screen.text[j] = screen.text[i]; screen.rend[j] = screen.rend[i]; } + j = row2 - count + 1, i = count; } else /* if (j < 0) */ @@ -730,6 +733,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) buf_text[i] = screen.text[j]; buf_rend[i] = screen.rend[j]; } + /* B2: Rotate lines */ for (j = row2, i = j - count; i >= row1; i--, j--) { @@ -737,6 +741,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) screen.text[j] = screen.text[i]; screen.rend[j] = screen.rend[i]; } + j = row1, i = count; count = -count; } @@ -749,8 +754,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count, int spec) screen.rend[j] = buf_rend[i]; if (!spec) /* line length may not equal TermWin.ncol */ - scr_blank_screen_mem (screen.text, screen.rend, - (unsigned int)j, rstyle); + scr_blank_screen_mem (screen.text, screen.rend, (unsigned int)j, rstyle); } return count; @@ -888,7 +892,7 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len) } } - if (width > 0) + if (width != 0) { #if !UNICODE_3 && ENABLE_COMBINING // trim characters we can't store directly :( @@ -1238,8 +1242,7 @@ rxvt_term::scr_erase_line (int mode) } if (screen.text[row]) - scr_blank_line (& (screen.text[row][col]), - & (screen.rend[row][col]), num, rstyle); + scr_blank_line (&screen.text[row][col], &screen.rend[row][col], num, rstyle); else scr_blank_screen_mem (screen.text, screen.rend, row, rstyle); } @@ -1769,8 +1772,7 @@ rxvt_term::scr_expose (int x, int y, int width, int height, bool refresh) D_SCREEN ((stderr, "rxvt_scr_expose (x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)- (c:%d,r:%d)", x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) - fill_text (& (drawn_text[i][rc[PART_BEG].col]), 0, - (rc[PART_END].col - rc[PART_BEG].col + 1)); + fill_text (&drawn_text[i][rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); if (refresh) scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); @@ -2615,8 +2617,7 @@ rxvt_term::selection_paste (Window win, Atom prop, bool delete_prop) char **cl; int cr; - if (XmbTextPropertyToTextList (display->display, &ct, &cl, - &cr) >= 0 && cl) + if (XmbTextPropertyToTextList (display->display, &ct, &cl, &cr) >= 0 && cl) { for (int i = 0; i < cr; i++) paste ((unsigned char *)cl[i], STRLEN (cl[i])); @@ -3521,50 +3522,3 @@ rxvt_term::im_set_position (XPoint *pos) #endif /* ------------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------------- * - * DEBUG ROUTINES * - * ------------------------------------------------------------------------- */ -#if 0 -void -rxvt_debug_colors (void) -{ - int color; - const char *name[] = - { - "fg", "bg", - "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" - }; - - fprintf (stderr, "Color ( "); - if (rstyle & RS_RVid) - fprintf (stderr, "rvid "); - if (rstyle & RS_Bold) - fprintf (stderr, "bold "); - if (rstyle & RS_Blink) - fprintf (stderr, "blink "); - if (rstyle & RS_Uline) - fprintf (stderr, "uline "); - fprintf (stderr, "): "); - - color = GET_FGCOLOR (rstyle); -#ifndef NO_BRIGHTCOLOR - if (color >= minBrightCOLOR && color <= maxBrightCOLOR) - { - color -= (minBrightCOLOR - minCOLOR); - fprintf (stderr, "bright "); - } -#endif - fprintf (stderr, "%s on ", name[color]); - - color = GET_BGCOLOR (rstyle); -#ifndef NO_BRIGHTCOLOR - if (color >= minBrightCOLOR && color <= maxBrightCOLOR) - { - color -= (minBrightCOLOR - minCOLOR); - fprintf (stderr, "bright "); - } -#endif - fprintf (stderr, "%s\n", name[color]); -} -#endif