simon-git: putty (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Tue Sep 13 12:28:12 BST 2022
TL;DR:
1a365501 Checklist updates for pre-release setup.
260aad5f windows/window.c: make random_save_seed call unconditional.
307e909b Windows: rethink API of write_aclip().
c674b2da Windows: move GUI timer handling into a utils module.
4249b39e New Seat method, seat_nonfatal().
4b3a8cbf Windows: remove static variables in wintw_request_resize.
f9e57259 windows/window.c: move (most) static vars into WinGuiSeat.
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2022-09-13 12:28:12
commit 1a3655013d5438f80e3a0d8de1b9f31f39134ec6
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=1a3655013d5438f80e3a0d8de1b9f31f39134ec6;hp=49aa6c2b0899e322ca8acebd2a51b6a3f43028df
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Sep 13 08:29:12 2022 +0100
Checklist updates for pre-release setup.
I don't know why I never bothered to write it down before, but it's a
good idea to let a pre-release build actually *happen* between turning
them on and updating the website to claim they exist.
Also, for the first time ever, I've just sent out an announcement
email for the 0.78 *pre-releases*, soliciting testing in advance of
the actual release. So, add that to the checklist as well.
CHECKLST.txt | 6 ++++++
1 file changed, 6 insertions(+)
commit 260aad5fcac562702a799d945d48ad8b0e26d29c
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=260aad5fcac562702a799d945d48ad8b0e26d29c;hp=1a3655013d5438f80e3a0d8de1b9f31f39134ec6
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Sep 12 12:55:47 2022 +0100
windows/window.c: make random_save_seed call unconditional.
The conditionalisation of that call on 'protocol == PROT_SSH' has been
around since the beginning of our git history. But in those days,
random_save_seed() was unconditional _internally_ - it would always
create and write to the seed file regardless of whether the random
pool had even been initialised, let alone used.
Now random_save_seed() has its own internal condition which prevents
it doing anything if the random subsystem was never started up in the
first place. So it's better to call it unconditionally from
cleanup_exit, and then it'll be able to do its thing whenever needed,
without having to second-guess based on the top-level protocol.
(In fact, that's what all the other implementations of cleanup_exit()
have done all along. On Unix, and in Windows console apps, we do call
random_save_seed() unconditionally, and expect it to uncomplainingly
do nothing if there's nothing to do.)
windows/window.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
commit 307e909b51d15428e1db02227e7d37cd4c25f5db
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=307e909b51d15428e1db02227e7d37cd4c25f5db;hp=260aad5fcac562702a799d945d48ad8b0e26d29c
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Sep 12 11:27:34 2022 +0100
Windows: rethink API of write_aclip().
That clipboard-writing function is called just once, from the Event
Log dialog procedure, for when the user deliberately copies to the
clipboard. That call always passes must_deselect = true, which means
the conditional WM_IGNORE_CLIP messages are not sent. So it's simpler
to remove that parameter completely, and the conditional calls which
are never used.
Also, the clipboard data copied from the Event Log dialog is being put
in the clipboard associated with the main PuTTY terminal window. But
anything else we copy from a dialog box using Windows's built-in
copy-paste mechanisms would surely be associated with the _dialog_,
not its parent window. So we should do the same thing here. Therefore,
I've added a HWND parameter to write_aclip() and used that in place of
wgs.term_hwnd, so that we can pass in the HWND of the dialog itself.
windows/dialog.c | 2 +-
windows/platform.h | 2 +-
windows/window.c | 10 ++--------
3 files changed, 4 insertions(+), 10 deletions(-)
commit c674b2da4f21aa767d3154ed7a3a77192ce99845
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=c674b2da4f21aa767d3154ed7a3a77192ce99845;hp=307e909b51d15428e1db02227e7d37cd4c25f5db
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Sep 12 11:57:15 2022 +0100
Windows: move GUI timer handling into a utils module.
Previously, the timing.c subsystem worked in Windows PuTTY by means of
scheduling WM_TIMER messages to be sent to the terminal window. Now it
uses a separate hidden window instead, and all the machinery for
handling that window lives on its own in windows/utils/gui-timing.c.
Most immediately, this removes a use of wgs.term_hwnd that will become
awkward when I move that structure in a following commit. But also, it
will make it easier to add the same timing subsystem to unrelated GUI
programs, such as Windows Pageant: if we ever decide to implement
automatic deletion or re-encryption of unused keys after a timeout,
this will help make that easier.
windows/CMakeLists.txt | 1 +
windows/platform.h | 2 ++
windows/utils/gui-timing.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++
windows/window.c | 29 ++----------------------
4 files changed, 61 insertions(+), 27 deletions(-)
commit 4249b39ed369e3ee948d4cb33391742b9d6965f5
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4249b39ed369e3ee948d4cb33391742b9d6965f5;hp=c674b2da4f21aa767d3154ed7a3a77192ce99845
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Sep 13 08:49:38 2022 +0100
New Seat method, seat_nonfatal().
This is like the seat-independent nonfatal(), but specifies a Seat,
which allows the GUI dialog box to have the right terminal window as
its parent (if there are multiple ones).
Changed over all the nonfatal() calls in the code base that could be
localised to a Seat, which means all the ones that come up if
something goes horribly wrong in host key storage. To make that
possible, I've added a 'seat' parameter to store_host_key(); it turns
out that all its call sites had one available already.
console.c | 5 +++++
proxy/sshproxy.c | 9 +++++++++
pscp.c | 1 +
psftp.c | 1 +
psocks.c | 2 +-
putty.h | 17 +++++++++++++----
ssh/kex2-client.c | 2 +-
ssh/server.c | 1 +
ssh/sesschan.c | 1 +
storage.h | 4 +++-
stubs/null-seat.c | 1 +
unix/console.c | 2 +-
unix/dialog.c | 3 ++-
unix/plink.c | 1 +
unix/storage.c | 14 +++++++-------
unix/window.c | 7 +++++++
utils/CMakeLists.txt | 1 +
utils/seat_nonfatal.c | 19 +++++++++++++++++++
utils/tempseat.c | 12 ++++++++++++
windows/console.c | 2 +-
windows/dialog.c | 2 +-
windows/plink.c | 1 +
windows/storage.c | 2 +-
windows/window.c | 13 +++++++++++++
24 files changed, 104 insertions(+), 19 deletions(-)
commit 4b3a8cbf61ce4ee19227784ba27c52a9e47774fb
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4b3a8cbf61ce4ee19227784ba27c52a9e47774fb;hp=4249b39ed369e3ee948d4cb33391742b9d6965f5
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Sep 13 11:11:59 2022 +0100
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.
windows/window.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
commit f9e572595bb8cb65f8fab86f8a84a3bbefaa1895
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=f9e572595bb8cb65f8fab86f8a84a3bbefaa1895;hp=4b3a8cbf61ce4ee19227784ba27c52a9e47774fb
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Sep 13 09:00:19 2022 +0100
windows/window.c: move (most) static vars into WinGuiSeat.
This is a piece of refactoring that's been overdue forever. In the
Unix front end, all the variables specific to a particular SSH session
live in a big 'inst' structure, and calls to any of the trait APIs
like Seat or TermWin can recover the right 'inst' from their input
context pointer. But the Windows frontend was written before that kind
of thing became habitual to me, and all its variables have been just
lying around at the top level of window.c, and most of those context
pointers were just ignored.
Now I've swept them all up and put them where they ought to be, in a
big context structure. This was made immeasurably easier by the very
nifty 'clang-rename' tool, which can rename a single variable in a C
source file, and find just the right set of identifiers to change even
if other variables in the file have the same name, even in sub-scopes.
So I started by clang-renaming all the top-level variables in question
to have names beginning with a prefix that didn't previously appear
anywhere in the code; checked that still worked; and then moved all
the declarations into the struct type and did a purely textual
search-and-replace of the prefix with 'wgs->'.
One potential benefit of this change is that it allows more than one
instance of the WinGuiSeat structure to exist in the same process. I
don't have any immediate plans to actually do that, but it's nice to
know it wouldn't be ruled out if we ever did need it.
But that's not the main reason I did it. The main reason is that I
recently looked at the output of a Windows build using clang -Wall,
and was horrified by the number of casual shadowings of
generically-named global variables like 'term' and 'conf' with local
variables of the same name. That seemed like a recipe for confusion,
and I decided the best way to disambiguate them all was to do this
refactoring that I'd wanted anyway for years.
A few uses of the global variables occurred in functions that didn't
have convenient access to the right WinGuiSeat via a callback
parameter of some kind. Those had to be treated specially. Most were
cleaned up in advance by the previous few commits; the remaining fixes
in this commit itself were in functions like modalfatalbox(),
nonfatal() and cleanup_exit(). The error reporting functions want the
terminal HWND to use as a MessageBox parameter; they also have the
side effect of un-hiding the mouse pointer in the terminal window, in
case it's hidden; and cleanup_exit wanted to free some resources
dangling off the WinGuiSeat.
For most of those cases, I've made a linked list of all currently live
WinGuiSeat structures, so that they can loop over _all_ live instances
(whether there's one as usual, none, or maybe more than one in
future). The parent window for non-connection-specific error messages
is found by simply picking one arbitrarily off the linked list (if
any); the cleanups are done by iterating over the _whole_ list.
The mouse-pointer unhiding is dealt with by simply allowing
show_mouseptr to take a _null_ WinGuiSeat pointer. The only thing it
needs the context for at all is to check whether pointer-hiding is
enabled in the session's Conf; so if we're _un_-hiding the pointer we
don't need to check, and can unhide it unconditionally.
The remaining global variables in window.c are the new linked list of
all WinGuiSeat structures; 'wm_mousewheel' and 'trust_icon' which
really should be global across all WinGuiSeats even if we were to have
more than one; and there's a static variable 'cursor_visible' in
show_mouseptr() which is likewise legitimately Seat-independent (since
it records the last value we passed to the Win32 API ShowCursor
function, and _that's_ global across the whole process state).
All of this should cause no functional change whatsoever.
windows/win-gui-seat.h | 134 +++-
windows/window.c | 1967 ++++++++++++++++++++++++------------------------
2 files changed, 1133 insertions(+), 968 deletions(-)
More information about the tartarus-commits
mailing list