OK, this is absolutely the last commit related to UI key events :)

Allowed modifier keys (Ctrl, Alt, Shift, etc) to be treated as normal
keys, and mapped to some action.  In those modes, the modifier keys are
just like any other key on the keyboard.  However, they also have
a special purpose when combined with other keys (text editing), and
this now works as well.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1189 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-12-08 20:19:58 +00:00
parent 8c47a3f155
commit 2c9b0d1ecb
5 changed files with 12 additions and 13 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: EventHandler.cxx,v 1.180 2006-12-08 16:49:25 stephena Exp $
// $Id: EventHandler.cxx,v 1.181 2006-12-08 20:19:58 stephena Exp $
//============================================================================
#include <sstream>
@ -631,9 +631,9 @@ void EventHandler::poll(uInt32 time)
{
// Assign ascii field if it doesn't exist
// Make sure 'state change' keys (Shift, Ctrl, etc) are excluded
if(key > SDLK_F15 && key < SDLK_HELP) return;
if(!ascii || ascii >= SDLK_LAST ||
ascii == SDLK_BACKSPACE || ascii == SDLK_DELETE) ascii = key;
key == SDLK_BACKSPACE || key == SDLK_DELETE) ascii = key;
if(key > SDLK_F15 && key < SDLK_HELP) ascii = 0;
myOverlay->handleKeyEvent(ascii, key, mod, state);
}
@ -1525,8 +1525,7 @@ void EventHandler::setJoyHatMap()
bool EventHandler::addKeyMapping(Event::Type event, EventMode mode, int key)
{
// These keys cannot be remapped
if(key == SDLK_TAB || (key > SDLK_F15 && key < SDLK_HELP) ||
eventIsAnalog(event))
if(key == SDLK_TAB || eventIsAnalog(event))
return false;
else
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Dialog.cxx,v 1.50 2006-12-08 16:49:33 stephena Exp $
// $Id: Dialog.cxx,v 1.51 2006-12-08 20:19:58 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -314,7 +314,7 @@ void Dialog::handleKeyDown(int ascii, int keycode, int modifiers)
// Check the keytable now, since we might get one of the above events,
// which must always be processed before any widget sees it.
if(e == Event::NoType)
e = instance()->eventHandler().eventForKey(ascii, kMenuMode);
e = instance()->eventHandler().eventForKey(keycode, kMenuMode);
// Unless a widget has claimed all responsibility for data, we assume
// that if an event exists for the given data, it should have priority.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: EditableWidget.cxx,v 1.19 2006-12-08 16:49:33 stephena Exp $
// $Id: EditableWidget.cxx,v 1.20 2006-12-08 20:19:58 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -92,7 +92,7 @@ bool EditableWidget::handleKeyDown(int ascii, int keycode, int modifiers)
bool handled = true;
bool dirty = false;
switch (ascii)
switch (keycode)
{
case '\n': // enter/return
case '\r':

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: ListWidget.cxx,v 1.45 2006-12-08 16:49:35 stephena Exp $
// $Id: ListWidget.cxx,v 1.46 2006-12-08 20:19:58 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -263,7 +263,7 @@ bool ListWidget::handleKeyDown(int ascii, int keycode, int modifiers)
else
{
// not editmode
switch (ascii)
switch (keycode)
{
case ' ': // space
// Snap list back to currently highlighted line

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: PopUpWidget.cxx,v 1.29 2006-12-08 16:49:36 stephena Exp $
// $Id: PopUpWidget.cxx,v 1.30 2006-12-08 20:19:58 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -135,7 +135,7 @@ void PopUpDialog::handleKeyDown(int ascii, int keycode, int modifiers)
if(isMouseDown())
return;
Event::Type e = instance()->eventHandler().eventForKey(ascii, kMenuMode);
Event::Type e = instance()->eventHandler().eventForKey(keycode, kMenuMode);
handleEvent(e);
}