commit 4b15b3427fd0835247d0a2e188c00f1d2aa04484
parent 17f7c1b7820e4f85913ec70ab3c76f238c15c54c
Author: hwsmm <9151706+hwsmm@users.noreply.github.com>
Date: Mon, 16 Jun 2025 00:41:19 +0900
Rename get_current_time_msec to get_current_time_in_msec and move to util.c
get_current_time_msec conflicts with a function with the same name in wlroots.
Diffstat:
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/common/util.c b/common/util.c
@@ -141,3 +141,9 @@ bool sway_set_cloexec(int fd, bool cloexec) {
}
return true;
}
+
+uint32_t get_current_time_in_msec(void) {
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ return now.tv_sec * 1000 + now.tv_nsec / 1000000;
+}
diff --git a/include/util.h b/include/util.h
@@ -61,4 +61,6 @@ const char *sway_wl_output_subpixel_to_string(enum wl_output_subpixel subpixel);
bool sway_set_cloexec(int fd, bool cloexec);
+uint32_t get_current_time_in_msec(void);
+
#endif
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
@@ -32,12 +32,6 @@
#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_sec * 1000 + now.tv_nsec / 1000000;
-}
-
/**
* Returns the node at the cursor's position. If there is a surface at that
* location, it is stored in **surface (it may not be a view).
@@ -144,7 +138,7 @@ struct sway_node *node_at_coords(
}
void cursor_rebase(struct sway_cursor *cursor) {
- uint32_t time_msec = get_current_time_msec();
+ uint32_t time_msec = get_current_time_in_msec();
seatop_rebase(cursor->seat, time_msec);
}
@@ -359,7 +353,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
enum wl_pointer_button_state state) {
if (time_msec == 0) {
- time_msec = get_current_time_msec();
+ time_msec = get_current_time_in_msec();
}
seatop_button(cursor->seat, time_msec, device, button, state);