Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2022-09-13 13:11:59 +0300
committerSimon Tatham <anakin@pobox.com>2022-09-13 14:32:04 +0300
commitb8473f0c11e3356cdf84d38ee5edf2062fc32824 (patch)
tree99b4c7a53a981e6217b35b523d1ad69031cad163
parent49aa6c2b0899e322ca8acebd2a51b6a3f43028df (diff)
Windows: remove static variables in wintw_request_resize.
Those have been there since around 2001. They're in a piece of code that calls get_fullscreen_rect to find the overall screen size, and then prevents attempts to resize the window larger than that. The static variables were arranging that we don't have to call get_fullscreen_rect more than once. But, firstly, computers are faster 20 years on; secondly, remote window-resize requests are intentionally rate-limited (as of commit d74308e90e3813a), so this shouldn't be the limiting factor anyway; and thirdly, multi-monitor support has appeared since then, which means that if the window has been dragged from one monitor to another then get_fullscreen_rect might _legitimately_ return a different bounding rectangle when called a second time. So we should just do the full check every time unconditionally. (cherry picked from commit 4b3a8cbf61ce4ee19227784ba27c52a9e47774fb)
-rw-r--r--windows/window.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/windows/window.c b/windows/window.c
index 059a123c..6ed581cd 100644
--- a/windows/window.c
+++ b/windows/window.c
@@ -1692,20 +1692,9 @@ static void wintw_request_resize(TermWin *tw, int w, int h)
/* Sanity checks ... */
{
- static int first_time = 1;
- static RECT ss;
-
- switch (first_time) {
- case 1:
- /* Get the size of the screen */
- if (get_fullscreen_rect(&ss))
- /* first_time = 0 */ ;
- else {
- first_time = 2;
- break;
- }
- case 0:
- /* Make sure the values are sane */
+ RECT ss;
+ if (get_fullscreen_rect(&ss)) {
+ /* Make sure the values aren't too big */
width = (ss.right - ss.left - extra_width) / 4;
height = (ss.bottom - ss.top - extra_height) / 6;