Ticket #4759: 5_-_osystem_add_support_for_scroll_lock_sci_remove_hack (SVN).patch
File 5_-_osystem_add_support_for_scroll_lock_sci_remove_hack (SVN).patch, 3.3 KB (added by , 14 years ago) |
---|
-
backends/platform/sdl/events.cpp
bool OSystem_SDL::handleKeyDown(SDL_Event &ev, Common::Event &event) { 234 234 235 235 SDLModToOSystemKeyFlags(SDL_GetModState(), event); 236 236 237 // Handle scroll lock as a key modifier 238 if (ev.key.keysym.sym == SDLK_SCROLLOCK) 239 _scrollLock = !_scrollLock; 240 241 if (_scrollLock) 242 event.kbd.flags |= Common::KBD_SCRL; 243 237 244 // Alt-Return and Alt-Enter toggle full screen mode 238 245 if (event.kbd.hasFlags(Common::KBD_ALT) && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) { 239 246 beginGFXTransaction(); … … bool OSystem_SDL::handleKeyUp(SDL_Event &ev, Common::Event &event) { 326 333 327 334 // Ctrl-Alt-<key> will change the GFX mode 328 335 SDLModToOSystemKeyFlags(SDL_GetModState(), event); 336 337 // Set the scroll lock sticky flag 338 if (_scrollLock) 339 event.kbd.flags |= Common::KBD_SCRL; 340 329 341 if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) { 330 342 // Swallow these key up events 331 343 return false; -
backends/platform/sdl/sdl.cpp
OSystem_SDL::OSystem_SDL() 232 232 _overlayscreen(0), _tmpscreen2(0), 233 233 _samplesPerSec(0), 234 234 _cdrom(0), _scalerProc(0), _modeChanged(false), _screenChangeCount(0), _dirtyChecksums(0), 235 _scrollLock(false), 235 236 _mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0), 236 237 _mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true), 237 238 _joystick(0), -
engines/sci/event.cpp
sciEvent SciEvent::getFromScummVM() { 120 120 int modifiers = em->getModifierState(); 121 121 122 122 // We add the modifier key status to buckybits 123 // SDL sends a keydown event if a modifier key is turned on and a keyup event if it's off124 //125 // FIXME: This code is semi-bogus. It only records the modifier key being *pressed*.126 // It does not track correctly whether scrolllock. is active. To do that, we127 // would have to record the fact that the modifier was pressed in global var,128 // and also watch for Common::EVENT_KEYUP events.129 // But this is still not quite good enough, because not all events might130 // pass through here (e.g. the GUI might be running with its own event loop).131 //132 // The best solution likely would be to add code to the EventManager class133 // for tracking which keys are pressed and which are not...134 if (ev.type == Common::EVENT_KEYDOWN || ev.type == Common::EVENT_KEYUP) {135 switch (ev.kbd.keycode) {136 case Common::KEYCODE_SCROLLOCK:137 if (ev.type == Common::EVENT_KEYDOWN) {138 _modifierStates |= SCI_KEYMOD_SCRLOCK;139 } else {140 _modifierStates &= ~SCI_KEYMOD_SCRLOCK;141 }142 break;143 default:144 break;145 }146 }147 123 //TODO: SCI_EVM_INSERT 148 124 149 125 input.modifiers = … … sciEvent SciEvent::getFromScummVM() { 152 128 ((modifiers & Common::KBD_SHIFT) ? SCI_KEYMOD_LSHIFT | SCI_KEYMOD_RSHIFT : 0) | 153 129 ((ev.kbd.flags & Common::KBD_NUM) ? SCI_KEYMOD_NUMLOCK : 0) | 154 130 ((ev.kbd.flags & Common::KBD_CAPS) ? SCI_KEYMOD_CAPSLOCK : 0) | 131 ((ev.kbd.flags & Common::KBD_SCRL) ? SCI_KEYMOD_SCRLOCK : 0) | 155 132 _modifierStates; 156 133 157 134 switch (ev.type) {