зеркало из https://github.com/github/putty.git
Formatting change to braces around one case of a switch.
Sometimes, within a switch statement, you want to declare local variables specific to the handler for one particular case. Until now I've mostly been writing this in the form switch (discriminant) { case SIMPLE: do stuff; break; case COMPLICATED: { declare variables; do stuff; } break; } which is ugly because the two pieces of essentially similar code appear at different indent levels, and also inconvenient because you have less horizontal space available to write the complicated case handler in - particuarly undesirable because _complicated_ case handlers are the ones most likely to need all the space they can get! After encountering a rather nicer idiom in the LLVM source code, and after a bit of hackery this morning figuring out how to persuade Emacs's auto-indent to do what I wanted with it, I've decided to move to an idiom in which the open brace comes right after the case statement, and the code within it is indented the same as it would have been without the brace. Then the whole case handler (including the break) lives inside those braces, and you get something that looks more like this: switch (discriminant) { case SIMPLE: do stuff; break; case COMPLICATED: { declare variables; do stuff; break; } } This commit is a big-bang change that reformats all the complicated case handlers I could find into the new layout. This is particularly nice in the Pageant main function, in which almost _every_ case handler had a bundle of variables and was long and complicated. (In fact that's what motivated me to get round to this.) Some of the innermost parts of the terminal escape-sequence handling are also breathing a bit easier now the horizontal pressure on them is relieved. (Also, in a few cases, I was able to remove the extra braces completely, because the only variable local to the case handler was a loop variable which our new C99 policy allows me to move into the initialiser clause of its for statement.) Viewed with whitespace ignored, this is not too disruptive a change. Downstream patches that conflict with it may need to be reapplied using --ignore-whitespace or similar.
This commit is contained in:
Родитель
2571eabeef
Коммит
8d186c3c93
|
@ -32,10 +32,9 @@ void backend_socket_log(Seat *seat, LogContext *logctx,
|
|||
sk_getaddr(addr, addrbuf, lenof(addrbuf));
|
||||
msg = dupprintf("Connected to %s", addrbuf);
|
||||
break;
|
||||
case PLUGLOG_PROXY_MSG:
|
||||
case PLUGLOG_PROXY_MSG: {
|
||||
/* Proxy-related log messages have their own identifying
|
||||
* prefix already, put on by our caller. */
|
||||
{
|
||||
int len, log_to_term;
|
||||
|
||||
/* Suffix \r\n temporarily, so we can log to the terminal. */
|
||||
|
@ -50,8 +49,8 @@ void backend_socket_log(Seat *seat, LogContext *logctx,
|
|||
seat_stderr(seat, msg, len);
|
||||
|
||||
msg[len-2] = '\0'; /* remove the \r\n again */
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
msg = NULL; /* shouldn't happen, but placate optimiser */
|
||||
break;
|
||||
|
|
18
cmdgen.c
18
cmdgen.c
|
@ -211,11 +211,10 @@ int main(int argc, char **argv)
|
|||
while (p && *++p) {
|
||||
char c = *p;
|
||||
switch (c) {
|
||||
case '-':
|
||||
case '-': {
|
||||
/*
|
||||
* Long option.
|
||||
*/
|
||||
{
|
||||
char *opt, *val;
|
||||
opt = p++; /* opt will have _one_ leading - */
|
||||
while (*p && *p != '=')
|
||||
|
@ -293,9 +292,9 @@ int main(int argc, char **argv)
|
|||
fprintf(stderr,
|
||||
"puttygen: no such option `-%s'\n", opt);
|
||||
}
|
||||
}
|
||||
p = NULL;
|
||||
break;
|
||||
}
|
||||
case 'h':
|
||||
case 'V':
|
||||
case 'P':
|
||||
|
@ -941,8 +940,7 @@ int main(int argc, char **argv)
|
|||
break;
|
||||
|
||||
case PUBLIC:
|
||||
case PUBLICO:
|
||||
{
|
||||
case PUBLICO: {
|
||||
FILE *fp;
|
||||
|
||||
if (outfile) {
|
||||
|
@ -973,11 +971,11 @@ int main(int argc, char **argv)
|
|||
|
||||
if (outfile)
|
||||
fclose(fp);
|
||||
}
|
||||
break;
|
||||
|
||||
case FP:
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case FP: {
|
||||
FILE *fp;
|
||||
char *fingerprint;
|
||||
|
||||
|
@ -1008,8 +1006,8 @@ int main(int argc, char **argv)
|
|||
fclose(fp);
|
||||
|
||||
sfree(fingerprint);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OPENSSH_AUTO:
|
||||
case OPENSSH_NEW:
|
||||
|
|
5
import.c
5
import.c
|
@ -1235,8 +1235,7 @@ static struct openssh_new_key *load_openssh_new_key(BinarySource *filesrc,
|
|||
goto error;
|
||||
}
|
||||
break;
|
||||
case ON_K_BCRYPT:
|
||||
{
|
||||
case ON_K_BCRYPT: {
|
||||
BinarySource opts[1];
|
||||
|
||||
BinarySource_BARE_INIT_PL(opts, str);
|
||||
|
@ -1247,9 +1246,9 @@ static struct openssh_new_key *load_openssh_new_key(BinarySource *filesrc,
|
|||
errmsg = "failed to parse bcrypt options string";
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* At this point we expect a uint32 saying how many keys are
|
||||
|
|
|
@ -1281,8 +1281,7 @@ int do_bidi(bidi_char *line, int count)
|
|||
bover = true;
|
||||
break;
|
||||
|
||||
case PDF:
|
||||
{
|
||||
case PDF: {
|
||||
int prevlevel = getPreviousLevel(levels, i);
|
||||
|
||||
if (prevlevel == -1) {
|
||||
|
@ -1292,9 +1291,9 @@ int do_bidi(bidi_char *line, int count)
|
|||
currentOverride = currentEmbedding & OMASK;
|
||||
currentEmbedding = currentEmbedding & ~OMASK;
|
||||
}
|
||||
}
|
||||
levels[i] = currentEmbedding;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Whitespace is treated as neutral for now */
|
||||
case WS:
|
||||
|
|
55
pageant.c
55
pageant.c
|
@ -642,11 +642,10 @@ static PageantAsyncOp *pageant_make_op(
|
|||
}
|
||||
|
||||
switch (type) {
|
||||
case SSH1_AGENTC_REQUEST_RSA_IDENTITIES:
|
||||
case SSH1_AGENTC_REQUEST_RSA_IDENTITIES: {
|
||||
/*
|
||||
* Reply with SSH1_AGENT_RSA_IDENTITIES_ANSWER.
|
||||
*/
|
||||
{
|
||||
pageant_client_log(pc, reqid,
|
||||
"request: SSH1_AGENTC_REQUEST_RSA_IDENTITIES");
|
||||
|
||||
|
@ -665,13 +664,12 @@ static PageantAsyncOp *pageant_make_op(
|
|||
sfree(fingerprint);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SSH2_AGENTC_REQUEST_IDENTITIES:
|
||||
}
|
||||
case SSH2_AGENTC_REQUEST_IDENTITIES: {
|
||||
/*
|
||||
* Reply with SSH2_AGENT_IDENTITIES_ANSWER.
|
||||
*/
|
||||
{
|
||||
pageant_client_log(pc, reqid,
|
||||
"request: SSH2_AGENTC_REQUEST_IDENTITIES");
|
||||
|
||||
|
@ -690,15 +688,14 @@ static PageantAsyncOp *pageant_make_op(
|
|||
sfree(fingerprint);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SSH1_AGENTC_RSA_CHALLENGE:
|
||||
}
|
||||
case SSH1_AGENTC_RSA_CHALLENGE: {
|
||||
/*
|
||||
* Reply with either SSH1_AGENT_RSA_RESPONSE or
|
||||
* SSH_AGENT_FAILURE, depending on whether we have that key
|
||||
* or not.
|
||||
*/
|
||||
{
|
||||
RSAKey reqkey;
|
||||
PageantKey *pk;
|
||||
mp_int *challenge, *response;
|
||||
|
@ -760,15 +757,14 @@ static PageantAsyncOp *pageant_make_op(
|
|||
mp_free(response);
|
||||
mp_free(challenge);
|
||||
freersakey(&reqkey);
|
||||
}
|
||||
break;
|
||||
case SSH2_AGENTC_SIGN_REQUEST:
|
||||
}
|
||||
case SSH2_AGENTC_SIGN_REQUEST: {
|
||||
/*
|
||||
* Reply with either SSH2_AGENT_SIGN_RESPONSE or
|
||||
* SSH_AGENT_FAILURE, depending on whether we have that key
|
||||
* or not.
|
||||
*/
|
||||
{
|
||||
PageantKey *pk;
|
||||
ptrlen keyblob, sigdata;
|
||||
uint32_t flags;
|
||||
|
@ -829,14 +825,13 @@ static PageantAsyncOp *pageant_make_op(
|
|||
so->failure_type = failure_type;
|
||||
so->crLine = 0;
|
||||
return &so->pao;
|
||||
}
|
||||
break;
|
||||
case SSH1_AGENTC_ADD_RSA_IDENTITY:
|
||||
}
|
||||
case SSH1_AGENTC_ADD_RSA_IDENTITY: {
|
||||
/*
|
||||
* Add to the list and return SSH_AGENT_SUCCESS, or
|
||||
* SSH_AGENT_FAILURE if the key was malformed.
|
||||
*/
|
||||
{
|
||||
RSAKey *key;
|
||||
|
||||
pageant_client_log(pc, reqid,
|
||||
|
@ -876,14 +871,13 @@ static PageantAsyncOp *pageant_make_op(
|
|||
freersakey(key);
|
||||
sfree(key);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SSH2_AGENTC_ADD_IDENTITY:
|
||||
}
|
||||
case SSH2_AGENTC_ADD_IDENTITY: {
|
||||
/*
|
||||
* Add to the list and return SSH_AGENT_SUCCESS, or
|
||||
* SSH_AGENT_FAILURE if the key was malformed.
|
||||
*/
|
||||
{
|
||||
ssh2_userkey *key = NULL;
|
||||
ptrlen algpl;
|
||||
const ssh_keyalg *alg;
|
||||
|
@ -941,15 +935,14 @@ static PageantAsyncOp *pageant_make_op(
|
|||
sfree(key->comment);
|
||||
sfree(key);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SSH1_AGENTC_REMOVE_RSA_IDENTITY:
|
||||
}
|
||||
case SSH1_AGENTC_REMOVE_RSA_IDENTITY: {
|
||||
/*
|
||||
* Remove from the list and return SSH_AGENT_SUCCESS, or
|
||||
* perhaps SSH_AGENT_FAILURE if it wasn't in the list to
|
||||
* start with.
|
||||
*/
|
||||
{
|
||||
RSAKey reqkey;
|
||||
PageantKey *pk;
|
||||
|
||||
|
@ -988,15 +981,14 @@ static PageantAsyncOp *pageant_make_op(
|
|||
} else {
|
||||
fail("key not found");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SSH2_AGENTC_REMOVE_IDENTITY:
|
||||
}
|
||||
case SSH2_AGENTC_REMOVE_IDENTITY: {
|
||||
/*
|
||||
* Remove from the list and return SSH_AGENT_SUCCESS, or
|
||||
* perhaps SSH_AGENT_FAILURE if it wasn't in the list to
|
||||
* start with.
|
||||
*/
|
||||
{
|
||||
PageantKey *pk;
|
||||
ptrlen blob;
|
||||
|
||||
|
@ -1031,13 +1023,12 @@ static PageantAsyncOp *pageant_make_op(
|
|||
put_byte(sb, SSH_AGENT_SUCCESS);
|
||||
|
||||
pageant_client_log(pc, reqid, "reply: SSH_AGENT_SUCCESS");
|
||||
}
|
||||
break;
|
||||
case SSH1_AGENTC_REMOVE_ALL_RSA_IDENTITIES:
|
||||
}
|
||||
case SSH1_AGENTC_REMOVE_ALL_RSA_IDENTITIES: {
|
||||
/*
|
||||
* Remove all SSH-1 keys. Always returns success.
|
||||
*/
|
||||
{
|
||||
pageant_client_log(pc, reqid, "request:"
|
||||
" SSH1_AGENTC_REMOVE_ALL_RSA_IDENTITIES");
|
||||
|
||||
|
@ -1047,13 +1038,12 @@ static PageantAsyncOp *pageant_make_op(
|
|||
put_byte(sb, SSH_AGENT_SUCCESS);
|
||||
|
||||
pageant_client_log(pc, reqid, "reply: SSH_AGENT_SUCCESS");
|
||||
}
|
||||
break;
|
||||
case SSH2_AGENTC_REMOVE_ALL_IDENTITIES:
|
||||
}
|
||||
case SSH2_AGENTC_REMOVE_ALL_IDENTITIES: {
|
||||
/*
|
||||
* Remove all SSH-2 keys. Always returns success.
|
||||
*/
|
||||
{
|
||||
pageant_client_log(pc, reqid,
|
||||
"request: SSH2_AGENTC_REMOVE_ALL_IDENTITIES");
|
||||
|
||||
|
@ -1063,10 +1053,9 @@ static PageantAsyncOp *pageant_make_op(
|
|||
put_byte(sb, SSH_AGENT_SUCCESS);
|
||||
|
||||
pageant_client_log(pc, reqid, "reply: SSH_AGENT_SUCCESS");
|
||||
}
|
||||
break;
|
||||
case SSH2_AGENTC_EXTENSION:
|
||||
{
|
||||
}
|
||||
case SSH2_AGENTC_EXTENSION: {
|
||||
enum Extension exttype = EXT_UNKNOWN;
|
||||
ptrlen extname = get_string(msg);
|
||||
pageant_client_log(pc, reqid,
|
||||
|
@ -1297,8 +1286,8 @@ static PageantAsyncOp *pageant_make_op(
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
pageant_client_log(pc, reqid, "request: unknown message type %d",
|
||||
type);
|
||||
|
|
13
proxy.c
13
proxy.c
|
@ -766,8 +766,7 @@ int proxy_socks4_negotiate (ProxySocket *p, int change)
|
|||
put_uint16(command, p->remote_port);
|
||||
|
||||
switch (sk_addrtype(p->remote_addr)) {
|
||||
case ADDRTYPE_IPV4:
|
||||
{
|
||||
case ADDRTYPE_IPV4: {
|
||||
char addr[4];
|
||||
sk_addrcopy(p->remote_addr, addr);
|
||||
put_data(command, addr, 4);
|
||||
|
@ -1084,8 +1083,7 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
|
|||
put_byte(command, 4); /* IPv6 */
|
||||
sk_addrcopy(p->remote_addr, strbuf_append(command, 16));
|
||||
break;
|
||||
case ADDRTYPE_NAME:
|
||||
{
|
||||
case ADDRTYPE_NAME: {
|
||||
char hostname[512];
|
||||
put_byte(command, 3); /* domain name */
|
||||
sk_getaddr(p->remote_addr, hostname, lenof(hostname));
|
||||
|
@ -1095,9 +1093,9 @@ int proxy_socks5_negotiate (ProxySocket *p, int change)
|
|||
strbuf_free(command);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
put_uint16(command, p->remote_port);
|
||||
|
||||
|
@ -1317,8 +1315,7 @@ char *format_telnet_command(SockAddr *addr, int port, Conf *conf)
|
|||
break;
|
||||
|
||||
case 'x':
|
||||
case 'X':
|
||||
{
|
||||
case 'X': {
|
||||
/* escaped hexadecimal value (ie. \xff) */
|
||||
unsigned char v = 0;
|
||||
int i = 0;
|
||||
|
@ -1350,8 +1347,8 @@ char *format_telnet_command(SockAddr *addr, int port, Conf *conf)
|
|||
i++;
|
||||
v <<= 4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
put_data(buf, fmt + so, 2);
|
||||
|
|
|
@ -492,14 +492,13 @@ static void write_clip_setting(settings_w *sesskey, const char *savekey,
|
|||
case CLIPUI_EXPLICIT:
|
||||
write_setting_s(sesskey, savekey, "explicit");
|
||||
break;
|
||||
case CLIPUI_CUSTOM:
|
||||
{
|
||||
case CLIPUI_CUSTOM: {
|
||||
char *sval = dupcat("custom:", conf_get_str(conf, strconfkey));
|
||||
write_setting_s(sesskey, savekey, sval);
|
||||
sfree(sval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void read_clip_setting(settings_r *sesskey, char *savekey,
|
||||
|
|
|
@ -262,15 +262,14 @@ bool ssh1_handle_direction_specific_packet(
|
|||
|
||||
return true;
|
||||
|
||||
case SSH1_SMSG_EXIT_STATUS:
|
||||
{
|
||||
case SSH1_SMSG_EXIT_STATUS: {
|
||||
int exitcode = get_uint32(pktin);
|
||||
ppl_logevent("Server sent command exit status %d", exitcode);
|
||||
ssh_got_exitcode(s->ppl.ssh, exitcode);
|
||||
|
||||
s->session_terminated = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -115,10 +115,10 @@ bool ssh1_handle_direction_specific_packet(
|
|||
|
||||
return true;
|
||||
|
||||
case SSH1_CMSG_REQUEST_PTY:
|
||||
case SSH1_CMSG_REQUEST_PTY: {
|
||||
if (s->finished_setup)
|
||||
goto unexpected_setup_packet;
|
||||
{
|
||||
|
||||
ptrlen termtype = get_string(pktin);
|
||||
unsigned height = get_uint32(pktin);
|
||||
unsigned width = get_uint32(pktin);
|
||||
|
@ -138,12 +138,12 @@ bool ssh1_handle_direction_specific_packet(
|
|||
} else {
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
pktout = ssh_bpp_new_pktout(
|
||||
s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE));
|
||||
pq_push(s->ppl.out_pq, pktout);
|
||||
return true;
|
||||
}
|
||||
|
||||
case SSH1_CMSG_PORT_FORWARD_REQUEST:
|
||||
if (s->finished_setup)
|
||||
|
@ -166,11 +166,10 @@ bool ssh1_handle_direction_specific_packet(
|
|||
pq_push(s->ppl.out_pq, pktout);
|
||||
return true;
|
||||
|
||||
case SSH1_CMSG_X11_REQUEST_FORWARDING:
|
||||
case SSH1_CMSG_X11_REQUEST_FORWARDING: {
|
||||
if (s->finished_setup)
|
||||
goto unexpected_setup_packet;
|
||||
|
||||
{
|
||||
ptrlen authproto = get_string(pktin);
|
||||
ptrlen authdata = get_string(pktin);
|
||||
unsigned screen_number = 0;
|
||||
|
@ -179,12 +178,12 @@ bool ssh1_handle_direction_specific_packet(
|
|||
|
||||
success = chan_enable_x11_forwarding(
|
||||
s->mainchan_chan, false, authproto, authdata, screen_number);
|
||||
}
|
||||
|
||||
pktout = ssh_bpp_new_pktout(
|
||||
s->ppl.bpp, (success ? SSH1_SMSG_SUCCESS : SSH1_SMSG_FAILURE));
|
||||
pq_push(s->ppl.out_pq, pktout);
|
||||
return true;
|
||||
}
|
||||
|
||||
case SSH1_CMSG_AGENT_REQUEST_FORWARDING:
|
||||
if (s->finished_setup)
|
||||
|
|
|
@ -516,19 +516,18 @@ static bool ssh2_connection_filter_queue(struct ssh2_connection_state *s)
|
|||
ssh2_channel_try_eof(c); /* in case we had a pending EOF */
|
||||
break;
|
||||
|
||||
case SSH2_MSG_CHANNEL_OPEN_FAILURE:
|
||||
case SSH2_MSG_CHANNEL_OPEN_FAILURE: {
|
||||
assert(c->halfopen);
|
||||
|
||||
{
|
||||
char *err = ssh2_channel_open_failure_error_text(pktin);
|
||||
chan_open_failed(c->chan, err);
|
||||
sfree(err);
|
||||
}
|
||||
|
||||
del234(s->channels, c);
|
||||
ssh2_channel_free(c);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SSH2_MSG_CHANNEL_DATA:
|
||||
case SSH2_MSG_CHANNEL_EXTENDED_DATA:
|
||||
|
|
95
terminal.c
95
terminal.c
|
@ -3411,8 +3411,7 @@ static void term_out(Terminal *term)
|
|||
strbuf_free(buf);
|
||||
}
|
||||
break;
|
||||
case '\007': /* BEL: Bell */
|
||||
{
|
||||
case '\007': { /* BEL: Bell */
|
||||
struct beeptime *newbeep;
|
||||
unsigned long ticks;
|
||||
|
||||
|
@ -3474,8 +3473,8 @@ static void term_out(Terminal *term)
|
|||
}
|
||||
}
|
||||
seen_disp_event(term);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '\b': /* BS: Back space */
|
||||
if (term->curs.x == 0 && (term->curs.y == 0 || !term->wrap))
|
||||
/* do nothing */ ;
|
||||
|
@ -3542,8 +3541,7 @@ static void term_out(Terminal *term)
|
|||
if (term->logctx)
|
||||
logtraffic(term->logctx, (unsigned char) c, LGTYP_ASCII);
|
||||
break;
|
||||
case '\t': /* HT: Character tabulation */
|
||||
{
|
||||
case '\t': { /* HT: Character tabulation */
|
||||
pos old_curs = term->curs;
|
||||
termline *ldata = scrlineptr(term->curs.y);
|
||||
|
||||
|
@ -3561,10 +3559,10 @@ static void term_out(Terminal *term)
|
|||
}
|
||||
|
||||
check_selection(term, old_curs, term->curs);
|
||||
}
|
||||
seen_disp_event(term);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
switch (term->termstate) {
|
||||
case TOPLEVEL:
|
||||
|
@ -3679,9 +3677,8 @@ static void term_out(Terminal *term)
|
|||
term->tabs[term->curs.x] = true;
|
||||
break;
|
||||
|
||||
case ANSI('8', '#'): /* DECALN: fills screen with Es :-) */
|
||||
case ANSI('8', '#'): { /* DECALN: fills screen with Es :-) */
|
||||
compatibility(VT100);
|
||||
{
|
||||
termline *ldata;
|
||||
int i, j;
|
||||
pos scrtop, scrbot;
|
||||
|
@ -3703,15 +3700,14 @@ static void term_out(Terminal *term)
|
|||
scrbot.x = 0;
|
||||
scrbot.y = term->rows;
|
||||
check_selection(term, scrtop, scrbot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ANSI('3', '#'):
|
||||
case ANSI('4', '#'):
|
||||
case ANSI('5', '#'):
|
||||
case ANSI('6', '#'):
|
||||
case ANSI('6', '#'): {
|
||||
compatibility(VT100);
|
||||
{
|
||||
int nlattr;
|
||||
termline *ldata;
|
||||
|
||||
|
@ -3733,8 +3729,8 @@ static void term_out(Terminal *term)
|
|||
check_line_size(term, ldata);
|
||||
check_trust_status(term, ldata);
|
||||
ldata->lattr = nlattr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* GZD4: G0 designate 94-set */
|
||||
case ANSI('A', '('):
|
||||
compatibility(VT100);
|
||||
|
@ -3913,8 +3909,7 @@ static void term_out(Terminal *term)
|
|||
(term->dec_om ? 2 : 0));
|
||||
seen_disp_event(term);
|
||||
break;
|
||||
case 'J': /* ED: erase screen or parts of it */
|
||||
{
|
||||
case 'J': { /* ED: erase screen or parts of it */
|
||||
unsigned int i = def(term->esc_args[0], 0);
|
||||
if (i == 3) {
|
||||
/* Erase Saved Lines (xterm)
|
||||
|
@ -3927,20 +3922,19 @@ static void term_out(Terminal *term)
|
|||
i = 0;
|
||||
erase_lots(term, false, !!(i & 2), !!(i & 1));
|
||||
}
|
||||
}
|
||||
if (term->scroll_on_disp)
|
||||
term->disptop = 0;
|
||||
seen_disp_event(term);
|
||||
break;
|
||||
case 'K': /* EL: erase line or parts of it */
|
||||
{
|
||||
}
|
||||
case 'K': { /* EL: erase line or parts of it */
|
||||
unsigned int i = def(term->esc_args[0], 0) + 1;
|
||||
if (i > 3)
|
||||
i = 0;
|
||||
erase_lots(term, true, !!(i & 2), !!(i & 1));
|
||||
}
|
||||
seen_disp_event(term);
|
||||
break;
|
||||
}
|
||||
case 'L': /* IL: insert lines */
|
||||
compatibility(VT102);
|
||||
CLAMP(term->esc_args[0], term->rows);
|
||||
|
@ -3994,17 +3988,13 @@ static void term_out(Terminal *term)
|
|||
case 'h': /* SM: toggle modes to high */
|
||||
case ANSI_QUE('h'):
|
||||
compatibility(VT100);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < term->esc_nargs; i++)
|
||||
for (int i = 0; i < term->esc_nargs; i++)
|
||||
toggle_mode(term, term->esc_args[i],
|
||||
term->esc_query, true);
|
||||
}
|
||||
break;
|
||||
case 'i': /* MC: Media copy */
|
||||
case ANSI_QUE('i'):
|
||||
case ANSI_QUE('i'): {
|
||||
compatibility(VT100);
|
||||
{
|
||||
char *printer;
|
||||
if (term->esc_nargs != 1) break;
|
||||
if (term->esc_args[0] == 5 &&
|
||||
|
@ -4018,17 +4008,14 @@ static void term_out(Terminal *term)
|
|||
term->printing) {
|
||||
term_print_finish(term);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'l': /* RM: toggle modes to low */
|
||||
case ANSI_QUE('l'):
|
||||
compatibility(VT100);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < term->esc_nargs; i++)
|
||||
for (int i = 0; i < term->esc_nargs; i++)
|
||||
toggle_mode(term, term->esc_args[i],
|
||||
term->esc_query, false);
|
||||
}
|
||||
break;
|
||||
case 'g': /* TBC: clear tabs */
|
||||
compatibility(VT100);
|
||||
|
@ -4078,37 +4065,33 @@ static void term_out(Terminal *term)
|
|||
}
|
||||
break;
|
||||
case 'm': /* SGR: set graphics rendition */
|
||||
{
|
||||
/*
|
||||
* A VT100 without the AVO only had one
|
||||
* attribute, either underline or
|
||||
* reverse video depending on the
|
||||
* cursor type, this was selected by
|
||||
* CSI 7m.
|
||||
* attribute, either underline or reverse
|
||||
* video depending on the cursor type, this
|
||||
* was selected by CSI 7m.
|
||||
*
|
||||
* case 2:
|
||||
* This is sometimes DIM, eg on the
|
||||
* GIGI and Linux
|
||||
* This is sometimes DIM, eg on the GIGI and
|
||||
* Linux
|
||||
* case 8:
|
||||
* This is sometimes INVIS various ANSI.
|
||||
* case 21:
|
||||
* This like 22 disables BOLD, DIM and INVIS
|
||||
*
|
||||
* The ANSI colours appear on any
|
||||
* terminal that has colour (obviously)
|
||||
* but the interaction between sgr0 and
|
||||
* the colours varies but is usually
|
||||
* related to the background colour
|
||||
* erase item. The interaction between
|
||||
* colour attributes and the mono ones
|
||||
* is also very implementation
|
||||
* The ANSI colours appear on any terminal
|
||||
* that has colour (obviously) but the
|
||||
* interaction between sgr0 and the colours
|
||||
* varies but is usually related to the
|
||||
* background colour erase item. The
|
||||
* interaction between colour attributes and
|
||||
* the mono ones is also very implementation
|
||||
* dependent.
|
||||
*
|
||||
* The 39 and 49 attributes are likely
|
||||
* to be unimplemented.
|
||||
* The 39 and 49 attributes are likely to be
|
||||
* unimplemented.
|
||||
*/
|
||||
int i;
|
||||
for (i = 0; i < term->esc_nargs; i++) {
|
||||
for (int i = 0; i < term->esc_nargs; i++) {
|
||||
switch (def(term->esc_args[i], 0)) {
|
||||
case 0: /* restore defaults */
|
||||
term->curr_attr = term->default_attr;
|
||||
|
@ -4293,7 +4276,6 @@ static void term_out(Terminal *term)
|
|||
}
|
||||
}
|
||||
set_erase_char(term);
|
||||
}
|
||||
break;
|
||||
case 's': /* save cursor */
|
||||
save_cursor(term, true);
|
||||
|
@ -4504,12 +4486,11 @@ static void term_out(Terminal *term)
|
|||
deselect(term);
|
||||
}
|
||||
break;
|
||||
case 'X': /* ECH: write N spaces w/o moving cursor */
|
||||
case 'X': { /* ECH: write N spaces w/o moving cursor */
|
||||
/* XXX VTTEST says this is vt220, vt510 manual
|
||||
* says vt100 */
|
||||
compatibility(ANSIMIN);
|
||||
CLAMP(term->esc_args[0], term->cols);
|
||||
{
|
||||
int n = def(term->esc_args[0], 1);
|
||||
pos cursplus;
|
||||
int p = term->curs.x;
|
||||
|
@ -4527,8 +4508,8 @@ static void term_out(Terminal *term)
|
|||
copy_termchar(cline, p++,
|
||||
&term->erase_char);
|
||||
seen_disp_event(term);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'x': /* DECREQTPARM: report terminal characteristics */
|
||||
compatibility(VT100);
|
||||
if (term->ldisc) {
|
||||
|
@ -4541,10 +4522,9 @@ static void term_out(Terminal *term)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'Z': /* CBT */
|
||||
case 'Z': { /* CBT */
|
||||
compatibility(OTHER);
|
||||
CLAMP(term->esc_args[0], term->cols);
|
||||
{
|
||||
int i = def(term->esc_args[0], 1);
|
||||
pos old_curs = term->curs;
|
||||
|
||||
|
@ -4555,8 +4535,8 @@ static void term_out(Terminal *term)
|
|||
!term->tabs[term->curs.x]);
|
||||
}
|
||||
check_selection(term, old_curs, term->curs);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ANSI('c', '='): /* Hide or Show Cursor */
|
||||
compatibility(SCOANSI);
|
||||
switch(term->esc_args[0]) {
|
||||
|
@ -4808,8 +4788,7 @@ static void term_out(Terminal *term)
|
|||
else if (term->osc_strlen < OSC_STR_MAX)
|
||||
term->osc_string[term->osc_strlen++] = (char)c;
|
||||
break;
|
||||
case SEEN_OSC_P:
|
||||
{
|
||||
case SEEN_OSC_P: {
|
||||
int max = (term->osc_strlen == 0 ? 21 : 15);
|
||||
int val;
|
||||
if ((int)c >= '0' && (int)c <= '9')
|
||||
|
@ -4832,8 +4811,8 @@ static void term_out(Terminal *term)
|
|||
term_invalidate(term);
|
||||
term->termstate = TOPLEVEL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SEEN_OSC_W:
|
||||
switch (c) {
|
||||
case '0':
|
||||
|
|
|
@ -422,12 +422,11 @@ static dr_emit_flags_t instrument_instr(
|
|||
case OP_rol:
|
||||
case OP_ror:
|
||||
case OP_rcl:
|
||||
case OP_rcr:
|
||||
case OP_rcr: {
|
||||
/*
|
||||
* Shift instructions. If they're register-controlled, log the
|
||||
* shift count.
|
||||
*/
|
||||
{
|
||||
opnd_t shiftcount = instr_get_src(instr, 0);
|
||||
if (!opnd_is_immed(shiftcount)) {
|
||||
reg_id_t r0;
|
||||
|
@ -444,9 +443,9 @@ static dr_emit_flags_t instrument_instr(
|
|||
st = drreg_unreserve_register(drcontext, bb, instr, r0);
|
||||
DR_ASSERT(st == DRREG_SUCCESS);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DR_EMIT_DEFAULT;
|
||||
}
|
||||
|
|
|
@ -974,14 +974,11 @@ void dlg_set_focus(union control *ctrl, dlgparam *dp)
|
|||
* Radio buttons: we find the currently selected button and
|
||||
* focus it.
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ctrl->radio.nbuttons; i++)
|
||||
for (int i = 0; i < ctrl->radio.nbuttons; i++)
|
||||
if (gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON(uc->buttons[i]))) {
|
||||
gtk_widget_grab_focus(uc->buttons[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CTRL_LISTBOX:
|
||||
#if !GTK_CHECK_VERSION(2,4,0)
|
||||
|
@ -1885,22 +1882,20 @@ GtkWidget *layout_ctrls(
|
|||
GtkWidget *w = NULL;
|
||||
|
||||
switch (ctrl->generic.type) {
|
||||
case CTRL_COLUMNS:
|
||||
{
|
||||
case CTRL_COLUMNS: {
|
||||
static const int simplecols[1] = { 100 };
|
||||
columns_set_cols(cols, ctrl->columns.ncols,
|
||||
(ctrl->columns.percentages ?
|
||||
ctrl->columns.percentages : simplecols));
|
||||
}
|
||||
continue; /* no actual control created */
|
||||
case CTRL_TABDELAY:
|
||||
{
|
||||
}
|
||||
case CTRL_TABDELAY: {
|
||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl->tabdelay.ctrl);
|
||||
if (uc)
|
||||
columns_taborder_last(cols, uc->toplevel);
|
||||
}
|
||||
continue; /* no actual control created */
|
||||
}
|
||||
}
|
||||
|
||||
uc = snew(struct uctrl);
|
||||
uc->sp = sp;
|
||||
|
@ -1947,12 +1942,11 @@ GtkWidget *layout_ctrls(
|
|||
ctrl->checkbox.shortcut, SHORTCUT_UCTRL, uc);
|
||||
left = true;
|
||||
break;
|
||||
case CTRL_RADIO:
|
||||
case CTRL_RADIO: {
|
||||
/*
|
||||
* Radio buttons get to go inside their own Columns, no
|
||||
* matter what.
|
||||
*/
|
||||
{
|
||||
gint i, *percentages;
|
||||
GSList *group;
|
||||
|
||||
|
@ -2004,10 +1998,9 @@ GtkWidget *layout_ctrls(
|
|||
SHORTCUT_UCTRL, uc);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CTRL_EDITBOX:
|
||||
{
|
||||
}
|
||||
case CTRL_EDITBOX: {
|
||||
GtkWidget *signalobject;
|
||||
|
||||
if (ctrl->editbox.has_list) {
|
||||
|
@ -2105,11 +2098,10 @@ GtkWidget *layout_ctrls(
|
|||
w = container;
|
||||
uc->label = label;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CTRL_FILESELECT:
|
||||
case CTRL_FONTSELECT:
|
||||
{
|
||||
case CTRL_FONTSELECT: {
|
||||
GtkWidget *ww;
|
||||
const char *browsebtn =
|
||||
(ctrl->generic.type == CTRL_FILESELECT ?
|
||||
|
@ -2162,8 +2154,8 @@ GtkWidget *layout_ctrls(
|
|||
G_CALLBACK(widget_focus), dp);
|
||||
g_signal_connect(G_OBJECT(ww), "clicked",
|
||||
G_CALLBACK(filefont_clicked), dp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CTRL_LISTBOX:
|
||||
|
||||
#if GTK_CHECK_VERSION(2,0,0)
|
||||
|
|
|
@ -5044,18 +5044,17 @@ static void gtk_seat_update_specials_menu(Seat *seat)
|
|||
case SS_SEP:
|
||||
menuitem = gtk_menu_item_new();
|
||||
break;
|
||||
default:
|
||||
default: {
|
||||
menuitem = gtk_menu_item_new_with_label(specials[i].name);
|
||||
{
|
||||
SessionSpecial *sc = snew(SessionSpecial);
|
||||
*sc = specials[i]; /* structure copy */
|
||||
g_object_set_data_full(G_OBJECT(menuitem), "user-data",
|
||||
sc, free_special_cmd);
|
||||
}
|
||||
g_signal_connect(G_OBJECT(menuitem), "activate",
|
||||
G_CALLBACK(special_menuitem), inst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (menuitem) {
|
||||
gtk_container_add(GTK_CONTAINER(menu), menuitem);
|
||||
gtk_widget_show(menuitem);
|
||||
|
|
|
@ -22,8 +22,7 @@ static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
|
|||
case WM_ERASEBKGND:
|
||||
return true;
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
case WM_PAINT: {
|
||||
HBRUSH hbr;
|
||||
HGDIOBJ holdbr;
|
||||
RECT cr;
|
||||
|
@ -58,8 +57,8 @@ static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
|
|||
DeleteObject(hbr);
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_NCHITTEST:
|
||||
return HTTRANSPARENT;
|
||||
|
@ -69,8 +68,7 @@ static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
|
|||
tip_font = NULL;
|
||||
break;
|
||||
|
||||
case WM_SETTEXT:
|
||||
{
|
||||
case WM_SETTEXT: {
|
||||
LPCTSTR str = (LPCTSTR) lParam;
|
||||
SIZE sz;
|
||||
HDC hdc = CreateCompatibleDC(NULL);
|
||||
|
@ -83,9 +81,9 @@ static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg,
|
|||
InvalidateRect(hWnd, NULL, false);
|
||||
|
||||
DeleteDC(hdc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, nMsg, wParam, lParam);
|
||||
}
|
||||
|
|
|
@ -925,20 +925,18 @@ void prefslist(struct prefslist *hdl, struct ctlpos *cp, int lines,
|
|||
wid = xpos - left;
|
||||
|
||||
switch (i) {
|
||||
case 1:
|
||||
case 1: {
|
||||
/* The drag list box. */
|
||||
r.left = left; r.right = wid;
|
||||
r.top = cp->ypos; r.bottom = listheight;
|
||||
{
|
||||
HWND ctl;
|
||||
ctl = doctl(cp, r, "LISTBOX",
|
||||
HWND ctl = doctl(cp, r, "LISTBOX",
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP |
|
||||
WS_VSCROLL | LBS_HASSTRINGS | LBS_USETABSTOPS,
|
||||
WS_EX_CLIENTEDGE,
|
||||
"", listid);
|
||||
p_MakeDragList(ctl);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
/* The "Up" and "Down" buttons. */
|
||||
|
@ -1496,8 +1494,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||
* switching on its type.
|
||||
*/
|
||||
switch (ctrl->generic.type) {
|
||||
case CTRL_TEXT:
|
||||
{
|
||||
case CTRL_TEXT: {
|
||||
char *wrapped, *escaped;
|
||||
int lines;
|
||||
num_ids = 1;
|
||||
|
@ -1507,8 +1504,8 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||
statictext(&pos, escaped, lines, base_id);
|
||||
sfree(escaped);
|
||||
sfree(wrapped);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CTRL_EDITBOX:
|
||||
num_ids = 2; /* static, edit */
|
||||
escaped = shortcut_escape(ctrl->editbox.label,
|
||||
|
@ -1533,9 +1530,8 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||
}
|
||||
sfree(escaped);
|
||||
break;
|
||||
case CTRL_RADIO:
|
||||
case CTRL_RADIO: {
|
||||
num_ids = ctrl->radio.nbuttons + 1; /* label as well */
|
||||
{
|
||||
struct radio *buttons;
|
||||
int i;
|
||||
|
||||
|
@ -1567,8 +1563,8 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||
}
|
||||
sfree(buttons);
|
||||
sfree(escaped);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CTRL_CHECKBOX:
|
||||
num_ids = 1;
|
||||
escaped = shortcut_escape(ctrl->checkbox.label,
|
||||
|
|
|
@ -88,17 +88,15 @@ static INT_PTR CALLBACK LogProc(HWND hwnd, UINT msg,
|
|||
int i;
|
||||
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
case WM_INITDIALOG: {
|
||||
char *str = dupprintf("%s Event Log", appname);
|
||||
SetWindowText(hwnd, str);
|
||||
sfree(str);
|
||||
}
|
||||
{
|
||||
|
||||
static int tabs[4] = { 78, 108 };
|
||||
SendDlgItemMessage(hwnd, IDN_LIST, LB_SETTABSTOPS, 2,
|
||||
(LPARAM) tabs);
|
||||
}
|
||||
|
||||
for (i = 0; i < ninitial; i++)
|
||||
SendDlgItemMessage(hwnd, IDN_LIST, LB_ADDSTRING,
|
||||
0, (LPARAM) events_initial[i]);
|
||||
|
@ -106,6 +104,7 @@ static INT_PTR CALLBACK LogProc(HWND hwnd, UINT msg,
|
|||
SendDlgItemMessage(hwnd, IDN_LIST, LB_ADDSTRING,
|
||||
0, (LPARAM) events_circular[(circular_first + i) % LOGEVENT_CIRCULAR_MAX]);
|
||||
return 1;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
@ -184,14 +183,13 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg,
|
|||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
case WM_INITDIALOG: {
|
||||
char *str = dupprintf("%s Licence", appname);
|
||||
SetWindowText(hwnd, str);
|
||||
sfree(str);
|
||||
SetDlgItemText(hwnd, IDA_TEXT, LICENCE_TEXT("\r\n\r\n"));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
@ -213,11 +211,10 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
|||
char *str;
|
||||
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
case WM_INITDIALOG: {
|
||||
str = dupprintf("About %s", appname);
|
||||
SetWindowText(hwnd, str);
|
||||
sfree(str);
|
||||
{
|
||||
char *buildinfo_text = buildinfo("\r\n");
|
||||
char *text = dupprintf
|
||||
("%s\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
|
||||
|
@ -226,8 +223,8 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
|||
sfree(buildinfo_text);
|
||||
SetDlgItemText(hwnd, IDA_TEXT, text);
|
||||
sfree(text);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
|
|
@ -2180,8 +2180,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
return 0;
|
||||
case WM_CREATE:
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
{
|
||||
case WM_CLOSE: {
|
||||
char *str;
|
||||
show_mouseptr(true);
|
||||
str = dupprintf("%s Exit Confirmation", appname);
|
||||
|
@ -2192,8 +2191,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
== IDOK)
|
||||
DestroyWindow(hwnd);
|
||||
sfree(str);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
show_mouseptr(true);
|
||||
PostQuitMessage(0);
|
||||
|
@ -2216,8 +2215,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
break;
|
||||
case IDM_NEWSESS:
|
||||
case IDM_DUPSESS:
|
||||
case IDM_SAVEDSESS:
|
||||
{
|
||||
case IDM_SAVEDSESS: {
|
||||
char b[2048];
|
||||
char *cl;
|
||||
const char *argprefix;
|
||||
|
@ -2296,8 +2294,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
if (filemap)
|
||||
CloseHandle(filemap);
|
||||
sfree(cl);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDM_RESTART:
|
||||
if (!backend) {
|
||||
lp_eventlog(&wgs.logpolicy, "----- Session restarted -----");
|
||||
|
@ -2306,8 +2304,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
}
|
||||
|
||||
break;
|
||||
case IDM_RECONF:
|
||||
{
|
||||
case IDM_RECONF: {
|
||||
Conf *prev_conf;
|
||||
int init_lvl = 1;
|
||||
bool reconfig_result;
|
||||
|
@ -2491,8 +2488,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
reset_window(init_lvl);
|
||||
|
||||
conf_free(prev_conf);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDM_COPYALL:
|
||||
term_copyall(term, clips_system, lenof(clips_system));
|
||||
break;
|
||||
|
@ -2680,8 +2677,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
}
|
||||
}
|
||||
return 0;
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
case WM_MOUSEMOVE: {
|
||||
/*
|
||||
* Windows seems to like to occasionally send MOUSEMOVE
|
||||
* events even if the mouse hasn't moved. Don't unhide
|
||||
|
@ -2695,7 +2691,6 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
wp = wParam; lp = lParam;
|
||||
last_mousemove = WM_MOUSEMOVE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Add the mouse position and message time to the random
|
||||
* number noise.
|
||||
|
@ -2717,8 +2712,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
wParam & MK_CONTROL, is_alt_pressed());
|
||||
}
|
||||
return 0;
|
||||
case WM_NCMOUSEMOVE:
|
||||
{
|
||||
}
|
||||
case WM_NCMOUSEMOVE: {
|
||||
static WPARAM wp = 0;
|
||||
static LPARAM lp = 0;
|
||||
if (wParam != wp || lParam != lp ||
|
||||
|
@ -2727,9 +2722,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
wp = wParam; lp = lParam;
|
||||
last_mousemove = WM_NCMOUSEMOVE;
|
||||
}
|
||||
}
|
||||
noise_ultralight(NOISE_SOURCE_MOUSEPOS, lParam);
|
||||
break;
|
||||
}
|
||||
case WM_IGNORE_CLIP:
|
||||
ignore_clip = wParam; /* don't panic on DESTROYCLIPBOARD */
|
||||
break;
|
||||
|
@ -2738,8 +2733,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
term_lost_clipboard_ownership(term, CLIP_SYSTEM);
|
||||
ignore_clip = false;
|
||||
return 0;
|
||||
case WM_PAINT:
|
||||
{
|
||||
case WM_PAINT: {
|
||||
PAINTSTRUCT p;
|
||||
|
||||
HideCaret(hwnd);
|
||||
|
@ -2836,10 +2830,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
SelectObject(hdc, GetStockObject(WHITE_PEN));
|
||||
EndPaint(hwnd, &p);
|
||||
ShowCaret(hwnd);
|
||||
}
|
||||
return 0;
|
||||
case WM_NETEVENT:
|
||||
{
|
||||
}
|
||||
case WM_NETEVENT: {
|
||||
/*
|
||||
* To protect against re-entrancy when Windows's recv()
|
||||
* immediately triggers a new WSAAsyncSelect window
|
||||
|
@ -2852,8 +2845,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
params->wParam = wParam;
|
||||
params->lParam = lParam;
|
||||
queue_toplevel_callback(wm_netevent_callback, params);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case WM_SETFOCUS:
|
||||
term_set_focus(term, true);
|
||||
CreateCaret(hwnd, caretbm, font_width, font_height);
|
||||
|
@ -3137,12 +3130,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
term_scroll(term, 0, -term->rows / 2);
|
||||
break;
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBTRACK: {
|
||||
/*
|
||||
* Use GetScrollInfo instead of HIWORD(wParam) to get
|
||||
* 32-bit scroll position.
|
||||
*/
|
||||
{
|
||||
SCROLLINFO si;
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
|
@ -3150,9 +3142,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
if (GetScrollInfo(hwnd, SB_VERT, &si) == 0)
|
||||
si.nTrackPos = HIWORD(wParam);
|
||||
term_scroll(term, 1, si.nTrackPos);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_PALETTECHANGED:
|
||||
if ((HWND) wParam != hwnd && pal != NULL) {
|
||||
|
@ -3232,15 +3224,13 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
|||
set_input_locale((HKL)lParam);
|
||||
sys_cursor_update();
|
||||
break;
|
||||
case WM_IME_STARTCOMPOSITION:
|
||||
{
|
||||
case WM_IME_STARTCOMPOSITION: {
|
||||
HIMC hImc = ImmGetContext(hwnd);
|
||||
ImmSetCompositionFont(hImc, &lfont);
|
||||
ImmReleaseContext(hwnd, hImc);
|
||||
}
|
||||
break;
|
||||
case WM_IME_COMPOSITION:
|
||||
{
|
||||
}
|
||||
case WM_IME_COMPOSITION: {
|
||||
HIMC hIMC;
|
||||
int n;
|
||||
char *buff;
|
||||
|
|
|
@ -1624,8 +1624,7 @@ void select_result(WPARAM wParam, LPARAM lParam)
|
|||
plug_receive(s->plug, 2, buf, ret);
|
||||
}
|
||||
break;
|
||||
case FD_WRITE:
|
||||
{
|
||||
case FD_WRITE: {
|
||||
int bufsize_before, bufsize_after;
|
||||
s->writable = true;
|
||||
bufsize_before = s->sending_oob + bufchain_size(&s->output_data);
|
||||
|
@ -1633,8 +1632,8 @@ void select_result(WPARAM wParam, LPARAM lParam)
|
|||
bufsize_after = s->sending_oob + bufchain_size(&s->output_data);
|
||||
if (bufsize_after < bufsize_before)
|
||||
plug_sent(s->plug, bufsize_after);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FD_CLOSE:
|
||||
/* Signal a close on the socket. First read any outstanding data. */
|
||||
do {
|
||||
|
@ -1652,8 +1651,7 @@ void select_result(WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
} while (ret > 0);
|
||||
return;
|
||||
case FD_ACCEPT:
|
||||
{
|
||||
case FD_ACCEPT: {
|
||||
#ifdef NO_IPV6
|
||||
struct sockaddr_in isa;
|
||||
#else
|
||||
|
@ -1687,6 +1685,7 @@ void select_result(WPARAM wParam, LPARAM lParam)
|
|||
} else if (plug_accepting(s->plug, sk_net_accept, actx)) {
|
||||
p_closesocket(t); /* denied or error */
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,8 +100,7 @@ static void progress_update(void *param, int action, int phase, int iprogress)
|
|||
case PROGFN_PHASE_EXTENT:
|
||||
p->phases[phase-1].total = progress;
|
||||
break;
|
||||
case PROGFN_READY:
|
||||
{
|
||||
case PROGFN_READY: {
|
||||
unsigned total = 0;
|
||||
int i;
|
||||
for (i = 0; i < p->nphases; i++) {
|
||||
|
@ -112,8 +111,8 @@ static void progress_update(void *param, int action, int phase, int iprogress)
|
|||
p->divisor = ((p->total + PROGRESSRANGE - 1) / PROGRESSRANGE);
|
||||
p->range = p->total / p->divisor;
|
||||
SendMessage(p->progbar, PBM_SETRANGE, 0, MAKELPARAM(0, p->range));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PROGFN_PROGRESS:
|
||||
if (p->phases[phase-1].exponential) {
|
||||
while (p->phases[phase-1].n < progress) {
|
||||
|
@ -236,11 +235,10 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg,
|
|||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
case WM_INITDIALOG: {
|
||||
/*
|
||||
* Centre the window.
|
||||
*/
|
||||
{ /* centre the window */
|
||||
RECT rs, rd;
|
||||
HWND hw;
|
||||
|
||||
|
@ -250,10 +248,10 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg,
|
|||
(rs.right + rs.left + rd.left - rd.right) / 2,
|
||||
(rs.bottom + rs.top + rd.top - rd.bottom) / 2,
|
||||
rd.right - rd.left, rd.bottom - rd.top, true);
|
||||
}
|
||||
|
||||
SetDlgItemText(hwnd, 1000, LICENCE_TEXT("\r\n\r\n"));
|
||||
return 1;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
@ -1057,13 +1055,12 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
|||
case IDC_KEYSSH2RSA:
|
||||
case IDC_KEYSSH2DSA:
|
||||
case IDC_KEYSSH2ECDSA:
|
||||
case IDC_KEYSSH2ED25519:
|
||||
{
|
||||
case IDC_KEYSSH2ED25519: {
|
||||
state = (struct MainDlgState *)
|
||||
GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
ui_set_key_type(hwnd, state, LOWORD(wParam));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDC_QUIT:
|
||||
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
|
@ -1478,8 +1475,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
|||
*/
|
||||
ui_set_state(hwnd, state, 2);
|
||||
break;
|
||||
case WM_HELP:
|
||||
{
|
||||
case WM_HELP: {
|
||||
int id = ((LPHELPINFO)lParam)->iCtrlId;
|
||||
const char *topic = NULL;
|
||||
switch (id) {
|
||||
|
@ -1531,8 +1527,8 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
|||
} else {
|
||||
MessageBeep(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_CLOSE:
|
||||
state = (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
sfree(state);
|
||||
|
|
|
@ -133,8 +133,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
|||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
case WM_INITDIALOG: {
|
||||
char *buildinfo_text = buildinfo("\r\n");
|
||||
char *text = dupprintf
|
||||
("Pageant\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
|
||||
|
@ -143,8 +142,8 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
|||
sfree(buildinfo_text);
|
||||
SetDlgItemText(hwnd, 1000, text);
|
||||
sfree(text);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
@ -186,12 +185,11 @@ static INT_PTR CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
|||
struct PassphraseProcStruct *p;
|
||||
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
case WM_INITDIALOG: {
|
||||
passphrase_box = hwnd;
|
||||
/*
|
||||
* Centre the window.
|
||||
*/
|
||||
{ /* centre the window */
|
||||
RECT rs, rd;
|
||||
HWND hw;
|
||||
|
||||
|
@ -201,7 +199,6 @@ static INT_PTR CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
|||
(rs.right + rs.left + rd.left - rd.right) / 2,
|
||||
(rs.bottom + rs.top + rd.top - rd.bottom) / 2,
|
||||
rd.right - rd.left, rd.bottom - rd.top, true);
|
||||
}
|
||||
|
||||
SetForegroundWindow(hwnd);
|
||||
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
|
||||
|
@ -214,6 +211,7 @@ static INT_PTR CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
|||
*passphrase = dupstr("");
|
||||
SetDlgItemText(hwnd, 102, *passphrase);
|
||||
return 0;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
@ -485,11 +483,10 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
|||
ssh2_userkey *skey;
|
||||
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
case WM_INITDIALOG: {
|
||||
/*
|
||||
* Centre the window.
|
||||
*/
|
||||
{ /* centre the window */
|
||||
RECT rs, rd;
|
||||
HWND hw;
|
||||
|
||||
|
@ -499,7 +496,6 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
|||
(rs.right + rs.left + rd.left - rd.right) / 2,
|
||||
(rs.bottom + rs.top + rd.top - rd.bottom) / 2,
|
||||
rd.right - rd.left, rd.bottom - rd.top, true);
|
||||
}
|
||||
|
||||
if (has_help())
|
||||
SetWindowLongPtr(hwnd, GWL_EXSTYLE,
|
||||
|
@ -520,6 +516,7 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
|||
}
|
||||
keylist_update();
|
||||
return 0;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
@ -607,8 +604,7 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
|||
return 0;
|
||||
}
|
||||
return 0;
|
||||
case WM_HELP:
|
||||
{
|
||||
case WM_HELP: {
|
||||
int id = ((LPHELPINFO)lParam)->iCtrlId;
|
||||
const char *topic = NULL;
|
||||
switch (id) {
|
||||
|
@ -621,8 +617,8 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
|
|||
} else {
|
||||
MessageBeep(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_CLOSE:
|
||||
keylist = NULL;
|
||||
DestroyWindow(hwnd);
|
||||
|
@ -1007,8 +1003,7 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
|||
case WM_COMMAND:
|
||||
case WM_SYSCOMMAND:
|
||||
switch (wParam & ~0xF) { /* low 4 bits reserved to Windows */
|
||||
case IDM_PUTTY:
|
||||
{
|
||||
case IDM_PUTTY: {
|
||||
TCHAR cmdline[10];
|
||||
cmdline[0] = '\0';
|
||||
if (restrict_putty_acl)
|
||||
|
@ -1019,8 +1014,8 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
|||
MessageBox(NULL, "Unable to execute PuTTY!",
|
||||
"Error", MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDM_CLOSE:
|
||||
if (passphrase_box)
|
||||
SendMessage(passphrase_box, WM_CLOSE, 0, 0);
|
||||
|
@ -1068,8 +1063,7 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
|||
case IDM_HELP:
|
||||
launch_help(hwnd, WINHELP_CTX_pageant_general);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
default: {
|
||||
if(wParam >= IDM_SESSIONS_BASE && wParam <= IDM_SESSIONS_MAX) {
|
||||
MENUITEMINFO mii;
|
||||
TCHAR buf[MAX_PATH + 1];
|
||||
|
@ -1091,9 +1085,9 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
|
|||
MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
quit_help(hwnd);
|
||||
|
@ -1108,8 +1102,7 @@ static LRESULT CALLBACK wm_copydata_WndProc(HWND hwnd, UINT message,
|
|||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_COPYDATA:
|
||||
{
|
||||
case WM_COPYDATA: {
|
||||
COPYDATASTRUCT *cds;
|
||||
char *mapname, *err;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче