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

Side by Side Diff: ppapi/examples/mouse_lock/mouse_lock.cc

Issue 8072011: Only allow to lock the mouse when the tab is in fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make changes in response to review comments & sync. Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 #include <stdarg.h> 6 #include <stdarg.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "ppapi/c/dev/ppb_console_dev.h" 9 #include "ppapi/c/dev/ppb_console_dev.h"
10 #include "ppapi/c/ppb_input_event.h" 10 #include "ppapi/c/ppb_input_event.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 virtual bool HandleInputEvent(const pp::InputEvent& event) { 48 virtual bool HandleInputEvent(const pp::InputEvent& event) {
49 switch (event.GetType()) { 49 switch (event.GetType()) {
50 case PP_INPUTEVENT_TYPE_MOUSEDOWN: { 50 case PP_INPUTEVENT_TYPE_MOUSEDOWN: {
51 pp::MouseInputEvent mouse_event(event); 51 pp::MouseInputEvent mouse_event(event);
52 if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT && 52 if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT &&
53 !mouse_locked_) { 53 !mouse_locked_) {
54 LockMouse( 54 LockMouse(
55 callback_factory_.NewRequiredCallback(&MyInstance::DidLockMouse)); 55 callback_factory_.NewRequiredCallback(&MyInstance::DidLockMouse));
56 } else if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT && 56 } else if (
57 mouse_locked_) { 57 mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE &&
58 mouse_locked_) {
58 UnlockMouse(); 59 UnlockMouse();
59 } 60 }
60 return true; 61 return true;
61 } 62 }
62 case PP_INPUTEVENT_TYPE_MOUSEMOVE: { 63 case PP_INPUTEVENT_TYPE_MOUSEMOVE: {
63 pp::MouseInputEvent mouse_event(event); 64 pp::MouseInputEvent mouse_event(event);
64 mouse_movement_ = mouse_event.GetMovement(); 65 mouse_movement_ = mouse_event.GetMovement();
65 static unsigned int i = 0; 66 static unsigned int i = 0;
66 Log(PP_LOGLEVEL_LOG, "[%d] movementX: %d; movementY: %d\n", i++, 67 Log(PP_LOGLEVEL_LOG, "[%d] movementX: %d; movementY: %d\n", i++,
67 mouse_movement_.x(), mouse_movement_.y()); 68 mouse_movement_.x(), mouse_movement_.y());
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 264
264 namespace pp { 265 namespace pp {
265 266
266 // Factory function for your specialization of the Module object. 267 // Factory function for your specialization of the Module object.
267 Module* CreateModule() { 268 Module* CreateModule() {
268 return new MyModule(); 269 return new MyModule();
269 } 270 }
270 271
271 } // namespace pp 272 } // namespace pp
272 273
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents_delegate.cc ('k') | ppapi/examples/mouse_lock/mouse_lock.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698