1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Windows: rewrite request_file() to support Unicode.

This centralises into windows/utils/request_file.c all of the code
that deals with the OPENFILENAME structure, and decides centrally
whether to use the Unicode or ANSI version of that structure and its
associated APIs. Now the output of any request_file function is our
own 'Filename' abstract type, instead of a raw char or wchar_t buffer,
which means that _any_ file dialog can produce a full Unicode filename
if the user wants to select one - and yet, in the w32old build, they
all uniformly fall back to the ANSI version, which is the only one
that works at all pre-NT.

A side effect: I've turned the FILTER_FOO_FILES family of definitions
from platform-specific #defines into a reasonably sensible enum. This
didn't affect the GTK side of things , because I'd never got round to
figuring out how to filter a file dialog down to a subset of files in
GTK, and still haven't. So I've just moved the existing FIXME comment
from platform.h to dialog.c.
This commit is contained in:
Simon Tatham
2024-12-13 19:23:30 +00:00
parent 22dfc46fb2
commit f8e1a2b3a9
13 changed files with 442 additions and 254 deletions

View File

@ -1739,6 +1739,9 @@ static void filefont_clicked(GtkButton *button, gpointer data)
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(button));
if (uc->ctrl->type == CTRL_FILESELECT) {
/*
* FIXME: do something about uc->ctrl->fileselect.filter
*/
#ifdef USE_GTK_FILE_CHOOSER_DIALOG
GtkWidget *filechoose = gtk_file_chooser_dialog_new(
uc->ctrl->fileselect.title, GTK_WINDOW(dp->window),

View File

@ -84,10 +84,6 @@ typedef void *HelpCtx;
#define NULL_HELPCTX ((HelpCtx)NULL)
#define HELPCTX(x) NULL
typedef const char *FILESELECT_FILTER_TYPE;
#define FILTER_KEY_FILES NULL /* FIXME */
#define FILTER_DYNLIB_FILES NULL /* FIXME */
/*
* Under X, selection data must not be NUL-terminated.
*/