aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-02-12 21:27:50 -0500
committerJesse Luehrs <doy@tozt.net>2017-02-12 21:27:50 -0500
commite45d71466d4a997428bb19eca8c01a9194076f30 (patch)
treeca7489c69fb2729dd69698e522e546e9f9c37278
parent6ee215a7797cbb15aed6136ccfcaf5daff5ae654 (diff)
downloadrunes-e45d71466d4a997428bb19eca8c01a9194076f30.tar.gz
runes-e45d71466d4a997428bb19eca8c01a9194076f30.zip
Revert "combine flushes when reading large amounts of data"
This reverts commit 6ee215a7797cbb15aed6136ccfcaf5daff5ae654. actually, the redraw_rate stuff should already be handling this
-rw-r--r--src/loop.c45
-rw-r--r--src/loop.h1
-rw-r--r--src/pty-unix.c14
-rw-r--r--src/pty-unix.h2
4 files changed, 1 insertions, 61 deletions
diff --git a/src/loop.c b/src/loop.c
index b6b5ef1..f37c431 100644
--- a/src/loop.c
+++ b/src/loop.c
@@ -17,17 +17,9 @@ struct runes_loop_timer_data {
void (*cb)(void*);
};
-struct runes_loop_idle_data {
- struct event *event;
- void *t;
- void (*cb)(void*);
-};
-
static void runes_loop_work_cb(evutil_socket_t fd, short what, void *arg);
static void runes_loop_timer_cb(evutil_socket_t fd, short what, void *arg);
-static void runes_loop_idle_cb(evutil_socket_t fd, short what, void *arg);
static void runes_loop_free_timer_data(struct runes_loop_timer_data *data);
-static void runes_loop_free_idle_data(struct runes_loop_idle_data *data);
RunesLoop *runes_loop_new()
{
@@ -35,7 +27,6 @@ RunesLoop *runes_loop_new()
loop = calloc(1, sizeof(RunesLoop));
loop->base = event_base_new();
- event_base_priority_init(loop->base, 3);
return loop;
}
@@ -95,24 +86,6 @@ void runes_loop_timer_clear(RunesLoop *loop, void *arg)
runes_loop_free_timer_data(data);
}
-void runes_loop_at_idle(RunesLoop *loop, void *t, void (*cb)(void*))
-{
- struct runes_loop_idle_data *data;
- struct timeval timeout;
-
- data = malloc(sizeof(struct runes_loop_idle_data));
- data->event = event_new(loop->base, -1, 0, runes_loop_idle_cb, data);
- data->t = t;
- data->cb = cb;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
-
- event_priority_set(data->event, 2);
-
- event_add(data->event, &timeout);
-}
-
void runes_loop_delete(RunesLoop *loop)
{
event_base_free(loop->base);
@@ -148,27 +121,9 @@ static void runes_loop_timer_cb(evutil_socket_t fd, short what, void *arg)
runes_loop_free_timer_data(data);
}
-static void runes_loop_idle_cb(evutil_socket_t fd, short what, void *arg)
-{
- struct runes_loop_idle_data *data = arg;
-
- UNUSED(fd);
- UNUSED(what);
-
- data->cb(data->t);
-
- runes_loop_free_idle_data(data);
-}
-
static void runes_loop_free_timer_data(struct runes_loop_timer_data *data)
{
event_free(data->event);
free(data->timeout);
free(data);
}
-
-static void runes_loop_free_idle_data(struct runes_loop_idle_data *data)
-{
- event_free(data->event);
- free(data);
-}
diff --git a/src/loop.h b/src/loop.h
index 72dbcb0..92d6cf9 100644
--- a/src/loop.h
+++ b/src/loop.h
@@ -15,7 +15,6 @@ void runes_loop_start_work(
void *runes_loop_timer_set(
RunesLoop *loop, int timeout, void *t, void (*cb)(void*));
void runes_loop_timer_clear(RunesLoop *loop, void *arg);
-void runes_loop_at_idle(RunesLoop *loop, void *t, void (*cb)(void*));
void runes_loop_delete(RunesLoop *loop);
#endif
diff --git a/src/pty-unix.c b/src/pty-unix.c
index d712aad..6cc4996 100644
--- a/src/pty-unix.c
+++ b/src/pty-unix.c
@@ -20,7 +20,6 @@
extern char **environ;
static int runes_pty_input_cb(void *t);
-static void runes_pty_flush_cb(void *t);
RunesPty *runes_pty_new()
{
@@ -165,10 +164,7 @@ static int runes_pty_input_cb(void *t)
((RunesTerm *)t)->scr, pty->readbuf, to_process);
pty->remaininglen = to_process - processed;
memmove(pty->readbuf, pty->readbuf + processed, pty->remaininglen);
- if (!pty->scheduled_flush) {
- runes_loop_at_idle(((RunesTerm *)t)->loop, t, runes_pty_flush_cb);
- pty->scheduled_flush = 1;
- }
+ runes_window_flush(t);
return 1;
}
@@ -179,11 +175,3 @@ static int runes_pty_input_cb(void *t)
return 0;
}
}
-
-static void runes_pty_flush_cb(void *t)
-{
- RunesPty *pty = ((RunesTerm *)t)->pty;
-
- runes_window_flush(t);
- pty->scheduled_flush = 0;
-}
diff --git a/src/pty-unix.h b/src/pty-unix.h
index 553be12..8894072 100644
--- a/src/pty-unix.h
+++ b/src/pty-unix.h
@@ -11,8 +11,6 @@ struct runes_pty {
char readbuf[RUNES_READ_BUFFER_LENGTH];
int readlen;
int remaininglen;
-
- int scheduled_flush: 1;
};
RunesPty *runes_pty_new(void);