Search
lxdream.org :: lxdream/src/display.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/display.h
changeset 614:a2d239d4438a
prev608:4f588e52bce0
next615:38b69ec2f4c8
author nkeynes
date Mon Jan 28 02:38:09 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Bug #49: Joystick support work in progress
file annotate diff log raw
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.3 @@ -123,6 +123,12 @@
1.4 uint16_t (*convert_to_dckeysym)( uint16_t keycode );
1.5
1.6 /**
1.7 + * Given a device-specific event code, return the corresponding keysym.
1.8 + * The string should be newly allocated (caller will free)
1.9 + */
1.10 + gchar *(*get_keysym_for_keycode)( uint16_t keycode );
1.11 +
1.12 + /**
1.13 * Create a render target with the given width and height.
1.14 */
1.15 render_buffer_t (*create_render_buffer)( uint32_t width, uint32_t height );
1.16 @@ -183,7 +189,7 @@
1.17
1.18 /****************** Input methods **********************/
1.19
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.22
1.23 /**
1.24 * Callback to receive mouse input events
1.25 @@ -221,13 +227,83 @@
1.26
1.27 gboolean input_is_key_registered( const gchar *keysym );
1.28
1.29 -void input_event_keydown( uint16_t keycode );
1.30 +uint16_t input_keycode_to_dckeysym( uint16_t keycode );
1.31
1.32 -void input_event_keyup( uint16_t keycode );
1.33 +/********************** Display/Input methods ***********************/
1.34 +
1.35 +/**
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.38 + */
1.39 +typedef struct input_driver {
1.40 + const char *id; /* Short identifier to display in the UI for the device (eg "JS0" ) */
1.41 +
1.42 + /**
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.46 + * be resolved.
1.47 + */
1.48 + uint16_t (*resolve_keysym)( struct input_driver *driver, const gchar *keysym );
1.49 +
1.50 + /**
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.54 + */
1.55 + uint16_t (*convert_to_dckeysym)( struct input_driver *driver, uint16_t keycode );
1.56 +
1.57 + /**
1.58 + * Given a device-specific event code, return the corresponding keysym.
1.59 + * The string should be newly allocated (caller will free)
1.60 + */
1.61 + gchar *(*get_keysym_for_keycode)( struct input_driver *driver, uint16_t keycode );
1.62 +
1.63 + /**
1.64 + * Destroy the input driver.
1.65 + */
1.66 + void (*destroy)( struct input_driver *driver );
1.67 +
1.68 +} *input_driver_t;
1.69 +
1.70 +/**
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.75 + */
1.76 +gboolean input_register_device( input_driver_t driver, uint16_t max_keycode );
1.77 +
1.78 +/**
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.82 + */
1.83 +void input_unregister_device( input_driver_t driver );
1.84 +
1.85 +/**
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.89 + */
1.90 +void display_set_focused( gboolean has_focus );
1.91 +
1.92 +void input_event_keydown( input_driver_t input, uint16_t keycode, uint32_t pressure );
1.93 +
1.94 +void input_event_keyup( input_driver_t input, uint16_t keycode, uint32_t pressure );
1.95
1.96 void input_event_mouse( uint32_t buttons, int32_t x_axis, int32_t y_axis );
1.97
1.98 -uint16_t input_keycode_to_dckeysym( uint16_t keycode );
1.99 +
1.100 +typedef void (*display_keysym_callback_t)( void *data, const gchar *keysym );
1.101 +
1.102 +/**
1.103 + * Set the keysym hook function (normally used by the UI to receive non-UI
1.104 + * input events during configuration.
1.105 + */
1.106 +void input_set_keysym_hook( display_keysym_callback_t hook, void *data );
1.107 +
1.108 +
1.109
1.110 #ifdef __cplusplus
1.111 }
.