Hi,
Here some performance optimize in function winButtonWmCommand.
The "_IUPBUT_INSIDE_ACTION" is not used anywhere else and can
changed by much faster C resource.

--- \dll\iup\a\src\win\iupwin_button.c  Mon Jun 03 20:25:39 2019
+++ iupwin_button.c     Wed Jun 05 10:58:31 2019
@@ -660,21 +660,17 @@
          so we added a test here also */
       if (iupAttribGetBoolean(ih, "CANFOCUS"))
       {
+        static int inside_action = 0;
         Icallback cb = IupGetCallback(ih, "ACTION");
         if (cb)
         {
           /* to avoid double calls when pressing enter and a dialog is 
displayed */
-          if (!iupAttribGet(ih, "_IUPBUT_INSIDE_ACTION"))  
+          if (!inside_action)  
           {
-            int ret;
-            iupAttribSet(ih, "_IUPBUT_INSIDE_ACTION", "1");
-
-            ret = cb(ih);
-            if (ret == IUP_CLOSE)
+            inside_action = 1;
+            if (cb(ih) == IUP_CLOSE)
               IupExitLoop();
-
-            if (ret!=IUP_IGNORE && iupObjectCheck(ih))
-              iupAttribSet(ih, "_IUPBUT_INSIDE_ACTION", NULL);
+            inside_action = 0;
           }
         }
       }

Best regards,
Ranier Vilela

Attachment: iupwin_button.c.patch
Description: iupwin_button.c.patch

_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to