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

Unified Diff: ppapi/examples/mouse_lock/mouse_lock.cc

Issue 10458008: Support mouse lock in Flash fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/examples/mouse_lock/mouse_lock.cc
diff --git a/ppapi/examples/mouse_lock/mouse_lock.cc b/ppapi/examples/mouse_lock/mouse_lock.cc
index 7eec8284d0191014ef42c470863d6c6ab06c50a1..4203622c9d0a8491cbcc374bdc2d9f9054d9185e 100644
--- a/ppapi/examples/mouse_lock/mouse_lock.cc
+++ b/ppapi/examples/mouse_lock/mouse_lock.cc
@@ -15,6 +15,7 @@
#include "ppapi/cpp/logging.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/mouse_lock.h"
+#include "ppapi/cpp/private/flash_fullscreen.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/var.h"
#include "ppapi/utility/completion_callback_factory.h"
@@ -30,7 +31,8 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
pending_paint_(false),
waiting_for_flush_completion_(false),
callback_factory_(this),
- console_(NULL) {
+ console_(NULL),
+ flash_fullscreen_(this) {
}
virtual ~MyInstance() {}
@@ -66,13 +68,18 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
}
case PP_INPUTEVENT_TYPE_KEYDOWN: {
pp::KeyboardInputEvent key_event(event);
- // Lock the mouse when the Enter key is pressed.
if (key_event.GetKeyCode() == 13) {
+ // Lock the mouse when the Enter key is pressed.
if (mouse_locked_)
UnlockMouse();
else
LockMouse(callback_factory_.NewCallback(&MyInstance::DidLockMouse));
return true;
+ } else if (key_event.GetKeyCode() == 70) {
scheib 2012/05/29 21:47:14 Document in HTML how and why to enter this mode.
yzshen1 2012/05/30 06:41:30 I have revised the HTML page. I didn't do it becau
+ // Enter Flash fullscreen mode when the 'f' key is pressed.
+ if (!flash_fullscreen_.IsFullscreen())
+ flash_fullscreen_.SetFullscreen(true);
+ return true;
}
return false;
}
@@ -199,7 +206,7 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
(direction == UP && y < center_y) ||
(direction == DOWN && y > center_y) ||
(direction == LEFT && x < center_x) ||
- (direction == RIGHT && x > center_y);
+ (direction == RIGHT && x > center_x);
if (within_bound_1 && within_bound_2 && within_bound_3) {
*image.GetAddr32(pp::Point(x, y)) = foreground_color;
@@ -244,6 +251,8 @@ class MyInstance : public pp::Instance, public pp::MouseLock {
const PPB_Console_Dev* console_;
+ pp::FlashFullscreen flash_fullscreen_;
+
pp::Graphics2D device_context_;
};

Powered by Google App Engine
This is Rietveld 408576698