Bug #1630
opengtk clients have a problem with GDK_KEY_plus key and sound volume
0%
Description
Affects gtk3.22, gtk4 and gtk5 clients, Qt client does not have any keys affecting sound volume.
In this code -
if (state & GDK_SHIFT_MASK) {
bool volchange = FALSE;
switch (keyval) {
case GDK_KEY_plus:
case GDK_KEY_KP_Add:
gui_options.sound_effects_volume += 10;
volchange = TRUE;
break;
case GDK_KEY_minus:
case GDK_KEY_KP_Subtract:
gui_options.sound_effects_volume -= 10;
volchange = TRUE;
break;
default:
break;
}
if (volchange) {
struct option *poption = optset_option_by_name(client_optset,
"sound_effects_volume");
gui_options.sound_effects_volume = CLIP(0,
gui_options.sound_effects_volume,
100);
option_changed(poption);
return TRUE;
}
} else if (!(state & GDK_CONTROL_MASK)) {
switch (keyval) {
case GDK_KEY_plus:
case GDK_KEY_KP_Add:
zoom_step_up();
return TRUE;
You can't ever get past the volchange part because the "+" key has the GDK_SHIFT_MASK on by definition - it's (GDK_KEY_equals with GDK_SHIFT_MASK). Since this also eats the key press, it won't get to the Menu entries for zoom that #943 wants to add.
We could drop having "+" and "-" affect sound volume, leaving only the keypad GDK_KEY_KP_Add and GDK_KEY_KP_Subtract to do that. (GDK_KEY_plus with Ctrl/Meta mask) is View menu item Show Stack Size.
Updated by Marko Lindqvist 12 days ago
Dean Brown wrote:
the "+" key has the GDK_SHIFT_MASK on by definition
Is that an American keyboard layout, or what? Likely I have implemented that code without realizing that such a details can differ between layouts (in Finnish keyboard '+' and '-' do not use any modifiers)
Updated by Dean Brown 12 days ago
Oy - the plot thickens. Yes American keyboard layout, "+" and "=" are the same key. I also didn't know that keyboards could be that different.
Updated by Dean Brown 11 days ago
An idea - use "<" and ">" to change sound volume. They are not used for anything in the gtk clients and in the Qt client, so could be added to Qt client as well.
Updated by Marko Lindqvist 11 days ago
Dean Brown wrote in #note-3:
An idea - use "<" and ">" to change sound volume. They are not used for anything in the gtk clients and in the Qt client, so could be added to Qt client as well.
Should be fine for sdl clients too.
Updated by Dean Brown 9 days ago
For Qt and gtk clients, no reason not to make them menu items, in the game menu. The sdl client is a problem on my Mac, I get no menus - might be better to let someone else handle that. Maybe I should create separate issues for the different clients?
Adding menu items means a little more translation work.
Also affects #1293 - if the new menu items get done first I can make an updated patch for #1293, if #1293 gets done first than adding the new menu items should also update the helpdata.txt