15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 6a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch/* From ppb_input_event.idl modified Thu Apr 3 14:52:10 2014. */ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef PPAPI_C_PPB_INPUT_EVENT_H_ 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPAPI_C_PPB_INPUT_EVENT_H_ 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_bool.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_instance.h" 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_macros.h" 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_point.h" 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_resource.h" 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_stdint.h" 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_time.h" 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_touch_point.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ppapi/c/pp_var.h" 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0" 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 "PPB_MouseInputEvent;1.0" 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 "PPB_MouseInputEvent;1.1" 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 "PPB_WheelInputEvent;1.0" 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0" 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2 "PPB_KeyboardInputEvent;1.2" 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ 345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 "PPB_TouchInputEvent;1.0" 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define PPB_TOUCH_INPUT_EVENT_INTERFACE PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 39a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#define PPB_IME_INPUT_EVENT_INTERFACE_1_0 "PPB_IMEInputEvent;1.0" 40a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#define PPB_IME_INPUT_EVENT_INTERFACE PPB_IME_INPUT_EVENT_INTERFACE_1_0 41a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @file 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This file defines the Input Event interfaces. 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @addtogroup Enums 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @{ 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This enumeration contains the types of input events. 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef enum { 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_UNDEFINED = -1, 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a mouse button was pressed. 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_MOUSEDOWN = 0, 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a mouse button was released. 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_MOUSEUP = 1, 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a mouse button was moved when it is over the instance 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * or dragged out of it. 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_MOUSEMOVE = 2, 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that the mouse entered the instance's bounds. 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_MOUSEENTER = 3, 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a mouse left the instance's bounds. 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_MOUSELEAVE = 4, 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that the scroll wheel was used. 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class. 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_WHEEL = 5, 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a key transitioned from "up" to "down". 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /* 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * TODO(brettw) differentiate from KEYDOWN. 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6, 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a key was pressed. This does not necessarily correspond 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * to a character depending on the key and language. Use the 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * PP_INPUTEVENT_TYPE_CHAR for character input. 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_KEYDOWN = 7, 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a key was released. 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_KEYUP = 8, 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a character was typed. Use this for text input. Key 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * down events may generate 0, 1, or more than one character event depending 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * on the key, locale, and operating system. 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_CHAR = 9, 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a context menu should be shown. 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This message will be sent when the user right-clicks or performs another 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * OS-specific mouse command that should open a context menu. When this event 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * is delivered depends on the system, on some systems (Mac) it will 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * delivered after the mouse down event, and on others (Windows) it will be 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * delivered after the mouse up event. 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * You will always get the normal mouse events. For example, you may see 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * MOUSEDOWN,CONTEXTMENU,MOUSEUP or MOUSEDOWN,MOUSEUP,CONTEXTMENU. 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The return value from the event handler determines if the context menu 1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event will be passed to the page when you are using filtered input events 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * (via RequestFilteringInputEvents()). In non-filtering mode the event will 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * never be propagated and no context menu will be displayed. If you are 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * handling mouse events in filtering mode, you may want to return true from 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * this event even if you do not support a context menu to suppress the 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * default one. 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_CONTEXTMENU = 10, 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that an input method composition process has just started. 1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_IME class. 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_IME_COMPOSITION_START = 11, 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that the input method composition string is updated. 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_IME class. 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE = 12, 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that an input method composition process has completed. 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_IME class. 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13, 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that an input method committed a string. 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_IME class. 1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_IME_TEXT = 14, 1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a finger was placed on a touch-enabled device. 1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. 1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_TOUCHSTART = 15, 1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a finger was moved on a touch-enabled device. 1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. 1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_TOUCHMOVE = 16, 1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a finger was released on a touch-enabled device. 1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_TOUCHEND = 17, 1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Notification that a touch event was canceled. 1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. 1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_TYPE_TOUCHCANCEL = 18 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} PP_InputEvent_Type; 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); 1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This enumeration contains event modifier constants. Each modifier is one 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * bit. Retrieve the modifiers from an input event using the GetEventModifiers 2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * function on PPB_InputEvent. 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef enum { 2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, 2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1, 2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2, 2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3, 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4, 2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5, 2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6, 2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7, 2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8, 2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9, 2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10, 2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_ISLEFT = 1 << 11, 2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MODIFIER_ISRIGHT = 1 << 12 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} PP_InputEvent_Modifier; 2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Modifier, 4); 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This enumeration contains constants representing each mouse button. To get 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the mouse button for a mouse down or up event, use GetMouseButton on 2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * PPB_InputEvent. 2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef enum { 2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MOUSEBUTTON_NONE = -1, 2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0, 2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1, 2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2 2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} PP_InputEvent_MouseButton; 2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_MouseButton, 4); 2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef enum { 2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Request mouse input events. 2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Normally you will request mouse events by calling RequestInputEvents(). 2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The only use case for filtered events (via RequestFilteringInputEvents()) 2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * is for instances that have irregular outlines and you want to perform hit 2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * testing, which is very uncommon. Requesting non-filtered mouse events will 2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * lead to higher performance. 2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_CLASS_MOUSE = 1 << 0, 2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Requests keyboard events. Often you will want to request filtered mode 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * (via RequestFilteringInputEvents) for keyboard events so you can pass on 2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * events (by returning false) that you don't handle. For example, if you 2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * don't request filtered mode and the user pressed "Page Down" when your 2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * instance has focus, the page won't scroll which will be a poor experience. 2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * A small number of tab and window management commands like Alt-F4 are never 2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * sent to the page. You can not request these keyboard commands since it 2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * would allow pages to trap users on a page. 2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_CLASS_KEYBOARD = 1 << 1, 2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Identifies scroll wheel input event. Wheel events must be requested in 2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * filtering mode via RequestFilteringInputEvents(). This is because many 2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * wheel commands should be forwarded to the page. 2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Most instances will not need this event. Consuming wheel events by 2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * returning true from your filtered event handler will prevent the user from 2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * scrolling the page when the mouse is over the instance which can be very 2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * annoying. 2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * If you handle wheel events (for example, you have a document viewer which 2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the user can scroll), the recommended behavior is to return false only if 2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the wheel event actually causes your document to scroll. When the user 2705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * reaches the end of the document, return false to indicating that the event 2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * was not handled. This will then forward the event to the containing page 2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * for scrolling, producing the nested scrolling behavior users expect from 2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * frames in a page. 2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_CLASS_WHEEL = 1 << 2, 2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Identifies touch input events. 2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Request touch events only if you intend to handle them. If the browser 2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * knows you do not need to handle touch events, it can handle them at a 2812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * higher level and achieve higher performance. If the plugin does not 2822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * register for touch-events, then it will receive synthetic mouse events that 2832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * are generated from the touch events (e.g. mouse-down for touch-start, 2842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * mouse-move for touch-move (with left-button down), and mouse-up for 2852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * touch-end. If the plugin does register for touch events, then the synthetic 2862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * mouse events are not created. 2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, 2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 2905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Identifies IME composition input events. 2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Request this input event class if you allow on-the-spot IME input. 2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_INPUTEVENT_CLASS_IME = 1 << 4 2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} PP_InputEvent_Class; 2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4); 2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @} 2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @addtogroup Interfaces 3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @{ 3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The <code>PPB_InputEvent</code> interface contains pointers to several 3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * functions related to generic input events on the browser. 3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct PPB_InputEvent_1_0 { 3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * RequestInputEvent() requests that input events corresponding to the given 3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * input events are delivered to the instance. 3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * It's recommended that you use RequestFilteringInputEvents() for keyboard 3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * events instead of this function so that you don't interfere with normal 3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * browser accelerators. 3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * By default, no input events are delivered. Call this function with the 3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * classes of events you are interested in to have them be delivered to 3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the instance. Calling this function will override any previous setting for 3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * each specified class of input events (for example, if you previously 3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * called RequestFilteringInputEvents(), this function will set those events 3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * to non-filtering mode). 3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Input events may have high overhead, so you should only request input 3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * events that your plugin will actually handle. For example, the browser may 3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * do optimizations for scroll or touch events that can be processed 3285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * substantially faster if it knows there are no non-default receivers for 3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * that message. Requesting that such messages be delivered, even if they are 3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * processed very quickly, may have a noticeable effect on the performance of 3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the page. 3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * Note that synthetic mouse events will be generated from touch events if 3345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * (and only if) you do not request touch events. 3352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * 3365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * When requesting input events through this function, the events will be 337a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch * delivered and <i>not</i> bubbled to the default handlers. 3385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <strong>Example:</strong> 340c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * @code 3415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); 3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * RequestFilteringInputEvents(instance, 3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); 344c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * @endcode 3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param instance The <code>PP_Instance</code> of the instance requesting 3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the given events. 3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param event_classes A combination of flags from 3505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_InputEvent_Class</code> that identifies the classes of events the 3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * instance is requesting. The flags are combined by logically ORing their 3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * values. 3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return <code>PP_OK</code> if the operation succeeded, 3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or 3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_ERROR_NOTSUPPORTED</code> if one of the event class bits were 3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * illegal. In the case of an invalid bit, all valid bits will be applied 3585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * and only the illegal bits will be ignored. The most common cause of a 3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_ERROR_NOTSUPPORTED</code> return value is requesting keyboard 3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * events, these must use RequestFilteringInputEvents(). 3615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int32_t (*RequestInputEvents)(PP_Instance instance, uint32_t event_classes); 3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * RequestFilteringInputEvents() requests that input events corresponding to 3655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the given input events are delivered to the instance for filtering. 3665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * By default, no input events are delivered. In most cases you would 3685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * register to receive events by calling RequestInputEvents(). In some cases, 3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * however, you may wish to filter events such that they can be bubbled up 370a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch * to the default handlers. In this case, register for those classes of 371a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch * events using this function instead of RequestInputEvents(). 3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Filtering input events requires significantly more overhead than just 3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * delivering them to the instance. As such, you should only request 3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * filtering in those cases where it's absolutely necessary. The reason is 3765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * that it requires the browser to stop and block for the instance to handle 3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the input event, rather than sending the input event asynchronously. This 3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * can have significant overhead. 3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <strong>Example:</strong> 381c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * @code 3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); 3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * RequestFilteringInputEvents(instance, 3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); 385c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * @endcode 3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return <code>PP_OK</code> if the operation succeeded, 3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or 3895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_ERROR_NOTSUPPORTED</code> if one of the event class bits were 3905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * illegal. In the case of an invalid bit, all valid bits will be applied 3915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * and only the illegal bits will be ignored. 3925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 3935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int32_t (*RequestFilteringInputEvents)(PP_Instance instance, 3945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t event_classes); 3955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 3965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * ClearInputEventRequest() requests that input events corresponding to the 3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * given input classes no longer be delivered to the instance. 3985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 3995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * By default, no input events are delivered. If you have previously 4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * requested input events via RequestInputEvents() or 4015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * RequestFilteringInputEvents(), this function will unregister handling 4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * for the given instance. This will allow greater browser performance for 4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * those events. 4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Note that you may still get some input events after clearing the flag if 4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * they were dispatched before the request was cleared. For example, if 4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * there are 3 mouse move events waiting to be delivered, and you clear the 4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * mouse event class during the processing of the first one, you'll still 4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * receive the next two. You just won't get more events generated. 4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param instance The <code>PP_Instance</code> of the instance requesting 4125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * to no longer receive the given events. 4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param event_classes A combination of flags from 4155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_InputEvent_Class</code> that identify the classes of events the 4165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * instance is no longer interested in. 4175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*ClearInputEventRequest)(PP_Instance instance, uint32_t event_classes); 4195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * IsInputEvent() returns true if the given resource is a valid input event 4215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * resource. 4225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to a generic 4245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * resource. 4255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return <code>PP_TRUE</code> if the given resource is a valid input event 4275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * resource. 4285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Bool (*IsInputEvent)(PP_Resource resource); 4305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetType() returns the type of input event for the given input event 4325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * resource. 4335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to an input 4355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 4365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return A <code>PP_InputEvent_Type</code> if its a valid input event or 4385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_INPUTEVENT_TYPE_UNDEFINED</code> if the resource is invalid. 4395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_Type (*GetType)(PP_Resource event); 4415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetTimeStamp() Returns the time that the event was generated. This will be 4435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * before the current time since processing and dispatching the event has 4445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * some overhead. Use this value to compare the times the user generated two 4455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * events without being sensitive to variable processing time. 4465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to the event. 4485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The return value is in time ticks, which is a monotonically 4505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * increasing clock not related to the wall clock time. It will not change 4515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * if the user changes their clock or daylight savings time starts, so can 4525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * be reliably used to compare events. This means, however, that you can't 4535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * correlate event times to a particular time of day on the system clock. 4545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TimeTicks (*GetTimeStamp)(PP_Resource event); 4565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetModifiers() returns a bitfield indicating which modifiers were down 4585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * at the time of the event. This is a combination of the flags in the 4595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_InputEvent_Modifier</code> enum. 4605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to an input 4625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 4635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The modifiers associated with the event, or 0 if the given 4655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * resource is not a valid event resource. 4665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t (*GetModifiers)(PP_Resource event); 4685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 4695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct PPB_InputEvent_1_0 PPB_InputEvent; 4715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 4735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The <code>PPB_MouseInputEvent</code> interface contains pointers to several 4745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * functions related to mouse input events. 4755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 4765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct PPB_MouseInputEvent_1_1 { 4775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 4785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Create() creates a mouse input event with the given parameters. Normally 4795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * you will get a mouse event passed through the 4805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>HandleInputEvent</code> and will not need to create them, but some 4815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * applications may want to create their own for internal use. The type must 4825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * be one of the mouse event types. 4835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] instance The instance for which this event occurred. 4855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of 4875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * input event. 4885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time 4905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * when the event occurred. 4915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] modifiers A bit field combination of the 4935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_InputEvent_Modifier</code> flags. 4945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] mouse_button The button that changed for mouse down or up 4965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for 4975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * mouse move, enter, and leave events. 4985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 4995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] mouse_position A <code>Point</code> containing the x and y 5005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * position of the mouse when the event occurred. 5015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] mouse_movement The change in position of the mouse. 5035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return A <code>PP_Resource</code> containing the new mouse input event. 5055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 5065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Resource (*Create)(PP_Instance instance, 5075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_Type type, 5085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TimeTicks time_stamp, 5095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t modifiers, 5105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_MouseButton mouse_button, 5115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const struct PP_Point* mouse_position, 5125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int32_t click_count, 5135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const struct PP_Point* mouse_movement); 5145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 5155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * IsMouseInputEvent() determines if a resource is a mouse event. 5165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to an event. 5185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return <code>PP_TRUE</code> if the given resource is a valid mouse input 5205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event, otherwise <code>PP_FALSE</code>. 5215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 5225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Bool (*IsMouseInputEvent)(PP_Resource resource); 5235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 5245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetButton() returns the mouse button that generated a mouse down or up 5255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 5265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a 5285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * mouse event. 5295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The mouse button associated with mouse down and up events. This 5315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move, 5325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * enter, and leave events, and for all non-mouse events. 5335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 5345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); 5355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 5365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetPosition() returns the pixel location of a mouse input event. When 5375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * the mouse is locked, it returns the last known mouse position just as 5385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * mouse lock was entered. 5395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a 5415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * mouse event. 5425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The point associated with the mouse event, relative to the upper- 5445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * left of the instance receiving the event. These values can be negative for 5455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * mouse drags. The return value will be (0, 0) for non-mouse events. 5465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 5475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct PP_Point (*GetPosition)(PP_Resource mouse_event); 5485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /* 5495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * TODO(brettw) figure out exactly what this means. 5505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 5515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int32_t (*GetClickCount)(PP_Resource mouse_event); 5525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 5535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns the change in position of the mouse. When the mouse is locked, 5545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * although the mouse position doesn't actually change, this function 5555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * still provides movement information, which indicates what the change in 5565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * position would be had the mouse not been locked. 5575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a 5595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * mouse event. 5605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The change in position of the mouse, relative to the previous 5625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * position. 5635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 5645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct PP_Point (*GetMovement)(PP_Resource mouse_event); 5655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 5665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 5675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct PPB_MouseInputEvent_1_1 PPB_MouseInputEvent; 5685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 5695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct PPB_MouseInputEvent_1_0 { 5705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Resource (*Create)(PP_Instance instance, 5715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_Type type, 5725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TimeTicks time_stamp, 5735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t modifiers, 5745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_MouseButton mouse_button, 5755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const struct PP_Point* mouse_position, 5765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int32_t click_count); 5775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Bool (*IsMouseInputEvent)(PP_Resource resource); 5785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); 5795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct PP_Point (*GetPosition)(PP_Resource mouse_event); 5805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int32_t (*GetClickCount)(PP_Resource mouse_event); 5815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 5825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 5835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 5845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The <code>PPB_WheelIputEvent</code> interface contains pointers to several 5855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * functions related to wheel input events. 5865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 5875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct PPB_WheelInputEvent_1_0 { 5885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 5895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Create() creates a wheel input event with the given parameters. Normally 5905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * you will get a wheel event passed through the 5915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>HandleInputEvent</code> and will not need to create them, but some 5925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * applications may want to create their own for internal use. 5935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] instance The instance for which this event occurred. 5955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time 5975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * when the event occurred. 5985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 5995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] modifiers A bit field combination of the 6005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_InputEvent_Modifier</code> flags. 6015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll 6035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * amounts. 6045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] wheel_ticks The number of "clicks" of the scroll wheel that 6065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * have produced the event. 6075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] scroll_by_page When true, the user is requesting to scroll 6095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * by pages. When false, the user is requesting to scroll by lines. 6105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return A <code>PP_Resource</code> containing the new wheel input event. 6125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 6135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Resource (*Create)(PP_Instance instance, 6145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TimeTicks time_stamp, 6155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t modifiers, 6165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const struct PP_FloatPoint* wheel_delta, 6175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const struct PP_FloatPoint* wheel_ticks, 6185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Bool scroll_by_page); 6195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 6205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * IsWheelInputEvent() determines if a resource is a wheel event. 6215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] wheel_event A <code>PP_Resource</code> corresponding to an 6235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 6245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return <code>PP_TRUE</code> if the given resource is a valid wheel input 6265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 6275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 6285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Bool (*IsWheelInputEvent)(PP_Resource resource); 6295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 6305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetDelta() returns the amount vertically and horizontally the user has 6315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * requested to scroll by with their mouse wheel. A scroll down or to the 6325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * right (where the content moves up or left) is represented as positive 6335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * values, and a scroll up or to the left (where the content moves down or 6345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * right) is represented as negative values. 6355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This amount is system dependent and will take into account the user's 6375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * preferred scroll sensitivity and potentially also nonlinear acceleration 6385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * based on the speed of the scrolling. 6395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Devices will be of varying resolution. Some mice with large detents will 6415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * only generate integer scroll amounts. But fractional values are also 6425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * possible, for example, on some trackpads and newer mice that don't have 6435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * "clicks". 6445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel 6465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 6475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The vertical and horizontal scroll values. The units are either in 6495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * pixels (when scroll_by_page is false) or pages (when scroll_by_page is 6505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * true). For example, y = -3 means scroll up 3 pixels when scroll_by_page 6515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * is false, and scroll up 3 pages when scroll_by_page is true. 6525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 6535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct PP_FloatPoint (*GetDelta)(PP_Resource wheel_event); 6545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 6555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetTicks() returns the number of "clicks" of the scroll wheel 6565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * that have produced the event. The value may have system-specific 6575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * acceleration applied to it, depending on the device. The positive and 6585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * negative meanings are the same as for GetDelta(). 6595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * If you are scrolling, you probably want to use the delta values. These 6615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * tick events can be useful if you aren't doing actual scrolling and don't 6625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * want or pixel values. An example may be cycling between different items in 6635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * a game. 6645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel 6665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 6675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The number of "clicks" of the scroll wheel. You may receive 6695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * fractional values for the wheel ticks if the mouse wheel is high 6705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * resolution or doesn't have "clicks". If your program wants discrete 6715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * events (as in the "picking items" example) you should accumulate 6725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * fractional click values from multiple messages until the total value 6735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * reaches positive or negative one. This should represent a similar amount 6745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * of scrolling as for a mouse that has a discrete mouse wheel. 6755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 6765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct PP_FloatPoint (*GetTicks)(PP_Resource wheel_event); 6775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 6785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetScrollByPage() indicates if the scroll delta x/y indicates pages or 6795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * lines to scroll by. 6805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel 6825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 6835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 6845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return <code>PP_TRUE</code> if the event is a wheel event and the user is 6855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * scrolling by pages. <code>PP_FALSE</code> if not or if the resource is not 6865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * a wheel event. 6875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 6885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Bool (*GetScrollByPage)(PP_Resource wheel_event); 6895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 6905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 6915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct PPB_WheelInputEvent_1_0 PPB_WheelInputEvent; 6925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 6935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 6945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The <code>PPB_KeyboardInputEvent</code> interface contains pointers to 6955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * several functions related to keyboard input events. 6965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 6975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct PPB_KeyboardInputEvent_1_2 { 6985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 6995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Creates a keyboard input event with the given parameters. Normally you 7005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * will get a keyboard event passed through the HandleInputEvent and will not 7015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * need to create them, but some applications may want to create their own 7025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * for internal use. The type must be one of the keyboard event types. 7035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] instance The instance for which this event occurred. 7055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of 7075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * input event. 7085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time 7105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * when the event occurred. 7115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param[in] modifiers A bit field combination of the 7135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_InputEvent_Modifier</code> flags. 7145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] key_code This value reflects the DOM KeyboardEvent 7165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * <code>keyCode</code> field, which is the Windows-style Virtual Key 7175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * code of the key. 7185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] character_text This value represents the typed character as a 7205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * UTF-8 string. 7215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param[in] code This value represents the DOM3 |code| string that 7235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * corresponds to the physical key being pressed. 7245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 7255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return A <code>PP_Resource</code> containing the new keyboard input 7265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 7275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 7285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Resource (*Create)(PP_Instance instance, 7295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_Type type, 7305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TimeTicks time_stamp, 7315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t modifiers, 7325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t key_code, 7335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct PP_Var character_text, 7345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct PP_Var code); 7355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 7365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * IsKeyboardInputEvent() determines if a resource is a keyboard event. 7375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to an event. 7395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return <code>PP_TRUE</code> if the given resource is a valid input event. 7415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 7425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); 7435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 7445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetKeyCode() returns the DOM keyCode field for the keyboard event. 7455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Chrome populates this with the Windows-style Virtual Key code of the key. 7465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] key_event A <code>PP_Resource</code> corresponding to a 7485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * keyboard event. 7495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The DOM keyCode field for the keyboard event. 7515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 7525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t (*GetKeyCode)(PP_Resource key_event); 7535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 7545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * GetCharacterText() returns the typed character as a UTF-8 string for the 7555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * given character event. 7565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] character_event A <code>PP_Resource</code> corresponding to a 7585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * keyboard event. 7595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return A string var representing a single typed character for character 7615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * input events. For non-character input events the return value will be an 7625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * undefined var. 7635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 7645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct PP_Var (*GetCharacterText)(PP_Resource character_event); 7655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) /** 7665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * GetCode() returns the DOM |code| field for this keyboard event, as 7675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * defined in the DOM3 Events spec: 7685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * http://www.w3.org/TR/DOM-Level-3-Events/ 7695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 7705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @param[in] key_event The key event for which to return the key code. 7715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * 7725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @return The string that contains the DOM |code| for the keyboard event. 7735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 7745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct PP_Var (*GetCode)(PP_Resource key_event); 7755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 7765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 7775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)typedef struct PPB_KeyboardInputEvent_1_2 PPB_KeyboardInputEvent; 7785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 7795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct PPB_KeyboardInputEvent_1_0 { 7805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_Resource (*Create)(PP_Instance instance, 7815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_InputEvent_Type type, 7825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_TimeTicks time_stamp, 7835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) uint32_t modifiers, 7845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) uint32_t key_code, 7855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct PP_Var character_text); 7865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); 7875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) uint32_t (*GetKeyCode)(PP_Resource key_event); 7885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) struct PP_Var (*GetCharacterText)(PP_Resource character_event); 7895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}; 7905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 7915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @} 7925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 7935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 7945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 7955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @addtogroup Enums 7965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @{ 7975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 7985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef enum { 7995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 8005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The list of all TouchPoints which are currently down. 8015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TOUCHLIST_TYPE_TOUCHES = 0, 8035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 8045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The list of all TouchPoints whose state has changed since the last 8055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * TouchInputEvent. 8065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TOUCHLIST_TYPE_CHANGEDTOUCHES = 1, 8085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 8095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The list of all TouchPoints which are targeting this plugin. This is a 8105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * subset of Touches. 8115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TOUCHLIST_TYPE_TARGETTOUCHES = 2 8135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} PP_TouchListType; 8145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TouchListType, 4); 8155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 8165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @} 8175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 8195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 8205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @addtogroup Interfaces 8215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @{ 8225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 8245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * The <code>PPB_TouchInputEvent</code> interface contains pointers to several 8255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * functions related to touch events. 8265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct PPB_TouchInputEvent_1_0 { 8285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 8295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Creates a touch input event with the given parameters. Normally you 8305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * will get a touch event passed through the HandleInputEvent and will not 8315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * need to create them, but some applications may want to create their own 8325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * for internal use. The type must be one of the touch event types. 8335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This newly created touch input event does not have any touch point in any 8345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * of the touch-point lists. <code>AddTouchPoint</code> should be called to 8355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * add the touch-points. 8365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] instance The instance for which this event occurred. 8385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of 8405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * input event. 8415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time 8435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * when the event occurred. 8445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] modifiers A bit field combination of the 8465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <code>PP_InputEvent_Modifier</code> flags. 8475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return A <code>PP_Resource</code> containing the new touch input event. 8495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Resource (*Create)(PP_Instance instance, 8515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_InputEvent_Type type, 8525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TimeTicks time_stamp, 8535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t modifiers); 8545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 8555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Adds a touch point to the touch event in the specified touch-list. 8565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] touch_event A <code>PP_Resource</code> corresponding to a touch 8585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 8595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] list The list to add the touch point to. 8615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] point The point to add to the list. 8635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void (*AddTouchPoint)(PP_Resource touch_event, 8655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TouchListType list, 8665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const struct PP_TouchPoint* point); 8675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 8685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * IsTouchInputEvent() determines if a resource is a touch event. 8695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to an event. 8715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return <code>PP_TRUE</code> if the given resource is a valid touch input 8735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event, otherwise <code>PP_FALSE</code>. 8745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_Bool (*IsTouchInputEvent)(PP_Resource resource); 8765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 8775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns the number of touch-points in the specified list. 8785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to a touch 8805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 8815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] list The list. 8835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return The number of touch-points in the specified list. 8855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t (*GetTouchCount)(PP_Resource resource, PP_TouchListType list); 8875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 8885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Returns the touch-point at the specified index from the specified list. 8895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to a touch 8915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 8925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] list The list. 8945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] index The index. 8965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 8975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return A <code>PP_TouchPoint</code> representing the touch-point. 8985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 8995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct PP_TouchPoint (*GetTouchByIndex)(PP_Resource resource, 9005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TouchListType list, 9015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t index); 9025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /** 903c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * Returns the touch-point with the specified touch-id in the specified list. 9045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 9055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to a touch 9065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * event. 9075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 9085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] list The list. 9095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 9105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @param[in] touch_id The id of the touch-point. 9115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 9125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @return A <code>PP_TouchPoint</code> representing the touch-point. 9135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 9145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct PP_TouchPoint (*GetTouchById)(PP_Resource resource, 9155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PP_TouchListType list, 9165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint32_t touch_id); 9175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 9185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 9195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)typedef struct PPB_TouchInputEvent_1_0 PPB_TouchInputEvent; 920a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 921a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)struct PPB_IMEInputEvent_1_0 { 922a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) /** 923a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * Create() creates an IME input event with the given parameters. Normally 924a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * you will get an IME event passed through the <code>HandleInputEvent</code> 925a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * and will not need to create them, but some applications may want to create 926a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * their own for internal use. 927a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 928a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] instance The instance for which this event occurred. 929a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 930a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of 931a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * input event. The type must be one of the IME event types. 932a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 933a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time 934a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * when the event occurred. 935a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 936a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] text The string returned by <code>GetText</code>. 937a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 938a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] segment_number The number returned by 939a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * <code>GetSegmentNumber</code>. 940a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 941a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] segment_offsets The array of numbers returned by 942a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * <code>GetSegmentOffset</code>. If <code>segment_number</code> is zero, 943a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * the number of elements of the array should be zero. If 944a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * <code>segment_number</code> is non-zero, the length of the array must be 945a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * <code>segment_number</code> + 1. 946a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 947a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] target_segment The number returned by 948a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * <code>GetTargetSegment</code>. 949a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 950a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] selection_start The start index returned by 951a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * <code>GetSelection</code>. 952a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 953a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] selection_end The end index returned by 954a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * <code>GetSelection</code>. 955a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 956a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @return A <code>PP_Resource</code> containing the new IME input event. 957a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) */ 958a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) PP_Resource (*Create)(PP_Instance instance, 959a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) PP_InputEvent_Type type, 960a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) PP_TimeTicks time_stamp, 961a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) struct PP_Var text, 962a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) uint32_t segment_number, 963a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) const uint32_t segment_offsets[], 964a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) int32_t target_segment, 965a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) uint32_t selection_start, 966a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) uint32_t selection_end); 967a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) /** 968a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * IsIMEInputEvent() determines if a resource is an IME event. 969a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 970a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] resource A <code>PP_Resource</code> corresponding to an event. 971a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 972a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @return <code>PP_TRUE</code> if the given resource is a valid input event. 973a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) */ 974a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) PP_Bool (*IsIMEInputEvent)(PP_Resource resource); 975a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) /** 976a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * GetText() returns the composition text as a UTF-8 string for the given IME 977a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * event. 978a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 979a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME 980a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * event. 981a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 982a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @return A string var representing the composition text. For non-IME input 983a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * events the return value will be an undefined var. 984a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) */ 985a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) struct PP_Var (*GetText)(PP_Resource ime_event); 986a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) /** 987a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * GetSegmentNumber() returns the number of segments in the composition text. 988a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 989a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME 990a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * event. 991a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 992a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @return The number of segments. For events other than COMPOSITION_UPDATE, 993a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * returns 0. 994a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) */ 995a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) uint32_t (*GetSegmentNumber)(PP_Resource ime_event); 996a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) /** 997a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * GetSegmentOffset() returns the position of the index-th segmentation point 998a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * in the composition text. The position is given by a byte-offset (not a 999a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * character-offset) of the string returned by GetText(). It always satisfies 1000a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) 1001a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). 1002a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range 1003a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * of the i-th segment, and hence GetSegmentNumber() can be a valid argument 1004a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * to this function instead of an off-by-1 error. 1005a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 1006a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME 1007a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * event. 1008a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 1009a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] index An integer indicating a segment. 1010a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 1011a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @return The byte-offset of the segmentation point. If the event is not 1012a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * COMPOSITION_UPDATE or index is out of range, returns 0. 1013a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) */ 1014a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index); 1015a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) /** 1016a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * GetTargetSegment() returns the index of the current target segment of 1017a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * composition. 1018a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 1019a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME 1020a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * event. 1021a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 1022a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @return An integer indicating the index of the target segment. When there 1023a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * is no active target segment, or the event is not COMPOSITION_UPDATE, 1024a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * returns -1. 1025a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) */ 1026a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) int32_t (*GetTargetSegment)(PP_Resource ime_event); 1027a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) /** 1028a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * GetSelection() returns the range selected by caret in the composition text. 1029a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 1030a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME 1031a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * event. 1032a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 1033a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[out] start The start position of the current selection. 1034a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * 1035a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * @param[out] end The end position of the current selection. 1036a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) */ 1037a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end); 1038a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)}; 1039a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 1040a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)typedef struct PPB_IMEInputEvent_1_0 PPB_IMEInputEvent; 10415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 10425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @} 10435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1044