Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->Linux技术 ->系统管理 ->正文

GDK Reference Manual

来源:Linux-cn.com 作者:Webmaster 时间:2007-05-05 点击: [收藏] [投稿]

  Because handling extended input devices may involve considerable overhead, they need to be turned on for each GdkWindow individually using gdk_input_set_extension_events(). (Or, more typically, for GtkWidgets, using gtk_widget_set_extension_events()). As an additional complication, depending on the support from the windowing system, its possible that a normal mouse cursor will not be displayed for a particular extension device. If an application does not want to deal with displaying a cursor itself, it can ask only to get extension events from devices that will display a cursor, by passing the GDK_EXTENSION_EVENTS_CURSOR value to gdk_input_set_extension_events(). Otherwise, the application must retrieve the device information using gdk_input_list_devices(), check the has_cursor field, and, if it is FALSE, draw a cursor itself when it receives motion events.

  Each pointing device is assigned a unique integer ID; events from a particular device can be identified by the deviceid field in the event structure. The events generated by pointer devices have also been extended to contain pressure, xtilt and ytilt fields which contain the extended information reported as additional valuators from the device. The pressure field is a a double value ranging from 0.0 to 1.0, while the tilt fields are double values ranging from -1.0 to 1.0. (With -1.0 representing the maximum title to the left or up, and 1.0 representing the maximum tilt to the right or down.)

  One additional field in each event is the source field, which contains an enumeration value describing the type of device; this currently can be one of GDK_SOURCE_MOUSE, GDK_SOURCE_PEN, GDK_SOURCE_ERASER, or GDK_SOURCE_CURSOR. This field is present to allow simple applications to (for instance) delete when they detect eraser devices without having to keep track of complicated per-device settings.

  Various aspects of each device may be configured. The easiest way of creating a GUI to allow the user to conifigure such a device is to use to use the GtkInputDialog widget in GTK+. However, even when using this widget, application writers will need to directly query and set the configuration parameters in order to save the state between invocations of the application. The configuration of devices is queried using gdk_input_list_devices. Each device must is activated using gdk_input_set_mode(), which also controls whether the device's range is mapped to the entire screen or to a single window. The mapping of the valuators of the device onto the predefined valuator types is set using gdk_input_set_axes. And the source type for each device can be set with gdk_input_set_source().

  Devices may also have associated keys or macro buttons. Such keys can be globally set to map into normal X keyboard events. The mapping is set using gdk_input_set_key().

  The interfaces in this section will most likely be considerably modified in the future to accomodate devices that may have different sets of additional valuators than the pressure xtilt and ytilt.

Details


GDK_CORE_POINTER
#define GDK_CORE_POINTER 0xfedc 

  This macro contains an integer value representing the device ID for the core pointer device.


gdk_input_list_devices ()
GList*gdk_input_list_devices(void); 

  Lists all available input devices, along with their configuration information.

  Returns : A GList of GdkDeviceInfo structures. This list is internal data of GTK+ and should not be modified or freed.

  struct GdkDeviceInfo


struct GdkDeviceInfo
{
guint32 deviceid;
gchar *name;
GdkInputSource source;
GdkInputMode mode;
gint has_cursor;/* TRUE if the X pointer follows device motion */
gint num_axes;
GdkAxisUse *axes;/* Specifies use for each axis */
gint num_keys;
GdkDeviceKey *keys;
}; 

  The GdkDeviceInfo structure contains information about a device. It has the following fields:

  guint32 deviceid a unique integer ID for this device.

  gchar *name the human-readable name for the device.

  GdkInputSource source the type of device.

  GdkInputMode mode a value indicating whether the device is enabled and how the device coordinates map to the screen.

  gint has_cursor if TRUE, a cursor will be displayed indicating the current on-screen location to the user. Otherwise, the application is responsible for drawing a cursor itself.

  gint num_axes the number of axes for this device.

  GdkAxisUse *axes a pointer to an array of GdkAxisUse values which give the mapping of axes onto the possible valuators for a GDK device.

  gint num_keys the number of macro buttons.

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:GTK v1.2 Tutorial(英文)   下一篇:Java入门(12) 事件与错误处理

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号