Overview

MPX stands for Multi-pointer X, It is available in Xserver 1.7 (released in October 2009), This page describes the status of MPX/XInput 2.0 support in GTK+

Experimental Git Repository

http://git.gnome.org/cgit/gtk+?h=xi2

to download and start hacking:

$ git clone git://git.gnome.org/gtk+/
$ cd gtk
$ git checkout -b xi2
$ git pull origin xi2

General changes

  • GdkDeviceManager has been added. It's a per display object that provides functions for querying the available devices and signals for keeping track of device hierarchy changes.

  • GdkDevice is now an abstract type, its class has several vmethods for grabbing, ungrabbing, querying state, warping, ...

    • The number of axes is possibly dynamic, there is now API to get to know which are the current axes.
    • Keyboards now also have a GdkDevice assigned

    • A GdkDevice field has been added to key press/release, enter/leave, grab broken, and focus in/out events.

  • All internals in GdkDisplay and GdkWindow have been made multipointer aware: double/triple click, grabs, pointer hooks, GdkPointerWindowInfo, events selection, window cursor.

  • By default, all devices' enter/leave events are compressed so windows just get 1 pair, if gdk_window_set_support_multidevice (window, TRUE) is called, each device will generate its own pair of events.
  • GtkDeviceGroup and ::multidevice-event is the part I'm most doubtful of, since it depends on future Xorg decisions about blob events. but makes multipointer interaction quite easy, there are some tests in gtk+/tests/multidevice/.

    • It could also perhaps be moved to Gdk
  • The concept of grab ownership has been added, a device grab could optionally block other devices' events for the grab window or for the whole application. The most restrictive grabs in effect shadow the others.

X11 internal changes

  • There are several GdkDevice and GdkDeviceManager implementations, for core X events, XInput 1.x and XInput 2.x.

    • The XI1 device manager is a subclass of the core one.
    • The XI2 one is fully standalone, no core events will be selected if XI2 is used.
  • GdkEventTranslator is a new interface to translate X events to GdkEvents, both GdkDisplay and GdkDeviceManager X11 implementations implement this

    • GdkDisplay takes care of events relative to windows (configure/expose/map/unmap/...)

    • GdkDeviceManager* take care of events coming from input devices

    • All this replaces all event handling code in gdkevents-x11.c and gdkinput-*.c. Code has been kept mostly as is when refactoring, all utility and misc functions have been moved wherever it made most sense.
  • GdkEventSource replaces GdkDisplaySource, it will use all attached GdkEventTranslators on X events.

  • There is a global switch for XI2 awareness, gdk_enable_multidevice(), which must be called before gdk_display_open()

Backwards compatibility

  • Unless gdk_enable_multidevice() is called, core or XInput 1.x implementations will be used.
  • All pure GTK+ applications should work equally with a single pointer, and reasonably well with multiple pointers, multidevice awareness would obviously need changes in apps.
  • in XI2, since core devices' events may also have pressure/tilt/etc info, gimp and inkscape work with tablets out of the box :)

  • Emacs-gtk and metacity work now out of the box, since the XI2 impl isn't used by default.
  • Both DnD and XEmbed protocols will need additions for multiple pointer awareness, a backwards compatible mode has been developed for both, where the first master device is used.

Missing stuff

  • Complex GtkWidgets need multipointer awareness, this can be done one by one

  • Non-x11 backends need readapting to _gdk_windowing_* API changes and to provide a GdkDeviceManager implementation

  • gtk_grab_add() could also need per-device replacement
  • per-pointer tooltips and multiple keyboard foci? do we want to get that far?

API Additions

gdk_enable_multidevice

GdkDevice
  gdk_device_list_axes
  gdk_device_get_display
  gdk_device_get_device_type
  gdk_device_grab
  gdk_device_ungrab
  GdkGrabOwnership

GdkDeviceManager
  gdk_device_manager_get_display
  gdk_device_manager_get_devices

GdkDisplay
  GdkDisplayDeviceHooks
  gdk_display_set_device_hooks

  gdk_display_get_device_manager
  gdk_display_get_device_state
  gdk_display_get_window_at_device_position
  gdk_display_warp_device
  gdk_display_device_is_grabbed

GdkEvent
  gdk_event_get_device

GdkWindow:
  gdk_window_set_device_cursor ()
  gdk_window_get_device_cursor()
  gdk_window_get_device_position
  gdk_window_set_device_events
  gdk_window_get_device_events
  gdk_window_set_support_multidevice
  gdk_window_get_support_multidevice

API Deprecations

gdk_pointer_grab
gdk_keyboard_grab
gdk_display_pointer_ungrab
gdk_display_keyboard_ungrab
gdk_display_pointer_is_grabbed
gdk_pointer_ungrab
gdk_keyboard_ungrab
gdk_pointer_is_grabbed
gdk_input_set_extension_events

GdkDisplay:
  gdk_display_set_pointer_hooks
  gdk_set_pointer_hooks

  gdk_display_get_pointer
  gdk_display_get_window_at_pointer
  gdk_display_warp_pointer

  gdk_display_get_core_pointer
  gdk_devices_list
  gdk_device_get_core_pointer

GdkWindow:
  gdk_window_get_pointer
  gdk_window_at_pointer

http://www.x.org/wiki/Development/Documentation/MPX

Discussion

Projects/GTK+/MPX (last edited 2013-11-22 15:36:58 by WilliamJonMcCann)