dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 021a5bc0000c6e511dfbaab3d032bfd584357616
parent 7d7c2f4300c69f9d635fee95bf4affb9bcf50176
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Sun, 12 Jun 2011 14:08:09 +0200

Enable mouse support only if compiled against ncurses

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
config.h | 8+++++++-
dvtm.c | 10+++++++++-
mouse.c | 9---------
3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/config.h b/config.h @@ -72,7 +72,7 @@ Key keys[] = { { MOD, 'l', { setmfact, { "+0.05" } } }, { MOD, '.', { toggleminimize, { NULL } } }, { MOD, 's', { togglebar, { NULL } } }, - { MOD, 'M', { mouse_toggle, { NULL } } }, + { MOD, 'M', { togglemouse, { NULL } } }, { MOD, '\n', { zoom , { NULL } } }, { MOD, '1', { focusn, { "1" } } }, { MOD, '2', { focusn, { "2" } } }, @@ -130,14 +130,20 @@ static const ColorRule colorrules[] = { * REPORT_MOUSE_POSITION report mouse movement */ +#ifdef NCURSES_MOUSE_VERSION +# define CONFIG_MOUSE /* compile in mouse support if we build against ncurses */ +#endif + #define ENABLE_MOUSE true /* whether to enable mouse events by default */ +#ifdef CONFIG_MOUSE Button buttons[] = { { BUTTON1_CLICKED, { mouse_focus, { NULL } } }, { BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { "[ ]" } } }, { BUTTON2_CLICKED, { mouse_zoom, { NULL } } }, { BUTTON3_CLICKED, { mouse_minimize, { NULL } } }, }; +#endif /* CONFIG_MOUSE */ Cmd commands[] = { { "create", { create, { NULL } } }, diff --git a/dvtm.c b/dvtm.c @@ -156,12 +156,12 @@ static void lock(const char *key[]); static void togglerunall(const char *args[]); static void togglebar(const char *args[]); +static void togglemouse(const char *args[]); static void mouse_focus(const char *args[]); static void mouse_fullscreen(const char *args[]); static void mouse_minimize(const char *args[]); static void mouse_zoom(const char *args[]); -static void mouse_toggle(); static void clear_workspace(); static void draw(Client *c); @@ -183,6 +183,8 @@ extern Screen screen; Screen screen = { MFACT, SCROLL_HISTORY }; static Client *sel = NULL; +static Client *msel = NULL; +static bool mouse_events_enabled = ENABLE_MOUSE; static Layout *layout = layouts; static StatusBar bar = { -1, BARPOS, 1 }; static CmdFifo cmdfifo = { -1 }; @@ -613,6 +615,12 @@ lock(const char *args[]) { } static void +togglemouse(const char *args[]) { + mouse_events_enabled = !mouse_events_enabled; + mouse_setup(); +} + +static void togglerunall(const char *args[]) { runinall = !runinall; } diff --git a/mouse.c b/mouse.c @@ -1,6 +1,3 @@ -static Client *msel = NULL; -static bool mouse_events_enabled = ENABLE_MOUSE; - static void mouse_focus(const char *args[]) { focus(msel); @@ -79,9 +76,3 @@ mouse_setup() { } mousemask(mask, NULL); } - -static void -mouse_toggle() { - mouse_events_enabled = !mouse_events_enabled; - mouse_setup(); -}