mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
d/qwerty: Fix input timestamps
This commit is contained in:
parent
30c2016e81
commit
24b13de593
|
@ -19,6 +19,7 @@
|
||||||
#include "util/u_logging.h"
|
#include "util/u_logging.h"
|
||||||
#include "util/u_time.h"
|
#include "util/u_time.h"
|
||||||
#include "util/u_misc.h"
|
#include "util/u_misc.h"
|
||||||
|
#include "os/os_time.h"
|
||||||
|
|
||||||
#include "qwerty_device.h"
|
#include "qwerty_device.h"
|
||||||
|
|
||||||
|
@ -116,7 +117,9 @@ qwerty_update_inputs(struct xrt_device *xd)
|
||||||
QWERTY_TRACE(qd, "select: %u, menu: %u", qc->select_clicked, qc->menu_clicked);
|
QWERTY_TRACE(qd, "select: %u, menu: %u", qc->select_clicked, qc->menu_clicked);
|
||||||
|
|
||||||
xd->inputs[QWERTY_SELECT].value.boolean = qc->select_clicked;
|
xd->inputs[QWERTY_SELECT].value.boolean = qc->select_clicked;
|
||||||
|
xd->inputs[QWERTY_SELECT].timestamp = qc->select_timestamp;
|
||||||
xd->inputs[QWERTY_MENU].value.boolean = qc->menu_clicked;
|
xd->inputs[QWERTY_MENU].value.boolean = qc->menu_clicked;
|
||||||
|
xd->inputs[QWERTY_MENU].timestamp = qc->menu_timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -501,12 +504,33 @@ qwerty_release_all(struct qwerty_device *qd)
|
||||||
|
|
||||||
// Controller methods
|
// Controller methods
|
||||||
|
|
||||||
// clang-format off
|
void
|
||||||
void qwerty_press_select(struct qwerty_controller *qc) { qc->select_clicked = true; }
|
qwerty_press_select(struct qwerty_controller *qc)
|
||||||
void qwerty_release_select(struct qwerty_controller *qc) { qc->select_clicked = false; }
|
{
|
||||||
void qwerty_press_menu(struct qwerty_controller *qc) { qc->menu_clicked = true; }
|
qc->select_clicked = true;
|
||||||
void qwerty_release_menu(struct qwerty_controller *qc) { qc->menu_clicked = false; }
|
qc->select_timestamp = os_monotonic_get_ns();
|
||||||
// clang-format on
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
qwerty_release_select(struct qwerty_controller *qc)
|
||||||
|
{
|
||||||
|
qc->select_clicked = false;
|
||||||
|
qc->select_timestamp = os_monotonic_get_ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
qwerty_press_menu(struct qwerty_controller *qc)
|
||||||
|
{
|
||||||
|
qc->menu_clicked = true;
|
||||||
|
qc->menu_timestamp = os_monotonic_get_ns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
qwerty_release_menu(struct qwerty_controller *qc)
|
||||||
|
{
|
||||||
|
qc->menu_clicked = false;
|
||||||
|
qc->menu_timestamp = os_monotonic_get_ns();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
qwerty_follow_hmd(struct qwerty_controller *qc, bool follow)
|
qwerty_follow_hmd(struct qwerty_controller *qc, bool follow)
|
||||||
|
|
|
@ -91,7 +91,9 @@ struct qwerty_controller
|
||||||
struct qwerty_device base;
|
struct qwerty_device base;
|
||||||
|
|
||||||
bool select_clicked;
|
bool select_clicked;
|
||||||
|
int64_t select_timestamp;
|
||||||
bool menu_clicked;
|
bool menu_clicked;
|
||||||
|
int64_t menu_timestamp;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Only used when a qwerty_hmd exists in the system.
|
* Only used when a qwerty_hmd exists in the system.
|
||||||
|
|
Loading…
Reference in a new issue