From 445d958902177390320e2d5bc384e7fb47afdeaf Mon Sep 17 00:00:00 2001 From: gotmor Date: Sun, 1 Jul 2007 22:11:43 +0000 Subject: added "onnewinput" event git-svn-id: http://dzen.googlecode.com/svn/trunk@117 f2baff5b-bf2c-0410-a398-912abdc3d8b2 --- README | 1 + action.c | 9 +++++---- action.h | 4 ++-- main.c | 3 +++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README b/README index b678237..2bab9c8 100644 --- a/README +++ b/README @@ -159,6 +159,7 @@ Supported events: onstart Perform actions right after startup onexit Perform actions just before exiting + onnewinput Perform actions if there is new input for the slave window button1 Mouse button1 released button2 Mouse button2 released button3 Mouse button3 released diff --git a/action.c b/action.c index 3d5fcb0..d5eaa93 100644 --- a/action.c +++ b/action.c @@ -14,6 +14,7 @@ struct event_lookup ev_lookup_table[] = { { "onstart", onstart}, { "onexit", onexit}, + { "onnewinput", onnewinput}, { "button1", button1}, { "button2", button2}, { "button3", button3}, @@ -25,7 +26,7 @@ struct event_lookup ev_lookup_table[] = { { "leaveslave", leaveslave}, { "sigusr1", sigusr1}, { "sigusr2", sigusr2}, - { "keymarker", keymarker}, + { "keymarker", keymarker}, { 0, 0 } }; @@ -47,9 +48,9 @@ struct action_lookup ac_lookup_table[] = { { "raise", a_raise}, { "lower", a_lower}, { "scrollhome", a_scrollhome}, - { "scrollend", a_scrollend}, - { "grabkeys", a_grabkeys}, - { "ungrabkeys", a_ungrabkeys}, + { "scrollend", a_scrollend}, + { "grabkeys", a_grabkeys}, + { "ungrabkeys", a_ungrabkeys}, { 0, 0 } }; diff --git a/action.h b/action.h index 65f4b17..0af044b 100644 --- a/action.h +++ b/action.h @@ -13,8 +13,8 @@ typedef struct _ev_list ev_list; typedef int handlerf(char **); enum ev_id { - /* startup, exit */ - onstart, onexit, + /* startup, exit, input */ + onstart, onexit, onnewinput, /* mouse buttons */ button1, button2, button3, button4, button5, /* entering/leaving windows */ diff --git a/main.c b/main.c index 25ee5fe..6b7ceff 100644 --- a/main.c +++ b/main.c @@ -515,7 +515,10 @@ static void handle_newl(void) { XWindowAttributes wa; + if(dzen.slave_win.max_lines && (dzen.slave_win.tcnt > last_cnt)) { + do_action(onnewinput); + if (XGetWindowAttributes(dzen.dpy, dzen.slave_win.win, &wa), wa.map_state != IsUnmapped /* autoscroll and redraw only if we're -- cgit v1.2.3-54-g00ecf