Fixed broken Ctrl and Shift toolbar buttons

This commit is contained in:
pelya
2014-03-23 14:33:43 +02:00
parent f4612e4031
commit 253ccf43e8
3 changed files with 18 additions and 1 deletions

View File

@@ -1165,24 +1165,35 @@ static CallBackFunction ToolbarSwitchClick(Window *w)
static CallBackFunction ToolbarCtrlClick(Window *w) static CallBackFunction ToolbarCtrlClick(Window *w)
{ {
_ctrl_pressed = !_ctrl_pressed; _ctrl_pressed = !_ctrl_pressed;
//DEBUG(misc, 1, "ToolbarCtrlClick: pressed %d", _ctrl_pressed);
w->SetWidgetLoweredState(WID_TN_CTRL, _ctrl_pressed); w->SetWidgetLoweredState(WID_TN_CTRL, _ctrl_pressed);
HandleCtrlChanged();
w->SetWidgetDirty(WID_TN_CTRL); w->SetWidgetDirty(WID_TN_CTRL);
HandleCtrlChanged();
EraseQueuedTouchCommand(); EraseQueuedTouchCommand();
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
return CBF_NONE; return CBF_NONE;
} }
static CallBackFunction ToolbarShiftClick(Window *w) static CallBackFunction ToolbarShiftClick(Window *w)
{ {
_shift_pressed = !_shift_pressed; _shift_pressed = !_shift_pressed;
//DEBUG(misc, 1, "ToolbarShiftClick: pressed %d", _shift_pressed);
w->SetWidgetLoweredState(WID_TN_SHIFT, _shift_pressed); w->SetWidgetLoweredState(WID_TN_SHIFT, _shift_pressed);
w->SetWidgetDirty(WID_TN_SHIFT); w->SetWidgetDirty(WID_TN_SHIFT);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
return CBF_NONE; return CBF_NONE;
} }
static CallBackFunction ToolbarDeleteClick(Window *w) static CallBackFunction ToolbarDeleteClick(Window *w)
{ {
DeleteNonVitalWindows(); DeleteNonVitalWindows();
_ctrl_pressed = false;
w->SetWidgetLoweredState(WID_TN_CTRL, _ctrl_pressed);
w->SetWidgetDirty(WID_TN_CTRL);
_shift_pressed = false;
w->SetWidgetLoweredState(WID_TN_SHIFT, _shift_pressed);
w->SetWidgetDirty(WID_TN_SHIFT);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
return CBF_NONE; return CBF_NONE;
} }

View File

@@ -761,10 +761,12 @@ void VideoDriver_SDL::MainLoop()
bool old_ctrl_pressed = _ctrl_pressed; bool old_ctrl_pressed = _ctrl_pressed;
#ifndef __ANDROID__
if (_settings_client.gui.touchscreen_mode == TSC_NONE) { if (_settings_client.gui.touchscreen_mode == TSC_NONE) {
_ctrl_pressed = !!(mod & KMOD_CTRL); _ctrl_pressed = !!(mod & KMOD_CTRL);
_shift_pressed = !!(mod & KMOD_SHIFT); _shift_pressed = !!(mod & KMOD_SHIFT);
} }
#endif
/* determine which directional keys are down */ /* determine which directional keys are down */
_dirkeys = _dirkeys =

View File

@@ -1 +1,5 @@
- Resize Aircraft window
- Resize Ship window
- Resize Music Program Selection window
- Resize all buttons and fonts when screen resolution changes
- Add Load button to Play Heightmap dialog - Add Load button to Play Heightmap dialog