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,
{
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 ();
/* *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,
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)
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),
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);
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,
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);
sb_w = mb_h = 0;
window_vt_x = window_vt_y = 0;
+
if (scrollbar_visible ())
{
sb_w = scrollbar_TotalWidth ();
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;
MIN_IT (TermWin.width, max_width);
szHint.width = szHint.base_width + TermWin.width;
}
+
if (height && height - szHint.base_height < max_height)
{
szHint.height = 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;
window_calc (width, height);
XSetWMNormalHints (display->display, TermWin.parent[0], &szHint);
+
if (!ignoreparent)
{
#ifdef SMART_RESIZE
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)
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);
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)
{
~rxvt_salloc ();
void *alloc ();
+ void *alloc (void *data, unsigned int datalen);
void free (void *data);
};
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 *));
for (p = nrow; p < prev_nrow; p++)
{
q = p + TermWin.saveLines;
+
if (screen.text[q])
{
#ifdef DEBUG_STRICT
talloc->free (screen.text[q]);
ralloc->free (screen.rend[q]);
}
+
if (swap.text[p])
{
#ifdef DEBUG_STRICT
talloc->free (swap.text[p]);
ralloc->free (swap.rend[p]);
}
+
#ifdef DEBUG_STRICT
assert (drawn_text[p] && drawn_rend[p]);
#endif
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);
}
/* 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));
{
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);
}
prev_nrow = prev_ncol = 0;
scr_reset ();
- scr_clear ();
+ scr_clear (true);
scr_refresh (SLOW_REFRESH);
}
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++)
{
screen.text[j] = screen.text[i];
screen.rend[j] = screen.rend[i];
}
+
j = row2 - count + 1, i = count;
}
else /* if (j < 0) */
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--)
{
screen.text[j] = screen.text[i];
screen.rend[j] = screen.rend[i];
}
+
j = row1, i = count;
count = -count;
}
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;
}
}
- if (width > 0)
+ if (width != 0)
{
#if !UNICODE_3 && ENABLE_COMBINING
// trim characters we can't store directly :(
}
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);
}
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);
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]));
#endif
/* ------------------------------------------------------------------------- */
-\f
-/* ------------------------------------------------------------------------- *
- * 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