1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Formatting: normalise back to 4-space indentation.

In several pieces of development recently I've run across the
occasional code block in the middle of a function which suddenly
switched to 2-space indent from this code base's usual 4. I decided I
was tired of it, so I ran the whole code base through a re-indenter,
which made a huge mess, and then manually sifted out the changes that
actually made sense from that pass.

Indeed, this caught quite a few large sections with 2-space indent
level, a couple with 8, and a handful of even weirder things like 3
spaces or 12. This commit fixes them all.
This commit is contained in:
Simon Tatham
2022-08-03 20:48:46 +01:00
parent b6d7c81d43
commit 3a42a09dad
28 changed files with 489 additions and 489 deletions

View File

@ -582,9 +582,9 @@ static INT_PTR GenericMainDlgProc(HWND hwnd, UINT msg, WPARAM wParam,
c = strrchr(s->pathname, '/');
if (!c)
c = s->pathname;
c = s->pathname;
else
c++;
c++;
item = treeview_insert(&tvfaff, j, c, s->pathname);
if (!hfirst) {

View File

@ -716,10 +716,10 @@ void remove_session_from_jumplist(const char * const sessionname)
bool set_explicit_app_user_model_id(void)
{
DECL_WINDOWS_FUNCTION(static, HRESULT, SetCurrentProcessExplicitAppUserModelID,
(PCWSTR));
DECL_WINDOWS_FUNCTION(
static, HRESULT, SetCurrentProcessExplicitAppUserModelID, (PCWSTR));
static HMODULE shell32_module = 0;
static HMODULE shell32_module = 0;
if (!shell32_module)
{
@ -738,7 +738,7 @@ bool set_explicit_app_user_model_id(void)
const wchar_t *id = get_app_user_model_id();
if (p_SetCurrentProcessExplicitAppUserModelID(id) == S_OK)
{
return true;
return true;
}
return false;
}

View File

@ -927,7 +927,7 @@ static DWORD try_connect(NetSocket *sock)
goto ret;
}
SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0);
SetHandleInformation((HANDLE)s, HANDLE_FLAG_INHERIT, 0);
if (sock->oobinline) {
BOOL b = true;
@ -1708,9 +1708,9 @@ void select_result(WPARAM wParam, LPARAM lParam)
t = p_accept(s->s,(struct sockaddr *)&isa,&addrlen);
if (t == INVALID_SOCKET)
{
err = p_WSAGetLastError();
if (err == WSATRY_AGAIN)
break;
err = p_WSAGetLastError();
if (err == WSATRY_AGAIN)
break;
}
actx.p = (void *)t;
@ -1723,9 +1723,9 @@ void select_result(WPARAM wParam, LPARAM lParam)
if (s->localhost_only && !ipv4_is_local_addr(isa.sin_addr))
#endif
{
p_closesocket(t); /* dodgy WinSock let nonlocal through */
p_closesocket(t); /* dodgy WinSock let nonlocal through */
} else if (plug_accepting(s->plug, sk_net_accept, actx)) {
p_closesocket(t); /* denied or error */
p_closesocket(t); /* denied or error */
}
break;
}

View File

@ -622,9 +622,9 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
GetWindowLongPtr(hwnd, GWL_EXSTYLE) |
WS_EX_CONTEXTHELP);
else {
HWND item = GetDlgItem(hwnd, IDC_KEYLIST_HELP);
if (item)
DestroyWindow(item);
HWND item = GetDlgItem(hwnd, IDC_KEYLIST_HELP);
if (item)
DestroyWindow(item);
}
keylist = hwnd;
@ -852,9 +852,9 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
topic = WINHELP_CTX_pageant_deferred; break;
}
if (topic) {
launch_help(hwnd, topic);
launch_help(hwnd, topic);
} else {
MessageBeep(0);
MessageBeep(0);
}
break;
}
@ -1312,8 +1312,8 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, cmdline,
_T(""), SW_SHOW) <= 32) {
MessageBox(NULL, "Unable to execute PuTTY!",
"Error", MB_OK | MB_ICONERROR);
MessageBox(NULL, "Unable to execute PuTTY!",
"Error", MB_OK | MB_ICONERROR);
}
break;
}
@ -1371,25 +1371,25 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
break;
default: {
if(wParam >= IDM_SESSIONS_BASE && wParam <= IDM_SESSIONS_MAX) {
MENUITEMINFO mii;
TCHAR buf[MAX_PATH + 1];
TCHAR param[MAX_PATH + 1];
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_TYPE;
mii.cch = MAX_PATH;
mii.dwTypeData = buf;
GetMenuItemInfo(session_menu, wParam, false, &mii);
param[0] = '\0';
if (restrict_putty_acl)
strcat(param, "&R");
strcat(param, "@");
strcat(param, mii.dwTypeData);
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, param,
_T(""), SW_SHOW) <= 32) {
MessageBox(NULL, "Unable to execute PuTTY!", "Error",
MB_OK | MB_ICONERROR);
}
MENUITEMINFO mii;
TCHAR buf[MAX_PATH + 1];
TCHAR param[MAX_PATH + 1];
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_TYPE;
mii.cch = MAX_PATH;
mii.dwTypeData = buf;
GetMenuItemInfo(session_menu, wParam, false, &mii);
param[0] = '\0';
if (restrict_putty_acl)
strcat(param, "&R");
strcat(param, "@");
strcat(param, mii.dwTypeData);
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, param,
_T(""), SW_SHOW) <= 32) {
MessageBox(NULL, "Unable to execute PuTTY!", "Error",
MB_OK | MB_ICONERROR);
}
}
break;
}
@ -1425,10 +1425,10 @@ static LRESULT CALLBACK wm_copydata_WndProc(HWND hwnd, UINT message,
err = answer_filemapping_message(mapname);
if (err) {
#ifdef DEBUG_IPC
debug("IPC failed: %s\n", err);
debug("IPC failed: %s\n", err);
#endif
sfree(err);
return 0;
sfree(err);
return 0;
}
return 1;
}

View File

@ -438,9 +438,9 @@ static INT_PTR CALLBACK PPKParamsProc(HWND hwnd, UINT msg,
topic = WINHELP_CTX_puttygen_kdfparam; break;
}
if (topic) {
launch_help(hwnd, topic);
launch_help(hwnd, topic);
} else {
MessageBeep(0);
MessageBeep(0);
}
break;
}
@ -2353,9 +2353,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
topic = WINHELP_CTX_puttygen_conversions; break;
}
if (topic) {
launch_help(hwnd, topic);
launch_help(hwnd, topic);
} else {
MessageBeep(0);
MessageBeep(0);
}
break;
}

View File

@ -175,7 +175,7 @@ bool make_private_security_descriptor(DWORD permissions,
*error = NULL;
if (!getsids(error))
goto cleanup;
goto cleanup;
memset(ea, 0, sizeof(ea));
ea[0].grfAccessPermissions = permissions;

View File

@ -1923,7 +1923,7 @@ static void reset_window(int reinit) {
static RECT ss;
int width, height;
get_fullscreen_rect(&ss);
get_fullscreen_rect(&ss);
width = (ss.right - ss.left - extra_width) / font_width;
height = (ss.bottom - ss.top - extra_height) / font_height;
@ -2283,52 +2283,52 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
argprefix = "";
if (wParam == IDM_DUPSESS) {
/*
* Allocate a file-mapping memory chunk for the
* config structure.
*/
SECURITY_ATTRIBUTES sa;
strbuf *serbuf;
void *p;
int size;
/*
* Allocate a file-mapping memory chunk for the
* config structure.
*/
SECURITY_ATTRIBUTES sa;
strbuf *serbuf;
void *p;
int size;
serbuf = strbuf_new();
conf_serialise(BinarySink_UPCAST(serbuf), conf);
size = serbuf->len;
serbuf = strbuf_new();
conf_serialise(BinarySink_UPCAST(serbuf), conf);
size = serbuf->len;
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = true;
filemap = CreateFileMapping(INVALID_HANDLE_VALUE,
&sa,
PAGE_READWRITE,
0, size, NULL);
if (filemap && filemap != INVALID_HANDLE_VALUE) {
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, size);
if (p) {
memcpy(p, serbuf->s, size);
UnmapViewOfFile(p);
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = true;
filemap = CreateFileMapping(INVALID_HANDLE_VALUE,
&sa,
PAGE_READWRITE,
0, size, NULL);
if (filemap && filemap != INVALID_HANDLE_VALUE) {
p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, size);
if (p) {
memcpy(p, serbuf->s, size);
UnmapViewOfFile(p);
}
}
}
strbuf_free(serbuf);
inherit_handles = true;
cl = dupprintf("putty %s&%p:%u", argprefix,
filemap, (unsigned)size);
strbuf_free(serbuf);
inherit_handles = true;
cl = dupprintf("putty %s&%p:%u", argprefix,
filemap, (unsigned)size);
} else if (wParam == IDM_SAVEDSESS) {
unsigned int sessno = ((lParam - IDM_SAVED_MIN)
/ MENU_SAVED_STEP) + 1;
if (sessno < (unsigned)sesslist.nsessions) {
const char *session = sesslist.sessions[sessno];
cl = dupprintf("putty %s@%s", argprefix, session);
inherit_handles = false;
} else
break;
unsigned int sessno = ((lParam - IDM_SAVED_MIN)
/ MENU_SAVED_STEP) + 1;
if (sessno < (unsigned)sesslist.nsessions) {
const char *session = sesslist.sessions[sessno];
cl = dupprintf("putty %s@%s", argprefix, session);
inherit_handles = false;
} else
break;
} else /* IDM_NEWSESS */ {
cl = dupprintf("putty%s%s",
*argprefix ? " " : "",
argprefix);
inherit_handles = false;
cl = dupprintf("putty%s%s",
*argprefix ? " " : "",
argprefix);
inherit_handles = false;
}
GetModuleFileName(NULL, b, sizeof(b) - 1);
@ -2374,24 +2374,24 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
hwnd, conf, backend ? backend_cfg_info(backend) : 0);
reconfiguring = false;
if (!reconfig_result) {
conf_free(prev_conf);
break;
conf_free(prev_conf);
break;
}
conf_cache_data();
resize_action = conf_get_int(conf, CONF_resize_action);
{
/* Disable full-screen if resizing forbidden */
int i;
for (i = 0; i < lenof(popup_menus); i++)
EnableMenuItem(popup_menus[i].menu, IDM_FULLSCREEN,
MF_BYCOMMAND |
(resize_action == RESIZE_DISABLED
? MF_GRAYED : MF_ENABLED));
/* Gracefully unzoom if necessary */
if (IsZoomed(hwnd) && (resize_action == RESIZE_DISABLED))
ShowWindow(hwnd, SW_RESTORE);
/* Disable full-screen if resizing forbidden */
int i;
for (i = 0; i < lenof(popup_menus); i++)
EnableMenuItem(popup_menus[i].menu, IDM_FULLSCREEN,
MF_BYCOMMAND |
(resize_action == RESIZE_DISABLED
? MF_GRAYED : MF_ENABLED));
/* Gracefully unzoom if necessary */
if (IsZoomed(hwnd) && (resize_action == RESIZE_DISABLED))
ShowWindow(hwnd, SW_RESTORE);
}
/* Pass new config data to the logging module */
@ -2403,8 +2403,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
* case where local editing has just been disabled.
*/
if (ldisc) {
ldisc_configure(ldisc, conf);
ldisc_echoedit_update(ldisc);
ldisc_configure(ldisc, conf);
ldisc_echoedit_update(ldisc);
}
if (conf_get_bool(conf, CONF_system_colour) !=
@ -2443,90 +2443,90 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
/* Enable or disable the scroll bar, etc */
{
LONG nflg, flag = GetWindowLongPtr(hwnd, GWL_STYLE);
LONG nexflag, exflag =
GetWindowLongPtr(hwnd, GWL_EXSTYLE);
LONG nflg, flag = GetWindowLongPtr(hwnd, GWL_STYLE);
LONG nexflag, exflag =
GetWindowLongPtr(hwnd, GWL_EXSTYLE);
nexflag = exflag;
if (conf_get_bool(conf, CONF_alwaysontop) !=
conf_get_bool(prev_conf, CONF_alwaysontop)) {
if (conf_get_bool(conf, CONF_alwaysontop)) {
nexflag |= WS_EX_TOPMOST;
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
} else {
nexflag &= ~(WS_EX_TOPMOST);
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
nexflag = exflag;
if (conf_get_bool(conf, CONF_alwaysontop) !=
conf_get_bool(prev_conf, CONF_alwaysontop)) {
if (conf_get_bool(conf, CONF_alwaysontop)) {
nexflag |= WS_EX_TOPMOST;
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
} else {
nexflag &= ~(WS_EX_TOPMOST);
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE);
}
}
}
if (conf_get_bool(conf, CONF_sunken_edge))
nexflag |= WS_EX_CLIENTEDGE;
else
nexflag &= ~(WS_EX_CLIENTEDGE);
if (conf_get_bool(conf, CONF_sunken_edge))
nexflag |= WS_EX_CLIENTEDGE;
else
nexflag &= ~(WS_EX_CLIENTEDGE);
nflg = flag;
if (conf_get_bool(conf, is_full_screen() ?
CONF_scrollbar_in_fullscreen :
CONF_scrollbar))
nflg |= WS_VSCROLL;
else
nflg &= ~WS_VSCROLL;
nflg = flag;
if (conf_get_bool(conf, is_full_screen() ?
CONF_scrollbar_in_fullscreen :
CONF_scrollbar))
nflg |= WS_VSCROLL;
else
nflg &= ~WS_VSCROLL;
if (resize_action == RESIZE_DISABLED ||
is_full_screen())
nflg &= ~WS_THICKFRAME;
else
nflg |= WS_THICKFRAME;
if (resize_action == RESIZE_DISABLED ||
is_full_screen())
nflg &= ~WS_THICKFRAME;
else
nflg |= WS_THICKFRAME;
if (resize_action == RESIZE_DISABLED)
nflg &= ~WS_MAXIMIZEBOX;
else
nflg |= WS_MAXIMIZEBOX;
if (resize_action == RESIZE_DISABLED)
nflg &= ~WS_MAXIMIZEBOX;
else
nflg |= WS_MAXIMIZEBOX;
if (nflg != flag || nexflag != exflag) {
if (nflg != flag)
SetWindowLongPtr(hwnd, GWL_STYLE, nflg);
if (nexflag != exflag)
SetWindowLongPtr(hwnd, GWL_EXSTYLE, nexflag);
if (nflg != flag || nexflag != exflag) {
if (nflg != flag)
SetWindowLongPtr(hwnd, GWL_STYLE, nflg);
if (nexflag != exflag)
SetWindowLongPtr(hwnd, GWL_EXSTYLE, nexflag);
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOCOPYBITS |
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
SWP_FRAMECHANGED);
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOCOPYBITS |
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
SWP_FRAMECHANGED);
init_lvl = 2;
}
init_lvl = 2;
}
}
/* Oops */
if (resize_action == RESIZE_DISABLED && IsZoomed(hwnd)) {
force_normal(hwnd);
init_lvl = 2;
force_normal(hwnd);
init_lvl = 2;
}
{
FontSpec *font = conf_get_fontspec(conf, CONF_font);
FontSpec *prev_font = conf_get_fontspec(prev_conf,
CONF_font);
FontSpec *font = conf_get_fontspec(conf, CONF_font);
FontSpec *prev_font = conf_get_fontspec(prev_conf,
CONF_font);
if (!strcmp(font->name, prev_font->name) ||
!strcmp(conf_get_str(conf, CONF_line_codepage),
conf_get_str(prev_conf, CONF_line_codepage)) ||
font->isbold != prev_font->isbold ||
font->height != prev_font->height ||
font->charset != prev_font->charset ||
conf_get_int(conf, CONF_font_quality) !=
conf_get_int(prev_conf, CONF_font_quality) ||
conf_get_int(conf, CONF_vtmode) !=
conf_get_int(prev_conf, CONF_vtmode) ||
conf_get_int(conf, CONF_bold_style) !=
conf_get_int(prev_conf, CONF_bold_style) ||
resize_action == RESIZE_DISABLED ||
resize_action == RESIZE_EITHER ||
resize_action != conf_get_int(prev_conf,
CONF_resize_action))
init_lvl = 2;
if (!strcmp(font->name, prev_font->name) ||
!strcmp(conf_get_str(conf, CONF_line_codepage),
conf_get_str(prev_conf, CONF_line_codepage)) ||
font->isbold != prev_font->isbold ||
font->height != prev_font->height ||
font->charset != prev_font->charset ||
conf_get_int(conf, CONF_font_quality) !=
conf_get_int(prev_conf, CONF_font_quality) ||
conf_get_int(conf, CONF_vtmode) !=
conf_get_int(prev_conf, CONF_vtmode) ||
conf_get_int(conf, CONF_bold_style) !=
conf_get_int(prev_conf, CONF_bold_style) ||
resize_action == RESIZE_DISABLED ||
resize_action == RESIZE_EITHER ||
resize_action != conf_get_int(prev_conf,
CONF_resize_action))
init_lvl = 2;
}
InvalidateRect(hwnd, NULL, true);
@ -2734,9 +2734,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
static LPARAM lp = 0;
if (wParam != wp || lParam != lp ||
last_mousemove != WM_MOUSEMOVE) {
show_mouseptr(true);
wp = wParam; lp = lParam;
last_mousemove = WM_MOUSEMOVE;
show_mouseptr(true);
wp = wParam; lp = lParam;
last_mousemove = WM_MOUSEMOVE;
}
/*
* Add the mouse position and message time to the random
@ -2765,9 +2765,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
static LPARAM lp = 0;
if (wParam != wp || lParam != lp ||
last_mousemove != WM_NCMOUSEMOVE) {
show_mouseptr(true);
wp = wParam; lp = lParam;
last_mousemove = WM_NCMOUSEMOVE;
show_mouseptr(true);
wp = wParam; lp = lParam;
last_mousemove = WM_NCMOUSEMOVE;
}
noise_ultralight(NOISE_SOURCE_MOUSEPOS, lParam);
break;
@ -2786,8 +2786,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
HideCaret(hwnd);
hdc = BeginPaint(hwnd, &p);
if (pal) {
SelectPalette(hdc, pal, true);
RealizePalette(hdc);
SelectPalette(hdc, pal, true);
RealizePalette(hdc);
}
/*
@ -2838,40 +2838,40 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
p.rcPaint.right >= offset_width + font_width*term->cols ||
p.rcPaint.bottom>= offset_height + font_height*term->rows)
{
HBRUSH fillcolour, oldbrush;
HPEN edge, oldpen;
fillcolour = CreateSolidBrush (
colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
oldbrush = SelectObject(hdc, fillcolour);
edge = CreatePen(PS_SOLID, 0,
colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
oldpen = SelectObject(hdc, edge);
HBRUSH fillcolour, oldbrush;
HPEN edge, oldpen;
fillcolour = CreateSolidBrush (
colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
oldbrush = SelectObject(hdc, fillcolour);
edge = CreatePen(PS_SOLID, 0,
colours[ATTR_DEFBG>>ATTR_BGSHIFT]);
oldpen = SelectObject(hdc, edge);
/*
* Jordan Russell reports that this apparently
* ineffectual IntersectClipRect() call masks a
* Windows NT/2K bug causing strange display
* problems when the PuTTY window is taller than
* the primary monitor. It seems harmless enough...
*/
IntersectClipRect(hdc,
p.rcPaint.left, p.rcPaint.top,
p.rcPaint.right, p.rcPaint.bottom);
/*
* Jordan Russell reports that this apparently
* ineffectual IntersectClipRect() call masks a
* Windows NT/2K bug causing strange display
* problems when the PuTTY window is taller than
* the primary monitor. It seems harmless enough...
*/
IntersectClipRect(hdc,
p.rcPaint.left, p.rcPaint.top,
p.rcPaint.right, p.rcPaint.bottom);
ExcludeClipRect(hdc,
offset_width, offset_height,
offset_width+font_width*term->cols,
offset_height+font_height*term->rows);
ExcludeClipRect(hdc,
offset_width, offset_height,
offset_width+font_width*term->cols,
offset_height+font_height*term->rows);
Rectangle(hdc, p.rcPaint.left, p.rcPaint.top,
p.rcPaint.right, p.rcPaint.bottom);
Rectangle(hdc, p.rcPaint.left, p.rcPaint.top,
p.rcPaint.right, p.rcPaint.bottom);
/* SelectClipRgn(hdc, NULL); */
/* SelectClipRgn(hdc, NULL); */
SelectObject(hdc, oldbrush);
DeleteObject(fillcolour);
SelectObject(hdc, oldpen);
DeleteObject(edge);
SelectObject(hdc, oldbrush);
DeleteObject(fillcolour);
SelectObject(hdc, oldpen);
DeleteObject(edge);
}
SelectObject(hdc, GetStockObject(SYSTEM_FONT));
SelectObject(hdc, GetStockObject(WHITE_PEN));
@ -3314,33 +3314,33 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
if (n > 0) {
int i;
buff = snewn(n, char);
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, n);
/*
* Jaeyoun Chung reports that Korean character
* input doesn't work correctly if we do a single
* term_keyinputw covering the whole of buff. So
* instead we send the characters one by one.
*/
/* don't divide SURROGATE PAIR */
if (ldisc) {
for (i = 0; i < n; i += 2) {
WCHAR hs = *(unsigned short *)(buff+i);
if (IS_HIGH_SURROGATE(hs) && i+2 < n) {
WCHAR ls = *(unsigned short *)(buff+i+2);
if (IS_LOW_SURROGATE(ls)) {
term_keyinputw(
term, (unsigned short *)(buff+i), 2);
i += 2;
continue;
int i;
buff = snewn(n, char);
ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, n);
/*
* Jaeyoun Chung reports that Korean character
* input doesn't work correctly if we do a single
* term_keyinputw covering the whole of buff. So
* instead we send the characters one by one.
*/
/* don't divide SURROGATE PAIR */
if (ldisc) {
for (i = 0; i < n; i += 2) {
WCHAR hs = *(unsigned short *)(buff+i);
if (IS_HIGH_SURROGATE(hs) && i+2 < n) {
WCHAR ls = *(unsigned short *)(buff+i+2);
if (IS_LOW_SURROGATE(ls)) {
term_keyinputw(
term, (unsigned short *)(buff+i), 2);
i += 2;
continue;
}
}
term_keyinputw(
term, (unsigned short *)(buff+i), 1);
}
}
term_keyinputw(
term, (unsigned short *)(buff+i), 1);
}
}
free(buff);
free(buff);
}
ImmReleaseContext(hwnd, hIMC);
return 1;
@ -5688,7 +5688,7 @@ static void wintw_move(TermWin *tw, int x, int y)
if (resize_action == RESIZE_DISABLED ||
resize_action == RESIZE_FONT ||
IsZoomed(wgs.term_hwnd))
return;
return;
SetWindowPos(wgs.term_hwnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
@ -5763,7 +5763,7 @@ static bool get_fullscreen_rect(RECT * ss)
ss->right = GetSystemMetrics(SM_CXSCREEN);
ss->bottom = GetSystemMetrics(SM_CYSCREEN);
*/
return GetClientRect(GetDesktopWindow(), ss);
return GetClientRect(GetDesktopWindow(), ss);
}
@ -5774,12 +5774,12 @@ static bool get_fullscreen_rect(RECT * ss)
static void make_full_screen()
{
DWORD style;
RECT ss;
RECT ss;
assert(IsZoomed(wgs.term_hwnd));
if (is_full_screen())
return;
if (is_full_screen())
return;
/* Remove the window furniture. */
style = GetWindowLongPtr(wgs.term_hwnd, GWL_STYLE);
@ -5791,7 +5791,7 @@ static void make_full_screen()
SetWindowLongPtr(wgs.term_hwnd, GWL_STYLE, style);
/* Resize ourselves to exactly cover the nearest monitor. */
get_fullscreen_rect(&ss);
get_fullscreen_rect(&ss);
SetWindowPos(wgs.term_hwnd, HWND_TOP, ss.left, ss.top,
ss.right - ss.left, ss.bottom - ss.top, SWP_FRAMECHANGED);