static void deinit_fonts(void);
static void set_input_locale(HKL);
static void update_savedsess_menu(void);
-static void init_flashwindow(void);
+static void init_winfuncs(void);
static int is_full_screen(void);
static void make_full_screen(void);
(((wch) >= 0x180B && (wch) <= 0x180D) || /* MONGOLIAN FREE VARIATION SELECTOR */ \
((wch) >= 0xFE00 && (wch) <= 0xFE0F)) /* VARIATION SELECTOR 1-16 */
+const int share_can_be_downstream = TRUE;
+const int share_can_be_upstream = TRUE;
+
/* Dummy routine, only required in plink. */
void ldisc_update(void *frontend, int echo, int edit)
{
init_help();
- init_flashwindow();
+ init_winfuncs();
conf = conf_new();
while (1) {
HANDLE *handles;
int nhandles, n;
+ DWORD timeout;
+
+ if (toplevel_callback_pending() ||
+ PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
+ /*
+ * If we have anything we'd like to do immediately, set
+ * the timeout for MsgWaitForMultipleObjects to zero so
+ * that we'll only do a quick check of our handles and
+ * then get on with whatever that was.
+ *
+ * One such option is a pending toplevel callback. The
+ * other is a non-empty Windows message queue, which you'd
+ * think we could leave to MsgWaitForMultipleObjects to
+ * check for us along with all the handles, but in fact we
+ * can't because once PeekMessage in one iteration of this
+ * loop has removed a message from the queue, the whole
+ * queue is considered uninteresting by the next
+ * invocation of MWFMO. So we check ourselves whether the
+ * message queue is non-empty, and if so, set this timeout
+ * to zero to ensure MWFMO doesn't block.
+ */
+ timeout = 0;
+ } else {
+ timeout = INFINITE;
+ /* The messages seem unreliable; especially if we're being tricky */
+ term_set_focus(term, GetForegroundWindow() == hwnd);
+ }
handles = handle_get_events(&nhandles);
- n = MsgWaitForMultipleObjects(nhandles, handles, FALSE, INFINITE,
- QS_ALLINPUT);
+ n = MsgWaitForMultipleObjects(nhandles, handles, FALSE,
+ timeout, QS_ALLINPUT);
if ((unsigned)(n - WAIT_OBJECT_0) < (unsigned)nhandles) {
handle_got_event(handles[n - WAIT_OBJECT_0]);
} else
sfree(handles);
- run_toplevel_callbacks();
-
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT)
goto finished; /* two-level break */
if (!(IsWindow(logbox) && IsDialogMessage(logbox, &msg)))
DispatchMessage(&msg);
-
- run_toplevel_callbacks();
}
- /* The messages seem unreliable; especially if we're being tricky */
- term_set_focus(term, GetForegroundWindow() == hwnd);
+ run_toplevel_callbacks();
}
finished:
return DefWindowProc(hwnd, message, wParam, lParam);
if (len != 0) {
- /*
- * Interrupt an ongoing paste. I'm not sure
- * this is sensible, but for the moment it's
- * preferable to having to faff about buffering
- * things.
- */
- term_nopaste(term);
-
/*
* We need not bother about stdin backlogs
* here, because in GUI PuTTY we can't do
return ibuf;
}
+DECL_WINDOWS_FUNCTION(static, BOOL, FlashWindowEx, (PFLASHWINFO));
+DECL_WINDOWS_FUNCTION(static, BOOL, ToUnicodeEx,
+ (UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL));
+
+static void init_winfuncs(void)
+{
+ HMODULE user32_module = load_system32_dll("user32.dll");
+ GET_WINDOWS_FUNCTION(user32_module, FlashWindowEx);
+ GET_WINDOWS_FUNCTION(user32_module, ToUnicodeEx);
+}
+
/*
* Translate a WM_(SYS)?KEY(UP|DOWN) message into a string of ASCII
* codes. Returns number of bytes used, zero to drop the message,
/* XXX how do we know what the max size of the keys array should
* be is? There's indication on MS' website of an Inquire/InquireEx
* functioning returning a KBINFO structure which tells us. */
- if (osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT) {
- r = ToUnicodeEx(wParam, scan, keystate, keys_unicode,
- lenof(keys_unicode), 0, kbd_layout);
+ if (osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT && p_ToUnicodeEx) {
+ r = p_ToUnicodeEx(wParam, scan, keystate, keys_unicode,
+ lenof(keys_unicode), 0, kbd_layout);
} else {
/* XXX 'keys' parameter is declared in MSDN documentation as
* 'LPWORD lpChar'.
if (r > 0) {
WCHAR keybuf;
- /*
- * Interrupt an ongoing paste. I'm not sure this is
- * sensible, but for the moment it's preferable to
- * having to faff about buffering things.
- */
- term_nopaste(term);
-
p = output;
for (i = 0; i < r; i++) {
wchar_t wch = keys_unicode[i];
sfree(stuff);
}
-DECL_WINDOWS_FUNCTION(static, BOOL, FlashWindowEx, (PFLASHWINFO));
-
-static void init_flashwindow(void)
-{
- HMODULE user32_module = load_system32_dll("user32.dll");
- GET_WINDOWS_FUNCTION(user32_module, FlashWindowEx);
-}
-
static BOOL flash_window_ex(DWORD dwFlags, UINT uCount, DWORD dwTimeout)
{
if (p_FlashWindowEx) {