0

Qt 5.1.1 タッチ サンプル アプリケーションを qtwayland モジュールで動作させたいです。

ウィンドウが表示され、Weston からタッチ トレースも取得されます。qtwayland も、タッチアップ、タッチダウン、タッチモーション用に登録されたコールバック関数でトリガーされていることがわかります。

ただし、QT は QT アプリケーションで QPushButton ハンドラを呼び出しません。

私が以下のように使用している Connect API: connect(ui->b_audio, SIGNAL(pressed()), this, SLOT(on_b_audio_clicked()));

なぜこれが起こるのか手がかりはありますか?調査してデバッグできるように、考えられる問題を提案してください。

前もって感謝します。ブーシャン。

4

2 に答える 2

0

これはhttps://bugreports.qt-project.org/browse/QTBUG-36602で、Qt 5.4.0 で回避策を用意する予定です。これを行うまでに、touch_frame は touch_motion に対して送信されているようですが、touch_up に対しては送信されていないようです。(wayland、weston、libinput の最新バージョンでテスト中)

于 2014-09-01T13:26:18.713 に答える
0

QtWayland では、QWaylandInputDevice::touch_frame() が QWindowSystemInterface::handleTouchEvent() を介して Qt 内部ウィンドウ システムにタッチ ポイントを渡します。Weston は WL_TOUCH_FRAME イベントをまったく送信しないため、ボタンまたは QML MouseArea はタッチ イベントを受信しません。次の行を、weston/src/evdev.c の evdev_flush_motion() の最後に追加できます。

notify_touch(master, time, 0, 0, 0, WL_TOUCH_FRAME);

そして、weston/src/input.c の notify_touch() を書き直します。

WL_EXPORT void
notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
         wl_fixed_t x, wl_fixed_t y, int touch_type)
{
  struct weston_compositor *ec = seat->compositor;
  struct weston_touch *touch = seat->touch;
  struct weston_touch_grab *grab = touch->grab;
  struct weston_surface *es;
  wl_fixed_t sx, sy;
  struct weston_touch *grab_touch = grab->touch;

  /* Update grab's global coordinates. */
  touch->grab_x = x;
  touch->grab_y = y;

  switch (touch_type) {
  case WL_TOUCH_DOWN:
    weston_compositor_idle_inhibit(ec);

    seat->num_tp++;

    /* the first finger down picks the surface, and all further go
     * to that surface for the remainder of the touch session i.e.
     * until all touch points are up again. */
    if (seat->num_tp == 1) {
      es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
      weston_touch_set_focus(seat, es);
    } else if (touch->focus) {
      es = (struct weston_surface *) touch->focus;
      weston_surface_from_global_fixed(es, x, y, &sx, &sy);
    } else {
      /* Unexpected condition: We have non-initial touch but
       * there is no focused surface.
       */
      weston_log("touch event received with %d points down"
           "but no surface focused\n", seat->num_tp);
      return;
    }

    grab->interface->down(grab, time, touch_id, sx, sy);
    if (seat->num_tp == 1) {
      touch->grab_serial =
        wl_display_get_serial(ec->wl_display);
      touch->grab_time = time;
      touch->grab_x = x;
      touch->grab_y = y;
    }

    break;
  case WL_TOUCH_MOTION:
    es = (struct weston_surface *) touch->focus;
    if (!es)
      break;

    weston_surface_from_global_fixed(es, x, y, &sx, &sy);
    grab->interface->motion(grab, time, touch_id, sx, sy);
    break;
  case WL_TOUCH_UP:
    weston_compositor_idle_release(ec);
    seat->num_tp--;
    grab->interface->up(grab, time, touch_id);
    break;
  case WL_TOUCH_FRAME:
    if (grab_touch->focus_resource) {
      wl_touch_send_frame(grab_touch->focus_resource);
      if (seat->num_tp == 0)
        weston_touch_set_focus(seat, NULL);
    }
  }
}

一方、weston の mt 構造体 (下記) は、現在のスロット番号のみを追跡できる int 値「slot」を使用しているため、weston はマルチタッチを適切に処理していないことがわかりました。

struct {
  int slot;
  int32_t x[MAX_SLOTS];
  int32_t y[MAX_SLOTS];
} mt;

マルチタッチ プロトコル タイプ B では、各スロットが指の接触に関連付けられ、タッチ フレーム (例: touch_down フレーム) で複数のスロット イベントを取得します。

ABS_MT_SLOT
ABS_MT_TRACKING_ID
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
ABS_MT_SLOT
ABS_MT_TRACKING_ID
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
EV_SYN

weston は最初のスロット イベントから EV_SYN イベントまでのイベントを処理し、EV_SYN が発生した場合は notify_touch() を呼び出します。したがって、weston は、notify_touch() を介して異なるスロット番号パラメーターで 2 つのタッチダウン イベントを連続して送信することはできません。

私の再実装では、mt 構造を変更します。

struct {
  int current_slot;
  uint32_t num_down_event;
  uint32_t num_motion_event;
  uint32_t num_up_event;
  int slots[MAX_CONTACTS];
  int32_t x[MAX_SLOTS];
  int32_t y[MAX_SLOTS];
} mt;
  • num_down_event: 触れた指の数を追跡する
  • num_motion_event: 指の動きを追跡する
  • num_up_event: 何本の指が持ち上げられたかを追跡します
  • スロット: すべてのタッチ フレームでスロット番号を追跡します
于 2014-01-17T10:42:44.417 に答える