Hi,
i started to read the dvtm source code only few days ago
in the hope to be able to contribute with the project soon
which, to me, is one of the best tool we could have today.
Yes, i'm serious.
Since i don't need the mouse support at all i made such
support "optional" with few lines of preprocessor code.
This allow to toggle the support by adding/removing the
relative comment into the config.mk file.
Feel free to include this little patch into the main code
or discard it at all if you think it's not much usefull
(in which case i'll have to remove the mouse code by hand
before compile any new release of dvtm).
I also disabled the debug informations which may be easily
toggled in a similar way to the mouse support in config.mk
Hope this helps and thanks to providing us a great tool as
dvtm!
--
Claudio M.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/MU d-@ s: a--> C++(+++) UB++>$ P+> !L E--- W++(+++)
N+@ o--> K? w+@> O-@> M- V? PS+@ PE+@ Y+ PGP> t(-)@ 5?
X+ R? tv-- b+> DI-- D? G e+@> h--@> r y*
------END GEEK CODE BLOCK------
--- ../dvtm-0.4.orig/dvtm.c 2008-02-16 12:09:13.191369197 +0100
+++ dvtm.c 2008-02-16 12:13:44.352315696 +0100
@@ -71,10 +71,12 @@
Action action;
} Key;
+#if defined(HANDLE_MOUSE)
typedef struct {
mmask_t mask;
Action action;
} Button;
+#endif /* HANDLE_MOUSE */
enum { BarTop, BarBot, BarOff };
@@ -106,11 +108,14 @@
void setlayout(const char *args[]);
void redraw(const char *args[]);
void zoom(const char *args[]);
+
+#if defined(HANDLE_MOUSE)
/* special mouse related commands */
void mouse_focus(const char *args[]);
void mouse_fullscreen(const char *args[]);
void mouse_minimize(const char *args[]);
void mouse_zoom(const char *args[]);
+#endif /* HANDLE_MOUSE */
void clear_workspace();
void draw_all(bool border);
@@ -669,6 +674,7 @@
return NULL;
}
+#if defined(HANDLE_MOUSE)
void
mouse_focus(const char *args[]){
focus(msel);
@@ -727,6 +733,7 @@
buttons[i].action.cmd(buttons[i].action.args);
msel = NULL;
}
+#endif /* HANDLE_MOUSE */
Client*
get_client_by_pid(pid_t pid){
@@ -802,10 +809,14 @@
start_color();
noecho();
keypad(stdscr, TRUE);
+
+#if defined(HANDLE_MOUSE)
for(i = 0, mask = 0; i < countof(buttons); i++)
mask |= buttons[i].mask;
if(mask)
mousemask(mask, NULL);
+#endif /* HANDLE_MOUSE */
+
raw();
madtty_init_colors();
madtty_init_vt100_graphics();
@@ -931,9 +942,12 @@
int code = getch();
Key *key;
if(code >= 0){
+#if defined(HANDLE_MOUSE)
if(code == KEY_MOUSE){
handle_mouse();
- } else if(is_modifier(code)){
+ } else
+#endif /* HANDLE_MOUSE */
+ if(is_modifier(code)){
int mod = code;
code = getch();
if(code >= 0){
--- ../dvtm-0.4.orig/config.h 2008-02-16 12:09:13.191369197 +0100
+++ config.h 2008-02-16 12:13:45.072360697 +0100
@@ -116,12 +116,14 @@
* REPORT_MOUSE_POSITION report mouse movement
*/
+#if defined(HANDLE_MOUSE)
Button buttons[] = {
{ BUTTON1_CLICKED, { mouse_focus, { NULL } } },
{ BUTTON1_DOUBLE_CLICKED, { mouse_fullscreen, { "[ ]" } } },
{ BUTTON2_CLICKED, { mouse_zoom, { NULL } } },
{ BUTTON3_CLICKED, { mouse_minimize, { NULL } } },
};
+#endif /* HANDLE_MOUSE */
/* gets executed when dvtm is started */
Action actions[] = {
--- ../dvtm-0.4.orig/config.mk 2008-02-16 12:09:13.191369197 +0100
+++ config.mk 2008-02-16 12:13:52.912850695 +0100
@@ -13,6 +13,12 @@
CFLAGS = -std=c99 -Os ${INCS} -DVERSION=\"${VERSION}\" -DNDEBUG
LDFLAGS = -L/usr/lib -L/usr/local/lib ${LIBS}
+# Debug informations
+#CFLAGS += -DNDEBUG
+
+# Mouse handling
+#CFLAGS += -DHANDLE_MOUSE
+
DEBUG_CFLAGS = -std=c99 -O0 -g -ggdb ${INCS} -Wall -DVERSION=\"${VERSION}\"
CC = cc