win: update window's image lazily
Use a flag to mark whether the image needs update, and only update once per frame. Also refactor some common code into functions, and handle image errors properly. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
13
src/win.h
13
src/win.h
@ -18,6 +18,7 @@
|
||||
#include "render.h"
|
||||
#include "types.h"
|
||||
#include "utils.h"
|
||||
#include "backend/backend.h"
|
||||
#include "x.h"
|
||||
|
||||
typedef struct session session_t;
|
||||
@ -104,6 +105,13 @@ typedef enum {
|
||||
WSTATE_UNMAPPED,
|
||||
} winstate_t;
|
||||
|
||||
typedef enum win_flags {
|
||||
/// win_image/shadow_image is out of date
|
||||
WIN_FLAGS_STALE_IMAGE = 1,
|
||||
/// there was an error trying to bind the images
|
||||
WIN_FLAGS_IMAGE_ERROR = 2,
|
||||
} win_flags_t;
|
||||
|
||||
/**
|
||||
* About coordinate systems
|
||||
*
|
||||
@ -282,6 +290,11 @@ struct win {
|
||||
#endif
|
||||
};
|
||||
|
||||
void win_release_image(backend_t *base, win *w);
|
||||
bool must_use win_bind_image(session_t *ps, win *w);
|
||||
|
||||
/// Attempt a rebind of window's images. If that failed, the original images are kept.
|
||||
bool win_try_rebind_image(session_t *ps, win *w);
|
||||
int win_get_name(session_t *ps, win *w);
|
||||
int win_get_role(session_t *ps, win *w);
|
||||
winmode_t attr_pure win_calc_mode(const win *w);
|
||||
|
Reference in New Issue
Block a user