mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Formatting: standardise on "func(\n", not "func\n(".
If the function name (or expression) in a function call or declaration is itself so long that even the first argument doesn't fit after it on the same line, or if that would leave so little space that it would be silly to try to wrap all the run-on lines into a tall thin column, then I used to do this ludicrously_long_function_name (arg1, arg2, arg3); and now prefer this ludicrously_long_function_name( arg1, arg2, arg3); I picked up the habit from Python, where the latter idiom is required by Python's syntactic significance of newlines (you can write the former if you use a backslash-continuation, but pretty much everyone seems to agree that that's much uglier). But I've found it works well in C as well: it makes it more obvious that the previous line is incomplete, it gives you a tiny bit more space to wrap the following lines into (the old idiom indents the _third_ line one space beyond the second), and I generally turn out to agree with the knock-on indentation decisions made by at least Emacs if you do it in the middle of a complex expression. Plus, of course, using the _same_ idiom between C and Python means less state-switching. So, while I'm making annoying indentation changes in general, this seems like a good time to dig out all the cases of the old idiom in this code, and switch them over to the new.
This commit is contained in:
parent
04c1617f20
commit
14203bc54f
4
pscp.c
4
pscp.c
@ -2189,8 +2189,8 @@ static void usage(void)
|
|||||||
printf("PuTTY Secure Copy client\n");
|
printf("PuTTY Secure Copy client\n");
|
||||||
printf("%s\n", ver);
|
printf("%s\n", ver);
|
||||||
printf("Usage: pscp [options] [user@]host:source target\n");
|
printf("Usage: pscp [options] [user@]host:source target\n");
|
||||||
printf
|
printf(
|
||||||
(" pscp [options] source [source...] [user@]host:target\n");
|
" pscp [options] source [source...] [user@]host:target\n");
|
||||||
printf(" pscp [options] -ls [user@]host:filespec\n");
|
printf(" pscp [options] -ls [user@]host:filespec\n");
|
||||||
printf("Options:\n");
|
printf("Options:\n");
|
||||||
printf(" -V print version information and exit\n");
|
printf(" -V print version information and exit\n");
|
||||||
|
@ -283,8 +283,8 @@ bool fxp_init(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (remotever > SFTP_PROTO_VERSION) {
|
if (remotever > SFTP_PROTO_VERSION) {
|
||||||
fxp_internal_error
|
fxp_internal_error(
|
||||||
("remote protocol is more advanced than we support");
|
"remote protocol is more advanced than we support");
|
||||||
sftp_pkt_free(pktin);
|
sftp_pkt_free(pktin);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -530,8 +530,8 @@ void sharestate_free(ssh_sharing_state *sharestate)
|
|||||||
sfree(sharestate);
|
sfree(sharestate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_halfchannel *share_add_halfchannel
|
static struct share_halfchannel *share_add_halfchannel(
|
||||||
(struct ssh_sharing_connstate *cs, unsigned server_id)
|
struct ssh_sharing_connstate *cs, unsigned server_id)
|
||||||
{
|
{
|
||||||
struct share_halfchannel *hc = snew(struct share_halfchannel);
|
struct share_halfchannel *hc = snew(struct share_halfchannel);
|
||||||
hc->server_id = server_id;
|
hc->server_id = server_id;
|
||||||
@ -544,8 +544,8 @@ static struct share_halfchannel *share_add_halfchannel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_halfchannel *share_find_halfchannel
|
static struct share_halfchannel *share_find_halfchannel(
|
||||||
(struct ssh_sharing_connstate *cs, unsigned server_id)
|
struct ssh_sharing_connstate *cs, unsigned server_id)
|
||||||
{
|
{
|
||||||
struct share_halfchannel dummyhc;
|
struct share_halfchannel dummyhc;
|
||||||
dummyhc.server_id = server_id;
|
dummyhc.server_id = server_id;
|
||||||
@ -559,9 +559,9 @@ static void share_remove_halfchannel(struct ssh_sharing_connstate *cs,
|
|||||||
sfree(hc);
|
sfree(hc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_channel *share_add_channel
|
static struct share_channel *share_add_channel(
|
||||||
(struct ssh_sharing_connstate *cs, unsigned downstream_id,
|
struct ssh_sharing_connstate *cs, unsigned downstream_id,
|
||||||
unsigned upstream_id, unsigned server_id, int state, int maxpkt)
|
unsigned upstream_id, unsigned server_id, int state, int maxpkt)
|
||||||
{
|
{
|
||||||
struct share_channel *chan = snew(struct share_channel);
|
struct share_channel *chan = snew(struct share_channel);
|
||||||
chan->downstream_id = downstream_id;
|
chan->downstream_id = downstream_id;
|
||||||
@ -598,16 +598,16 @@ static void share_channel_set_server_id(struct ssh_sharing_connstate *cs,
|
|||||||
add234(cs->channels_by_server, chan);
|
add234(cs->channels_by_server, chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_channel *share_find_channel_by_upstream
|
static struct share_channel *share_find_channel_by_upstream(
|
||||||
(struct ssh_sharing_connstate *cs, unsigned upstream_id)
|
struct ssh_sharing_connstate *cs, unsigned upstream_id)
|
||||||
{
|
{
|
||||||
struct share_channel dummychan;
|
struct share_channel dummychan;
|
||||||
dummychan.upstream_id = upstream_id;
|
dummychan.upstream_id = upstream_id;
|
||||||
return find234(cs->channels_by_us, &dummychan, NULL);
|
return find234(cs->channels_by_us, &dummychan, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_channel *share_find_channel_by_server
|
static struct share_channel *share_find_channel_by_server(
|
||||||
(struct ssh_sharing_connstate *cs, unsigned server_id)
|
struct ssh_sharing_connstate *cs, unsigned server_id)
|
||||||
{
|
{
|
||||||
struct share_channel dummychan;
|
struct share_channel dummychan;
|
||||||
dummychan.server_id = server_id;
|
dummychan.server_id = server_id;
|
||||||
@ -626,9 +626,8 @@ static void share_remove_channel(struct ssh_sharing_connstate *cs,
|
|||||||
sfree(chan);
|
sfree(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_xchannel *share_add_xchannel
|
static struct share_xchannel *share_add_xchannel(
|
||||||
(struct ssh_sharing_connstate *cs,
|
struct ssh_sharing_connstate *cs, unsigned upstream_id, unsigned server_id)
|
||||||
unsigned upstream_id, unsigned server_id)
|
|
||||||
{
|
{
|
||||||
struct share_xchannel *xc = snew(struct share_xchannel);
|
struct share_xchannel *xc = snew(struct share_xchannel);
|
||||||
xc->upstream_id = upstream_id;
|
xc->upstream_id = upstream_id;
|
||||||
@ -647,16 +646,16 @@ static struct share_xchannel *share_add_xchannel
|
|||||||
return xc;
|
return xc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_xchannel *share_find_xchannel_by_upstream
|
static struct share_xchannel *share_find_xchannel_by_upstream(
|
||||||
(struct ssh_sharing_connstate *cs, unsigned upstream_id)
|
struct ssh_sharing_connstate *cs, unsigned upstream_id)
|
||||||
{
|
{
|
||||||
struct share_xchannel dummyxc;
|
struct share_xchannel dummyxc;
|
||||||
dummyxc.upstream_id = upstream_id;
|
dummyxc.upstream_id = upstream_id;
|
||||||
return find234(cs->xchannels_by_us, &dummyxc, NULL);
|
return find234(cs->xchannels_by_us, &dummyxc, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_xchannel *share_find_xchannel_by_server
|
static struct share_xchannel *share_find_xchannel_by_server(
|
||||||
(struct ssh_sharing_connstate *cs, unsigned server_id)
|
struct ssh_sharing_connstate *cs, unsigned server_id)
|
||||||
{
|
{
|
||||||
struct share_xchannel dummyxc;
|
struct share_xchannel dummyxc;
|
||||||
dummyxc.server_id = server_id;
|
dummyxc.server_id = server_id;
|
||||||
@ -671,9 +670,8 @@ static void share_remove_xchannel(struct ssh_sharing_connstate *cs,
|
|||||||
share_xchannel_free(xc);
|
share_xchannel_free(xc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_forwarding *share_add_forwarding
|
static struct share_forwarding *share_add_forwarding(
|
||||||
(struct ssh_sharing_connstate *cs,
|
struct ssh_sharing_connstate *cs, const char *host, int port)
|
||||||
const char *host, int port)
|
|
||||||
{
|
{
|
||||||
struct share_forwarding *fwd = snew(struct share_forwarding);
|
struct share_forwarding *fwd = snew(struct share_forwarding);
|
||||||
fwd->host = dupstr(host);
|
fwd->host = dupstr(host);
|
||||||
@ -687,8 +685,8 @@ static struct share_forwarding *share_add_forwarding
|
|||||||
return fwd;
|
return fwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct share_forwarding *share_find_forwarding
|
static struct share_forwarding *share_find_forwarding(
|
||||||
(struct ssh_sharing_connstate *cs, const char *host, int port)
|
struct ssh_sharing_connstate *cs, const char *host, int port)
|
||||||
{
|
{
|
||||||
struct share_forwarding dummyfwd, *ret;
|
struct share_forwarding dummyfwd, *ret;
|
||||||
dummyfwd.host = dupstr(host);
|
dummyfwd.host = dupstr(host);
|
||||||
@ -1013,10 +1011,10 @@ void share_dead_xchannel_respond(struct ssh_sharing_connstate *cs,
|
|||||||
if (get_bool(src)) {
|
if (get_bool(src)) {
|
||||||
strbuf *packet = strbuf_new();
|
strbuf *packet = strbuf_new();
|
||||||
put_uint32(packet, xc->server_id);
|
put_uint32(packet, xc->server_id);
|
||||||
ssh_send_packet_from_downstream
|
ssh_send_packet_from_downstream(
|
||||||
(cs->parent->cl, cs->id, SSH2_MSG_CHANNEL_FAILURE,
|
cs->parent->cl, cs->id, SSH2_MSG_CHANNEL_FAILURE,
|
||||||
packet->s, packet->len,
|
packet->s, packet->len,
|
||||||
"downstream refused X channel open");
|
"downstream refused X channel open");
|
||||||
strbuf_free(packet);
|
strbuf_free(packet);
|
||||||
}
|
}
|
||||||
} else if (msg->type == SSH2_MSG_CHANNEL_CLOSE) {
|
} else if (msg->type == SSH2_MSG_CHANNEL_CLOSE) {
|
||||||
@ -1380,9 +1378,9 @@ static void share_got_pkt_from_downstream(struct ssh_sharing_connstate *cs,
|
|||||||
* cleaned up if downstream goes away.
|
* cleaned up if downstream goes away.
|
||||||
*/
|
*/
|
||||||
pkt[wantreplypos] = 1;
|
pkt[wantreplypos] = 1;
|
||||||
ssh_send_packet_from_downstream
|
ssh_send_packet_from_downstream(
|
||||||
(cs->parent->cl, cs->id, type, pkt, pktlen,
|
cs->parent->cl, cs->id, type, pkt, pktlen,
|
||||||
orig_wantreply ? NULL : "upstream added want_reply flag");
|
orig_wantreply ? NULL : "upstream added want_reply flag");
|
||||||
fwd = share_add_forwarding(cs, host, port);
|
fwd = share_add_forwarding(cs, host, port);
|
||||||
ssh_sharing_queue_global_request(cs->parent->cl, cs);
|
ssh_sharing_queue_global_request(cs->parent->cl, cs);
|
||||||
|
|
||||||
@ -1443,9 +1441,9 @@ static void share_got_pkt_from_downstream(struct ssh_sharing_connstate *cs,
|
|||||||
* deleted even if downstream doesn't want to know.
|
* deleted even if downstream doesn't want to know.
|
||||||
*/
|
*/
|
||||||
pkt[wantreplypos] = 1;
|
pkt[wantreplypos] = 1;
|
||||||
ssh_send_packet_from_downstream
|
ssh_send_packet_from_downstream(
|
||||||
(cs->parent->cl, cs->id, type, pkt, pktlen,
|
cs->parent->cl, cs->id, type, pkt, pktlen,
|
||||||
orig_wantreply ? NULL : "upstream added want_reply flag");
|
orig_wantreply ? NULL : "upstream added want_reply flag");
|
||||||
ssh_sharing_queue_global_request(cs->parent->cl, cs);
|
ssh_sharing_queue_global_request(cs->parent->cl, cs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1208,15 +1208,15 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|||||||
* When acquire_cred yields no useful expiration, go with
|
* When acquire_cred yields no useful expiration, go with
|
||||||
* the service ticket expiration.
|
* the service ticket expiration.
|
||||||
*/
|
*/
|
||||||
s->gss_stat = s->shgss->lib->init_sec_context
|
s->gss_stat = s->shgss->lib->init_sec_context(
|
||||||
(s->shgss->lib,
|
s->shgss->lib,
|
||||||
&s->shgss->ctx,
|
&s->shgss->ctx,
|
||||||
s->shgss->srv_name,
|
s->shgss->srv_name,
|
||||||
s->gssapi_fwd,
|
s->gssapi_fwd,
|
||||||
&s->gss_rcvtok,
|
&s->gss_rcvtok,
|
||||||
&s->gss_sndtok,
|
&s->gss_sndtok,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (s->gss_stat!=SSH_GSS_S_COMPLETE &&
|
if (s->gss_stat!=SSH_GSS_S_COMPLETE &&
|
||||||
s->gss_stat!=SSH_GSS_S_CONTINUE_NEEDED) {
|
s->gss_stat!=SSH_GSS_S_CONTINUE_NEEDED) {
|
||||||
|
@ -292,8 +292,8 @@ static gboolean try_grab_keyboard(gpointer vctx)
|
|||||||
if (!GDK_IS_WINDOW(gdkw) || !gdk_window_is_visible(gdkw))
|
if (!GDK_IS_WINDOW(gdkw) || !gdk_window_is_visible(gdkw))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
seat = gdk_display_get_default_seat
|
seat = gdk_display_get_default_seat(
|
||||||
(gtk_widget_get_display(ctx->dialog));
|
gtk_widget_get_display(ctx->dialog));
|
||||||
if (!seat)
|
if (!seat)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@ -317,8 +317,8 @@ static gboolean try_grab_keyboard(gpointer vctx)
|
|||||||
GdkDeviceManager *dm;
|
GdkDeviceManager *dm;
|
||||||
GdkDevice *pointer, *keyboard;
|
GdkDevice *pointer, *keyboard;
|
||||||
|
|
||||||
dm = gdk_display_get_device_manager
|
dm = gdk_display_get_device_manager(
|
||||||
(gtk_widget_get_display(ctx->dialog));
|
gtk_widget_get_display(ctx->dialog));
|
||||||
if (!dm)
|
if (!dm)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
219
unix/dialog.c
219
unix/dialog.c
@ -345,8 +345,8 @@ char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#if GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->combo) {
|
if (uc->combo) {
|
||||||
return dupstr(gtk_entry_get_text
|
return dupstr(gtk_entry_get_text(
|
||||||
(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(uc->combo)))));
|
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(uc->combo)))));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -425,9 +425,9 @@ void dlg_listbox_del(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2,4,0)
|
#if !GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->menu) {
|
if (uc->menu) {
|
||||||
gtk_container_remove
|
gtk_container_remove(
|
||||||
(GTK_CONTAINER(uc->menu),
|
GTK_CONTAINER(uc->menu),
|
||||||
g_list_nth_data(GTK_MENU_SHELL(uc->menu)->children, index));
|
g_list_nth_data(GTK_MENU_SHELL(uc->menu)->children, index));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (uc->list) {
|
if (uc->list) {
|
||||||
@ -1003,8 +1003,8 @@ void dlg_set_focus(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
* focus it.
|
* focus it.
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < ctrl->radio.nbuttons; i++)
|
for (int i = 0; i < ctrl->radio.nbuttons; i++)
|
||||||
if (gtk_toggle_button_get_active
|
if (gtk_toggle_button_get_active(
|
||||||
(GTK_TOGGLE_BUTTON(uc->buttons[i]))) {
|
GTK_TOGGLE_BUTTON(uc->buttons[i]))) {
|
||||||
gtk_widget_grab_focus(uc->buttons[i]);
|
gtk_widget_grab_focus(uc->buttons[i]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1137,8 +1137,8 @@ void dlg_coloursel_start(dlgcontrol *ctrl, dlgparam *dp, int r, int g, int b)
|
|||||||
GtkWidget *coloursel =
|
GtkWidget *coloursel =
|
||||||
gtk_color_selection_dialog_new("Select a colour");
|
gtk_color_selection_dialog_new("Select a colour");
|
||||||
GtkColorSelectionDialog *ccs = GTK_COLOR_SELECTION_DIALOG(coloursel);
|
GtkColorSelectionDialog *ccs = GTK_COLOR_SELECTION_DIALOG(coloursel);
|
||||||
GtkColorSelection *cs = GTK_COLOR_SELECTION
|
GtkColorSelection *cs = GTK_COLOR_SELECTION(
|
||||||
(gtk_color_selection_dialog_get_color_selection(ccs));
|
gtk_color_selection_dialog_get_color_selection(ccs));
|
||||||
gtk_color_selection_set_has_opacity_control(cs, false);
|
gtk_color_selection_set_has_opacity_control(cs, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1385,10 +1385,10 @@ static gboolean listitem_key(GtkWidget *item, GdkEventKey *event,
|
|||||||
gtk_list_select_child(GTK_LIST(list),
|
gtk_list_select_child(GTK_LIST(list),
|
||||||
GTK_WIDGET(children->data));
|
GTK_WIDGET(children->data));
|
||||||
gtk_widget_grab_focus(GTK_WIDGET(children->data));
|
gtk_widget_grab_focus(GTK_WIDGET(children->data));
|
||||||
gtk_adjustment_clamp_page
|
gtk_adjustment_clamp_page(
|
||||||
(adj,
|
adj,
|
||||||
adj->lower + (adj->upper-adj->lower) * i / n,
|
adj->lower + (adj->upper-adj->lower) * i / n,
|
||||||
adj->lower + (adj->upper-adj->lower) * (i+1) / n);
|
adj->lower + (adj->upper-adj->lower) * (i+1) / n);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free(chead);
|
g_list_free(chead);
|
||||||
@ -1620,8 +1620,8 @@ static void filesel_ok(GtkButton *button, gpointer data)
|
|||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
gpointer filesel = g_object_get_data(G_OBJECT(button), "user-data");
|
gpointer filesel = g_object_get_data(G_OBJECT(button), "user-data");
|
||||||
struct uctrl *uc = g_object_get_data(G_OBJECT(filesel), "user-data");
|
struct uctrl *uc = g_object_get_data(G_OBJECT(filesel), "user-data");
|
||||||
const char *name = gtk_file_selection_get_filename
|
const char *name = gtk_file_selection_get_filename(
|
||||||
(GTK_FILE_SELECTION(filesel));
|
GTK_FILE_SELECTION(filesel));
|
||||||
filechoose_emit_value(dp, uc, name);
|
filechoose_emit_value(dp, uc, name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1634,14 +1634,14 @@ static void fontsel_ok(GtkButton *button, gpointer data)
|
|||||||
|
|
||||||
gpointer fontsel = g_object_get_data(G_OBJECT(button), "user-data");
|
gpointer fontsel = g_object_get_data(G_OBJECT(button), "user-data");
|
||||||
struct uctrl *uc = g_object_get_data(G_OBJECT(fontsel), "user-data");
|
struct uctrl *uc = g_object_get_data(G_OBJECT(fontsel), "user-data");
|
||||||
const char *name = gtk_font_selection_dialog_get_font_name
|
const char *name = gtk_font_selection_dialog_get_font_name(
|
||||||
(GTK_FONT_SELECTION_DIALOG(fontsel));
|
GTK_FONT_SELECTION_DIALOG(fontsel));
|
||||||
gtk_entry_set_text(GTK_ENTRY(uc->entry), name);
|
gtk_entry_set_text(GTK_ENTRY(uc->entry), name);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
unifontsel *fontsel = (unifontsel *)g_object_get_data
|
unifontsel *fontsel = (unifontsel *)g_object_get_data(
|
||||||
(G_OBJECT(button), "user-data");
|
G_OBJECT(button), "user-data");
|
||||||
struct uctrl *uc = (struct uctrl *)fontsel->user_data;
|
struct uctrl *uc = (struct uctrl *)fontsel->user_data;
|
||||||
char *name = unifontsel_get_name(fontsel);
|
char *name = unifontsel_get_name(fontsel);
|
||||||
assert(name); /* should always be ok after OK pressed */
|
assert(name); /* should always be ok after OK pressed */
|
||||||
@ -1685,9 +1685,9 @@ static void coloursel_ok(GtkButton *button, gpointer data)
|
|||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,0,0)
|
#if GTK_CHECK_VERSION(2,0,0)
|
||||||
{
|
{
|
||||||
GtkColorSelection *cs = GTK_COLOR_SELECTION
|
GtkColorSelection *cs = GTK_COLOR_SELECTION(
|
||||||
(gtk_color_selection_dialog_get_color_selection
|
gtk_color_selection_dialog_get_color_selection(
|
||||||
(GTK_COLOR_SELECTION_DIALOG(coloursel)));
|
GTK_COLOR_SELECTION_DIALOG(coloursel)));
|
||||||
GdkColor col;
|
GdkColor col;
|
||||||
gtk_color_selection_get_current_color(cs, &col);
|
gtk_color_selection_get_current_color(cs, &col);
|
||||||
dp->coloursel_result.r = col.red / 0x0100;
|
dp->coloursel_result.r = col.red / 0x0100;
|
||||||
@ -1696,9 +1696,9 @@ static void coloursel_ok(GtkButton *button, gpointer data)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
GtkColorSelection *cs = GTK_COLOR_SELECTION
|
GtkColorSelection *cs = GTK_COLOR_SELECTION(
|
||||||
(gtk_color_selection_dialog_get_color_selection
|
gtk_color_selection_dialog_get_color_selection(
|
||||||
(GTK_COLOR_SELECTION_DIALOG(coloursel)));
|
GTK_COLOR_SELECTION_DIALOG(coloursel)));
|
||||||
gdouble cvals[4];
|
gdouble cvals[4];
|
||||||
gtk_color_selection_get_color(cs, cvals);
|
gtk_color_selection_get_color(cs, cvals);
|
||||||
dp->coloursel_result.r = (int) (255 * cvals[0]);
|
dp->coloursel_result.r = (int) (255 * cvals[0]);
|
||||||
@ -1728,14 +1728,14 @@ static void filefont_clicked(GtkButton *button, gpointer data)
|
|||||||
|
|
||||||
if (uc->ctrl->type == CTRL_FILESELECT) {
|
if (uc->ctrl->type == CTRL_FILESELECT) {
|
||||||
#ifdef USE_GTK_FILE_CHOOSER_DIALOG
|
#ifdef USE_GTK_FILE_CHOOSER_DIALOG
|
||||||
GtkWidget *filechoose = gtk_file_chooser_dialog_new
|
GtkWidget *filechoose = gtk_file_chooser_dialog_new(
|
||||||
(uc->ctrl->fileselect.title, GTK_WINDOW(dp->window),
|
uc->ctrl->fileselect.title, GTK_WINDOW(dp->window),
|
||||||
(uc->ctrl->fileselect.for_writing ?
|
(uc->ctrl->fileselect.for_writing ?
|
||||||
GTK_FILE_CHOOSER_ACTION_SAVE :
|
GTK_FILE_CHOOSER_ACTION_SAVE :
|
||||||
GTK_FILE_CHOOSER_ACTION_OPEN),
|
GTK_FILE_CHOOSER_ACTION_OPEN),
|
||||||
STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL,
|
STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL,
|
||||||
STANDARD_OPEN_LABEL, GTK_RESPONSE_ACCEPT,
|
STANDARD_OPEN_LABEL, GTK_RESPONSE_ACCEPT,
|
||||||
(const gchar *)NULL);
|
(const gchar *)NULL);
|
||||||
gtk_window_set_modal(GTK_WINDOW(filechoose), true);
|
gtk_window_set_modal(GTK_WINDOW(filechoose), true);
|
||||||
g_object_set_data(G_OBJECT(filechoose), "user-data", (gpointer)uc);
|
g_object_set_data(G_OBJECT(filechoose), "user-data", (gpointer)uc);
|
||||||
g_signal_connect(G_OBJECT(filechoose), "response",
|
g_signal_connect(G_OBJECT(filechoose), "response",
|
||||||
@ -1745,19 +1745,19 @@ static void filefont_clicked(GtkButton *button, gpointer data)
|
|||||||
GtkWidget *filesel =
|
GtkWidget *filesel =
|
||||||
gtk_file_selection_new(uc->ctrl->fileselect.title);
|
gtk_file_selection_new(uc->ctrl->fileselect.title);
|
||||||
gtk_window_set_modal(GTK_WINDOW(filesel), true);
|
gtk_window_set_modal(GTK_WINDOW(filesel), true);
|
||||||
g_object_set_data
|
g_object_set_data(
|
||||||
(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "user-data",
|
G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "user-data",
|
||||||
(gpointer)filesel);
|
(gpointer)filesel);
|
||||||
g_object_set_data(G_OBJECT(filesel), "user-data", (gpointer)uc);
|
g_object_set_data(G_OBJECT(filesel), "user-data", (gpointer)uc);
|
||||||
g_signal_connect
|
g_signal_connect(
|
||||||
(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",
|
G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",
|
||||||
G_CALLBACK(filesel_ok), (gpointer)dp);
|
G_CALLBACK(filesel_ok), (gpointer)dp);
|
||||||
g_signal_connect_swapped
|
g_signal_connect_swapped(
|
||||||
(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",
|
G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",
|
||||||
G_CALLBACK(gtk_widget_destroy), (gpointer)filesel);
|
G_CALLBACK(gtk_widget_destroy), (gpointer)filesel);
|
||||||
g_signal_connect_swapped
|
g_signal_connect_swapped(
|
||||||
(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), "clicked",
|
G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), "clicked",
|
||||||
G_CALLBACK(gtk_widget_destroy), (gpointer)filesel);
|
G_CALLBACK(gtk_widget_destroy), (gpointer)filesel);
|
||||||
gtk_widget_show(filesel);
|
gtk_widget_show(filesel);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1775,12 +1775,12 @@ static void filefont_clicked(GtkButton *button, gpointer data)
|
|||||||
GtkWidget *fontsel =
|
GtkWidget *fontsel =
|
||||||
gtk_font_selection_dialog_new("Select a font");
|
gtk_font_selection_dialog_new("Select a font");
|
||||||
gtk_window_set_modal(GTK_WINDOW(fontsel), true);
|
gtk_window_set_modal(GTK_WINDOW(fontsel), true);
|
||||||
gtk_font_selection_dialog_set_filter
|
gtk_font_selection_dialog_set_filter(
|
||||||
(GTK_FONT_SELECTION_DIALOG(fontsel),
|
GTK_FONT_SELECTION_DIALOG(fontsel),
|
||||||
GTK_FONT_FILTER_BASE, GTK_FONT_ALL,
|
GTK_FONT_FILTER_BASE, GTK_FONT_ALL,
|
||||||
NULL, NULL, NULL, NULL, spacings, NULL);
|
NULL, NULL, NULL, NULL, spacings, NULL);
|
||||||
if (!gtk_font_selection_dialog_set_font_name
|
if (!gtk_font_selection_dialog_set_font_name(
|
||||||
(GTK_FONT_SELECTION_DIALOG(fontsel), fontname)) {
|
GTK_FONT_SELECTION_DIALOG(fontsel), fontname)) {
|
||||||
/*
|
/*
|
||||||
* If the font name wasn't found as it was, try opening
|
* If the font name wasn't found as it was, try opening
|
||||||
* it and extracting its FONT property. This should
|
* it and extracting its FONT property. This should
|
||||||
@ -1800,27 +1800,27 @@ static void filefont_clicked(GtkButton *button, gpointer data)
|
|||||||
if (XGetFontProperty(xfs, fontprop, &ret)) {
|
if (XGetFontProperty(xfs, fontprop, &ret)) {
|
||||||
char *name = XGetAtomName(disp, (Atom)ret);
|
char *name = XGetAtomName(disp, (Atom)ret);
|
||||||
if (name)
|
if (name)
|
||||||
gtk_font_selection_dialog_set_font_name
|
gtk_font_selection_dialog_set_font_name(
|
||||||
(GTK_FONT_SELECTION_DIALOG(fontsel), name);
|
GTK_FONT_SELECTION_DIALOG(fontsel), name);
|
||||||
}
|
}
|
||||||
gdk_font_unref(font);
|
gdk_font_unref(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_object_set_data
|
g_object_set_data(
|
||||||
(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
|
G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
|
||||||
"user-data", (gpointer)fontsel);
|
"user-data", (gpointer)fontsel);
|
||||||
g_object_set_data(G_OBJECT(fontsel), "user-data", (gpointer)uc);
|
g_object_set_data(G_OBJECT(fontsel), "user-data", (gpointer)uc);
|
||||||
g_signal_connect
|
g_signal_connect(
|
||||||
(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
|
G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
|
||||||
"clicked", G_CALLBACK(fontsel_ok), (gpointer)dp);
|
"clicked", G_CALLBACK(fontsel_ok), (gpointer)dp);
|
||||||
g_signal_connect_swapped
|
g_signal_connect_swapped(
|
||||||
(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
|
G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
|
||||||
"clicked", G_CALLBACK(gtk_widget_destroy),
|
"clicked", G_CALLBACK(gtk_widget_destroy),
|
||||||
(gpointer)fontsel);
|
(gpointer)fontsel);
|
||||||
g_signal_connect_swapped
|
g_signal_connect_swapped(
|
||||||
(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->cancel_button),
|
G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->cancel_button),
|
||||||
"clicked", G_CALLBACK(gtk_widget_destroy),
|
"clicked", G_CALLBACK(gtk_widget_destroy),
|
||||||
(gpointer)fontsel);
|
(gpointer)fontsel);
|
||||||
gtk_widget_show(fontsel);
|
gtk_widget_show(fontsel);
|
||||||
|
|
||||||
#else /* !GTK_CHECK_VERSION(2,0,0) */
|
#else /* !GTK_CHECK_VERSION(2,0,0) */
|
||||||
@ -2018,8 +2018,8 @@ GtkWidget *layout_ctrls(
|
|||||||
GtkWidget *b;
|
GtkWidget *b;
|
||||||
gint colstart;
|
gint colstart;
|
||||||
|
|
||||||
b = (gtk_radio_button_new_with_label
|
b = gtk_radio_button_new_with_label(
|
||||||
(group, ctrl->radio.buttons[i]));
|
group, ctrl->radio.buttons[i]);
|
||||||
uc->buttons[i] = b;
|
uc->buttons[i] = b;
|
||||||
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(b));
|
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(b));
|
||||||
colstart = i % ctrl->radio.ncolumns;
|
colstart = i % ctrl->radio.ncolumns;
|
||||||
@ -2059,8 +2059,8 @@ GtkWidget *layout_ctrls(
|
|||||||
*/
|
*/
|
||||||
uc->listmodel = gtk_list_store_new(2, G_TYPE_INT,
|
uc->listmodel = gtk_list_store_new(2, G_TYPE_INT,
|
||||||
G_TYPE_STRING);
|
G_TYPE_STRING);
|
||||||
w = gtk_combo_box_new_with_model_and_entry
|
w = gtk_combo_box_new_with_model_and_entry(
|
||||||
(GTK_TREE_MODEL(uc->listmodel));
|
GTK_TREE_MODEL(uc->listmodel));
|
||||||
g_object_set(G_OBJECT(w), "entry-text-column", 1,
|
g_object_set(G_OBJECT(w), "entry-text-column", 1,
|
||||||
(const char *)NULL);
|
(const char *)NULL);
|
||||||
/* We cannot support password combo boxes. */
|
/* We cannot support password combo boxes. */
|
||||||
@ -2261,8 +2261,8 @@ GtkWidget *layout_ctrls(
|
|||||||
* Create a non-editable GtkComboBox (that is, not
|
* Create a non-editable GtkComboBox (that is, not
|
||||||
* its subclass GtkComboBoxEntry).
|
* its subclass GtkComboBoxEntry).
|
||||||
*/
|
*/
|
||||||
w = gtk_combo_box_new_with_model
|
w = gtk_combo_box_new_with_model(
|
||||||
(GTK_TREE_MODEL(uc->listmodel));
|
GTK_TREE_MODEL(uc->listmodel));
|
||||||
uc->combo = w;
|
uc->combo = w;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2306,8 +2306,8 @@ GtkWidget *layout_ctrls(
|
|||||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w),
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w),
|
||||||
GTK_POLICY_NEVER,
|
GTK_POLICY_NEVER,
|
||||||
GTK_POLICY_AUTOMATIC);
|
GTK_POLICY_AUTOMATIC);
|
||||||
uc->adj = gtk_scrolled_window_get_vadjustment
|
uc->adj = gtk_scrolled_window_get_vadjustment(
|
||||||
(GTK_SCROLLED_WINDOW(w));
|
GTK_SCROLLED_WINDOW(w));
|
||||||
|
|
||||||
gtk_widget_show(uc->list);
|
gtk_widget_show(uc->list);
|
||||||
g_signal_connect(G_OBJECT(uc->list), "selection-changed",
|
g_signal_connect(G_OBJECT(uc->list), "selection-changed",
|
||||||
@ -2377,15 +2377,15 @@ GtkWidget *layout_ctrls(
|
|||||||
* Create the list box itself, its columns, and
|
* Create the list box itself, its columns, and
|
||||||
* its containing scrolled window.
|
* its containing scrolled window.
|
||||||
*/
|
*/
|
||||||
w = gtk_tree_view_new_with_model
|
w = gtk_tree_view_new_with_model(
|
||||||
(GTK_TREE_MODEL(uc->listmodel));
|
GTK_TREE_MODEL(uc->listmodel));
|
||||||
g_object_set_data(G_OBJECT(uc->listmodel), "user-data",
|
g_object_set_data(G_OBJECT(uc->listmodel), "user-data",
|
||||||
(gpointer)w);
|
(gpointer)w);
|
||||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
|
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
|
||||||
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
|
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
|
||||||
gtk_tree_selection_set_mode
|
gtk_tree_selection_set_mode(
|
||||||
(sel, ctrl->listbox.multisel ? GTK_SELECTION_MULTIPLE :
|
sel, ctrl->listbox.multisel ? GTK_SELECTION_MULTIPLE :
|
||||||
GTK_SELECTION_SINGLE);
|
GTK_SELECTION_SINGLE);
|
||||||
uc->treeview = w;
|
uc->treeview = w;
|
||||||
g_signal_connect(G_OBJECT(w), "row-activated",
|
g_signal_connect(G_OBJECT(w), "row-activated",
|
||||||
G_CALLBACK(listbox_doubleclick), dp);
|
G_CALLBACK(listbox_doubleclick), dp);
|
||||||
@ -2422,10 +2422,10 @@ GtkWidget *layout_ctrls(
|
|||||||
"ellipsize-set", true,
|
"ellipsize-set", true,
|
||||||
(const char *)NULL);
|
(const char *)NULL);
|
||||||
}
|
}
|
||||||
column = gtk_tree_view_column_new_with_attributes
|
column = gtk_tree_view_column_new_with_attributes(
|
||||||
("heading", cellrend, "text", i+1, (char *)NULL);
|
"heading", cellrend, "text", i+1, (char *)NULL);
|
||||||
gtk_tree_view_column_set_sizing
|
gtk_tree_view_column_set_sizing(
|
||||||
(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
|
column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2434,16 +2434,16 @@ GtkWidget *layout_ctrls(
|
|||||||
GtkWidget *scroll;
|
GtkWidget *scroll;
|
||||||
|
|
||||||
scroll = gtk_scrolled_window_new(NULL, NULL);
|
scroll = gtk_scrolled_window_new(NULL, NULL);
|
||||||
gtk_scrolled_window_set_shadow_type
|
gtk_scrolled_window_set_shadow_type(
|
||||||
(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN);
|
GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN);
|
||||||
gtk_widget_show(w);
|
gtk_widget_show(w);
|
||||||
gtk_container_add(GTK_CONTAINER(scroll), w);
|
gtk_container_add(GTK_CONTAINER(scroll), w);
|
||||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
|
||||||
GTK_POLICY_AUTOMATIC,
|
GTK_POLICY_AUTOMATIC,
|
||||||
GTK_POLICY_ALWAYS);
|
GTK_POLICY_ALWAYS);
|
||||||
gtk_widget_set_size_request
|
gtk_widget_set_size_request(
|
||||||
(scroll, -1,
|
scroll, -1,
|
||||||
ctrl->listbox.height * get_listitemheight(w));
|
ctrl->listbox.height * get_listitemheight(w));
|
||||||
|
|
||||||
w = scroll;
|
w = scroll;
|
||||||
}
|
}
|
||||||
@ -2737,8 +2737,8 @@ gint win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
if (schr == sc->uc->ctrl->radio.shortcut) {
|
if (schr == sc->uc->ctrl->radio.shortcut) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < sc->uc->ctrl->radio.nbuttons; i++)
|
for (i = 0; i < sc->uc->ctrl->radio.nbuttons; i++)
|
||||||
if (gtk_toggle_button_get_active
|
if (gtk_toggle_button_get_active(
|
||||||
(GTK_TOGGLE_BUTTON(sc->uc->buttons[i]))) {
|
GTK_TOGGLE_BUTTON(sc->uc->buttons[i]))) {
|
||||||
gtk_widget_grab_focus(sc->uc->buttons[i]);
|
gtk_widget_grab_focus(sc->uc->buttons[i]);
|
||||||
}
|
}
|
||||||
} else if (sc->uc->ctrl->radio.shortcuts) {
|
} else if (sc->uc->ctrl->radio.shortcuts) {
|
||||||
@ -2746,8 +2746,8 @@ gint win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
for (i = 0; i < sc->uc->ctrl->radio.nbuttons; i++)
|
for (i = 0; i < sc->uc->ctrl->radio.nbuttons; i++)
|
||||||
if (schr == sc->uc->ctrl->radio.shortcuts[i]) {
|
if (schr == sc->uc->ctrl->radio.shortcuts[i]) {
|
||||||
gtk_widget_grab_focus(sc->uc->buttons[i]);
|
gtk_widget_grab_focus(sc->uc->buttons[i]);
|
||||||
g_signal_emit_by_name
|
g_signal_emit_by_name(
|
||||||
(G_OBJECT(sc->uc->buttons[i]), "clicked");
|
G_OBJECT(sc->uc->buttons[i]), "clicked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3036,13 +3036,13 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
|
|||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
treescroll = gtk_scrolled_window_new(NULL, NULL);
|
treescroll = gtk_scrolled_window_new(NULL, NULL);
|
||||||
#if GTK_CHECK_VERSION(2,0,0)
|
#if GTK_CHECK_VERSION(2,0,0)
|
||||||
treestore = gtk_tree_store_new
|
treestore = gtk_tree_store_new(
|
||||||
(TREESTORE_NUM, G_TYPE_STRING, G_TYPE_INT);
|
TREESTORE_NUM, G_TYPE_STRING, G_TYPE_INT);
|
||||||
tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(treestore));
|
tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(treestore));
|
||||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), false);
|
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), false);
|
||||||
treerenderer = gtk_cell_renderer_text_new();
|
treerenderer = gtk_cell_renderer_text_new();
|
||||||
treecolumn = gtk_tree_view_column_new_with_attributes
|
treecolumn = gtk_tree_view_column_new_with_attributes(
|
||||||
("Label", treerenderer, "text", 0, NULL);
|
"Label", treerenderer, "text", 0, NULL);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), treecolumn);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), treecolumn);
|
||||||
treeselection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
|
treeselection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
|
||||||
gtk_tree_selection_set_mode(treeselection, GTK_SELECTION_BROWSE);
|
gtk_tree_selection_set_mode(treeselection, GTK_SELECTION_BROWSE);
|
||||||
@ -3170,9 +3170,8 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
|
|||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
if (!treelevels[j-1]) {
|
if (!treelevels[j-1]) {
|
||||||
treelevels[j-1] = GTK_TREE(gtk_tree_new());
|
treelevels[j-1] = GTK_TREE(gtk_tree_new());
|
||||||
gtk_tree_item_set_subtree
|
gtk_tree_item_set_subtree(
|
||||||
(treeitemlevels[j-1],
|
treeitemlevels[j-1], GTK_WIDGET(treelevels[j-1]));
|
||||||
GTK_WIDGET(treelevels[j-1]));
|
|
||||||
if (j < 2)
|
if (j < 2)
|
||||||
gtk_tree_item_expand(treeitemlevels[j-1]);
|
gtk_tree_item_expand(treeitemlevels[j-1]);
|
||||||
else
|
else
|
||||||
@ -3910,10 +3909,10 @@ void about_box(void *window)
|
|||||||
|
|
||||||
{
|
{
|
||||||
char *buildinfo_text = buildinfo("\n");
|
char *buildinfo_text = buildinfo("\n");
|
||||||
char *label_text = dupprintf
|
char *label_text = dupprintf(
|
||||||
("%s\n\n%s\n\n%s\n\n%s",
|
"%s\n\n%s\n\n%s\n\n%s",
|
||||||
appname, ver, buildinfo_text,
|
appname, ver, buildinfo_text,
|
||||||
"Copyright " SHORT_COPYRIGHT_DETAILS ". All rights reserved");
|
"Copyright " SHORT_COPYRIGHT_DETAILS ". All rights reserved");
|
||||||
w = gtk_label_new(label_text);
|
w = gtk_label_new(label_text);
|
||||||
gtk_label_set_justify(GTK_LABEL(w), GTK_JUSTIFY_CENTER);
|
gtk_label_set_justify(GTK_LABEL(w), GTK_JUSTIFY_CENTER);
|
||||||
#if GTK_CHECK_VERSION(2,0,0)
|
#if GTK_CHECK_VERSION(2,0,0)
|
||||||
@ -4055,8 +4054,8 @@ gint eventlog_selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
|
|||||||
gtk_list_unselect_all(GTK_LIST(uc->list));
|
gtk_list_unselect_all(GTK_LIST(uc->list));
|
||||||
#else
|
#else
|
||||||
assert(uc->treeview);
|
assert(uc->treeview);
|
||||||
gtk_tree_selection_unselect_all
|
gtk_tree_selection_unselect_all(
|
||||||
(gtk_tree_view_get_selection(GTK_TREE_VIEW(uc->treeview)));
|
gtk_tree_view_get_selection(GTK_TREE_VIEW(uc->treeview)));
|
||||||
#endif
|
#endif
|
||||||
es->ignore_selchange = false;
|
es->ignore_selchange = false;
|
||||||
|
|
||||||
@ -4112,10 +4111,10 @@ void showeventlog(eventlog_stuff *es, void *parentwin)
|
|||||||
gtk_widget_show(w0);
|
gtk_widget_show(w0);
|
||||||
w1 = layout_ctrls(&es->dp, NULL, &es->scs, s1, GTK_WINDOW(window));
|
w1 = layout_ctrls(&es->dp, NULL, &es->scs, s1, GTK_WINDOW(window));
|
||||||
gtk_container_set_border_width(GTK_CONTAINER(w1), 10);
|
gtk_container_set_border_width(GTK_CONTAINER(w1), 10);
|
||||||
gtk_widget_set_size_request(w1, 20 + string_width
|
gtk_widget_set_size_request(
|
||||||
("LINE OF TEXT GIVING WIDTH OF EVENT LOG IS "
|
w1, 20 + string_width("LINE OF TEXT GIVING WIDTH OF EVENT LOG IS "
|
||||||
"QUITE LONG 'COS SSH LOG ENTRIES ARE WIDE"),
|
"QUITE LONG 'COS SSH LOG ENTRIES ARE WIDE"),
|
||||||
-1);
|
-1);
|
||||||
our_dialog_add_to_content_area(GTK_WINDOW(window), w1, true, true, 0);
|
our_dialog_add_to_content_area(GTK_WINDOW(window), w1, true, true, 0);
|
||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(&es->dp, es->listctrl);
|
struct uctrl *uc = dlg_find_byctrl(&es->dp, es->listctrl);
|
||||||
|
@ -574,8 +574,8 @@ static void x11font_destroy(unifont *font)
|
|||||||
static void x11_alloc_subfont(struct x11font *xfont, int sfid)
|
static void x11_alloc_subfont(struct x11font *xfont, int sfid)
|
||||||
{
|
{
|
||||||
Display *disp = xfont->disp;
|
Display *disp = xfont->disp;
|
||||||
char *derived_name = x11_guess_derived_font_name
|
char *derived_name = x11_guess_derived_font_name(
|
||||||
(disp, xfont->fonts[0].xfs, sfid & 1, !!(sfid & 2));
|
disp, xfont->fonts[0].xfs, sfid & 1, !!(sfid & 2));
|
||||||
xfont->fonts[sfid].xfs = XLoadQueryFont(disp, derived_name);
|
xfont->fonts[sfid].xfs = XLoadQueryFont(disp, derived_name);
|
||||||
xfont->fonts[sfid].allocated = true;
|
xfont->fonts[sfid].allocated = true;
|
||||||
sfree(derived_name);
|
sfree(derived_name);
|
||||||
@ -691,10 +691,9 @@ static void x11font_cairo_setup(
|
|||||||
xfi->indexflip = (*((char *) &endianness_test) == 1) ? 0 : 7;
|
xfi->indexflip = (*((char *) &endianness_test) == 1) ? 0 : 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfi->pixmap = XCreatePixmap
|
xfi->pixmap = XCreatePixmap(
|
||||||
(disp,
|
disp, GDK_DRAWABLE_XID(gtk_widget_get_window(ctx->u.cairo.widget)),
|
||||||
GDK_DRAWABLE_XID(gtk_widget_get_window(ctx->u.cairo.widget)),
|
xfi->pixwidth, xfi->pixheight, 1);
|
||||||
xfi->pixwidth, xfi->pixheight, 1);
|
|
||||||
gcvals.foreground = WhitePixel(disp, widgetscr);
|
gcvals.foreground = WhitePixel(disp, widgetscr);
|
||||||
gcvals.background = BlackPixel(disp, widgetscr);
|
gcvals.background = BlackPixel(disp, widgetscr);
|
||||||
gcvals.font = xfi->xfs->fid;
|
gcvals.font = xfi->xfs->fid;
|
||||||
@ -747,8 +746,8 @@ static void x11font_cairo_cache_glyph(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
xfi->glyphcache[glyphindex].bitmap = bitmap;
|
xfi->glyphcache[glyphindex].bitmap = bitmap;
|
||||||
xfi->glyphcache[glyphindex].surface = cairo_image_surface_create_for_data
|
xfi->glyphcache[glyphindex].surface = cairo_image_surface_create_for_data(
|
||||||
(bitmap, CAIRO_FORMAT_A1, xfi->pixwidth, xfi->pixheight, xfi->rowsize);
|
bitmap, CAIRO_FORMAT_A1, xfi->pixwidth, xfi->pixheight, xfi->rowsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void x11font_cairo_draw_glyph(unifont_drawctx *ctx,
|
static void x11font_cairo_draw_glyph(unifont_drawctx *ctx,
|
||||||
@ -2226,9 +2225,9 @@ unifont *multifont_create(GtkWidget *widget, const char *name,
|
|||||||
if (font->want_fallback) {
|
if (font->want_fallback) {
|
||||||
for (i = 0; i < lenof(unifont_types); i++) {
|
for (i = 0; i < lenof(unifont_types); i++) {
|
||||||
if (unifont_types[i]->create_fallback) {
|
if (unifont_types[i]->create_fallback) {
|
||||||
fallback = unifont_types[i]->create_fallback
|
fallback = unifont_types[i]->create_fallback(
|
||||||
(widget, font->height, wide, bold,
|
widget, font->height, wide, bold,
|
||||||
shadowoffset, shadowalways);
|
shadowoffset, shadowalways);
|
||||||
if (fallback)
|
if (fallback)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2663,9 +2662,9 @@ static void unifontsel_set_filter_buttons(unifontsel_internal *fs)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < fs->n_filter_buttons; i++) {
|
for (i = 0; i < fs->n_filter_buttons; i++) {
|
||||||
int flagbit = GPOINTER_TO_INT(g_object_get_data
|
int flagbit = GPOINTER_TO_INT(g_object_get_data(
|
||||||
(G_OBJECT(fs->filter_buttons[i]),
|
G_OBJECT(fs->filter_buttons[i]),
|
||||||
"user-data"));
|
"user-data"));
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fs->filter_buttons[i]),
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fs->filter_buttons[i]),
|
||||||
!!(fs->filter_flags & flagbit));
|
!!(fs->filter_flags & flagbit));
|
||||||
}
|
}
|
||||||
@ -2679,8 +2678,8 @@ static void unifontsel_draw_preview_text_inner(unifont_drawctx *dctx,
|
|||||||
fontinfo *info = fs->selected;
|
fontinfo *info = fs->selected;
|
||||||
|
|
||||||
if (info) {
|
if (info) {
|
||||||
sizename = info->fontclass->scale_fontname
|
sizename = info->fontclass->scale_fontname(
|
||||||
(GTK_WIDGET(fs->u.window), info->realname, fs->selsize);
|
GTK_WIDGET(fs->u.window), info->realname, fs->selsize);
|
||||||
font = info->fontclass->create(GTK_WIDGET(fs->u.window),
|
font = info->fontclass->create(GTK_WIDGET(fs->u.window),
|
||||||
sizename ? sizename : info->realname,
|
sizename ? sizename : info->realname,
|
||||||
false, false, 0, 0);
|
false, false, 0, 0);
|
||||||
@ -2867,9 +2866,9 @@ static void unifontsel_select_font(unifontsel_internal *fs,
|
|||||||
*/
|
*/
|
||||||
assert(info->familyindex >= 0);
|
assert(info->familyindex >= 0);
|
||||||
treepath = gtk_tree_path_new_from_indices(info->familyindex, -1);
|
treepath = gtk_tree_path_new_from_indices(info->familyindex, -1);
|
||||||
gtk_tree_selection_select_path
|
gtk_tree_selection_select_path(
|
||||||
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->family_list)),
|
gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->family_list)),
|
||||||
treepath);
|
treepath);
|
||||||
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->family_list),
|
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->family_list),
|
||||||
treepath, NULL, false, 0.0, 0.0);
|
treepath, NULL, false, 0.0, 0.0);
|
||||||
success = gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->family_model),
|
success = gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->family_model),
|
||||||
@ -2891,9 +2890,9 @@ static void unifontsel_select_font(unifontsel_internal *fs,
|
|||||||
if (info->style) {
|
if (info->style) {
|
||||||
assert(info->styleindex >= 0);
|
assert(info->styleindex >= 0);
|
||||||
treepath = gtk_tree_path_new_from_indices(info->styleindex, -1);
|
treepath = gtk_tree_path_new_from_indices(info->styleindex, -1);
|
||||||
gtk_tree_selection_select_path
|
gtk_tree_selection_select_path(
|
||||||
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->style_list)),
|
gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->style_list)),
|
||||||
treepath);
|
treepath);
|
||||||
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->style_list),
|
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->style_list),
|
||||||
treepath, NULL, false, 0.0, 0.0);
|
treepath, NULL, false, 0.0, 0.0);
|
||||||
gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->style_model),
|
gtk_tree_model_get_iter(GTK_TREE_MODEL(fs->style_model),
|
||||||
@ -2914,9 +2913,9 @@ static void unifontsel_select_font(unifontsel_internal *fs,
|
|||||||
if (info->size) {
|
if (info->size) {
|
||||||
assert(info->sizeindex >= 0);
|
assert(info->sizeindex >= 0);
|
||||||
treepath = gtk_tree_path_new_from_indices(info->sizeindex, -1);
|
treepath = gtk_tree_path_new_from_indices(info->sizeindex, -1);
|
||||||
gtk_tree_selection_select_path
|
gtk_tree_selection_select_path(
|
||||||
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->size_list)),
|
gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->size_list)),
|
||||||
treepath);
|
treepath);
|
||||||
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->size_list),
|
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->size_list),
|
||||||
treepath, NULL, false, 0.0, 0.0);
|
treepath, NULL, false, 0.0, 0.0);
|
||||||
gtk_tree_path_free(treepath);
|
gtk_tree_path_free(treepath);
|
||||||
@ -3236,8 +3235,8 @@ static void alias_resolve(GtkTreeView *treeview, GtkTreePath *path,
|
|||||||
int flags;
|
int flags;
|
||||||
struct fontinfo_realname_find f;
|
struct fontinfo_realname_find f;
|
||||||
|
|
||||||
newname = info->fontclass->canonify_fontname
|
newname = info->fontclass->canonify_fontname(
|
||||||
(GTK_WIDGET(fs->u.window), info->realname, &newsize, &flags, true);
|
GTK_WIDGET(fs->u.window), info->realname, &newsize, &flags, true);
|
||||||
|
|
||||||
f.realname = newname;
|
f.realname = newname;
|
||||||
f.flags = flags;
|
f.flags = flags;
|
||||||
@ -3363,10 +3362,10 @@ unifontsel *unifontsel_new(const char *wintitle)
|
|||||||
fs->u.user_data = NULL;
|
fs->u.user_data = NULL;
|
||||||
fs->u.window = GTK_WINDOW(gtk_dialog_new());
|
fs->u.window = GTK_WINDOW(gtk_dialog_new());
|
||||||
gtk_window_set_title(fs->u.window, wintitle);
|
gtk_window_set_title(fs->u.window, wintitle);
|
||||||
fs->u.cancel_button = gtk_dialog_add_button
|
fs->u.cancel_button = gtk_dialog_add_button(
|
||||||
(GTK_DIALOG(fs->u.window), STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL);
|
GTK_DIALOG(fs->u.window), STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL);
|
||||||
fs->u.ok_button = gtk_dialog_add_button
|
fs->u.ok_button = gtk_dialog_add_button(
|
||||||
(GTK_DIALOG(fs->u.window), STANDARD_OK_LABEL, GTK_RESPONSE_OK);
|
GTK_DIALOG(fs->u.window), STANDARD_OK_LABEL, GTK_RESPONSE_OK);
|
||||||
gtk_widget_grab_default(fs->u.ok_button);
|
gtk_widget_grab_default(fs->u.ok_button);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3398,8 +3397,8 @@ unifontsel *unifontsel_new(const char *wintitle)
|
|||||||
w = table;
|
w = table;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area
|
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(
|
||||||
(GTK_DIALOG(fs->u.window))),
|
GTK_DIALOG(fs->u.window))),
|
||||||
w, true, true, 0);
|
w, true, true, 0);
|
||||||
|
|
||||||
label = gtk_label_new_with_mnemonic("_Font:");
|
label = gtk_label_new_with_mnemonic("_Font:");
|
||||||
@ -3422,9 +3421,9 @@ unifontsel *unifontsel_new(const char *wintitle)
|
|||||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
|
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
|
||||||
gtk_label_set_mnemonic_widget(GTK_LABEL(label), w);
|
gtk_label_set_mnemonic_widget(GTK_LABEL(label), w);
|
||||||
gtk_widget_show(w);
|
gtk_widget_show(w);
|
||||||
column = gtk_tree_view_column_new_with_attributes
|
column = gtk_tree_view_column_new_with_attributes(
|
||||||
("Font", gtk_cell_renderer_text_new(),
|
"Font", gtk_cell_renderer_text_new(),
|
||||||
"text", 0, (char *)NULL);
|
"text", 0, (char *)NULL);
|
||||||
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
|
||||||
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(w))),
|
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(w))),
|
||||||
@ -3473,9 +3472,9 @@ unifontsel *unifontsel_new(const char *wintitle)
|
|||||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
|
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
|
||||||
gtk_label_set_mnemonic_widget(GTK_LABEL(label), w);
|
gtk_label_set_mnemonic_widget(GTK_LABEL(label), w);
|
||||||
gtk_widget_show(w);
|
gtk_widget_show(w);
|
||||||
column = gtk_tree_view_column_new_with_attributes
|
column = gtk_tree_view_column_new_with_attributes(
|
||||||
("Style", gtk_cell_renderer_text_new(),
|
"Style", gtk_cell_renderer_text_new(),
|
||||||
"text", 0, "sensitive", 3, "weight", 4, (char *)NULL);
|
"text", 0, "sensitive", 3, "weight", 4, (char *)NULL);
|
||||||
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
|
||||||
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(w))),
|
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(w))),
|
||||||
@ -3531,9 +3530,9 @@ unifontsel *unifontsel_new(const char *wintitle)
|
|||||||
w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
|
w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
|
||||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
|
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
|
||||||
gtk_widget_show(w);
|
gtk_widget_show(w);
|
||||||
column = gtk_tree_view_column_new_with_attributes
|
column = gtk_tree_view_column_new_with_attributes(
|
||||||
("Size", gtk_cell_renderer_text_new(),
|
"Size", gtk_cell_renderer_text_new(),
|
||||||
"text", 0, (char *)NULL);
|
"text", 0, (char *)NULL);
|
||||||
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
|
||||||
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
|
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
|
||||||
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(w))),
|
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(w))),
|
||||||
@ -3740,8 +3739,8 @@ void unifontsel_set_name(unifontsel *fontsel, const char *fontname)
|
|||||||
*/
|
*/
|
||||||
fontname = unifont_do_prefix(fontname, &start, &end);
|
fontname = unifont_do_prefix(fontname, &start, &end);
|
||||||
for (i = start; i < end; i++) {
|
for (i = start; i < end; i++) {
|
||||||
fontname2 = unifont_types[i]->canonify_fontname
|
fontname2 = unifont_types[i]->canonify_fontname(
|
||||||
(GTK_WIDGET(fs->u.window), fontname, &size, &flags, false);
|
GTK_WIDGET(fs->u.window), fontname, &size, &flags, false);
|
||||||
if (fontname2)
|
if (fontname2)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3791,8 +3790,8 @@ char *unifontsel_get_name(unifontsel *fontsel)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (fs->selected->size == 0) {
|
if (fs->selected->size == 0) {
|
||||||
name = fs->selected->fontclass->scale_fontname
|
name = fs->selected->fontclass->scale_fontname(
|
||||||
(GTK_WIDGET(fs->u.window), fs->selected->realname, fs->selsize);
|
GTK_WIDGET(fs->u.window), fs->selected->realname, fs->selsize);
|
||||||
if (name) {
|
if (name) {
|
||||||
char *ret = dupcat(fs->selected->fontclass->prefix, ":", name);
|
char *ret = dupcat(fs->selected->fontclass->prefix, ":", name);
|
||||||
sfree(name);
|
sfree(name);
|
||||||
|
@ -128,8 +128,8 @@ void our_dialog_add_to_content_area(GtkWindow *dlg, GtkWidget *w,
|
|||||||
|
|
||||||
gtk_box_pack_start(vbox, w, expand, fill, padding);
|
gtk_box_pack_start(vbox, w, expand, fill, padding);
|
||||||
#else
|
#else
|
||||||
gtk_box_pack_start
|
gtk_box_pack_start(
|
||||||
(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))),
|
GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))),
|
||||||
w, expand, fill, padding);
|
w, expand, fill, padding);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1675,10 +1675,11 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
*/
|
*/
|
||||||
guint new_keyval;
|
guint new_keyval;
|
||||||
GdkModifierType consumed;
|
GdkModifierType consumed;
|
||||||
if (gdk_keymap_translate_keyboard_state
|
if (gdk_keymap_translate_keyboard_state(
|
||||||
(gdk_keymap_get_for_display(gdk_display_get_default()),
|
gdk_keymap_get_for_display(gdk_display_get_default()),
|
||||||
event->hardware_keycode, event->state & ~META_MANUAL_MASK,
|
event->hardware_keycode,
|
||||||
0, &new_keyval, NULL, NULL, &consumed)) {
|
event->state & ~META_MANUAL_MASK,
|
||||||
|
0, &new_keyval, NULL, NULL, &consumed)) {
|
||||||
ucsoutput[0] = '\033';
|
ucsoutput[0] = '\033';
|
||||||
ucsoutput[1] = gdk_keyval_to_unicode(new_keyval);
|
ucsoutput[1] = gdk_keyval_to_unicode(new_keyval);
|
||||||
#ifdef KEY_EVENT_DIAGNOSTICS
|
#ifdef KEY_EVENT_DIAGNOSTICS
|
||||||
|
@ -62,8 +62,8 @@ static void wm_copydata_agent_query(strbuf *query, void **out, int *outlen)
|
|||||||
psd = (PSECURITY_DESCRIPTOR)
|
psd = (PSECURITY_DESCRIPTOR)
|
||||||
LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
|
LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
|
||||||
if (psd) {
|
if (psd) {
|
||||||
if (p_InitializeSecurityDescriptor
|
if (p_InitializeSecurityDescriptor(
|
||||||
(psd, SECURITY_DESCRIPTOR_REVISION) &&
|
psd, SECURITY_DESCRIPTOR_REVISION) &&
|
||||||
p_SetSecurityDescriptorOwner(psd, usersid, false)) {
|
p_SetSecurityDescriptorOwner(psd, usersid, false)) {
|
||||||
sa.nLength = sizeof(sa);
|
sa.nLength = sizeof(sa);
|
||||||
sa.bInheritHandle = true;
|
sa.bInheritHandle = true;
|
||||||
|
@ -385,10 +385,10 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
|||||||
SetWindowText(hwnd, str);
|
SetWindowText(hwnd, str);
|
||||||
sfree(str);
|
sfree(str);
|
||||||
char *buildinfo_text = buildinfo("\r\n");
|
char *buildinfo_text = buildinfo("\r\n");
|
||||||
char *text = dupprintf
|
char *text = dupprintf(
|
||||||
("%s\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
|
"%s\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
|
||||||
appname, ver, buildinfo_text,
|
appname, ver, buildinfo_text,
|
||||||
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
||||||
sfree(buildinfo_text);
|
sfree(buildinfo_text);
|
||||||
SetDlgItemText(hwnd, IDA_TEXT, text);
|
SetDlgItemText(hwnd, IDA_TEXT, text);
|
||||||
MakeDlgItemBorderless(hwnd, IDA_TEXT);
|
MakeDlgItemBorderless(hwnd, IDA_TEXT);
|
||||||
|
@ -544,13 +544,13 @@ static void update_jumplist_from_registry(void)
|
|||||||
*/
|
*/
|
||||||
for (i = 0, found = false; i < nremoved && !found; i++) {
|
for (i = 0, found = false; i < nremoved && !found; i++) {
|
||||||
IShellLink *rlink;
|
IShellLink *rlink;
|
||||||
if (SUCCEEDED(pRemoved->lpVtbl->GetAt
|
if (SUCCEEDED(pRemoved->lpVtbl->GetAt(
|
||||||
(pRemoved, i, COMPTR(IShellLink, &rlink)))) {
|
pRemoved, i, COMPTR(IShellLink, &rlink)))) {
|
||||||
char desc1[2048], desc2[2048];
|
char desc1[2048], desc2[2048];
|
||||||
if (SUCCEEDED(link->lpVtbl->GetDescription
|
if (SUCCEEDED(link->lpVtbl->GetDescription(
|
||||||
(link, desc1, sizeof(desc1)-1)) &&
|
link, desc1, sizeof(desc1)-1)) &&
|
||||||
SUCCEEDED(rlink->lpVtbl->GetDescription
|
SUCCEEDED(rlink->lpVtbl->GetDescription(
|
||||||
(rlink, desc2, sizeof(desc2)-1)) &&
|
rlink, desc2, sizeof(desc2)-1)) &&
|
||||||
!strcmp(desc1, desc2)) {
|
!strcmp(desc1, desc2)) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@ -575,8 +575,8 @@ static void update_jumplist_from_registry(void)
|
|||||||
* Get the array form of the collection we've just constructed,
|
* Get the array form of the collection we've just constructed,
|
||||||
* and put it in the jump list.
|
* and put it in the jump list.
|
||||||
*/
|
*/
|
||||||
if (!SUCCEEDED(collection->lpVtbl->QueryInterface
|
if (!SUCCEEDED(collection->lpVtbl->QueryInterface(
|
||||||
(collection, COMPTR(IObjectArray, &array))))
|
collection, COMPTR(IObjectArray, &array))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
pCDL->lpVtbl->AppendCategory(pCDL, L"Recent Sessions", array);
|
pCDL->lpVtbl->AppendCategory(pCDL, L"Recent Sessions", array);
|
||||||
@ -608,8 +608,8 @@ static void update_jumplist_from_registry(void)
|
|||||||
* Get the array form of the collection we've just constructed,
|
* Get the array form of the collection we've just constructed,
|
||||||
* and put it in the jump list.
|
* and put it in the jump list.
|
||||||
*/
|
*/
|
||||||
if (!SUCCEEDED(collection->lpVtbl->QueryInterface
|
if (!SUCCEEDED(collection->lpVtbl->QueryInterface(
|
||||||
(collection, COMPTR(IObjectArray, &array))))
|
collection, COMPTR(IObjectArray, &array))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
pCDL->lpVtbl->AddUserTasks(pCDL, array);
|
pCDL->lpVtbl->AddUserTasks(pCDL, array);
|
||||||
@ -636,8 +636,8 @@ static void update_jumplist_from_registry(void)
|
|||||||
* Get the array form of the collection we've just constructed,
|
* Get the array form of the collection we've just constructed,
|
||||||
* and put it in the jump list.
|
* and put it in the jump list.
|
||||||
*/
|
*/
|
||||||
if (!SUCCEEDED(collection->lpVtbl->QueryInterface
|
if (!SUCCEEDED(collection->lpVtbl->QueryInterface(
|
||||||
(collection, COMPTR(IObjectArray, &array))))
|
collection, COMPTR(IObjectArray, &array))))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
pCDL->lpVtbl->AddUserTasks(pCDL, array);
|
pCDL->lpVtbl->AddUserTasks(pCDL, array);
|
||||||
|
@ -77,33 +77,33 @@ static bool create_named_pipe(NamedPipeServerSocket *ps, bool first_instance)
|
|||||||
sa.lpSecurityDescriptor = ps->psd;
|
sa.lpSecurityDescriptor = ps->psd;
|
||||||
sa.bInheritHandle = false;
|
sa.bInheritHandle = false;
|
||||||
|
|
||||||
ps->pipehandle = CreateNamedPipe
|
ps->pipehandle = CreateNamedPipe(
|
||||||
(/* lpName */
|
/* lpName */
|
||||||
ps->pipename,
|
ps->pipename,
|
||||||
|
|
||||||
/* dwOpenMode */
|
/* dwOpenMode */
|
||||||
PIPE_ACCESS_DUPLEX |
|
PIPE_ACCESS_DUPLEX |
|
||||||
FILE_FLAG_OVERLAPPED |
|
FILE_FLAG_OVERLAPPED |
|
||||||
(first_instance ? FILE_FLAG_FIRST_PIPE_INSTANCE : 0),
|
(first_instance ? FILE_FLAG_FIRST_PIPE_INSTANCE : 0),
|
||||||
|
|
||||||
/* dwPipeMode */
|
/* dwPipeMode */
|
||||||
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT
|
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT
|
||||||
#ifdef PIPE_REJECT_REMOTE_CLIENTS
|
#ifdef PIPE_REJECT_REMOTE_CLIENTS
|
||||||
| PIPE_REJECT_REMOTE_CLIENTS
|
| PIPE_REJECT_REMOTE_CLIENTS
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
|
|
||||||
/* nMaxInstances */
|
/* nMaxInstances */
|
||||||
PIPE_UNLIMITED_INSTANCES,
|
PIPE_UNLIMITED_INSTANCES,
|
||||||
|
|
||||||
/* nOutBufferSize, nInBufferSize */
|
/* nOutBufferSize, nInBufferSize */
|
||||||
4096, 4096, /* FIXME: think harder about buffer sizes? */
|
4096, 4096, /* FIXME: think harder about buffer sizes? */
|
||||||
|
|
||||||
/* nDefaultTimeOut */
|
/* nDefaultTimeOut */
|
||||||
0 /* default timeout */,
|
0 /* default timeout */,
|
||||||
|
|
||||||
/* lpSecurityAttributes */
|
/* lpSecurityAttributes */
|
||||||
&sa);
|
&sa);
|
||||||
|
|
||||||
return ps->pipehandle != INVALID_HANDLE_VALUE;
|
return ps->pipehandle != INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
@ -133,10 +133,10 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
|||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WM_INITDIALOG: {
|
case WM_INITDIALOG: {
|
||||||
char *buildinfo_text = buildinfo("\r\n");
|
char *buildinfo_text = buildinfo("\r\n");
|
||||||
char *text = dupprintf
|
char *text = dupprintf(
|
||||||
("Pageant\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
|
"Pageant\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
|
||||||
ver, buildinfo_text,
|
ver, buildinfo_text,
|
||||||
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
||||||
sfree(buildinfo_text);
|
sfree(buildinfo_text);
|
||||||
SetDlgItemText(hwnd, IDC_ABOUT_TEXTBOX, text);
|
SetDlgItemText(hwnd, IDC_ABOUT_TEXTBOX, text);
|
||||||
MakeDlgItemBorderless(hwnd, IDC_ABOUT_TEXTBOX);
|
MakeDlgItemBorderless(hwnd, IDC_ABOUT_TEXTBOX);
|
||||||
|
@ -543,10 +543,10 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
|||||||
|
|
||||||
{
|
{
|
||||||
char *buildinfo_text = buildinfo("\r\n");
|
char *buildinfo_text = buildinfo("\r\n");
|
||||||
char *text = dupprintf
|
char *text = dupprintf(
|
||||||
("PuTTYgen\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
|
"PuTTYgen\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
|
||||||
ver, buildinfo_text,
|
ver, buildinfo_text,
|
||||||
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
||||||
sfree(buildinfo_text);
|
sfree(buildinfo_text);
|
||||||
SetDlgItemText(hwnd, 1000, text);
|
SetDlgItemText(hwnd, 1000, text);
|
||||||
MakeDlgItemBorderless(hwnd, 1000);
|
MakeDlgItemBorderless(hwnd, 1000);
|
||||||
@ -1922,10 +1922,10 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
|||||||
|
|
||||||
if ((state->keytype == RSA || state->keytype == DSA) &&
|
if ((state->keytype == RSA || state->keytype == DSA) &&
|
||||||
state->key_bits < 256) {
|
state->key_bits < 256) {
|
||||||
char *message = dupprintf
|
char *message = dupprintf(
|
||||||
("PuTTYgen will not generate a key smaller than 256"
|
"PuTTYgen will not generate a key smaller than 256"
|
||||||
" bits.\nKey length reset to default %d. Continue?",
|
" bits.\nKey length reset to default %d. Continue?",
|
||||||
DEFAULT_KEY_BITS);
|
DEFAULT_KEY_BITS);
|
||||||
int ret = MessageBox(hwnd, message, "PuTTYgen Warning",
|
int ret = MessageBox(hwnd, message, "PuTTYgen Warning",
|
||||||
MB_ICONWARNING | MB_OKCANCEL);
|
MB_ICONWARNING | MB_OKCANCEL);
|
||||||
sfree(message);
|
sfree(message);
|
||||||
@ -1935,9 +1935,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
|||||||
SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEY_BITS, false);
|
SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEY_BITS, false);
|
||||||
} else if ((state->keytype == RSA || state->keytype == DSA) &&
|
} else if ((state->keytype == RSA || state->keytype == DSA) &&
|
||||||
state->key_bits < DEFAULT_KEY_BITS) {
|
state->key_bits < DEFAULT_KEY_BITS) {
|
||||||
char *message = dupprintf
|
char *message = dupprintf(
|
||||||
("Keys shorter than %d bits are not recommended. "
|
"Keys shorter than %d bits are not recommended. "
|
||||||
"Really generate this key?", DEFAULT_KEY_BITS);
|
"Really generate this key?", DEFAULT_KEY_BITS);
|
||||||
int ret = MessageBox(hwnd, message, "PuTTYgen Warning",
|
int ret = MessageBox(hwnd, message, "PuTTYgen Warning",
|
||||||
MB_ICONWARNING | MB_OKCANCEL);
|
MB_ICONWARNING | MB_OKCANCEL);
|
||||||
sfree(message);
|
sfree(message);
|
||||||
|
@ -685,8 +685,8 @@ void write_random_seed(void *data, int len)
|
|||||||
* returning the resulting concatenated list of strings in 'out' (if
|
* returning the resulting concatenated list of strings in 'out' (if
|
||||||
* non-null).
|
* non-null).
|
||||||
*/
|
*/
|
||||||
static int transform_jumplist_registry
|
static int transform_jumplist_registry(
|
||||||
(const char *add, const char *rem, char **out)
|
const char *add, const char *rem, char **out)
|
||||||
{
|
{
|
||||||
HKEY rkey = open_regkey(true, HKEY_CURRENT_USER, reg_jumplist_key);
|
HKEY rkey = open_regkey(true, HKEY_CURRENT_USER, reg_jumplist_key);
|
||||||
if (!rkey)
|
if (!rkey)
|
||||||
|
@ -290,10 +290,10 @@ static bool really_restrict_process_acl(char **error)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ERROR_SUCCESS != p_SetSecurityInfo
|
if (ERROR_SUCCESS != p_SetSecurityInfo(
|
||||||
(GetCurrentProcess(), SE_KERNEL_OBJECT,
|
GetCurrentProcess(), SE_KERNEL_OBJECT,
|
||||||
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
|
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
|
||||||
usersid, NULL, acl, NULL)) {
|
usersid, NULL, acl, NULL)) {
|
||||||
*error = dupprintf("Unable to set process ACL: %s",
|
*error = dupprintf("Unable to set process ACL: %s",
|
||||||
win_strerror(GetLastError()));
|
win_strerror(GetLastError()));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user