"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "windows/window.c" between
putty-0.75.tar.gz and putty-0.76.tar.gz

About: PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms, along with an xterm terminal emulator.

window.c  (putty-0.75):window.c  (putty-0.76)
skipping to change at line 266 skipping to change at line 266
static void wintw_clip_request_paste(TermWin *, int clipboard); static void wintw_clip_request_paste(TermWin *, int clipboard);
static void wintw_refresh(TermWin *); static void wintw_refresh(TermWin *);
static void wintw_request_resize(TermWin *, int w, int h); static void wintw_request_resize(TermWin *, int w, int h);
static void wintw_set_title(TermWin *, const char *title); static void wintw_set_title(TermWin *, const char *title);
static void wintw_set_icon_title(TermWin *, const char *icontitle); static void wintw_set_icon_title(TermWin *, const char *icontitle);
static void wintw_set_minimised(TermWin *, bool minimised); static void wintw_set_minimised(TermWin *, bool minimised);
static void wintw_set_maximised(TermWin *, bool maximised); static void wintw_set_maximised(TermWin *, bool maximised);
static void wintw_move(TermWin *, int x, int y); static void wintw_move(TermWin *, int x, int y);
static void wintw_set_zorder(TermWin *, bool top); static void wintw_set_zorder(TermWin *, bool top);
static void wintw_palette_set(TermWin *, unsigned, unsigned, const rgb *); static void wintw_palette_set(TermWin *, unsigned, unsigned, const rgb *);
static void wintw_palette_get_overrides(TermWin *); static void wintw_palette_get_overrides(TermWin *, Terminal *);
static const TermWinVtable windows_termwin_vt = { static const TermWinVtable windows_termwin_vt = {
.setup_draw_ctx = wintw_setup_draw_ctx, .setup_draw_ctx = wintw_setup_draw_ctx,
.draw_text = wintw_draw_text, .draw_text = wintw_draw_text,
.draw_cursor = wintw_draw_cursor, .draw_cursor = wintw_draw_cursor,
.draw_trust_sigil = wintw_draw_trust_sigil, .draw_trust_sigil = wintw_draw_trust_sigil,
.char_width = wintw_char_width, .char_width = wintw_char_width,
.free_draw_ctx = wintw_free_draw_ctx, .free_draw_ctx = wintw_free_draw_ctx,
.set_cursor_pos = wintw_set_cursor_pos, .set_cursor_pos = wintw_set_cursor_pos,
.set_raw_mouse_mode = wintw_set_raw_mouse_mode, .set_raw_mouse_mode = wintw_set_raw_mouse_mode,
skipping to change at line 1217 skipping to change at line 1217
static inline rgb rgb_from_colorref(COLORREF cr) static inline rgb rgb_from_colorref(COLORREF cr)
{ {
rgb toret; rgb toret;
toret.r = GetRValue(cr); toret.r = GetRValue(cr);
toret.g = GetGValue(cr); toret.g = GetGValue(cr);
toret.b = GetBValue(cr); toret.b = GetBValue(cr);
return toret; return toret;
} }
static void wintw_palette_get_overrides(TermWin *tw) static void wintw_palette_get_overrides(TermWin *tw, Terminal *term)
{ {
if (conf_get_bool(conf, CONF_system_colour)) { if (conf_get_bool(conf, CONF_system_colour)) {
rgb rgb; rgb rgb;
rgb = rgb_from_colorref(GetSysColor(COLOR_WINDOWTEXT)); rgb = rgb_from_colorref(GetSysColor(COLOR_WINDOWTEXT));
term_palette_override(term, OSC4_COLOUR_fg, rgb); term_palette_override(term, OSC4_COLOUR_fg, rgb);
term_palette_override(term, OSC4_COLOUR_fg_bold, rgb); term_palette_override(term, OSC4_COLOUR_fg_bold, rgb);
rgb = rgb_from_colorref(GetSysColor(COLOR_WINDOW)); rgb = rgb_from_colorref(GetSysColor(COLOR_WINDOW));
term_palette_override(term, OSC4_COLOUR_bg, rgb); term_palette_override(term, OSC4_COLOUR_bg, rgb);
skipping to change at line 2397 skipping to change at line 2397
* Flush the line discipline's edit buffer in the * Flush the line discipline's edit buffer in the
* case where local editing has just been disabled. * case where local editing has just been disabled.
*/ */
if (ldisc) { if (ldisc) {
ldisc_configure(ldisc, conf); ldisc_configure(ldisc, conf);
ldisc_echoedit_update(ldisc); ldisc_echoedit_update(ldisc);
} }
if (conf_get_bool(conf, CONF_system_colour) != if (conf_get_bool(conf, CONF_system_colour) !=
conf_get_bool(prev_conf, CONF_system_colour)) conf_get_bool(prev_conf, CONF_system_colour))
term_notify_palette_overrides_changed(term); term_notify_palette_changed(term);
/* Pass new config data to the terminal */ /* Pass new config data to the terminal */
term_reconfig(term, conf); term_reconfig(term, conf);
setup_clipboards(term, conf); setup_clipboards(term, conf);
/* Reinitialise the colour palette, in case the terminal /* Reinitialise the colour palette, in case the terminal
* just read new settings out of Conf */ * just read new settings out of Conf */
if (pal) if (pal)
DeleteObject(pal); DeleteObject(pal);
logpal = NULL; logpal = NULL;
skipping to change at line 3163 skipping to change at line 3163
* Use GetScrollInfo instead of HIWORD(wParam) to get * Use GetScrollInfo instead of HIWORD(wParam) to get
* 32-bit scroll position. * 32-bit scroll position.
*/ */
SCROLLINFO si; SCROLLINFO si;
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_TRACKPOS; si.fMask = SIF_TRACKPOS;
if (GetScrollInfo(hwnd, SB_VERT, &si) == 0) if (GetScrollInfo(hwnd, SB_VERT, &si) == 0)
si.nTrackPos = HIWORD(wParam); si.nTrackPos = HIWORD(wParam);
term_scroll(term, 1, si.nTrackPos); term_scroll(term, 1, si.nTrackPos);
if (in_scrollbar_loop) {
/*
* Allow window updates to happen during interactive
* scroll.
*
* When the user takes hold of our window's scrollbar
* and wobbles it interactively back and forth, the
* first thing that happens is that this window
* procedure receives WM_SYSCOMMAND / SC_VSCROLL. [1]
* The default handler for that window message starts
* a subsidiary message loop, which continues to run
* until the user lets go of the scrollbar again. All
* WM_VSCROLL / SB_THUMBTRACK messages are generated
* by the handlers within that subsidiary message
* loop.
*
* So, during that time, _our_ message loop is not
* running, which means toplevel callbacks and timers
* and so forth are not happening, which means that
* when we redraw the window and set a timer to clear
* the cooldown flag 20ms later, that timer never
* fires, and we aren't able to keep redrawing the
* window.
*
* The 'obvious' answer would be to seize that
* SYSCOMMAND ourselves and inhibit the default
* handler, so that our message loop carries on
* running. But that would mean we'd have to
* reimplement the whole of the scrollbar handler!
*
* So instead we apply a bodge: set a static variable
* that indicates that we're _in_ that sub-loop, and
* if so, decide it's OK to manually call
* term_update() proper, bypassing the timer and
* cooldown and rate-limiting systems completely,
* whenever we see an SB_THUMBTRACK. This shouldn't
* cause a rate overload, because we're only doing it
* once per UI event!
*
* [1] Actually, there's an extra oddity where
* SC_HSCROLL and SC_VSCROLL have their documented
* values the wrong way round. Many people on the
* Internet have noticed this, e.g.
* https://stackoverflow.com/q/55528397
*/
term_update(term);
}
break; break;
} }
} }
if (in_scrollbar_loop) {
/*
* Allow window updates to happen during interactive
* scroll.
*
* When the user takes hold of our window's scrollbar and
* wobbles it interactively back and forth, or presses on
* one of the arrow buttons at the ends, the first thing
* that happens is that this window procedure receives
* WM_SYSCOMMAND / SC_VSCROLL. [1] The default handler for
* that window message starts a subsidiary message loop,
* which continues to run until the user lets go of the
* scrollbar again. All WM_VSCROLL / SB_THUMBTRACK
* messages are generated by the handlers within that
* subsidiary message loop.
*
* So, during that time, _our_ message loop is not
* running, which means toplevel callbacks and timers and
* so forth are not happening, which means that when we
* redraw the window and set a timer to clear the cooldown
* flag 20ms later, that timer never fires, and we aren't
* able to keep redrawing the window.
*
* The 'obvious' answer would be to seize that SYSCOMMAND
* ourselves and inhibit the default handler, so that our
* message loop carries on running. But that would mean
* we'd have to reimplement the whole of the scrollbar
* handler!
*
* So instead we apply a bodge: set a static variable that
* indicates that we're _in_ that sub-loop, and if so,
* decide it's OK to manually call term_update() proper,
* bypassing the timer and cooldown and rate-limiting
* systems completely, whenever we see an SB_THUMBTRACK.
* This shouldn't cause a rate overload, because we're
* only doing it once per UI event!
*
* [1] Actually, there's an extra oddity where SC_HSCROLL
* and SC_VSCROLL have their documented values the wrong
* way round. Many people on the Internet have noticed
* this, e.g. https://stackoverflow.com/q/55528397
*/
term_update(term);
}
break; break;
case WM_PALETTECHANGED: case WM_PALETTECHANGED:
if ((HWND) wParam != hwnd && pal != NULL) { if ((HWND) wParam != hwnd && pal != NULL) {
HDC hdc = make_hdc(); HDC hdc = make_hdc();
if (hdc) { if (hdc) {
if (RealizePalette(hdc) > 0) if (RealizePalette(hdc) > 0)
UpdateColors(hdc); UpdateColors(hdc);
free_hdc(hdc); free_hdc(hdc);
} }
} }
skipping to change at line 3387 skipping to change at line 3384
pair[1] = c; pair[1] = c;
term_keyinputw(term, pair, 2); term_keyinputw(term, pair, 2);
} else if (!IS_SURROGATE(c)) { } else if (!IS_SURROGATE(c)) {
term_keyinputw(term, &c, 1); term_keyinputw(term, &c, 1);
} }
} }
return 0; return 0;
case WM_SYSCOLORCHANGE: case WM_SYSCOLORCHANGE:
if (conf_get_bool(conf, CONF_system_colour)) { if (conf_get_bool(conf, CONF_system_colour)) {
/* Refresh palette from system colours. */ /* Refresh palette from system colours. */
term_notify_palette_overrides_changed(term); term_notify_palette_changed(term);
init_palette(); init_palette();
/* Force a repaint of the terminal window. */ /* Force a repaint of the terminal window. */
term_invalidate(term); term_invalidate(term);
} }
break; break;
case WM_GOT_CLIPDATA: case WM_GOT_CLIPDATA:
process_clipdata((HGLOBAL)lParam, wParam); process_clipdata((HGLOBAL)lParam, wParam);
return 0; return 0;
default: default:
if (message == wm_mousewheel || message == WM_MOUSEWHEEL) { if (message == wm_mousewheel || message == WM_MOUSEWHEEL) {
skipping to change at line 5445 skipping to change at line 5442
* delivering the clipboard data has to get hold of it by - * delivering the clipboard data has to get hold of it by -
* for example - talking over a network connection which is * for example - talking over a network connection which is
* forwarded through this very PuTTY. * forwarded through this very PuTTY.
* *
* Hence, we spawn a subthread to read the clipboard, and do * Hence, we spawn a subthread to read the clipboard, and do
* our paste when it's finished. The thread will send a * our paste when it's finished. The thread will send a
* message back to our main window when it terminates, and * message back to our main window when it terminates, and
* that tells us it's OK to paste. * that tells us it's OK to paste.
*/ */
DWORD in_threadid; /* required for Win9x */ DWORD in_threadid; /* required for Win9x */
CreateThread(NULL, 0, clipboard_read_threadfunc, HANDLE hThread = CreateThread(NULL, 0, clipboard_read_threadfunc,
wgs.term_hwnd, 0, &in_threadid); wgs.term_hwnd, 0, &in_threadid);
if (hThread)
CloseHandle(hThread); /* we don't need the thread handle */
} }
/* /*
* Print a modal (Really Bad) message box and perform a fatal exit. * Print a modal (Really Bad) message box and perform a fatal exit.
*/ */
void modalfatalbox(const char *fmt, ...) void modalfatalbox(const char *fmt, ...)
{ {
va_list ap; va_list ap;
char *message, *title; char *message, *title;
 End of changes. 7 change blocks. 
54 lines changed or deleted 53 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)