jcs
/wallops
/amendments
/107
chatter: Use need_downscroll for resizing background tabs
s/INT_MAX/SHRT_MAX/
jcs made amendment 107 2 months ago
--- chatter.c Mon Sep 16 09:24:57 2024
+++ chatter.c Mon Sep 16 10:34:36 2024
@@ -39,7 +39,7 @@ void chatter_layout_tab(struct chatter *chatter, struc
void chatter_focus_tab(struct chatter *chatter, struct chatter_tab *tab);
void chatter_draw_grow_icon(struct chatter *chatter);
void chatter_autoscroll(struct chatter *chatter, TEHandle te,
- ControlHandle scroller);
+ ControlHandle scroller, bool force);
short chatter_wait_type(struct focusable *focusable);
void chatter_key_down(struct focusable *focusable, EventRecord *event);
void chatter_mouse_down(struct focusable *focusable, EventRecord *event);
@@ -329,7 +329,7 @@ chatter_layout_tab(struct chatter *chatter, struct cha
(*(tab->messages_te))->caretHook = NullCaretHook;
TEActivate(tab->messages_te);
chatter_autoscroll(chatter, tab->messages_te,
- tab->messages_scroller);
+ tab->messages_scroller, false);
} else {
HLock(tab->messages_te);
(*(tab->messages_te))->viewRect = bounds;
@@ -394,7 +394,7 @@ chatter_focus_tab(struct chatter *chatter, struct chat
if (tab->need_downscroll) {
chatter_autoscroll(chatter, tab->messages_te,
- tab->messages_scroller);
+ tab->messages_scroller, true);
tab->need_downscroll = false;
}
@@ -906,28 +906,27 @@ chatter_resize(struct focusable *focusable, EventRecor
HLock(ttab->messages_te);
TEUpdate(&(*(ttab->messages_te))->viewRect, ttab->messages_te);
HUnlock(ttab->messages_te);
- TEPinScroll(0, INT_MAX, ttab->messages_te);
- TEPinScroll(0, -INT_MAX, ttab->messages_te);
- chatter_autoscroll(chatter, ttab->messages_te,
- ttab->messages_scroller);
+ ttab->need_downscroll = true;
}
+
+ /* resume normal drawing */
+ SetClip(savergn);
+ DisposeRgn(savergn);
/* update the current tab as-is */
+ chatter_use_shadow(chatter);
chatter_layout(chatter, false, NULL);
HLock(chatter->current_tab->messages_te);
TEUpdate(&(*(chatter->current_tab->messages_te))->viewRect,
chatter->current_tab->messages_te);
HUnlock(chatter->current_tab->messages_te);
- TEPinScroll(0, INT_MAX, chatter->current_tab->messages_te);
- TEPinScroll(0, -INT_MAX, chatter->current_tab->messages_te);
+ TEPinScroll(0, SHRT_MAX, chatter->current_tab->messages_te);
+ TEPinScroll(0, -SHRT_MAX, chatter->current_tab->messages_te);
chatter_autoscroll(chatter, chatter->current_tab->messages_te,
- chatter->current_tab->messages_scroller);
-
- /* resume normal drawing */
- SetClip(savergn);
- DisposeRgn(savergn);
-
+ chatter->current_tab->messages_scroller, true);
chatter_update(focusable, NULL);
+ chatter_reveal_shadow(chatter);
+
ValidRect(&chatter->win->portRect);
}
@@ -1213,10 +1212,10 @@ te_overflow:
TEDelete(tab->messages_te);
/* scroll up, causing a repaint */
- TEPinScroll(0, INT_MAX, tab->messages_te);
+ TEPinScroll(0, SHRT_MAX, tab->messages_te);
/* then scroll back down to what it looked like before we did anything */
- TEPinScroll(0, -INT_MAX, tab->messages_te);
+ TEPinScroll(0, -SHRT_MAX, tab->messages_te);
/* resume normal drawing */
SetClip(savergn);
@@ -1237,7 +1236,7 @@ no_overflow:
if (chatter->current_tab == tab && chatter->win == FrontWindow())
chatter_autoscroll(chatter, tab->messages_te,
- tab->messages_scroller);
+ tab->messages_scroller, false);
else
tab->need_downscroll = true;
@@ -1266,11 +1265,11 @@ no_overflow:
void
chatter_autoscroll(struct chatter *chatter, TEHandle te,
- ControlHandle scroller)
+ ControlHandle scroller, bool force)
{
/* only scroll down if we're already at the last line */
- if (GetCtlValue(scroller) == GetCtlMax(scroller)) {
- TEPinScroll(0, -INT_MAX, te);
+ if (force || GetCtlValue(scroller) == GetCtlMax(scroller)) {
+ TEPinScroll(0, -SHRT_MAX, te);
SetCtlValue(scroller, GetCtlMax(scroller));
}
@@ -1289,12 +1288,13 @@ chatter_clear_messages(struct chatter *chatter, struct
TESetText(NULL, 0, tab->messages_te);
/* scroll up, causing a repaint */
- TEPinScroll(0, INT_MAX, tab->messages_te);
+ TEPinScroll(0, SHRT_MAX, tab->messages_te);
/* then scroll back down to what it looked like before we did anything */
- TEPinScroll(0, -INT_MAX, tab->messages_te);
+ TEPinScroll(0, -SHRT_MAX, tab->messages_te);
- chatter_autoscroll(chatter, tab->messages_te, tab->messages_scroller);
+ chatter_autoscroll(chatter, tab->messages_te, tab->messages_scroller,
+ true);
SetClip(savergn);
DisposeRgn(savergn);