mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-30 00:04:49 -05:00
Reorganise handling of WM_SIZE to fix two generality problems.
Firstly, maximise and restore events were expected never to occur during an interactive resize process (i.e. between WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE), but in fact Aero now allows this to happen if you move the pointer to the top of the screen while dragging the window. Secondly, plain old WM_SIZE events were expected never to occur _outside_ interactive resizes, but Aero permits that too (e.g. Windows-left and Windows-right), and also third-party window repositioning tools will send these. [originally from svn r9040]
This commit is contained in:
parent
094459a7e6
commit
0b6407878a
@ -2750,55 +2750,50 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||||||
width = LOWORD(lParam);
|
width = LOWORD(lParam);
|
||||||
height = HIWORD(lParam);
|
height = HIWORD(lParam);
|
||||||
|
|
||||||
if (!resizing) {
|
if (wParam == SIZE_MAXIMIZED && !was_zoomed) {
|
||||||
if (wParam == SIZE_MAXIMIZED && !was_zoomed) {
|
was_zoomed = 1;
|
||||||
was_zoomed = 1;
|
prev_rows = term->rows;
|
||||||
prev_rows = term->rows;
|
prev_cols = term->cols;
|
||||||
prev_cols = term->cols;
|
if (cfg.resize_action == RESIZE_TERM) {
|
||||||
if (cfg.resize_action == RESIZE_TERM) {
|
w = width / font_width;
|
||||||
w = width / font_width;
|
if (w < 1) w = 1;
|
||||||
if (w < 1) w = 1;
|
h = height / font_height;
|
||||||
h = height / font_height;
|
if (h < 1) h = 1;
|
||||||
if (h < 1) h = 1;
|
|
||||||
|
|
||||||
term_size(term, h, w, cfg.savelines);
|
term_size(term, h, w, cfg.savelines);
|
||||||
}
|
}
|
||||||
reset_window(0);
|
reset_window(0);
|
||||||
} else if (wParam == SIZE_RESTORED && was_zoomed) {
|
} else if (wParam == SIZE_RESTORED && was_zoomed) {
|
||||||
was_zoomed = 0;
|
was_zoomed = 0;
|
||||||
if (cfg.resize_action == RESIZE_TERM)
|
if (cfg.resize_action == RESIZE_TERM)
|
||||||
term_size(term, prev_rows, prev_cols, cfg.savelines);
|
term_size(term, prev_rows, prev_cols, cfg.savelines);
|
||||||
if (cfg.resize_action != RESIZE_FONT)
|
if (cfg.resize_action != RESIZE_FONT)
|
||||||
reset_window(2);
|
reset_window(2);
|
||||||
else
|
else
|
||||||
reset_window(0);
|
reset_window(0);
|
||||||
}
|
} else if (wParam == SIZE_MINIMIZED) {
|
||||||
/* This is an unexpected resize, these will normally happen
|
/* do nothing */
|
||||||
* if the window is too large. Probably either the user
|
} else if (cfg.resize_action != RESIZE_FONT && !is_alt_pressed()) {
|
||||||
* selected a huge font or the screen size has changed.
|
w = (width-cfg.window_border*2) / font_width;
|
||||||
*
|
if (w < 1) w = 1;
|
||||||
* This is also called with minimize.
|
h = (height-cfg.window_border*2) / font_height;
|
||||||
*/
|
if (h < 1) h = 1;
|
||||||
else reset_window(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (resizing) {
|
||||||
* Don't call back->size in mid-resize. (To prevent
|
/*
|
||||||
* massive numbers of resize events getting sent
|
* Don't call back->size in mid-resize. (To
|
||||||
* down the connection during an NT opaque drag.)
|
* prevent massive numbers of resize events
|
||||||
*/
|
* getting sent down the connection during an NT
|
||||||
if (resizing) {
|
* opaque drag.)
|
||||||
if (cfg.resize_action != RESIZE_FONT && !is_alt_pressed()) {
|
*/
|
||||||
need_backend_resize = TRUE;
|
need_backend_resize = TRUE;
|
||||||
w = (width-cfg.window_border*2) / font_width;
|
|
||||||
if (w < 1) w = 1;
|
|
||||||
h = (height-cfg.window_border*2) / font_height;
|
|
||||||
if (h < 1) h = 1;
|
|
||||||
|
|
||||||
cfg.height = h;
|
cfg.height = h;
|
||||||
cfg.width = w;
|
cfg.width = w;
|
||||||
} else
|
} else {
|
||||||
reset_window(0);
|
term_size(term, h, w, cfg.savelines);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reset_window(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sys_cursor_update();
|
sys_cursor_update();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user