1.1 --- a/src/display.h Sat Jan 26 02:45:27 2008 +0000
1.2 +++ b/src/display.h Mon Jan 28 02:38:09 2008 +0000
1.4 uint16_t (*convert_to_dckeysym)( uint16_t keycode );
1.7 + * Given a device-specific event code, return the corresponding keysym.
1.8 + * The string should be newly allocated (caller will free)
1.10 + gchar *(*get_keysym_for_keycode)( uint16_t keycode );
1.13 * Create a render target with the given width and height.
1.15 render_buffer_t (*create_render_buffer)( uint32_t width, uint32_t height );
1.18 /****************** Input methods **********************/
1.20 -typedef void (*input_key_callback_t)( void *data, uint32_t value, gboolean isKeyDown );
1.21 +typedef void (*input_key_callback_t)( void *data, uint32_t value, uint32_t pressure, gboolean isKeyDown );
1.24 * Callback to receive mouse input events
1.25 @@ -221,13 +227,83 @@
1.27 gboolean input_is_key_registered( const gchar *keysym );
1.29 -void input_event_keydown( uint16_t keycode );
1.30 +uint16_t input_keycode_to_dckeysym( uint16_t keycode );
1.32 -void input_event_keyup( uint16_t keycode );
1.33 +/********************** Display/Input methods ***********************/
1.36 + * Auxilliary input driver - provides input separate to and in addition to the
1.37 + * core UI/display. (primarily used for joystick devices)
1.39 +typedef struct input_driver {
1.40 + const char *id; /* Short identifier to display in the UI for the device (eg "JS0" ) */
1.43 + * Given a particular keysym, return the keycode associated with it.
1.44 + * @param keysym The keysym to be resolved, ie "Tab"
1.45 + * @return the display-specific keycode, or 0 if the keysym cannot
1.48 + uint16_t (*resolve_keysym)( struct input_driver *driver, const gchar *keysym );
1.51 + * Given a device-specific event code, convert it to a dreamcast keyboard code.
1.52 + * This is only required for actual keyboard devices, other devices should just
1.53 + * leave this method NULL.
1.55 + uint16_t (*convert_to_dckeysym)( struct input_driver *driver, uint16_t keycode );
1.58 + * Given a device-specific event code, return the corresponding keysym.
1.59 + * The string should be newly allocated (caller will free)
1.61 + gchar *(*get_keysym_for_keycode)( struct input_driver *driver, uint16_t keycode );
1.64 + * Destroy the input driver.
1.66 + void (*destroy)( struct input_driver *driver );
1.71 + * Register a new input driver (which must have a unique name)
1.72 + * @param driver the driver to register
1.73 + * @param max_keycode the highest possible keycode reported by the device
1.74 + * @return TRUE on success, FALSE on failure (eg driver already registed).
1.76 +gboolean input_register_device( input_driver_t driver, uint16_t max_keycode );
1.79 + * Unregister an input driver.
1.80 + * @param driver the driver to unregister
1.81 + * If the driver is not in fact registered, this function has no effect.
1.83 +void input_unregister_device( input_driver_t driver );
1.86 + * Called from the UI to indicate that the emulation window is focused (ie
1.87 + * able to receive input). This method is used to gate non-UI input devices -
1.88 + * when the display is not focused, all input events will be silently ignored.
1.90 +void display_set_focused( gboolean has_focus );
1.92 +void input_event_keydown( input_driver_t input, uint16_t keycode, uint32_t pressure );
1.94 +void input_event_keyup( input_driver_t input, uint16_t keycode, uint32_t pressure );
1.96 void input_event_mouse( uint32_t buttons, int32_t x_axis, int32_t y_axis );
1.98 -uint16_t input_keycode_to_dckeysym( uint16_t keycode );
1.100 +typedef void (*display_keysym_callback_t)( void *data, const gchar *keysym );
1.103 + * Set the keysym hook function (normally used by the UI to receive non-UI
1.104 + * input events during configuration.
1.106 +void input_set_keysym_hook( display_keysym_callback_t hook, void *data );