Skip to content

Commit

Permalink
Fixing disappearing and out of place jumpy windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaburg committed Sep 30, 2020
1 parent 2603582 commit 9313033
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
#include <X11/Xlib.h>
#include <ev.h>
#include <pixman.h>
#include <xcb/xproto.h>
#include <xcb/render.h>
#include <xcb/sync.h>
#include <xcb/xproto.h>

#include "uthash_extra.h"
#ifdef CONFIG_OPENGL
Expand All @@ -55,11 +55,11 @@
#include "backend/driver.h"
#include "compiler.h"
#include "config.h"
#include "list.h"
#include "region.h"
#include "render.h"
#include "types.h"
#include "utils.h"
#include "list.h"
#include "render.h"
#include "win_defs.h"
#include "x.h"

Expand Down Expand Up @@ -254,11 +254,11 @@ typedef struct session {
// Cached blur convolution kernels.
struct x_convolution_kernel **blur_kerns_cache;
/// If we should quit
bool quit:1;
bool quit : 1;
/// Whether there are pending updates, like window creation, etc.
/// TODO use separate flags for dfferent kinds of updates so we don't
/// waste our time.
bool pending_updates:1;
bool pending_updates : 1;

// === Expose event related ===
/// Pointer to an array of <code>XRectangle</code>-s of exposed region.
Expand Down Expand Up @@ -534,8 +534,12 @@ static inline void wintype_arr_enable(bool arr[]) {
}
}


/**
* Get current system clock in milliseconds.
*/
int64_t get_time_ms(void);

/**
* Get current system clock in microseconds * 40.
*/
int64_t get_time_40us(void);
11 changes: 10 additions & 1 deletion src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ static inline void free_xinerama_info(session_t *ps) {
* Get current system clock in milliseconds.
*/
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;
}

/**
* Get current system clock in microseconds * 40.
*/
int64_t get_time_40us(void) {
struct timespec tp;
clock_gettime(CLOCK_MONOTONIC, &tp);
// return (int64_t)tp.tv_sec * 1000 + (int64_t)tp.tv_nsec / 1000000;
Expand Down Expand Up @@ -425,7 +434,7 @@ static struct managed_win *paint_preprocess(session_t *ps, bool *fade_running) {

// Fading step calculation
long steps = 0L;
auto now = get_time_ms();
auto now = get_time_40us();
if (ps->fade_time) {
assert(now >= ps->fade_time);
steps = (now - ps->fade_time) / ps->o.fade_delta;
Expand Down

0 comments on commit 9313033

Please sign in to comment.