[Pkg-wmaker-commits] [wmbiff] 09/38: message list, button 2 support

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:03:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_16
in repository wmbiff.

commit 42e87b349954c1d8004c0d60179361ef44999700
Author: bluehal <bluehal>
Date:   Wed Apr 16 08:14:34 2003 +0000

    message list, button 2 support
---
 wmbiff/Client.h | 15 ++++++++++----
 wmbiff/wmbiff.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 65 insertions(+), 14 deletions(-)

diff --git a/wmbiff/Client.h b/wmbiff/Client.h
index c686c95..acc5020 100644
--- a/wmbiff/Client.h
+++ b/wmbiff/Client.h
@@ -1,11 +1,11 @@
-/* $Id: Client.h,v 1.30 2003/01/19 13:13:04 bluehal Exp $ */
+/* $Id: Client.h,v 1.31 2003/04/16 08:16:48 bluehal Exp $ */
 /* Author : Scott Holden ( scotth at thezone.net )
    Modified : Yong-iL Joh ( tolkien at mizi.com )
    Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
  *
  * Email Checker Pop3/Imap4/Licq/Gicu/mbox/maildir/finger
  *
- * Last Updated : $Date: 2003/01/19 13:13:04 $
+ * Last Updated : $Date: 2003/04/16 08:16:48 $
  *
  */
 
@@ -24,13 +24,19 @@
 #include <gcrypt.h>
 #endif
 
+#ifdef __LCLINT__
+typedef unsigned int off_t;
+#endif
+
+struct msglst;
 typedef struct _mbox_t *Pop3;
 typedef struct _mbox_t {
 	char label[32];				/* Printed at left; max 5 chars */
 	char path[256];				/* Path to mailbox */
 	char notify[256];			/* Program to notify mail arrivation */
-	char action[256];			/* Action to execute on mouse click */
-	char fetchcmd[256];			/* Action for mail fetching for pop3/imap */
+	char action[256];			/* Action to execute on mouse click, reduces to what happens on button1 */
+	char button2[256];			/* What to run on button2. (middle) */
+	char fetchcmd[256];			/* Action for mail fetching for pop3/imap, reduces to what happens on button3 */
 	int fetchinterval;
 	int TotalMsgs;				/* Total messages in mailbox */
 	int UnreadMsgs;				/* New (unread) messages in mailbox */
@@ -67,6 +73,7 @@ typedef struct _mbox_t {
 	} u;
 
 	int (*checkMail) ( /*@notnull@ */ Pop3);
+    struct msglst *(*getHeaders) ( /*@notnull@ */ Pop3);
 
 	time_t prevtime;
 	time_t prevfetch_time;
diff --git a/wmbiff/wmbiff.c b/wmbiff/wmbiff.c
index f6ad6fe..8e2ea06 100644
--- a/wmbiff/wmbiff.c
+++ b/wmbiff/wmbiff.c
@@ -1,4 +1,4 @@
-/* $Id: wmbiff.c,v 1.52 2003/03/30 10:38:38 bluehal Exp $ */
+/* $Id: wmbiff.c,v 1.53 2003/04/16 08:14:34 bluehal Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -29,6 +29,7 @@
 
 #include "Client.h"
 #include "charutil.h"
+#include "MessageList.h"
 
 #ifdef USE_DMALLOC
 #include <dmalloc.h>
@@ -73,8 +74,8 @@ static const char *font = NULL;
 int debug_default = DEBUG_ERROR;
 
 /* color from wmbiff's xpm, down to 24 bits. */
-static const char *foreground = "#21B3AF";	/* foreground cyan */
-static const char *background = "#202020";	/* background gray */
+const char *foreground = "#21B3AF";	/* foreground cyan */
+const char *background = "#202020";	/* background gray */
 static const char *highlight = "yellow";
 int SkipCertificateCheck = 0;
 int Relax = 0;					/* be not paranoid */
@@ -296,6 +297,8 @@ static int Read_Config_File(char *filename, int *loopinterval)
 			strcpy(mbox[mbox_index].action, value);
 		} else if (!strcmp(setting, "interval.")) {
 			mbox[mbox_index].loopinterval = atoi(value);
+		} else if (!strcmp(setting, "buttontwo.")) {
+			strcpy(mbox[mbox_index].button2, value);
 		} else if (!strcmp(setting, "fetchcmd.")) {
 			strcpy(mbox[mbox_index].fetchcmd, value);
 		} else if (!strcmp(setting, "fetchinterval.")) {
@@ -334,8 +337,10 @@ static void init_biff(char *config_file)
 		mbox[i].path[0] = '\0';
 		mbox[i].notify[0] = '\0';
 		mbox[i].action[0] = '\0';
+		mbox[i].button2[0] = '\0';
 		mbox[i].fetchcmd[0] = '\0';
 		mbox[i].loopinterval = 0;
+		mbox[i].getHeaders = NULL;
 		mbox[i].debug = debug_default;
 		mbox[i].askpass = DEFAULT_ASKPASS;
 	}
@@ -878,11 +883,14 @@ static void restart_wmbiff(int sig
 	exit(EXIT_FAILURE);
 }
 
+extern Window win;
+extern Window iconwin;
 
 static void do_biff(int argc, const char **argv)
 {
 	unsigned int i;
 	int but_pressed_region = -1;
+	int but_released_region = -1;
 	time_t curtime;
 	int Sleep_Interval;
 	const char **skin_xpm = NULL;
@@ -944,12 +952,18 @@ static void do_biff(int argc, const char **argv)
 		/* X Events */
 		while (XPending(display)) {
 			XEvent Event;
+            const char *press_action;
 
 			XNextEvent(display, &Event);
 
 			switch (Event.type) {
 			case Expose:
-				RedrawWindow();
+                if(Event.xany.window != win && 
+                   Event.xany.window != iconwin ) {
+                    msglst_redraw();
+                } else {
+                    RedrawWindow();
+                }
 				break;
 			case DestroyNotify:
 				XCloseDisplay(display);
@@ -958,28 +972,58 @@ static void do_biff(int argc, const char **argv)
 			case ButtonPress:
 				but_pressed_region =
 					CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
+                switch (Event.xbutton.button) {
+                case 1:
+                    press_action = mbox[but_pressed_region].action;
+                    break;
+                case 2:
+                    press_action = mbox[but_pressed_region].button2;
+                    break;
+                case 3:
+                    press_action = mbox[but_pressed_region].fetchcmd;
+                    break;
+                default:
+                    press_action = NULL;
+                    break;
+                        
+                }
+                if(press_action && strcmp(press_action, "msglst") == 0) {
+					msglst_show(&mbox[but_pressed_region], Event.xbutton.x_root, Event.xbutton.y_root);
+                }
 				break;
 			case ButtonRelease:
-				i = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
+				but_released_region = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
 				if (but_pressed_region == (int) i
 					&& but_pressed_region >= 0) {
+                    const char *click_action;
+
 					switch (Event.xbutton.button) {
 					case 1:	/* Left mouse-click */
 						/* C-S-left will restart wmbiff. */
 						if ((Event.xbutton.state & ControlMask) &&
 							(Event.xbutton.state & ShiftMask)) {
 							restart_wmbiff(0);
-						} else if (mbox[i].action[0] != '\0') {
-							(void) execCommand(mbox[i].action);
 						}
+                        click_action = mbox[but_released_region].action;
 						break;
+					case 2:	/* Middle mouse-click */
+                        click_action = mbox[but_released_region].button2;
+                        break;
 					case 3:	/* Right mouse-click */
-						if (mbox[i].fetchcmd[0] != '\0') {
-							(void) execCommand(mbox[i].fetchcmd);
-						}
+                        click_action = mbox[but_released_region].fetchcmd;
 						break;
+                    default:
+                        click_action = NULL;
+                        break;
 					}
+                    if(click_action != NULL && click_action[0] != '\0' && strcmp(click_action, "msglst")) {
+                        (void) execCommand(click_action);
+                    }
 				}
+
+                /* a button was released, hide the message list if open */
+                msglst_hide();
+
 				but_pressed_region = -1;
 				/* RedrawWindow(); */
 				break;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list