From 282695a9e923f069da86486dd9b0cf79f20da76f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 13 Apr 2014 01:14:26 -0400 Subject: this is an unnecessary level of abstraction --- Makefile | 2 +- events.c | 21 --------------------- events.h | 14 -------------- pty-unix.c | 4 ++-- runes.h | 5 ++++- window-xlib.c | 4 ++-- 6 files changed, 9 insertions(+), 41 deletions(-) delete mode 100644 events.c delete mode 100644 events.h diff --git a/Makefile b/Makefile index cae9f45..e84d562 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ OUT = runes -OBJ = runes.o display.o term.o events.o vt100.o window-xlib.o pty-unix.o +OBJ = runes.o display.o term.o vt100.o window-xlib.o pty-unix.o LIBS = cairo cairo-xlib libuv CFLAGS ?= -g -Wall -Wextra -Werror LDFLAGS ?= -g -Wall -Wextra -Werror diff --git a/events.c b/events.c deleted file mode 100644 index 32ca790..0000000 --- a/events.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "runes.h" - -void runes_handle_keyboard_event(RunesTerm *t, char *buf, size_t len) -{ - runes_pty_backend_write(t, buf, len); -} - -void runes_handle_pty_read(RunesTerm *t, char *buf, ssize_t len) -{ - runes_vt100_process_string(t, buf, len); -} - -void runes_handle_pty_close(RunesTerm *t) -{ - runes_window_backend_request_close(t); -} - -void runes_handle_close_window(RunesTerm *t) -{ - runes_pty_backend_request_close(t); -} diff --git a/events.h b/events.h deleted file mode 100644 index 4307b4f..0000000 --- a/events.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _RUNES_EVENTS_H -#define _RUNES_EVENTS_H - -struct runes_loop_data { - uv_work_t req; - RunesTerm *t; -}; - -void runes_handle_keyboard_event(RunesTerm *t, char *buf, size_t len); -void runes_handle_pty_read(RunesTerm *t, char *buf, ssize_t len); -void runes_handle_pty_close(RunesTerm *t); -void runes_handle_close_window(RunesTerm *t); - -#endif diff --git a/pty-unix.c b/pty-unix.c index bf66749..4664f16 100644 --- a/pty-unix.c +++ b/pty-unix.c @@ -116,12 +116,12 @@ static void runes_pty_backend_got_data(uv_work_t *req, int status) t = data->data.t; if (data->len > 0) { - runes_handle_pty_read(t, data->buf, data->len); + runes_vt100_process_string(t, data->buf, data->len); uv_queue_work( t->loop, req, runes_pty_backend_read, runes_pty_backend_got_data); } else { - runes_handle_pty_close(t); + runes_window_backend_request_close(t); free(req); } } diff --git a/runes.h b/runes.h index 9233937..7ba6be2 100644 --- a/runes.h +++ b/runes.h @@ -14,7 +14,10 @@ typedef struct runes_window RunesWindowBackend; typedef struct runes_pty RunesPtyBackend; typedef struct runes_loop_data RunesLoopData; -#include "events.h" +struct runes_loop_data { + uv_work_t req; + RunesTerm *t; +}; #include "window-xlib.h" #include "pty-unix.h" diff --git a/window-xlib.c b/window-xlib.c index 76f97bf..958bb26 100644 --- a/window-xlib.c +++ b/window-xlib.c @@ -214,7 +214,7 @@ static void runes_window_backend_process_event(uv_work_t *req, int status) break; } - runes_handle_keyboard_event(t, buf, chars); + runes_pty_backend_write(t, buf, chars); free(buf); break; } @@ -255,7 +255,7 @@ static void runes_window_backend_process_event(uv_work_t *req, int status) runes_window_backend_process_event); } else { - runes_handle_close_window(t); + runes_pty_backend_request_close(t); free(req); } } -- cgit v1.2.3-54-g00ecf