From edae24f501c06c18b2add55203bbe239db6c76d9 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sun, 12 Aug 2012 09:19:36 +0200 Subject: [PATCH] uterm: vt: remove duplicate kmscon_vt_action This enum is not needed as the uterm-vt code already has enums for vt-actions. Replace it with UTERM_VT_ACTIVATE/DEACTIVATE. Signed-off-by: David Herrmann --- src/uterm_vt.c | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/uterm_vt.c b/src/uterm_vt.c index 8c6d319..9f14d34 100644 --- a/src/uterm_vt.c +++ b/src/uterm_vt.c @@ -50,18 +50,13 @@ struct kmscon_vt; -enum kmscon_vt_action { - KMSCON_VT_ENTER, - KMSCON_VT_LEAVE, -}; - enum kmscon_vt_id { KMSCON_VT_CUR = 0, KMSCON_VT_NEW = -1, }; typedef bool (*kmscon_vt_cb) (struct kmscon_vt *vt, - enum kmscon_vt_action action, + unsigned int action, void *data); void kmscon_vt_close(struct kmscon_vt *vt); @@ -144,7 +139,7 @@ static void vt_enter(struct ev_eloop *eloop, struct signalfd_siginfo *info, log_warn("cannot set graphics mode on vt %p", vt); if (vt->cb) - vt->cb(vt, KMSCON_VT_ENTER, vt->data); + vt->cb(vt, UTERM_VT_ACTIVATE, vt->data); } static void vt_leave(struct ev_eloop *eloop, struct signalfd_siginfo *info, @@ -161,7 +156,7 @@ static void vt_leave(struct ev_eloop *eloop, struct signalfd_siginfo *info, if (ret || vts.v_active != vt->num) return; - if (vt->cb && !vt->cb(vt, KMSCON_VT_LEAVE, vt->data)) { + if (vt->cb && !vt->cb(vt, UTERM_VT_DEACTIVATE, vt->data)) { log_debug("leaving VT %d %p denied", vt->num, vt); ioctl(vt->fd, VT_RELDISP, 0); } else { @@ -487,25 +482,9 @@ static int vt_call(struct uterm_vt *vt, unsigned int event) return 0; } -static bool vt_event(struct kmscon_vt *ovt, enum kmscon_vt_action action, - void *data) +static bool vt_event(struct kmscon_vt *ovt, unsigned int action, void *data) { - struct uterm_vt *vt = data; - int ret = 0; - - switch (action) { - case KMSCON_VT_ENTER: - ret = vt_call(vt, UTERM_VT_ACTIVATE); - break; - case KMSCON_VT_LEAVE: - ret = vt_call(vt, UTERM_VT_DEACTIVATE); - break; - } - - if (ret) - return false; - - return true; + return !vt_call(data, action); } static void vt_idle_event(struct ev_eloop *eloop, void *unused, void *data) -- 2.7.4