Skip to content
Browse files

main: use ui subsystem

Use the new UI subsystem in the main application. The kmscon application
provides now the same functionality as the test_terminal application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
  • Loading branch information...
1 parent e6d3d3f commit ead3172d49757f38e2ceb6bd09b87cb7b84cb370 @dvdhrm committed Mar 24, 2012
Showing with 22 additions and 6 deletions.
  1. +1 −0 Makefile.am
  2. +21 −6 src/main.c
View
1 Makefile.am
@@ -40,6 +40,7 @@ nodist_libkmscon_core_la_SOURCES = \
libkmscon_core_la_SOURCES = \
src/conf.c src/conf.h \
src/misc.c src/misc.h \
+ src/ui.c src/ui.h \
src/console.c src/console.h \
src/unicode.c src/unicode.h \
src/log.c src/log.h \
View
27 src/main.c
@@ -30,7 +30,9 @@
#include <string.h>
#include "conf.h"
#include "eloop.h"
+#include "input.h"
#include "log.h"
+#include "ui.h"
#include "uterm.h"
#include "vt.h"
@@ -42,6 +44,8 @@ struct kmscon_app {
struct kmscon_vt *vt;
bool exit;
struct uterm_video *video;
+ struct kmscon_input *input;
+ struct kmscon_ui *ui;
};
static void sig_generic(struct ev_signal *sig, int signum, void *data)
@@ -52,10 +56,6 @@ static void sig_generic(struct ev_signal *sig, int signum, void *data)
log_info("terminating due to caught signal %d", signum);
}
-static void update_displays(struct kmscon_app *app)
-{
-}
-
static bool vt_switch(struct kmscon_vt *vt,
enum kmscon_vt_action action,
void *data)
@@ -68,9 +68,10 @@ static bool vt_switch(struct kmscon_vt *vt,
if (ret) {
log_err("cannot wake-up video system");
} else {
- update_displays(app);
+ kmscon_input_wake_up(app->input);
}
} else if (action == KMSCON_VT_LEAVE) {
+ kmscon_input_sleep(app->input);
uterm_video_sleep(app->video);
if (app->exit)
ev_eloop_exit(app->vt_eloop);
@@ -81,6 +82,8 @@ static bool vt_switch(struct kmscon_vt *vt,
static void destroy_app(struct kmscon_app *app)
{
+ kmscon_ui_free(app->ui);
+ kmscon_input_unref(app->input);
uterm_video_unref(app->video);
kmscon_vt_unref(app->vt);
ev_eloop_rm_eloop(app->vt_eloop);
@@ -115,11 +118,23 @@ static int setup_app(struct kmscon_app *app)
if (ret)
goto err_app;
+ ret = uterm_video_new(&app->video, UTERM_VIDEO_DRM, app->eloop);
+ if (ret)
+ goto err_app;
+
+ ret = kmscon_input_new(&app->input);
+ if (ret)
+ goto err_app;
+
+ ret = kmscon_input_connect_eloop(app->input, app->eloop);
+ if (ret)
+ goto err_app;
+
ret = kmscon_vt_open(app->vt, KMSCON_VT_NEW, app->vt_eloop);
if (ret)
goto err_app;
- ret = uterm_video_new(&app->video, UTERM_VIDEO_DRM, app->eloop);
+ ret = kmscon_ui_new(&app->ui, app->eloop, app->video, app->input);
if (ret)
goto err_app;

0 comments on commit ead3172

Please sign in to comment.
Something went wrong with that request. Please try again.