← Back to team overview

touch-packages team mailing list archive

[Bug 1311699] Re: MirMotionEvent.action needs stronger typing (to MirMotionAction etc)

 

mir (0.10.0+15.04.20150107.2-0ubuntu1) vivid; urgency=medium


** Changed in: mir (Ubuntu)
   Importance: Undecided => Medium

** Changed in: mir (Ubuntu)
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to mir in Ubuntu.
https://bugs.launchpad.net/bugs/1311699

Title:
  MirMotionEvent.action needs stronger typing (to MirMotionAction etc)

Status in Mir:
  Fix Released
Status in mir package in Ubuntu:
  Fix Released

Bug description:
  MirMotionEvent.action is currently an int for legacy android
  compatibility reasons. We need to clean this up and use
  MirMotionAction properly, unlike in examples...

  MirMotionAction action =
  static_cast<MirMotionAction>(event.motion.action & ~0xff00);

  
  OLD DESCRIPTION:
  MirEvent::action is currently effectively an opaque value, as Mir headers do not specify its meaning.

  So event.h must either define counterparts to the android
  AMOTION_EVENT_ACTION_* values below or split up the action and pointer
  index into separate variables.

  """
  /* Bit shift for the action bits holding the pointer index as
   * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
   */
  #define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8

  enum {
      /* Bit mask of the parts of the action code that are the action itself.
       */
      AMOTION_EVENT_ACTION_MASK = 0xff,

      /* Bits in the action code that represent a pointer index, used with
       * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP.  Shifting
       * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
       * index where the data for the pointer going up or down can be found.
       */
      AMOTION_EVENT_ACTION_POINTER_INDEX_MASK  = 0xff00,
  """

  Right now in the "Qt compositor" code I had to resort to locally
  defining those values, which is a hack:

  ""
  // from android-input AMOTION_EVENT_ACTION_*, hidden inside mir bowels
  // mir headers should define them
  const int QtEventFeeder::MirEventActionMask = 0xff;
  const int QtEventFeeder::MirEventActionPointerIndexMask = 0xff00;
  const int QtEventFeeder::MirEventActionPointerIndexShift = 8;
  ""

To manage notifications about this bug go to:
https://bugs.launchpad.net/mir/+bug/1311699/+subscriptions