Commit bd4609b1 authored by Matthias Clasen's avatar Matthias Clasen

Merge the xi2-for-master branch

parent a538f639
......@@ -1560,22 +1560,22 @@ if test "x$gdktarget" = "xx11"; then
fi
# set up things for XInput
if test "x$with_xinput" = "xxfree" || test "x$with_xinput" = "xyes"; then
if test "x$with_xinput" != "xno" && $PKG_CONFIG --exists "xi" ; then
AC_DEFINE(XINPUT_XFREE, 1,
[Define to 1 if XFree XInput should be used])
if $PKG_CONFIG --exists xi ; then
X_PACKAGES="$X_PACKAGES xi"
else
GTK_ADD_LIB(x_extra_libs, Xi)
fi
X_PACKAGES="$X_PACKAGES xi"
AC_CHECK_HEADER(X11/extensions/XInput2.h,
have_xinput2=yes; AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]))
else
AC_DEFINE(XINPUT_NONE, 1,
[Define to 1 if no XInput should be used])
fi
AM_CONDITIONAL(XINPUT_XFREE, test x$with_xinput = xxfree || test x$with_xinput = xyes)
AM_CONDITIONAL(XINPUT_NONE, test "x$with_xinput" = "xno")
AM_CONDITIONAL(XINPUT_XFREE, test "x$with_xinput" != "xno")
AM_CONDITIONAL(XINPUT_2, test "x$have_xinput2" = "xyes")
# Check for the RANDR extension
if $PKG_CONFIG --exists "xrandr >= 1.2.99" ; then
......@@ -1633,6 +1633,7 @@ else
XPACKAGES=
AM_CONDITIONAL(XINPUT_XFREE, false)
AM_CONDITIONAL(XINPUT_2, false)
AM_CONDITIONAL(USE_X11, false)
AM_CONDITIONAL(HAVE_X11R6, false)
fi
......
......@@ -53,7 +53,7 @@
<xi:include href="xml/threads.xml" />
<xi:include href="xml/input.xml" />
<xi:include href="xml/input_devices.xml" />
<xi:include href="xml/gdkdevicemanager.xml" />
<xi:include href="xml/pango_interaction.xml" />
<xi:include href="xml/cairo_interaction.xml" />
......
......@@ -81,6 +81,7 @@ gdk_filter_return_get_type
gdk_font_type_get_type
gdk_function_get_type
gdk_gc_values_mask_get_type
gdk_grab_ownership_get_type
gdk_grab_status_get_type
gdk_gravity_get_type
gdk_image_type_get_type
......@@ -110,8 +111,7 @@ gdk_window_type_get_type
gdk_window_type_hint_get_type
gdk_wm_decoration_get_type
gdk_wm_function_get_type
gdk_pointer_grab_info_libgtk_only
gdk_keyboard_grab_info_libgtk_only
gdk_device_grab_info_libgtk_only
gdk_add_option_entries_libgtk_only
gdk_pre_parse_libgtk_only
</SECTION>
......@@ -126,9 +126,11 @@ gdk_display_get_name
gdk_display_get_n_screens
gdk_display_get_screen
gdk_display_get_default_screen
gdk_display_get_device_manager
gdk_display_pointer_ungrab
gdk_display_keyboard_ungrab
gdk_display_pointer_is_grabbed
gdk_display_device_is_grabbed
gdk_display_beep
gdk_display_sync
gdk_display_flush
......@@ -141,10 +143,15 @@ gdk_display_add_client_message_filter
gdk_display_set_double_click_time
gdk_display_set_double_click_distance
gdk_display_get_pointer
gdk_display_get_device_state
gdk_display_get_window_at_pointer
gdk_display_get_window_at_device_position
GdkDisplayPointerHooks
gdk_display_set_pointer_hooks
GdkDisplayDeviceHooks
gdk_display_set_device_hooks
gdk_display_warp_pointer
gdk_display_warp_device
gdk_display_supports_cursor_color
gdk_display_supports_cursor_alpha
gdk_display_get_default_cursor_size
......@@ -741,6 +748,7 @@ gdk_window_get_origin
gdk_window_get_deskrelative_origin
gdk_window_get_root_coords
gdk_window_get_pointer
gdk_window_get_device_position
GdkModifierType
gdk_window_get_parent
gdk_window_get_toplevel
......@@ -762,6 +770,14 @@ gdk_window_set_functions
GdkWMFunction
gdk_get_default_root_window
<SUBSECTION>
gdk_window_get_support_multidevice
gdk_window_set_support_multidevice
gdk_window_get_device_cursor
gdk_window_set_device_cursor
gdk_window_get_device_events
gdk_window_set_device_events
<SUBSECTION>
GdkPointerHooks
gdk_set_pointer_hooks
......@@ -1027,14 +1043,22 @@ gdk_keymap_get_type
</SECTION>
<SECTION>
<TITLE>Input Devices</TITLE>
<FILE>input_devices</FILE>
<TITLE>GdkDeviceManager</TITLE>
<FILE>gdkdevicemanager</FILE>
GdkDeviceManager
GdkDevice
GdkDeviceType
GdkInputSource
GdkInputMode
GdkDeviceKey
GdkDeviceAxis
GdkAxisUse
GdkGrabOwnership
gdk_enable_multidevice
gdk_device_manager_get_display
gdk_device_manager_list_devices
<SUBSECTION>
gdk_devices_list
gdk_device_get_name
gdk_device_set_source
......@@ -1045,8 +1069,16 @@ gdk_device_set_key
gdk_device_get_key
gdk_device_set_axis_use
gdk_device_get_axis_use
gdk_device_get_core_pointer
gdk_device_get_associated_device
gdk_device_get_device_type
gdk_device_get_display
gdk_device_get_has_cursor
gdk_device_get_n_axes
gdk_device_get_core_pointer
<SUBSECTION>
gdk_device_grab
gdk_device_ungrab
<SUBSECTION>
gdk_device_get_state
......@@ -1054,16 +1086,30 @@ gdk_device_get_history
gdk_device_free_history
GdkTimeCoord
gdk_device_get_axis
gdk_device_list_axes
gdk_device_get_axis_value
<SUBSECTION>
gdk_input_set_extension_events
GdkExtensionMode
<SUBSECTION>
gdk_devices_list
gdk_device_get_core_pointer
<SUBSECTION Standard>
GDK_TYPE_AXIS_USE
GDK_TYPE_EXTENSION_MODE
GDK_TYPE_INPUT_MODE
GDK_TYPE_INPUT_SOURCE
GDK_TYPE_DEVICE_TYPE
GDK_TYPE_GRAB_OWNERSHIP
GDK_DEVICE_MANAGER
GDK_DEVICE_MANAGER_CLASS
GDK_DEVICE_MANAGER_GET_CLASS
GDK_IS_DEVICE_MANAGER
GDK_IS_DEVICE_MANAGER_CLASS
GDK_TYPE_DEVICE_MANAGER
GDK_DEVICE
GDK_DEVICE_CLASS
GDK_DEVICE_GET_CLASS
......@@ -1073,7 +1119,12 @@ GDK_TYPE_DEVICE
<SUBSECTION Private>
GdkDeviceClass
GdkDevicePrivate
GdkDeviceManagerClass
GdkDeviceManagerPrivate
gdk_device_get_type
gdk_device_manager_get_type
gdk_device_type_get_type
GDK_MAX_TIMECOORD_AXES
</SECTION>
......@@ -1101,6 +1152,9 @@ gdk_event_get_axis
gdk_event_get_coords
gdk_event_get_root_coords
gdk_event_request_motions
gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
<SUBSECTION>
gdk_event_handler_set
......@@ -1117,6 +1171,8 @@ gdk_get_show_events
gdk_set_show_events
gdk_event_set_screen
gdk_event_get_screen
gdk_event_get_device
gdk_event_set_device
<SUBSECTION>
gdk_setting_get
......@@ -1240,6 +1296,8 @@ gdk_drag_context_get_action
gdk_drag_context_get_actions
gdk_drag_context_get_suggested_action
gdk_drag_context_list_targets
gdk_drag_context_get_device
gdk_drag_context_set_device
<SUBSECTION Standard>
GDK_DRAG_CONTEXT
......
......@@ -9,3 +9,5 @@ gdk_pango_renderer_get_type
gdk_pixmap_get_type
gdk_gc_get_type
gdk_keymap_get_type
gdk_device_get_type
gdk_device_manager_get_type
<!-- ##### SECTION Title ##### -->
Input Devices
<!-- ##### SECTION Short_Description ##### -->
Functions for handling extended input devices
<!-- ##### SECTION Long_Description ##### -->
<para>
In addition to the normal keyboard and mouse input devices, GTK+ also
contains support for <firstterm>extended input devices</firstterm>. In
particular, this support is targeted at graphics tablets. Graphics
tablets typically return sub-pixel positioning information and possibly
information about the pressure and tilt of the stylus. Under
X, the support for extended devices is done through the
<firstterm>XInput</firstterm> extension.
</para>
<para>
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_devices_list(),
check the <structfield>has_cursor</structfield> field, and,
if it is %FALSE, draw a cursor itself when it receives
motion events.
</para>
<para>
Each pointing device is assigned a unique integer ID; events from a
particular device can be identified by the
<structfield>deviceid</structfield> field in the event structure. The
events generated by pointer devices have also been extended to contain
<structfield>pressure</structfield>, <structfield>xtilt</structfield>
and <structfield>ytilt</structfield> fields which contain the extended
information reported as additional <firstterm>valuators</firstterm>
from the device. The <structfield>pressure</structfield> 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 tilt to the left or up, and 1.0 representing the maximum
tilt to the right or down.)
</para>
<para>
One additional field in each event is the
<structfield>source</structfield> 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.
</para>
<para>
Various aspects of each device may be configured.
The configuration of devices is queried using gdk_devices_list().
Each device must be activated using gdk_device_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_device_set_axis_use(). And the source type for each device
can be set with gdk_device_set_source().
</para>
<para>
Devices may also have associated <firstterm>keys</firstterm>
or macro buttons. Such keys can be globally set to map
into normal X keyboard events. The mapping is set using
gdk_device_set_key().
</para>
<para>
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 <structfield>xtilt</structfield>
and <structfield>ytilt</structfield>.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GdkDevice ##### -->
<para>
A <structname>GdkDevice</structname> structure contains
a detailed description of an extended input device. All
fields are read-only; but you can use gdk_device_set_source(),
gdk_device_set_mode(), gdk_device_set_key() and gdk_device_set_axis_use()
to configure various aspects of the device.
</para>
@parent_instance: the parent instance
@name: the name of this device.
@source: the type of this device.
@mode: the mode of this device
@has_cursor: %TRUE if the pointer follows device motion.
@num_axes: the length of the @axes array.
@axes: an array of #GdkDeviceAxis, describing the axes of this device.
@num_keys: the length of the @keys array.
@keys: an array of #GdkDeviceKey, describing the mapped macro buttons
of this device.
<!-- ##### ENUM GdkInputSource ##### -->
<para>
An enumeration describing the type of an input device
in general terms.
</para>
@GDK_SOURCE_MOUSE: the device is a mouse. (This will be reported for the core
pointer, even if it is something else, such as a trackball.)
@GDK_SOURCE_PEN: the device is a stylus of a graphics tablet or similar device.
@GDK_SOURCE_ERASER: the device is an eraser. Typically, this would be the other end
of a stylus on a graphics tablet.
@GDK_SOURCE_CURSOR: the device is a graphics tablet "puck" or similar device.
<!-- ##### ENUM GdkInputMode ##### -->
<para>
An enumeration that describes the mode of an input device.
</para>
@GDK_MODE_DISABLED: the device is disabled and will not report any events.
@GDK_MODE_SCREEN: the device is enabled. The device's coordinate space
maps to the entire screen.
@GDK_MODE_WINDOW: the device is enabled. The device's coordinate space
is mapped to a single window. The manner in which this window
is chosen is undefined, but it will typically be the same
way in which the focus window for key events is determined.
<!-- ##### STRUCT GdkDeviceKey ##### -->
<para>
The <structname>GdkDeviceKey</structname> structure contains information
about the mapping of one device macro button onto a normal X key event.
It has the following fields:
</para>
@keyval: the keyval to generate when the macro button is pressed.
If this is 0, no keypress will be generated.
@modifiers: the modifiers set for the generated key event.
<!-- ##### STRUCT GdkDeviceAxis ##### -->
<para>
The <structname>GdkDeviceAxis</structname> structure contains information
about the range and mapping of a device axis.
</para>
@use: specifies how the axis is used.
@min: the minimal value that will be reported by this axis.
@max: the maximal value that will be reported by this axis.
<!-- ##### ENUM GdkAxisUse ##### -->
<para>
An enumeration describing the way in which a device
axis (valuator) maps onto the predefined valuator
types that GTK+ understands.
</para>
@GDK_AXIS_IGNORE: the axis is ignored.
@GDK_AXIS_X: the axis is used as the x axis.
@GDK_AXIS_Y: the axis is used as the y axis.
@GDK_AXIS_PRESSURE: the axis is used for pressure information.
@GDK_AXIS_XTILT: the axis is used for x tilt information.
@GDK_AXIS_YTILT: the axis is used for x tilt information.
@GDK_AXIS_WHEEL: the axis is used for wheel information.
@GDK_AXIS_LAST: a constant equal to the numerically highest axis value.
<!-- ##### FUNCTION gdk_devices_list ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gdk_device_set_source ##### -->
<para>
Sets the source type for an input device.
</para>
@device: a #GdkDevice.
@source: the source type.
<!-- ##### FUNCTION gdk_device_set_mode ##### -->
<para>
Sets a the mode of an input device. The mode controls if the
device is active and whether the device's range is mapped to the
entire screen or to a single window.
</para>
@device: a #GdkDevice.
@mode: the input mode.
@Returns: %TRUE if the mode was successfully changed.
<!-- ##### FUNCTION gdk_device_set_key ##### -->
<para>
Specifies the X key event to generate when a macro button of a device
is pressed.
</para>
@device: a #GdkDevice.
@index_: the index of the macro button to set.
@keyval: the keyval to generate.
@modifiers: the modifiers to set.
<!-- ##### FUNCTION gdk_device_set_axis_use ##### -->
<para>
Specifies how an axis of a device is used.
</para>
@device: a #GdkDevice.
@index_: the index of the axis.
@use: specifies how the axis is used.
<!-- ##### FUNCTION gdk_device_get_core_pointer ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gdk_device_get_state ##### -->
@device:
@window:
@axes:
@mask:
<!-- ##### FUNCTION gdk_device_get_history ##### -->
<para>
</para>
@device:
@window:
@start:
@stop:
@events:
@n_events:
@Returns:
<!-- ##### FUNCTION gdk_device_free_history ##### -->
<para>
Frees an array of #GdkTimeCoord that was returned by gdk_device_get_history().
</para>
@events: an array of #GdkTimeCoord.
@n_events: the length of the array.
<!-- ##### STRUCT GdkTimeCoord ##### -->
<para>
The #GdkTimeCoord structure stores a single event in a
motion history. It contains the following fields:
</para>
@time: The timestamp for this event.
@axes: the values of the device's axes.
<!-- ##### FUNCTION gdk_device_get_axis ##### -->
<para>
</para>
@device:
@axes:
@use:
@value:
@Returns:
<!-- ##### FUNCTION gdk_input_set_extension_events ##### -->
<para>
Turns extension events on or off for a particular window,
and specifies the event mask for extension events.
</para>
@window: a #GdkWindow.
@mask: the event mask
@mode: the type of extension events that are desired.
<!-- ##### ENUM GdkExtensionMode ##### -->
<para>
An enumeration used to specify which extension events
are desired for a particular widget.
</para>
@GDK_EXTENSION_EVENTS_NONE: no extension events are desired.
@GDK_EXTENSION_EVENTS_ALL: all extension events are desired.
@GDK_EXTENSION_EVENTS_CURSOR: extension events are desired only if a cursor
will be displayed for the device.
......@@ -62,6 +62,13 @@ symbol GDK_MULTIHEAD_SAFE by using the command line option
<literal>-DGTK_MULTIHEAD_SAFE=1</literal>.
</para>
<para>
Similarly, if you want to make sure that your program doesn't use any
functions which may be problematic in a multidevice setting, you can
define the preprocessor symbol GDK_MULTIDEVICE_SAFE by using the command
line option <literal>-DGTK_MULTIDEVICE_SAFE=1</literal>.
</para>
<para>
The recommended way of using GTK+ has always been to only include the
toplevel headers <filename>gtk.h</filename>, <filename>gdk.h</filename>,
......
......@@ -336,6 +336,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
<xi:include href="xml/gtktooltip.xml" />
<xi:include href="xml/gtkviewport.xml" />
<xi:include href="xml/gtkaccessible.xml" />
<xi:include href="xml/gtkdevicegroup.xml" />
</chapter>
<chapter id="AbstractObjects">
......
......@@ -79,11 +79,6 @@ gtk_accelerator_get_label
gtk_accelerator_set_default_mod_mask
gtk_accelerator_get_default_mod_mask
<SUBSECTION Private>
GtkAccelGroupEntry
GtkAccelGroupPrivate
gtk_accel_group_get_type
<SUBSECTION Standard>
GtkAccelGroupClass
GTK_TYPE_ACCEL_GROUP
......@@ -92,6 +87,11 @@ GTK_IS_ACCEL_GROUP
GTK_ACCEL_GROUP_CLASS
GTK_IS_ACCEL_GROUP_CLASS
GTK_ACCEL_GROUP_GET_CLASS
<SUBSECTION Private>
GtkAccelGroupPrivate
GtkAccelGroupEntry
gtk_accel_group_get_type
</SECTION>
<SECTION>
......@@ -263,10 +263,10 @@ gtk_action_group_add_action_with_accel
gtk_action_group_remove_action
GtkActionEntry
gtk_action_group_add_actions
gtk_action_group_add_actions_full
gtk_action_group_add_actions_full
GtkToggleActionEntry
gtk_action_group_add_toggle_actions
gtk_action_group_add_toggle_actions_full
gtk_action_group_add_toggle_actions_full
GtkRadioActionEntry
gtk_action_group_add_radio_actions
gtk_action_group_add_radio_actions_full
......@@ -782,6 +782,7 @@ gtk_combo_box_insert_text
gtk_combo_box_prepend_text
gtk_combo_box_remove_text
gtk_combo_box_get_active_text
gtk_combo_box_popup_for_device
gtk_combo_box_popup
gtk_combo_box_popdown
gtk_combo_box_get_popup_accessible
......@@ -1961,6 +1962,7 @@ gtk_menu_new
gtk_menu_set_screen
gtk_menu_reorder_child
gtk_menu_attach
gtk_menu_popup_for_device
gtk_menu_popup
gtk_menu_set_accel_group
gtk_menu_get_accel_group
......@@ -4812,15 +4814,18 @@ gtk_widget_set_parent
gtk_widget_set_parent_window
gtk_widget_get_parent_window
gtk_widget_set_events
gtk_widget_get_events
gtk_widget_add_events
gtk_widget_set_extension_events
gtk_widget_get_extension_events
gtk_widget_set_device_events
gtk_widget_get_device_events
gtk_widget_add_device_events
gtk_widget_get_toplevel
gtk_widget_get_ancestor
gtk_widget_get_colormap
gtk_widget_set_colormap
gtk_widget_get_visual
gtk_widget_get_events
gtk_widget_get_pointer
gtk_widget_is_ancestor
gtk_widget_translate_coordinates
......@@ -4938,11 +4943,14 @@ gtk_widget_is_toplevel
gtk_widget_set_window
gtk_widget_set_receives_default
gtk_widget_get_receives_default
gtk_widget_set_support_multidevice
gtk_widget_get_support_multidevice
gtk_widget_set_realized
gtk_widget_get_realized
gtk_widget_set_mapped
gtk_widget_get_mapped
gtk_widget_get_requisition
gtk_widget_device_is_shadowed
<SUBSECTION>
gtk_requisition_copy
......@@ -5091,6 +5099,7 @@ gtk_window_group_new
gtk_window_group_add_window
gtk_window_group_remove_window
gtk_window_group_list_windows
gtk_window_group_get_current_device_grab
<SUBSECTION Standard>
GTK_IS_WINDOW_GROUP
GTK_IS_WINDOW_GROUP_CLASS
......@@ -5132,6 +5141,8 @@ gtk_false
gtk_grab_add
gtk_grab_get_current
gtk_grab_remove
gtk_device_grab_add
gtk_device_grab_remove
<SUBSECTION>
gtk_init_add
......@@ -5153,6 +5164,7 @@ gtk_key_snooper_remove
gtk_get_current_event
gtk_get_current_event_time
gtk_get_current_event_state
gtk_get_current_event_device
gtk_get_event_widget
gtk_propagate_event
......
......@@ -77,6 +77,9 @@ gdk_public_h_sources = \
gdkcairo.h \
gdkcolor.h \
gdkcursor.h \
gdkdevice.h \
gdkdevicemanager.h \
gdkdeviceprivate.h \
gdkdisplay.h \
gdkdisplaymanager.h \
gdkdnd.h \
......@@ -122,6 +125,8 @@ gdk_c_sources = \
gdkcairo.c \
gdkcolor.c \
gdkcursor.c \
gdkdevice.c \
gdkdevicemanager.c \
gdkdisplay.c \
gdkdisplaymanager.c \
gdkdnd.c \
......
......@@ -787,5 +787,28 @@ gdk_set_program_class (const char *program_class)
gdk_progclass = g_strdup (program_class);
}
/**
* gdk_enable_multidevice:
*
* Enables multidevice support in GDK. This call must happen prior
* to gdk_display_open(), gtk_init(), gtk_init_with_args() or
* gtk_init_check() in order to take effect.
*
* Note that individual #GdkWindow<!-- -->s still need to explicitly
* enable multidevice awareness through gdk_window_set_support_multidevice().
*
* This function must be called before initializing GDK.
*
* Since: 3.0
**/
void
gdk_enable_multidevice (void)
{
if (gdk_initialized)
return;
_gdk_enable_multidevice = TRUE;
}
#define __GDK_C__
#include "gdkaliasdef.c"