changeset 1760:3bbbb5a55cf8

Fix buttons causing double events when toolbar support is enabled on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Jun 2012 00:54:45 +0000
parents e113f9e46fbd
children ae7f1a0eb0ea
files win/dw.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Sat Jun 23 21:54:35 2012 +0000
+++ b/win/dw.c	Tue Jun 26 00:54:45 2012 +0000
@@ -2189,8 +2189,16 @@
 #ifdef TOOLBAR                     
                      else if (message == BN_CLICKED && tmp->message == WM_COMMAND && tmp->window == (HWND)mp2)
                      {
-                        result = clickfunc(tmp->window, tmp->data);
-                        tmp = NULL;
+                        TCHAR tmpbuf[100] = {0};
+
+                        GetClassName((HWND)mp2, tmpbuf, 99);
+
+                        /* Make sure this isn't a button, because it will have already been handled */
+                        if (_tcsnicmp(tmpbuf, BUTTONCLASSNAME, _tcslen(BUTTONCLASSNAME)+1) != 0)
+                        {
+                           result = clickfunc(tmp->window, tmp->data);
+                           tmp = NULL;
+                        }
                      }
 #endif                     
                      else if (tmp->id && passthru == tmp->id)