aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorTudor Brindus <me@tbrindus.ca>2020-06-05 17:12:31 -0400
committerSimon Ser <contact@emersion.fr>2020-06-06 13:38:41 +0200
commitd7900c6e5e82406c1ed6a6df2ff3d1896149deff (patch)
treeed8ca52d119bdbc250c3e2e7d5e7f8f63d450449 /sway/input
parentd835df38dedc9c5e2a64d7eb204eae480470d5c1 (diff)
common/util: fix `get_current_time_msec` returning microseconds
This commit makes `get_current_time_msec` correctly return milliseconds as opposed to microseconds. It also considers the value of `tv_sec`, so we don't lose occasionally go back in time by one second. Finally, the function is moved into `util.c` so that it can be reused elsewhere without having to consider these pitfalls.
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 8e39dac1..d6c50acc 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -4,8 +4,6 @@
#include <libevdev/libevdev.h>
#include <linux/input-event-codes.h>
#include <errno.h>
-#include <float.h>
-#include <limits.h>
#include <strings.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_cursor.h>
@@ -13,9 +11,9 @@
#include <wlr/types/wlr_tablet_v2.h>
#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/util/region.h>
-#include "list.h"
-#include "log.h"
#include "config.h"
+#include "log.h"
+#include "util.h"
#include "sway/commands.h"
#include "sway/desktop.h"
#include "sway/desktop/transaction.h"
@@ -24,19 +22,12 @@
#include "sway/input/tablet.h"
#include "sway/layers.h"
#include "sway/output.h"
-#include "sway/tree/arrange.h"
#include "sway/tree/container.h"
#include "sway/tree/root.h"
#include "sway/tree/view.h"
#include "sway/tree/workspace.h"
#include "wlr-layer-shell-unstable-v1-protocol.h"
-static uint32_t get_current_time_msec(void) {
- struct timespec now;
- clock_gettime(CLOCK_MONOTONIC, &now);
- return now.tv_nsec / 1000;
-}
-
static struct wlr_surface *layer_surface_at(struct sway_output *output,
struct wl_list *layer, double ox, double oy, double *sx, double *sy) {
struct sway_layer_surface *sway_layer;