From feb9e222e5d632fd6eacea77d17a7538ce82dffb Mon Sep 17 00:00:00 2001 From: jon Date: Tue, 7 Jul 2020 21:26:27 +0200 Subject: [PATCH] high refresh rate movement --- src/common.h | 2 +- src/event.c | 2 +- src/picom.c | 6 ++++-- src/win.c | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/common.h b/src/common.h index 9498ebe..27d0076 100644 --- a/src/common.h +++ b/src/common.h @@ -529,6 +529,6 @@ static inline void wintype_arr_enable(bool arr[]) { } /** - * Get current system clock in milliseconds. + * Get current system clock in 40 microseconds. */ int64_t get_time_ms(void); diff --git a/src/event.c b/src/event.c index 62f62bf..05197e2 100644 --- a/src/event.c +++ b/src/event.c @@ -203,7 +203,7 @@ static void configure_win(session_t *ps, xcb_configure_notify_event_t *ce) { auto mw = (struct managed_win *)w; float t = get_time_ms(); - if (mw->oldX == -30000 && mw->oldY == -30000 && mw->oldW == 0 && mw->oldH == 0) { + if (mw->oldX == -500 && mw->oldY == -500 && mw->oldW == 0 && mw->oldH == 0) { if (!mw->isOld) { /* mw->isOld = true; */ diff --git a/src/picom.c b/src/picom.c index d2dc1fe..8a728cb 100644 --- a/src/picom.c +++ b/src/picom.c @@ -124,14 +124,16 @@ static inline void free_xinerama_info(session_t *ps) { } /** - * Get current system clock in milliseconds. + * Get current system clock in 40micro second accuracy. */ int64_t get_time_ms(void) { struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); - return (int64_t)tp.tv_sec * 1000 + (int64_t)tp.tv_nsec / 1000000; +/* return (int64_t)tp.tv_sec * 1000 + (int64_t)tp.tv_nsec / 1000000; //ultra high refresh */ + return (int64_t)tp.tv_sec * 100 + (int64_t)tp.tv_nsec / 250000; //ultra high refresh } + // XXX Move to x.c void cxinerama_upd_scrs(session_t *ps) { // XXX Consider deprecating Xinerama, switch to RandR when necessary diff --git a/src/win.c b/src/win.c index a830082..9151682 100644 --- a/src/win.c +++ b/src/win.c @@ -1191,8 +1191,8 @@ struct win *fill_win(session_t *ps, struct win *w) { .invert_color = false, .blur_background = false, - .oldX = -30000, - .oldY = -30000, + .oldX = -10000, + .oldY = -10000, .oldW = 0, .oldH = 0, @@ -2088,8 +2088,8 @@ void map_win_start(session_t *ps, struct managed_win *w) { w->a.map_state = XCB_MAP_STATE_VIEWABLE; if (!w->isOld) { - w->oldX = -10000; - w->oldY = -10000; + w->oldX = -1000; + w->oldY = -1000; w->oldW = 0; w->oldH = 0; }