diff options
| author | hwsmm <9151706+hwsmm@users.noreply.github.com> | 2025-06-16 00:41:19 +0900 |
|---|---|---|
| committer | Kenny Levinsen <kl@kl.wtf> | 2025-06-16 11:26:26 +0200 |
| commit | 4b15b3427fd0835247d0a2e188c00f1d2aa04484 (patch) | |
| tree | eb1ba6fc19fc687f097957ab9039e5f4d37d8cd3 | |
| parent | 17f7c1b7820e4f85913ec70ab3c76f238c15c54c (diff) | |
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.
| -rw-r--r-- | common/util.c | 6 | ||||
| -rw-r--r-- | include/util.h | 2 | ||||
| -rw-r--r-- | sway/input/cursor.c | 10 |
3 files changed, 10 insertions, 8 deletions
diff --git a/common/util.c b/common/util.c index 7c492bcb..ae1fe443 100644 --- 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 index f887d489..92f5916c 100644 --- 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 index 1fd57ec4..aeab558c 100644 --- 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); |
