mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-28 23:34:49 -05:00
Exorcise beeps from the Colours pane in Gtk.
The colour list box beeped at the user whenever it found that something other than exactly one colour was selected. This seems to happen implicitly in Gtk when the pane is changed. In Gtk1, this gave you a beep whenever you left the Colours dialog after having selected a colour from the list; in Gtk2, you additionally got a beep _every_ time you subsequently re-entered the Colours dialog (for reasons I haven't investigated). Windows was unaffected. Also, in Gtk (unlike Windows), it's possible for the user to go back to the state where no items in the list box are selected at all. For these reasons, stop beeping at the user, and instead blank the RGB edit boxes as a hint that edits to them would be futile. (Really we should be disabling them entirely, but the cross-platform edit controls aren't up to that yet.) [originally from svn r8074]
This commit is contained in:
parent
189c9a2a08
commit
6e447b9f18
33
config.c
33
config.c
@ -623,7 +623,7 @@ static void colour_handler(union control *ctrl, void *dlg,
|
||||
Config *cfg = (Config *)data;
|
||||
struct colour_data *cd =
|
||||
(struct colour_data *)ctrl->generic.context.p;
|
||||
int update = FALSE, r, g, b;
|
||||
int update = FALSE, clear, r, g, b;
|
||||
|
||||
if (event == EVENT_REFRESH) {
|
||||
if (ctrl == cd->listbox) {
|
||||
@ -633,21 +633,21 @@ static void colour_handler(union control *ctrl, void *dlg,
|
||||
for (i = 0; i < lenof(colours); i++)
|
||||
dlg_listbox_add(ctrl, dlg, colours[i]);
|
||||
dlg_update_done(ctrl, dlg);
|
||||
dlg_editbox_set(cd->redit, dlg, "");
|
||||
dlg_editbox_set(cd->gedit, dlg, "");
|
||||
dlg_editbox_set(cd->bedit, dlg, "");
|
||||
clear = TRUE;
|
||||
update = TRUE;
|
||||
}
|
||||
} else if (event == EVENT_SELCHANGE) {
|
||||
if (ctrl == cd->listbox) {
|
||||
/* The user has selected a colour. Update the RGB text. */
|
||||
int i = dlg_listbox_index(ctrl, dlg);
|
||||
if (i < 0) {
|
||||
dlg_beep(dlg);
|
||||
return;
|
||||
clear = TRUE;
|
||||
} else {
|
||||
clear = FALSE;
|
||||
r = cfg->colours[i][0];
|
||||
g = cfg->colours[i][1];
|
||||
b = cfg->colours[i][2];
|
||||
}
|
||||
r = cfg->colours[i][0];
|
||||
g = cfg->colours[i][1];
|
||||
b = cfg->colours[i][2];
|
||||
update = TRUE;
|
||||
}
|
||||
} else if (event == EVENT_VALCHANGE) {
|
||||
@ -700,16 +700,23 @@ static void colour_handler(union control *ctrl, void *dlg,
|
||||
cfg->colours[i][0] = r;
|
||||
cfg->colours[i][1] = g;
|
||||
cfg->colours[i][2] = b;
|
||||
clear = FALSE;
|
||||
update = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (update) {
|
||||
char buf[40];
|
||||
sprintf(buf, "%d", r); dlg_editbox_set(cd->redit, dlg, buf);
|
||||
sprintf(buf, "%d", g); dlg_editbox_set(cd->gedit, dlg, buf);
|
||||
sprintf(buf, "%d", b); dlg_editbox_set(cd->bedit, dlg, buf);
|
||||
if (clear) {
|
||||
dlg_editbox_set(cd->redit, dlg, "");
|
||||
dlg_editbox_set(cd->gedit, dlg, "");
|
||||
dlg_editbox_set(cd->bedit, dlg, "");
|
||||
} else {
|
||||
char buf[40];
|
||||
sprintf(buf, "%d", r); dlg_editbox_set(cd->redit, dlg, buf);
|
||||
sprintf(buf, "%d", g); dlg_editbox_set(cd->gedit, dlg, buf);
|
||||
sprintf(buf, "%d", b); dlg_editbox_set(cd->bedit, dlg, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user