| OLD | NEW |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can | 2 // Use of this source code is governed by a BSD-style license that can |
| 3 // be found in the LICENSE file. | 3 // be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h" | 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "native_client/src/include/nacl_scoped_ptr.h" | 10 #include "native_client/src/include/nacl_scoped_ptr.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 PP_TimeTicks GetTimeStamp(PP_Resource event) { | 123 PP_TimeTicks GetTimeStamp(PP_Resource event) { |
| 124 IMPLEMENT_RESOURCE_THUNK(GetTimeStamp, event, 0.0); | 124 IMPLEMENT_RESOURCE_THUNK(GetTimeStamp, event, 0.0); |
| 125 } | 125 } |
| 126 | 126 |
| 127 uint32_t GetModifiers(PP_Resource event) { | 127 uint32_t GetModifiers(PP_Resource event) { |
| 128 IMPLEMENT_RESOURCE_THUNK(GetModifiers, event, 0); | 128 IMPLEMENT_RESOURCE_THUNK(GetModifiers, event, 0); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Mouse ----------------------------------------------------------------------- | 131 // Mouse ----------------------------------------------------------------------- |
| 132 | 132 |
| 133 PP_Resource CreateMouseInputEvent1_1(PP_Instance instance, | 133 PP_Resource CreateMouseInputEventDev(PP_Instance instance, |
| 134 PP_InputEvent_Type type, | 134 PP_InputEvent_Type type, |
| 135 PP_TimeTicks time_stamp, | 135 PP_TimeTicks time_stamp, |
| 136 uint32_t modifiers, | 136 uint32_t modifiers, |
| 137 PP_InputEvent_MouseButton mouse_button, | 137 PP_InputEvent_MouseButton mouse_button, |
| 138 const PP_Point* mouse_position, | 138 const PP_Point* mouse_position, |
| 139 int32_t click_count, | 139 int32_t click_count, |
| 140 const PP_Point* mouse_movement) { | 140 const PP_Point* mouse_movement) { |
| 141 DebugPrintf("PPB_InputEvent::CreateMouseInputEvent: instance=" | 141 DebugPrintf("PPB_InputEvent::CreateMouseInputEvent: instance=" |
| 142 "%"NACL_PRIu32", type=%d, time_stamp=%lf, modifiers=" | 142 "%"NACL_PRIu32", type=%d, time_stamp=%lf, modifiers=" |
| 143 "%"NACL_PRIu32", mouse_button=%d, x=%"NACL_PRId32", y=" | 143 "%"NACL_PRIu32", mouse_button=%d, x=%"NACL_PRId32", y=" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 159 mouse_position->y, | 159 mouse_position->y, |
| 160 click_count, | 160 click_count, |
| 161 mouse_movement->x, | 161 mouse_movement->x, |
| 162 mouse_movement->y, | 162 mouse_movement->y, |
| 163 &resource_id); | 163 &resource_id); |
| 164 if (srpc_result == NACL_SRPC_RESULT_OK) | 164 if (srpc_result == NACL_SRPC_RESULT_OK) |
| 165 return resource_id; | 165 return resource_id; |
| 166 return kInvalidResourceId; | 166 return kInvalidResourceId; |
| 167 } | 167 } |
| 168 | 168 |
| 169 PP_Resource CreateMouseInputEvent1_0(PP_Instance instance, | 169 PP_Resource CreateMouseInputEvent(PP_Instance instance, |
| 170 PP_InputEvent_Type type, | 170 PP_InputEvent_Type type, |
| 171 PP_TimeTicks time_stamp, | 171 PP_TimeTicks time_stamp, |
| 172 uint32_t modifiers, | 172 uint32_t modifiers, |
| 173 PP_InputEvent_MouseButton mouse_button, | 173 PP_InputEvent_MouseButton mouse_button, |
| 174 const PP_Point* mouse_position, | 174 const PP_Point* mouse_position, |
| 175 int32_t click_count) { | 175 int32_t click_count) { |
| 176 PP_Point mouse_movement = PP_MakePoint(0, 0); | 176 PP_Point mouse_movement = PP_MakePoint(0, 0); |
| 177 return CreateMouseInputEvent1_1(instance, type, time_stamp, modifiers, | 177 return CreateMouseInputEventDev(instance, type, time_stamp, modifiers, |
| 178 mouse_button, mouse_position, click_count, | 178 mouse_button, mouse_position, click_count, |
| 179 &mouse_movement); | 179 &mouse_movement); |
| 180 | 180 |
| 181 } | 181 } |
| 182 | 182 |
| 183 PP_Bool IsMouseInputEvent(PP_Resource resource) { | 183 PP_Bool IsMouseInputEvent(PP_Resource resource) { |
| 184 if (!IsInputEvent(resource)) | 184 if (!IsInputEvent(resource)) |
| 185 return PP_FALSE; | 185 return PP_FALSE; |
| 186 PP_InputEvent_Type type = GetType(resource); | 186 PP_InputEvent_Type type = GetType(resource); |
| 187 return PP_FromBool(type == PP_INPUTEVENT_TYPE_MOUSEDOWN || | 187 return PP_FromBool(type == PP_INPUTEVENT_TYPE_MOUSEDOWN || |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 ClearInputEventRequest, | 322 ClearInputEventRequest, |
| 323 IsInputEvent, | 323 IsInputEvent, |
| 324 ::GetType, | 324 ::GetType, |
| 325 ::GetTimeStamp, | 325 ::GetTimeStamp, |
| 326 ::GetModifiers | 326 ::GetModifiers |
| 327 }; | 327 }; |
| 328 return &input_event_interface; | 328 return &input_event_interface; |
| 329 } | 329 } |
| 330 | 330 |
| 331 // static | 331 // static |
| 332 const PPB_MouseInputEvent_1_0* PluginInputEvent::GetMouseInterface1_0() { | 332 const PPB_MouseInputEvent* PluginInputEvent::GetMouseInterface() { |
| 333 static const PPB_MouseInputEvent_1_0 mouse_input_event_interface = { | 333 static const PPB_MouseInputEvent mouse_input_event_interface = { |
| 334 CreateMouseInputEvent1_0, | 334 CreateMouseInputEvent, |
| 335 IsMouseInputEvent, | 335 IsMouseInputEvent, |
| 336 ::GetMouseButton, | 336 ::GetMouseButton, |
| 337 ::GetMousePosition, | 337 ::GetMousePosition, |
| 338 ::GetMouseClickCount | 338 ::GetMouseClickCount |
| 339 }; | 339 }; |
| 340 return &mouse_input_event_interface; | 340 return &mouse_input_event_interface; |
| 341 } | 341 } |
| 342 | 342 |
| 343 // static | 343 // static |
| 344 const PPB_MouseInputEvent* PluginInputEvent::GetMouseInterface1_1() { | 344 const PPB_MouseInputEvent_Dev* PluginInputEvent::GetMouseDevInterface() { |
| 345 static const PPB_MouseInputEvent mouse_input_event_interface = { | 345 static const PPB_MouseInputEvent_Dev mouse_input_event_interface = { |
| 346 CreateMouseInputEvent1_1, | 346 CreateMouseInputEventDev, |
| 347 IsMouseInputEvent, | 347 IsMouseInputEvent, |
| 348 ::GetMouseButton, | 348 ::GetMouseButton, |
| 349 ::GetMousePosition, | 349 ::GetMousePosition, |
| 350 ::GetMouseClickCount, | 350 ::GetMouseClickCount, |
| 351 ::GetMouseMovement | 351 ::GetMouseMovement |
| 352 }; | 352 }; |
| 353 return &mouse_input_event_interface; | 353 return &mouse_input_event_interface; |
| 354 } | 354 } |
| 355 | 355 |
| 356 // static | 356 // static |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 return input_event_data_.key_code; | 435 return input_event_data_.key_code; |
| 436 } | 436 } |
| 437 | 437 |
| 438 PP_Var PluginInputEvent::GetCharacterText() const { | 438 PP_Var PluginInputEvent::GetCharacterText() const { |
| 439 PPBVarInterface()->AddRef(character_text_); | 439 PPBVarInterface()->AddRef(character_text_); |
| 440 return character_text_; | 440 return character_text_; |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace ppapi_proxy | 443 } // namespace ppapi_proxy |
| 444 | 444 |
| OLD | NEW |