mirror of https://github.com/stella-emu/stella.git
First pass at converting text input to the new SDL2 scheme. Basically,
the old way mixed both single-key events and Unicode input into one method, and the new way separates them (using a new handleText method). Currently it seems to be working fine in the ROM launcher (yay!, I can now quickly jump to ROMs by name again). There are still some issues in the debugger, which I'll work on next. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2913 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
d66226c210
commit
90248b2701
|
@ -26,7 +26,6 @@ EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
EventHandlerSDL2::~EventHandlerSDL2()
|
EventHandlerSDL2::~EventHandlerSDL2()
|
||||||
{
|
{
|
||||||
|
@ -46,45 +45,59 @@ void EventHandlerSDL2::initializeJoysticks()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void EventHandlerSDL2::enableTextEvents(bool enable)
|
||||||
|
{
|
||||||
|
if(enable)
|
||||||
|
SDL_StartTextInput();
|
||||||
|
else
|
||||||
|
SDL_StopTextInput();
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandlerSDL2::pollEvent()
|
void EventHandlerSDL2::pollEvent()
|
||||||
{
|
{
|
||||||
while(SDL_PollEvent(&event))
|
while(SDL_PollEvent(&myEvent))
|
||||||
{
|
{
|
||||||
switch(event.type)
|
switch(myEvent.type)
|
||||||
{
|
{
|
||||||
// keyboard events
|
// keyboard events
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
{
|
{
|
||||||
if(!event.key.repeat)
|
if(!myEvent.key.repeat)
|
||||||
handleKeyEvent((StellaKey)event.key.keysym.scancode,
|
handleKeyEvent((StellaKey)myEvent.key.keysym.scancode,
|
||||||
(StellaMod)event.key.keysym.mod,
|
(StellaMod)myEvent.key.keysym.mod,
|
||||||
'x', //FIXSDL event.key.keysym.scancode,
|
myEvent.key.type == SDL_KEYDOWN);
|
||||||
event.key.type == SDL_KEYDOWN);
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SDL_TEXTINPUT:
|
||||||
|
{
|
||||||
|
handleTextEvent(*(myEvent.text.text));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
{
|
{
|
||||||
handleMouseMotionEvent(event.motion.x, event.motion.y,
|
handleMouseMotionEvent(myEvent.motion.x, myEvent.motion.y,
|
||||||
event.motion.xrel, event.motion.yrel, 0);
|
myEvent.motion.xrel, myEvent.motion.yrel, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
{
|
{
|
||||||
bool pressed = event.button.type == SDL_MOUSEBUTTONDOWN;
|
bool pressed = myEvent.button.type == SDL_MOUSEBUTTONDOWN;
|
||||||
switch(event.button.button)
|
switch(myEvent.button.button)
|
||||||
{
|
{
|
||||||
case SDL_BUTTON_LEFT:
|
case SDL_BUTTON_LEFT:
|
||||||
handleMouseButtonEvent(pressed ? EVENT_LBUTTONDOWN : EVENT_LBUTTONUP,
|
handleMouseButtonEvent(pressed ? EVENT_LBUTTONDOWN : EVENT_LBUTTONUP,
|
||||||
event.button.x, event.button.y);
|
myEvent.button.x, myEvent.button.y);
|
||||||
break;
|
break;
|
||||||
case SDL_BUTTON_RIGHT:
|
case SDL_BUTTON_RIGHT:
|
||||||
handleMouseButtonEvent(pressed ? EVENT_RBUTTONDOWN : EVENT_RBUTTONUP,
|
handleMouseButtonEvent(pressed ? EVENT_RBUTTONDOWN : EVENT_RBUTTONUP,
|
||||||
event.button.x, event.button.y);
|
myEvent.button.x, myEvent.button.y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -92,10 +105,10 @@ void EventHandlerSDL2::pollEvent()
|
||||||
|
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
if(event.wheel.y < 0)
|
if(myEvent.wheel.y < 0)
|
||||||
handleMouseButtonEvent(EVENT_WHEELDOWN, 0, event.wheel.y);
|
handleMouseButtonEvent(EVENT_WHEELDOWN, 0, myEvent.wheel.y);
|
||||||
else if(event.wheel.y > 0)
|
else if(myEvent.wheel.y > 0)
|
||||||
handleMouseButtonEvent(EVENT_WHEELUP, 0, event.wheel.y);
|
handleMouseButtonEvent(EVENT_WHEELUP, 0, myEvent.wheel.y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,38 +116,40 @@ void EventHandlerSDL2::pollEvent()
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_JOYBUTTONUP:
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_JOYBUTTONDOWN:
|
||||||
{
|
{
|
||||||
handleJoyEvent(event.jbutton.which, event.jbutton.button,
|
handleJoyEvent(myEvent.jbutton.which, myEvent.jbutton.button,
|
||||||
event.jbutton.state == SDL_PRESSED ? 1 : 0);
|
myEvent.jbutton.state == SDL_PRESSED ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_JOYAXISMOTION:
|
case SDL_JOYAXISMOTION:
|
||||||
{
|
{
|
||||||
handleJoyAxisEvent(event.jaxis.which, event.jaxis.axis,
|
handleJoyAxisEvent(myEvent.jaxis.which, myEvent.jaxis.axis,
|
||||||
event.jaxis.value);
|
myEvent.jaxis.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_JOYHATMOTION:
|
case SDL_JOYHATMOTION:
|
||||||
{
|
{
|
||||||
int v = event.jhat.value, value = 0;
|
int v = myEvent.jhat.value, value = 0;
|
||||||
if(v & SDL_HAT_UP) value |= EVENT_HATUP_M;
|
if(v & SDL_HAT_UP) value |= EVENT_HATUP_M;
|
||||||
if(v & SDL_HAT_DOWN) value |= EVENT_HATDOWN_M;
|
if(v & SDL_HAT_DOWN) value |= EVENT_HATDOWN_M;
|
||||||
if(v & SDL_HAT_LEFT) value |= EVENT_HATLEFT_M;
|
if(v & SDL_HAT_LEFT) value |= EVENT_HATLEFT_M;
|
||||||
if(v & SDL_HAT_RIGHT) value |= EVENT_HATRIGHT_M;
|
if(v & SDL_HAT_RIGHT) value |= EVENT_HATRIGHT_M;
|
||||||
if(v == SDL_HAT_CENTERED) value = EVENT_HATCENTER_M;
|
if(v == SDL_HAT_CENTERED) value = EVENT_HATCENTER_M;
|
||||||
|
|
||||||
handleJoyHatEvent(event.jhat.which, event.jhat.hat, value);
|
handleJoyHatEvent(myEvent.jhat.which, myEvent.jhat.hat, value);
|
||||||
break; // SDL_JOYHATMOTION
|
break; // SDL_JOYHATMOTION
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
|
{
|
||||||
handleEvent(Event::Quit, 1);
|
handleEvent(Event::Quit, 1);
|
||||||
break; // SDL_QUIT
|
break; // SDL_QUIT
|
||||||
|
}
|
||||||
|
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
switch(event.window.event)
|
switch(myEvent.window.event)
|
||||||
{
|
{
|
||||||
case SDL_WINDOWEVENT_SHOWN:
|
case SDL_WINDOWEVENT_SHOWN:
|
||||||
handleSystemEvent(EVENT_WINDOW_SHOWN);
|
handleSystemEvent(EVENT_WINDOW_SHOWN);
|
||||||
|
@ -147,11 +162,11 @@ void EventHandlerSDL2::pollEvent()
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
handleSystemEvent(EVENT_WINDOW_MOVED,
|
handleSystemEvent(EVENT_WINDOW_MOVED,
|
||||||
event.window.data1, event.window.data1);
|
myEvent.window.data1, myEvent.window.data1);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_RESIZED:
|
case SDL_WINDOWEVENT_RESIZED:
|
||||||
handleSystemEvent(EVENT_WINDOW_RESIZED,
|
handleSystemEvent(EVENT_WINDOW_RESIZED,
|
||||||
event.window.data1, event.window.data1);
|
myEvent.window.data1, myEvent.window.data1);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MINIMIZED:
|
case SDL_WINDOWEVENT_MINIMIZED:
|
||||||
handleSystemEvent(EVENT_WINDOW_MINIMIZED);
|
handleSystemEvent(EVENT_WINDOW_MINIMIZED);
|
||||||
|
@ -183,21 +198,22 @@ void EventHandlerSDL2::pollEvent()
|
||||||
#ifdef JOYSTICK_SUPPORT
|
#ifdef JOYSTICK_SUPPORT
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
EventHandlerSDL2::JoystickSDL2::JoystickSDL2(int idx)
|
EventHandlerSDL2::JoystickSDL2::JoystickSDL2(int idx)
|
||||||
: stick(NULL)
|
: myStick(NULL)
|
||||||
{
|
{
|
||||||
stick = SDL_JoystickOpen(idx);
|
myStick = SDL_JoystickOpen(idx);
|
||||||
if(stick)
|
if(myStick)
|
||||||
{
|
{
|
||||||
initialize(SDL_JoystickName(stick), SDL_JoystickNumAxes(stick),
|
initialize(SDL_JoystickName(myStick),
|
||||||
SDL_JoystickNumButtons(stick), SDL_JoystickNumHats(stick));
|
SDL_JoystickNumAxes(myStick), SDL_JoystickNumButtons(myStick),
|
||||||
|
SDL_JoystickNumHats(myStick), SDL_JoystickNumBalls(myStick));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
EventHandlerSDL2::JoystickSDL2::~JoystickSDL2()
|
EventHandlerSDL2::JoystickSDL2::~JoystickSDL2()
|
||||||
{
|
{
|
||||||
if(stick)
|
if(myStick)
|
||||||
SDL_JoystickClose(stick);
|
SDL_JoystickClose(myStick);
|
||||||
stick = NULL;
|
myStick = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,13 +50,18 @@ class EventHandlerSDL2 : public EventHandler
|
||||||
*/
|
*/
|
||||||
void initializeJoysticks();
|
void initializeJoysticks();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enable/disable text events (distinct from single-key events).
|
||||||
|
*/
|
||||||
|
void enableTextEvents(bool enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Collects and dispatches any pending SDL2 events.
|
Collects and dispatches any pending SDL2 events.
|
||||||
*/
|
*/
|
||||||
void pollEvent();
|
void pollEvent();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Event event;
|
SDL_Event myEvent;
|
||||||
|
|
||||||
#ifdef JOYSTICK_SUPPORT
|
#ifdef JOYSTICK_SUPPORT
|
||||||
// A thin wrapper around a basic StellaJoystick, holding the pointer to
|
// A thin wrapper around a basic StellaJoystick, holding the pointer to
|
||||||
|
@ -68,7 +73,7 @@ class EventHandlerSDL2 : public EventHandler
|
||||||
virtual ~JoystickSDL2();
|
virtual ~JoystickSDL2();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Joystick* stick;
|
SDL_Joystick* myStick;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -280,7 +280,22 @@ int DataGridWidget::findItem(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
bool DataGridWidget::handleText(char text)
|
||||||
|
{
|
||||||
|
if (_editMode)
|
||||||
|
{
|
||||||
|
// Class EditableWidget handles all text editing related key presses for us
|
||||||
|
if(EditableWidget::handleText(text))
|
||||||
|
{
|
||||||
|
setDirty(); draw();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Ignore all mod keys
|
// Ignore all mod keys
|
||||||
if(instance().eventHandler().kbdControl(mod) ||
|
if(instance().eventHandler().kbdControl(mod) ||
|
||||||
|
@ -290,16 +305,8 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
if (_editMode)
|
if (!_editMode)
|
||||||
{
|
{
|
||||||
// Class EditableWidget handles all text editing related key presses for us
|
|
||||||
handled = EditableWidget::handleKeyDown(key, mod, ascii);
|
|
||||||
if(handled)
|
|
||||||
setDirty(); draw();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// not editmode
|
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_RETURN:
|
case KBDK_RETURN:
|
||||||
|
@ -409,53 +416,39 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
negateCell();
|
negateCell();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KBDK_I: // invert
|
||||||
|
if(_editable)
|
||||||
|
invertCell();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_MINUS: // decrement
|
||||||
|
if(_editable)
|
||||||
|
decrementCell();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_EQUALS: // increment
|
||||||
|
if(_editable)
|
||||||
|
incrementCell();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_COMMA: // shift left
|
||||||
|
if(_editable)
|
||||||
|
lshiftCell();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_PERIOD: // shift right
|
||||||
|
if(_editable)
|
||||||
|
rshiftCell();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KBDK_Z: // zero
|
||||||
|
if(_editable)
|
||||||
|
zeroCell();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
handled = false;
|
handled = false;
|
||||||
}
|
}
|
||||||
if(!handled)
|
|
||||||
{
|
|
||||||
handled = true;
|
|
||||||
|
|
||||||
switch(ascii)
|
|
||||||
{
|
|
||||||
case 'i': // invert
|
|
||||||
case '!':
|
|
||||||
if(_editable)
|
|
||||||
invertCell();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '-': // decrement
|
|
||||||
if(_editable)
|
|
||||||
decrementCell();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '+': // increment
|
|
||||||
case '=':
|
|
||||||
if(_editable)
|
|
||||||
incrementCell();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '<': // shift left
|
|
||||||
case ',':
|
|
||||||
if(_editable)
|
|
||||||
lshiftCell();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '>': // shift right
|
|
||||||
case '.':
|
|
||||||
if(_editable)
|
|
||||||
rshiftCell();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'z': // zero
|
|
||||||
if(_editable)
|
|
||||||
zeroCell();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
handled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirty)
|
if (dirty)
|
||||||
|
@ -474,7 +467,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool DataGridWidget::handleKeyUp(StellaKey key, StellaMod mod, char ascii)
|
bool DataGridWidget::handleKeyUp(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
if (key == _currentKeyDown)
|
if (key == _currentKeyDown)
|
||||||
_currentKeyDown = KBDK_UNKNOWN;
|
_currentKeyDown = KBDK_UNKNOWN;
|
||||||
|
@ -506,7 +499,7 @@ void DataGridWidget::lostFocusWidget()
|
||||||
void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
|
void DataGridWidget::handleCommand(CommandSender* sender, int cmd,
|
||||||
int data, int id)
|
int data, int id)
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case kSetPositionCmd:
|
case kSetPositionCmd:
|
||||||
// Chain access; pass to parent
|
// Chain access; pass to parent
|
||||||
|
|
|
@ -75,8 +75,9 @@ class DataGridWidget : public EditableWidget
|
||||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseWheel(int x, int y, int direction);
|
virtual void handleMouseWheel(int x, int y, int direction);
|
||||||
virtual bool handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
virtual bool handleText(char text);
|
||||||
virtual bool handleKeyUp(StellaKey key, StellaMod mod, char ascii);
|
virtual bool handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
|
virtual bool handleKeyUp(StellaKey key, StellaMod mod);
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
virtual bool wantsFocus() { return true; }
|
virtual bool wantsFocus() { return true; }
|
||||||
|
|
|
@ -86,26 +86,26 @@ void DebuggerDialog::loadConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
bool handled = instance().eventHandler().kbdAlt(mod);
|
bool handled = instance().eventHandler().kbdAlt(mod);
|
||||||
if(handled)
|
if(handled)
|
||||||
{
|
{
|
||||||
switch(ascii)
|
switch(key)
|
||||||
{
|
{
|
||||||
case 's':
|
case KBDK_S:
|
||||||
doStep();
|
doStep();
|
||||||
break;
|
break;
|
||||||
case 't':
|
case KBDK_T:
|
||||||
doTrace();
|
doTrace();
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case KBDK_F:
|
||||||
doAdvance();
|
doAdvance();
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case KBDK_L:
|
||||||
doScanlineAdvance();
|
doScanlineAdvance();
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case KBDK_R:
|
||||||
doRewind();
|
doRewind();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -114,7 +114,7 @@ void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!handled)
|
if(!handled)
|
||||||
Dialog::handleKeyDown(key, mod, ascii);
|
Dialog::handleKeyDown(key, mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -67,7 +67,7 @@ class DebuggerDialog : public Dialog
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
void handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
void handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
void doStep();
|
void doStep();
|
||||||
|
|
|
@ -272,7 +272,18 @@ void RomListWidget::handleMouseWheel(int x, int y, int direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool RomListWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
bool RomListWidget::handleText(char text)
|
||||||
|
{
|
||||||
|
if(_editMode)
|
||||||
|
{
|
||||||
|
// Class EditableWidget handles all text editing related key presses for us
|
||||||
|
return EditableWidget::handleText(text);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool RomListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Ignore all Alt-mod keys
|
// Ignore all Alt-mod keys
|
||||||
if(instance().eventHandler().kbdAlt(mod))
|
if(instance().eventHandler().kbdAlt(mod))
|
||||||
|
@ -281,14 +292,8 @@ bool RomListWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
int oldSelectedItem = _selectedItem;
|
int oldSelectedItem = _selectedItem;
|
||||||
|
|
||||||
if (_editMode)
|
if(!_editMode)
|
||||||
{
|
{
|
||||||
// Class EditableWidget handles all text editing related key presses for us
|
|
||||||
handled = EditableWidget::handleKeyDown(key, mod, ascii);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// not editmode
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case KBDK_SPACE:
|
case KBDK_SPACE:
|
||||||
|
@ -316,7 +321,7 @@ bool RomListWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool RomListWidget::handleKeyUp(StellaKey key, StellaMod mod, char ascii)
|
bool RomListWidget::handleKeyUp(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
if (key == _currentKeyDown)
|
if (key == _currentKeyDown)
|
||||||
_currentKeyDown = KBDK_UNKNOWN;
|
_currentKeyDown = KBDK_UNKNOWN;
|
||||||
|
|
|
@ -68,8 +68,9 @@ class RomListWidget : public EditableWidget
|
||||||
void handleMouseDown(int x, int y, int button, int clickCount);
|
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
void handleMouseUp(int x, int y, int button, int clickCount);
|
void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
void handleMouseWheel(int x, int y, int direction);
|
void handleMouseWheel(int x, int y, int direction);
|
||||||
bool handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
bool handleText(char text);
|
||||||
bool handleKeyUp(StellaKey key, StellaMod mod, char ascii);
|
bool handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
|
bool handleKeyUp(StellaKey key, StellaMod mod);
|
||||||
bool handleEvent(Event::Type e);
|
bool handleEvent(Event::Type e);
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ class TiaOutputWidget : public Widget, public CommandSender
|
||||||
/*
|
/*
|
||||||
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseWheel(int x, int y, int direction);
|
virtual void handleMouseWheel(int x, int y, int direction);
|
||||||
virtual bool handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
virtual bool handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
virtual bool handleKeyUp(StellaKey key, StellaMod mod, char ascii);
|
virtual bool handleKeyUp(StellaKey key, StellaMod mod);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -93,7 +93,7 @@ int ToggleWidget::findItem(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Ignore all mod keys
|
// Ignore all mod keys
|
||||||
if(instance().eventHandler().kbdControl(mod) ||
|
if(instance().eventHandler().kbdControl(mod) ||
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ToggleWidget : public Widget, public CommandSender
|
||||||
|
|
||||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
virtual bool handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
virtual bool handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
virtual bool wantsFocus() { return true; }
|
virtual bool wantsFocus() { return true; }
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
|
@ -155,7 +154,7 @@ void EventHandler::reset(State state)
|
||||||
// We wait a little while, since 'hold' events may be present, and we want
|
// We wait a little while, since 'hold' events may be present, and we want
|
||||||
// time for the ROM to process them
|
// time for the ROM to process them
|
||||||
if(state == S_EMULATE)
|
if(state == S_EMULATE)
|
||||||
SDL_AddTimer(500, resetEventsCallback, (void*)this);
|
SDL_AddTimer(500, resetEventsCallback, (void*)this); //FIXSDL
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -338,7 +337,15 @@ void EventHandler::poll(uInt64 time)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, char ascii, bool state)
|
void EventHandler::handleTextEvent(char text)
|
||||||
|
{
|
||||||
|
// Text events are only used in GUI mode
|
||||||
|
if(myOverlay != NULL)
|
||||||
|
myOverlay->handleTextEvent(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
|
||||||
{
|
{
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
|
|
||||||
|
@ -632,7 +639,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, char ascii, bool
|
||||||
if(myState == S_EMULATE)
|
if(myState == S_EMULATE)
|
||||||
handleEvent(myKeyTable[key][kEmulationMode], state);
|
handleEvent(myKeyTable[key][kEmulationMode], state);
|
||||||
else if(myOverlay != NULL)
|
else if(myOverlay != NULL)
|
||||||
myOverlay->handleKeyEvent(key, mod, ascii, state);
|
myOverlay->handleKeyEvent(key, mod, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -2059,14 +2066,14 @@ void EventHandler::setEventState(State state)
|
||||||
// For certain ROMs it may be forced off, whatever the setting
|
// For certain ROMs it may be forced off, whatever the setting
|
||||||
myUseCtrlKeyFlag = myOSystem.settings().getBool("ctrlcombo");
|
myUseCtrlKeyFlag = myOSystem.settings().getBool("ctrlcombo");
|
||||||
|
|
||||||
// Only enable Unicode in GUI modes, since there we need it for ascii data
|
// Only enable text input in GUI modes, since in emulation mode the
|
||||||
// Otherwise, it causes a performance hit, so leave it off
|
// keyboard acts as one large joystick with many (single) buttons
|
||||||
switch(myState)
|
switch(myState)
|
||||||
{
|
{
|
||||||
case S_EMULATE:
|
case S_EMULATE:
|
||||||
myOverlay = NULL;
|
myOverlay = NULL;
|
||||||
myOSystem.sound().mute(false);
|
myOSystem.sound().mute(false);
|
||||||
//FIXME SDL_EnableUNICODE(0);
|
enableTextEvents(false);
|
||||||
if(myOSystem.console().controller(Controller::Left).type() ==
|
if(myOSystem.console().controller(Controller::Left).type() ==
|
||||||
Controller::CompuMate)
|
Controller::CompuMate)
|
||||||
myUseCtrlKeyFlag = false;
|
myUseCtrlKeyFlag = false;
|
||||||
|
@ -2075,28 +2082,28 @@ void EventHandler::setEventState(State state)
|
||||||
case S_PAUSE:
|
case S_PAUSE:
|
||||||
myOverlay = NULL;
|
myOverlay = NULL;
|
||||||
myOSystem.sound().mute(true);
|
myOSystem.sound().mute(true);
|
||||||
//FIXME SDL_EnableUNICODE(0);
|
enableTextEvents(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_MENU:
|
case S_MENU:
|
||||||
myOverlay = &myOSystem.menu();
|
myOverlay = &myOSystem.menu();
|
||||||
//FIXME SDL_EnableUNICODE(1);
|
enableTextEvents(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_CMDMENU:
|
case S_CMDMENU:
|
||||||
myOverlay = &myOSystem.commandMenu();
|
myOverlay = &myOSystem.commandMenu();
|
||||||
//FIXME SDL_EnableUNICODE(1);
|
enableTextEvents(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case S_LAUNCHER:
|
case S_LAUNCHER:
|
||||||
myOverlay = &myOSystem.launcher();
|
myOverlay = &myOSystem.launcher();
|
||||||
//FIXME SDL_EnableUNICODE(1);
|
enableTextEvents(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
case S_DEBUGGER:
|
case S_DEBUGGER:
|
||||||
myOverlay = &myOSystem.debugger();
|
myOverlay = &myOSystem.debugger();
|
||||||
//FIXME SDL_EnableUNICODE(1);
|
enableTextEvents(true);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2551,7 +2558,7 @@ EventHandler::StellaJoystick::~StellaJoystick()
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::StellaJoystick::initialize(const string& desc,
|
void EventHandler::StellaJoystick::initialize(const string& desc,
|
||||||
int axes, int buttons, int hats)
|
int axes, int buttons, int hats, int /*balls*/)
|
||||||
{
|
{
|
||||||
name = desc;
|
name = desc;
|
||||||
|
|
||||||
|
|
|
@ -325,8 +325,8 @@ class EventHandler
|
||||||
Methods which are called by derived classes to handle specific types
|
Methods which are called by derived classes to handle specific types
|
||||||
of input.
|
of input.
|
||||||
*/
|
*/
|
||||||
// TODO - adapt these to SDL2
|
void handleTextEvent(char text);
|
||||||
void handleKeyEvent(StellaKey key, StellaMod mod, char ascii, bool state);
|
void handleKeyEvent(StellaKey key, StellaMod mod, bool state);
|
||||||
void handleMouseMotionEvent(int x, int y, int xrel, int yrel, int button);
|
void handleMouseMotionEvent(int x, int y, int xrel, int yrel, int button);
|
||||||
void handleMouseButtonEvent(MouseButton b, int x, int y);
|
void handleMouseButtonEvent(MouseButton b, int x, int y);
|
||||||
void handleJoyEvent(int stick, int button, uInt8 state);
|
void handleJoyEvent(int stick, int button, uInt8 state);
|
||||||
|
@ -338,6 +338,11 @@ class EventHandler
|
||||||
*/
|
*/
|
||||||
virtual void initializeJoysticks() = 0;
|
virtual void initializeJoysticks() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enable/disable text events (distinct from single-key events).
|
||||||
|
*/
|
||||||
|
virtual void enableTextEvents(bool enable) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Collects and dispatches any pending events.
|
Collects and dispatches any pending events.
|
||||||
*/
|
*/
|
||||||
|
@ -381,7 +386,7 @@ class EventHandler
|
||||||
string about() const;
|
string about() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initialize(const string& desc, int axes, int buttons, int hats);
|
void initialize(const string& desc, int axes, int buttons, int hats, int balls);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum JoyType {
|
enum JoyType {
|
||||||
|
@ -495,9 +500,8 @@ class EventHandler
|
||||||
// a Ctrl combo when it isn't wanted)
|
// a Ctrl combo when it isn't wanted)
|
||||||
bool myUseCtrlKeyFlag;
|
bool myUseCtrlKeyFlag;
|
||||||
|
|
||||||
// A bug in the SDL video handler creates an extraneous mouse motion
|
// Sometimes an extraneous mouse motion event occurs after a video
|
||||||
// event after a video state change
|
// state change; we detect when this happens and discard the event
|
||||||
// We detect when this happens and discard the event
|
|
||||||
bool mySkipMouseMotion;
|
bool mySkipMouseMotion;
|
||||||
|
|
||||||
// Used for continuous snapshot mode
|
// Used for continuous snapshot mode
|
||||||
|
|
|
@ -288,7 +288,7 @@ void ContextMenu::handleMouseWheel(int x, int y, int direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
void ContextMenu::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
handleEvent(instance().eventHandler().eventForKey(key, kMenuMode));
|
handleEvent(instance().eventHandler().eventForKey(key, kMenuMode));
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ class ContextMenu : public Dialog, public CommandSender
|
||||||
void handleMouseMoved(int x, int y, int button);
|
void handleMouseMoved(int x, int y, int button);
|
||||||
bool handleMouseClicks(int x, int y, int button);
|
bool handleMouseClicks(int x, int y, int button);
|
||||||
void handleMouseWheel(int x, int y, int direction);
|
void handleMouseWheel(int x, int y, int direction);
|
||||||
void handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
void handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
void handleJoyDown(int stick, int button);
|
void handleJoyDown(int stick, int button);
|
||||||
void handleJoyAxis(int stick, int axis, int value);
|
void handleJoyAxis(int stick, int axis, int value);
|
||||||
bool handleJoyHat(int stick, int hat, int value);
|
bool handleJoyHat(int stick, int hat, int value);
|
||||||
|
|
|
@ -319,7 +319,15 @@ void Dialog::drawDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
void Dialog::handleText(char text)
|
||||||
|
{
|
||||||
|
// Focused widget receives text events
|
||||||
|
if(_focusedWidget)
|
||||||
|
_focusedWidget->handleText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Dialog::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Test for TAB character
|
// Test for TAB character
|
||||||
// Shift-left/shift-right cursor selects next tab
|
// Shift-left/shift-right cursor selects next tab
|
||||||
|
@ -328,8 +336,6 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
Event::Type e = Event::NoType;
|
Event::Type e = Event::NoType;
|
||||||
|
|
||||||
// Detect selection of previous and next tab headers and objects
|
// Detect selection of previous and next tab headers and objects
|
||||||
// For some strange reason, 'tab' needs to be interpreted as keycode,
|
|
||||||
// not ascii??
|
|
||||||
if(instance().eventHandler().kbdShift(mod))
|
if(instance().eventHandler().kbdShift(mod))
|
||||||
{
|
{
|
||||||
if(key == KBDK_LEFT && cycleTab(-1))
|
if(key == KBDK_LEFT && cycleTab(-1))
|
||||||
|
@ -352,18 +358,18 @@ void Dialog::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
if(!handleNavEvent(e) && _focusedWidget)
|
if(!handleNavEvent(e) && _focusedWidget)
|
||||||
{
|
{
|
||||||
if(_focusedWidget->wantsRaw() || e == Event::NoType)
|
if(_focusedWidget->wantsRaw() || e == Event::NoType)
|
||||||
_focusedWidget->handleKeyDown(key, mod, ascii);
|
_focusedWidget->handleKeyDown(key, mod);
|
||||||
else
|
else
|
||||||
_focusedWidget->handleEvent(e);
|
_focusedWidget->handleEvent(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Dialog::handleKeyUp(StellaKey key, StellaMod mod, char ascii)
|
void Dialog::handleKeyUp(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Focused widget receives keyup events
|
// Focused widget receives keyup events
|
||||||
if(_focusedWidget)
|
if(_focusedWidget)
|
||||||
_focusedWidget->handleKeyUp(key, mod, ascii);
|
_focusedWidget->handleKeyUp(key, mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -78,8 +78,9 @@ class Dialog : public GuiObject
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
void releaseFocus();
|
void releaseFocus();
|
||||||
|
|
||||||
virtual void handleKeyDown(StellaKey key, StellaMod modifiers, char ascii);
|
virtual void handleText(char text);
|
||||||
virtual void handleKeyUp(StellaKey key, StellaMod modifiers, char ascii);
|
virtual void handleKeyDown(StellaKey key, StellaMod modifiers);
|
||||||
|
virtual void handleKeyUp(StellaKey key, StellaMod modifiers);
|
||||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseWheel(int x, int y, int direction);
|
virtual void handleMouseWheel(int x, int y, int direction);
|
||||||
|
|
|
@ -56,8 +56,7 @@ void DialogContainer::updateTime(uInt64 time)
|
||||||
// Key still pressed
|
// Key still pressed
|
||||||
if(myCurrentKeyDown.keycode != 0 && myKeyRepeatTime < myTime)
|
if(myCurrentKeyDown.keycode != 0 && myKeyRepeatTime < myTime)
|
||||||
{
|
{
|
||||||
activeDialog->handleKeyDown(myCurrentKeyDown.keycode, myCurrentKeyDown.flags,
|
activeDialog->handleKeyDown(myCurrentKeyDown.keycode, myCurrentKeyDown.flags);
|
||||||
myCurrentKeyDown.ascii);
|
|
||||||
myKeyRepeatTime = myTime + kRepeatSustainDelay;
|
myKeyRepeatTime = myTime + kRepeatSustainDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,8 +142,18 @@ void DialogContainer::reStack()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void DialogContainer::handleKeyEvent(StellaKey key, StellaMod mod,
|
void DialogContainer::handleTextEvent(char text)
|
||||||
char ascii, bool state)
|
{
|
||||||
|
if(myDialogStack.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Send the event to the dialog box on the top of the stack
|
||||||
|
Dialog* activeDialog = myDialogStack.top();
|
||||||
|
activeDialog->handleText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void DialogContainer::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
|
||||||
{
|
{
|
||||||
if(myDialogStack.empty())
|
if(myDialogStack.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -155,14 +164,13 @@ void DialogContainer::handleKeyEvent(StellaKey key, StellaMod mod,
|
||||||
{
|
{
|
||||||
myCurrentKeyDown.keycode = key;
|
myCurrentKeyDown.keycode = key;
|
||||||
myCurrentKeyDown.flags = mod;
|
myCurrentKeyDown.flags = mod;
|
||||||
myCurrentKeyDown.ascii = ascii;
|
|
||||||
myKeyRepeatTime = myTime + kRepeatInitialDelay;
|
myKeyRepeatTime = myTime + kRepeatInitialDelay;
|
||||||
|
|
||||||
activeDialog->handleKeyDown(key, mod, ascii);
|
activeDialog->handleKeyDown(key, mod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
activeDialog->handleKeyUp(key, mod, ascii);
|
activeDialog->handleKeyUp(key, mod);
|
||||||
|
|
||||||
// Only stop firing events if it's the current key
|
// Only stop firing events if it's the current key
|
||||||
if (key == myCurrentKeyDown.keycode)
|
if (key == myCurrentKeyDown.keycode)
|
||||||
|
|
|
@ -65,14 +65,20 @@ class DialogContainer
|
||||||
void updateTime(uInt64 time);
|
void updateTime(uInt64 time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle a keyboard event.
|
Handle a keyboard Unicode text event.
|
||||||
|
|
||||||
@param key Actual key symbol
|
@param text Unicode character string
|
||||||
@param mod Modifiers
|
|
||||||
@param ascii ASCII translation
|
|
||||||
@param state Pressed (true) or released (false)
|
|
||||||
*/
|
*/
|
||||||
void handleKeyEvent(StellaKey key, StellaMod mod, char ascii, bool state);
|
void handleTextEvent(char text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Handle a keyboard single-key event.
|
||||||
|
|
||||||
|
@param key Actual key symbol
|
||||||
|
@param mod Modifiers
|
||||||
|
@param state Pressed (true) or released (false)
|
||||||
|
*/
|
||||||
|
void handleKeyEvent(StellaKey key, StellaMod mod, bool state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle a mouse motion event.
|
Handle a mouse motion event.
|
||||||
|
@ -166,7 +172,6 @@ class DialogContainer
|
||||||
struct {
|
struct {
|
||||||
StellaKey keycode;
|
StellaKey keycode;
|
||||||
StellaMod flags;
|
StellaMod flags;
|
||||||
char ascii;
|
|
||||||
} myCurrentKeyDown;
|
} myCurrentKeyDown;
|
||||||
uInt64 myKeyRepeatTime;
|
uInt64 myKeyRepeatTime;
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,23 @@ bool EditableWidget::tryInsertChar(char c, int pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
bool EditableWidget::handleText(char text)
|
||||||
|
{
|
||||||
|
if(!_editable)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(tryInsertChar(text, _caretPos))
|
||||||
|
{
|
||||||
|
_caretPos++;
|
||||||
|
sendCommand(EditableWidget::kChangedCmd, 0, _id);
|
||||||
|
setDirty(); draw();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
if(!_editable)
|
if(!_editable)
|
||||||
return true;
|
return true;
|
||||||
|
@ -117,24 +133,24 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
|
|
||||||
case KBDK_BACKSPACE:
|
case KBDK_BACKSPACE:
|
||||||
dirty = killChar(-1);
|
dirty = killChar(-1);
|
||||||
if(dirty) sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
if(dirty) sendCommand(EditableWidget::kChangedCmd, key, _id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_DELETE:
|
case KBDK_DELETE:
|
||||||
dirty = killChar(+1);
|
dirty = killChar(+1);
|
||||||
if(dirty) sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
if(dirty) sendCommand(EditableWidget::kChangedCmd, key, _id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_LEFT:
|
case KBDK_LEFT:
|
||||||
if(instance().eventHandler().kbdControl(mod))
|
if(instance().eventHandler().kbdControl(mod))
|
||||||
dirty = specialKeys(key, ascii);
|
dirty = specialKeys(key);
|
||||||
else if(_caretPos > 0)
|
else if(_caretPos > 0)
|
||||||
dirty = setCaretPos(_caretPos - 1);
|
dirty = setCaretPos(_caretPos - 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_RIGHT:
|
case KBDK_RIGHT:
|
||||||
if(instance().eventHandler().kbdControl(mod))
|
if(instance().eventHandler().kbdControl(mod))
|
||||||
dirty = specialKeys(key, ascii);
|
dirty = specialKeys(key);
|
||||||
else if(_caretPos < (int)_editString.size())
|
else if(_caretPos < (int)_editString.size())
|
||||||
dirty = setCaretPos(_caretPos + 1);
|
dirty = setCaretPos(_caretPos + 1);
|
||||||
break;
|
break;
|
||||||
|
@ -150,13 +166,7 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
default:
|
default:
|
||||||
if (instance().eventHandler().kbdControl(mod))
|
if (instance().eventHandler().kbdControl(mod))
|
||||||
{
|
{
|
||||||
dirty = specialKeys(key, ascii);
|
dirty = specialKeys(key);
|
||||||
}
|
|
||||||
else if (tryInsertChar(ascii, _caretPos))
|
|
||||||
{
|
|
||||||
_caretPos++;
|
|
||||||
sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
|
||||||
dirty = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
handled = false;
|
handled = false;
|
||||||
|
@ -250,7 +260,7 @@ bool EditableWidget::adjustOffset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool EditableWidget::specialKeys(StellaKey key, char ascii)
|
bool EditableWidget::specialKeys(StellaKey key)
|
||||||
{
|
{
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
|
|
||||||
|
@ -262,7 +272,7 @@ bool EditableWidget::specialKeys(StellaKey key, char ascii)
|
||||||
|
|
||||||
case KBDK_C:
|
case KBDK_C:
|
||||||
copySelectedText();
|
copySelectedText();
|
||||||
if(handled) sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_E:
|
case KBDK_E:
|
||||||
|
@ -271,27 +281,27 @@ bool EditableWidget::specialKeys(StellaKey key, char ascii)
|
||||||
|
|
||||||
case KBDK_D:
|
case KBDK_D:
|
||||||
handled = killChar(+1);
|
handled = killChar(+1);
|
||||||
if(handled) sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_K:
|
case KBDK_K:
|
||||||
handled = killLine(+1);
|
handled = killLine(+1);
|
||||||
if(handled) sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_U:
|
case KBDK_U:
|
||||||
handled = killLine(-1);
|
handled = killLine(-1);
|
||||||
if(handled) sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_V:
|
case KBDK_V:
|
||||||
pasteSelectedText();
|
pasteSelectedText();
|
||||||
if(handled) sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_W:
|
case KBDK_W:
|
||||||
handled = killLastWord();
|
handled = killLastWord();
|
||||||
if(handled) sendCommand(EditableWidget::kChangedCmd, ascii, _id);
|
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_LEFT:
|
case KBDK_LEFT:
|
||||||
|
|
|
@ -47,7 +47,8 @@ class EditableWidget : public Widget, public CommandSender
|
||||||
bool isEditable() const { return _editable; }
|
bool isEditable() const { return _editable; }
|
||||||
void setEditable(bool editable);
|
void setEditable(bool editable);
|
||||||
|
|
||||||
virtual bool handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
virtual bool handleText(char text);
|
||||||
|
virtual bool handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
|
|
||||||
// We only want to focus this widget when we can edit its contents
|
// We only want to focus this widget when we can edit its contents
|
||||||
virtual bool wantsFocus() { return _editable; }
|
virtual bool wantsFocus() { return _editable; }
|
||||||
|
@ -67,7 +68,7 @@ class EditableWidget : public Widget, public CommandSender
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Line editing
|
// Line editing
|
||||||
bool specialKeys(StellaKey key, char ascii);
|
bool specialKeys(StellaKey key);
|
||||||
bool killChar(int direction);
|
bool killChar(int direction);
|
||||||
bool killLine(int direction);
|
bool killLine(int direction);
|
||||||
bool killLastWord();
|
bool killLastWord();
|
||||||
|
|
|
@ -247,7 +247,7 @@ void EventMappingWidget::enableButtons(bool state)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool EventMappingWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
bool EventMappingWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Remap keys in remap mode
|
// Remap keys in remap mode
|
||||||
if(myRemapStatus && myActionSelected >= 0)
|
if(myRemapStatus && myActionSelected >= 0)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class EventMappingWidget : public Widget, public CommandSender
|
||||||
const StringList& actions, EventMode mode);
|
const StringList& actions, EventMode mode);
|
||||||
~EventMappingWidget();
|
~EventMappingWidget();
|
||||||
|
|
||||||
bool handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
bool handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
void handleJoyDown(int stick, int button);
|
void handleJoyDown(int stick, int button);
|
||||||
void handleJoyAxis(int stick, int axis, int value);
|
void handleJoyAxis(int stick, int axis, int value);
|
||||||
bool handleJoyHat(int stick, int hat, int value);
|
bool handleJoyHat(int stick, int hat, int value);
|
||||||
|
|
|
@ -338,15 +338,15 @@ void InputDialog::setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void InputDialog::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
void InputDialog::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Remap key events in remap mode, otherwise pass to parent dialog
|
// Remap key events in remap mode, otherwise pass to parent dialog
|
||||||
if(myEmulEventMapper->remapMode())
|
if(myEmulEventMapper->remapMode())
|
||||||
myEmulEventMapper->handleKeyDown(key, mod, ascii);
|
myEmulEventMapper->handleKeyDown(key, mod);
|
||||||
else if(myMenuEventMapper->remapMode())
|
else if(myMenuEventMapper->remapMode())
|
||||||
myMenuEventMapper->handleKeyDown(key, mod, ascii);
|
myMenuEventMapper->handleKeyDown(key, mod);
|
||||||
else
|
else
|
||||||
Dialog::handleKeyDown(key, mod, ascii);
|
Dialog::handleKeyDown(key, mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -41,7 +41,7 @@ class InputDialog : public Dialog
|
||||||
~InputDialog();
|
~InputDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
virtual void handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
virtual void handleJoyDown(int stick, int button);
|
virtual void handleJoyDown(int stick, int button);
|
||||||
virtual void handleJoyAxis(int stick, int axis, int value);
|
virtual void handleJoyAxis(int stick, int axis, int value);
|
||||||
virtual bool handleJoyHat(int stick, int hat, int value);
|
virtual bool handleJoyHat(int stick, int hat, int value);
|
||||||
|
|
|
@ -453,14 +453,14 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
// Grab the key before passing it to the actual dialog and check for
|
// Grab the key before passing it to the actual dialog and check for
|
||||||
// Control-R (reload ROM listing)
|
// Control-R (reload ROM listing)
|
||||||
if(instance().eventHandler().kbdControl(mod) && key == KBDK_R)
|
if(instance().eventHandler().kbdControl(mod) && key == KBDK_R)
|
||||||
updateListing();
|
updateListing();
|
||||||
else
|
else
|
||||||
Dialog::handleKeyDown(key, mod, ascii);
|
Dialog::handleKeyDown(key, mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -80,9 +80,9 @@ class LauncherDialog : public Dialog
|
||||||
void reload() { updateListing(); }
|
void reload() { updateListing(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
void handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
void loadConfig();
|
void loadConfig();
|
||||||
void updateListing(const string& nameToSelect = "");
|
void updateListing(const string& nameToSelect = "");
|
||||||
|
|
|
@ -240,17 +240,12 @@ int ListWidget::findItem(int x, int y) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool ListWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
bool ListWidget::handleText(char text)
|
||||||
{
|
{
|
||||||
// Ignore all Alt-mod keys
|
|
||||||
if(instance().eventHandler().kbdAlt(mod))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
int oldSelectedItem = _selectedItem;
|
int oldSelectedItem = _selectedItem;
|
||||||
|
|
||||||
if (!_editMode && _quickSelect &&
|
if (!_editMode && _quickSelect)//FIXSDL && ((isalnum(ascii)) || isspace(ascii)))
|
||||||
((isalnum(ascii)) || isspace(ascii)))
|
|
||||||
{
|
{
|
||||||
// Quick selection mode: Go to first list item starting with this key
|
// Quick selection mode: Go to first list item starting with this key
|
||||||
// (or a substring accumulated from the last couple key presses).
|
// (or a substring accumulated from the last couple key presses).
|
||||||
|
@ -259,9 +254,9 @@ bool ListWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
// method "enableQuickSelect()" or so ?
|
// method "enableQuickSelect()" or so ?
|
||||||
uInt64 time = instance().getTicks() / 1000;
|
uInt64 time = instance().getTicks() / 1000;
|
||||||
if (_quickSelectTime < time)
|
if (_quickSelectTime < time)
|
||||||
_quickSelectStr = ascii;
|
_quickSelectStr = text;
|
||||||
else
|
else
|
||||||
_quickSelectStr += ascii;
|
_quickSelectStr += text;
|
||||||
_quickSelectTime = time + _QUICK_SELECT_DELAY;
|
_quickSelectTime = time + _QUICK_SELECT_DELAY;
|
||||||
|
|
||||||
// FIXME: This is bad slow code (it scans the list linearly each time a
|
// FIXME: This is bad slow code (it scans the list linearly each time a
|
||||||
|
@ -282,11 +277,30 @@ bool ListWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
else if (_editMode)
|
else if (_editMode)
|
||||||
{
|
{
|
||||||
// Class EditableWidget handles all text editing related key presses for us
|
// Class EditableWidget handles all text editing related key presses for us
|
||||||
handled = EditableWidget::handleKeyDown(key, mod, ascii);
|
handled = EditableWidget::handleText(text);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (_selectedItem != oldSelectedItem)
|
||||||
|
{
|
||||||
|
_scrollBar->draw();
|
||||||
|
scrollToSelected();
|
||||||
|
|
||||||
|
sendCommand(ListWidget::kSelectionChangedCmd, _selectedItem, _id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool ListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
|
{
|
||||||
|
// Ignore all Alt-mod keys
|
||||||
|
if(instance().eventHandler().kbdAlt(mod))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
bool handled = true;
|
||||||
|
if (!_editMode)
|
||||||
{
|
{
|
||||||
// not editmode
|
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_SPACE:
|
case KBDK_SPACE:
|
||||||
|
@ -303,20 +317,12 @@ bool ListWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_selectedItem != oldSelectedItem)
|
|
||||||
{
|
|
||||||
_scrollBar->draw();
|
|
||||||
scrollToSelected();
|
|
||||||
|
|
||||||
sendCommand(ListWidget::kSelectionChangedCmd, _selectedItem, _id);
|
|
||||||
}
|
|
||||||
|
|
||||||
_currentKeyDown = key;
|
_currentKeyDown = key;
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool ListWidget::handleKeyUp(StellaKey key, StellaMod mod, char ascii)
|
bool ListWidget::handleKeyUp(StellaKey key, StellaMod mod)
|
||||||
{
|
{
|
||||||
if (key == _currentKeyDown)
|
if (key == _currentKeyDown)
|
||||||
_currentKeyDown = KBDK_UNKNOWN;
|
_currentKeyDown = KBDK_UNKNOWN;
|
||||||
|
|
|
@ -66,8 +66,9 @@ class ListWidget : public EditableWidget
|
||||||
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
virtual void handleMouseUp(int x, int y, int button, int clickCount);
|
||||||
virtual void handleMouseWheel(int x, int y, int direction);
|
virtual void handleMouseWheel(int x, int y, int direction);
|
||||||
virtual bool handleKeyDown(StellaKey key, StellaMod mod, char ascii);
|
virtual bool handleText(char text);
|
||||||
virtual bool handleKeyUp(StellaKey key, StellaMod mod, char ascii);
|
virtual bool handleKeyDown(StellaKey key, StellaMod mod);
|
||||||
|
virtual bool handleKeyUp(StellaKey key, StellaMod mod);
|
||||||
virtual bool handleEvent(Event::Type e);
|
virtual bool handleEvent(Event::Type e);
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,9 @@ class Widget : public GuiObject
|
||||||
virtual int getAbsX() const { return _x + _boss->getChildX(); }
|
virtual int getAbsX() const { return _x + _boss->getChildX(); }
|
||||||
virtual int getAbsY() const { return _y + _boss->getChildY(); }
|
virtual int getAbsY() const { return _y + _boss->getChildY(); }
|
||||||
|
|
||||||
virtual bool handleKeyDown(StellaKey key, StellaMod mod, char ascii) { return false; }
|
virtual bool handleText(char text) { return false; }
|
||||||
virtual bool handleKeyUp(StellaKey key, StellaMod mod, char ascii) { return false; }
|
virtual bool handleKeyDown(StellaKey key, StellaMod mod) { return false; }
|
||||||
|
virtual bool handleKeyUp(StellaKey key, StellaMod mod) { return false; }
|
||||||
virtual void handleMouseDown(int x, int y, int button, int clickCount) {}
|
virtual void handleMouseDown(int x, int y, int button, int clickCount) {}
|
||||||
virtual void handleMouseUp(int x, int y, int button, int clickCount) {}
|
virtual void handleMouseUp(int x, int y, int button, int clickCount) {}
|
||||||
virtual void handleMouseEntered(int button) {}
|
virtual void handleMouseEntered(int button) {}
|
||||||
|
|
Loading…
Reference in New Issue