Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Issue 9963099: Support SDL_ActiveEvent (Closed)

Created:
8 years, 8 months ago by eugenis
Modified:
8 years, 8 months ago
CC:
native-client-reviews_googlegroups.com
Visibility:
Public.

Description

Support SDL_ActiveEvent SDL tracks three kinds of application state: SDL_APPACTIVE, SDL_APPINPUTFOCUS, and SDL_APPMOUSEFOCUS. The first corresponds to whether the window is minimized, the second to keyboard focus, and the third to whether the mouse is over the window. For NaCl, I believe the best analogues are PP_INPUTEVENT_TYPE_MOUSEENTER and PP_INPUTEVENT_TYPE_MOUSELEAVE for SDL_APPMOUSEFOCUS, keyboard focus for SDL_APPINPUTFOCUS, and page visibility for SDL_APPACTIVE. SDL_APPMOUSEFOCUS can be supported easily with SDL_NACL_PushEvent. For the other two, I believe we need new entry points, and possible even JS postMessage involvement. Page visibility is exposed in pepper 18 via pp::Instance::DidChangeView(View) and pp::View::IsPageVisible(), but that's not on stable yet. Focus should be pp::Instance::DidChangeFocus(bool), but that appears to be updated only when WebKit-internal focus changes. It doesn't notice when you switch tabs or windows, unlike DOM focus and blur events. Unclear if this is intentional or an oversight in the implementation. The main thing this buys is that SDL calls SDL_ResetKeyboard() when input focus is lost. This means it, e.g., generates a fake key-up event for Ctrl when switching tabs with Ctrl-Tab, otherwise the module keeps thinking Ctrl is held down. Some ports may also useful things with the others, such as pausing when SDL_APPACTIVE is lost. Implementation-wise, this is a little invasive as it rewrites the internal event queue to use SDL_Event as the intermediate structure as that seemed cleanest. Landing a change by David Benjamin, reviewed at https://chromiumcodereview.appspot.com/9860021/ Committed: https://code.google.com/p/naclports/source/detail?r=568

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+98 lines, -74 lines) Patch
M libraries/SDL-1.2.14/nacl-SDL-1.2.14.patch View 10 chunks +98 lines, -74 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
eugenis
8 years, 8 months ago (2012-04-03 10:34:14 UTC) #1
robertm
8 years, 8 months ago (2012-04-03 13:47:24 UTC) #2
LGTM

Powered by Google App Engine
This is Rietveld 408576698