aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Münnich <be.muennich@googlemail.com>2012-03-13 21:58:48 +0100
committerBert Münnich <be.muennich@googlemail.com>2012-03-13 21:58:48 +0100
commitd7ff54bb6efc3dbaa2e524a141b423f894bcbc98 (patch)
treede9efd4f6740b5c8d978755432c30422e6a15a03
parent3238ef6bf6a4a0e1842aff565f4286ef9de6ce3c (diff)
Optimized redraw timeout after window resize for tiling window managers; related to issue #44
-rw-r--r--Makefile2
-rw-r--r--main.c16
2 files changed, 16 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index f0a46d5..e89a309 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = git-20120302
+VERSION = git-20120313
CC = gcc
CFLAGS = -ansi -Wall -pedantic -O2
diff --git a/main.c b/main.c
index bf1835c..2483d10 100644
--- a/main.c
+++ b/main.c
@@ -53,6 +53,7 @@ typedef struct {
void redraw(void);
void reset_cursor(void);
void animate(void);
+void clear_resize(void);
appmode_t mode;
img_t img;
@@ -65,6 +66,8 @@ size_t filesize;
int prefix;
+bool resized = false;
+
char win_bar_l[INFO_STR_LEN];
char win_bar_r[INFO_STR_LEN];
char win_title[INFO_STR_LEN];
@@ -73,6 +76,7 @@ timeout_t timeouts[] = {
{ { 0, 0 }, false, redraw },
{ { 0, 0 }, false, reset_cursor },
{ { 0, 0 }, false, animate },
+ { { 0, 0 }, false, clear_resize },
};
void cleanup(void) {
@@ -321,6 +325,10 @@ void animate(void) {
}
}
+void clear_resize(void) {
+ resized = false;
+}
+
bool keymask(const keymap_t *k, unsigned int state) {
return (k->ctrl ? ControlMask : 0) == (state & ControlMask);
}
@@ -452,11 +460,17 @@ void run(void) {
break;
case ConfigureNotify:
if (win_configure(&win, &ev.xconfigure)) {
- set_timeout(redraw, TO_REDRAW_RESIZE, false);
if (mode == MODE_IMAGE)
img.checkpan = true;
else
tns.dirty = true;
+ if (!resized || win.fullscreen) {
+ redraw();
+ set_timeout(clear_resize, TO_REDRAW_RESIZE, false);
+ resized = true;
+ } else {
+ set_timeout(redraw, TO_REDRAW_RESIZE, false);
+ }
}
break;
case KeyPress: