dvtm

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

commit df665efcf62a87243779018b68e5f16d408b0c7c
parent 0a803f611324f6268d9bee9fd3b23b3948b0d84b
Author: Albin Tonnerre <albin.tonnerre@gmail.com>
Date:   Sat, 24 Jan 2009 13:42:52 +0100

Add a new function mouse_toggle and a new Mod-M combination
to allow disabling mouse grabbing at runtime, useful when e.g.
you want to copy/paste plenty of text. Originally reported as
debian bug #506155

Diffstat:
config.h | 3+++
dvtm.1 | 4+++-
dvtm.c | 1+
mouse.c | 10++++++++++
4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/config.h b/config.h @@ -73,6 +73,9 @@ Key keys[] = { #ifdef CONFIG_STATUSBAR { MOD, 's', { togglebar, { NULL } } }, #endif +#ifdef CONFIG_MOUSE + { MOD, 'M', { mouse_toggle, { NULL } } }, +#endif { MOD, '\n', { zoom , { NULL } } }, { MOD, '1', { focusn, { "1" } } }, { MOD, '2', { focusn, { "2" } } }, diff --git a/dvtm.1 b/dvtm.1 @@ -100,6 +100,8 @@ Escape the next typed key. .B Mod\-X Lock screen. .TP +.B Mod\-M +Toggle dvtm mouse grabbing. .B Mod\-q Quit dvtm. .SS Mouse commands @@ -108,7 +110,7 @@ Quit dvtm. By default dvtm captures mouse events to provide the actions listed below. Unfortunately this interferes with the standard X copy and paste mechanism. To work around this you need to hold down SHIFT while selecting or pasting text. Alternatively you can -disable mouse support at compile time. +disable mouse support at compile time, or use Mod\-M to toggle mouse support dynamically. .TP .B Button1 click Select window. diff --git a/dvtm.c b/dvtm.c @@ -135,6 +135,7 @@ 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(); #endif static void clear_workspace(); diff --git a/mouse.c b/mouse.c @@ -68,3 +68,13 @@ mouse_setup() { if (mask) mousemask(mask, NULL); } + +static void +mouse_toggle() { + static int state = 0; + if(!state) + mousemask(0, NULL); + else + mouse_setup(); + state = !state; +}