diff android/dw.cpp @ 2670:e3a95940c18f

Android: Implement DW_FCF_CLOSEBUTTON and DW_FCF_TITLEBAR flags. Move the window destroy logic into the C code event handler... That way handling the DW_SIGNAL_DELETE can prevent the window closure. The application still can't be stopped from closing, but windows can.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 18 Oct 2021 00:09:57 +0000
parents 917f2d1f9cae
children 0ed61ddb9957
line wrap: on
line diff
--- a/android/dw.cpp	Sun Oct 17 20:14:51 2021 +0000
+++ b/android/dw.cpp	Mon Oct 18 00:09:57 2021 +0000
@@ -563,7 +563,8 @@
 
 int _dw_event_handler(jobject object, void **params)
 {
-    DWSignalHandler *handler = _dw_get_handler(object, DW_POINTER_TO_INT(params[8]));
+    int messageid = DW_POINTER_TO_INT(params[8]);
+    DWSignalHandler *handler = _dw_get_handler(object, messageid);
 
     if (handler)
     {
@@ -573,7 +574,7 @@
          * If it isn't a draw event, either queue the event
          * or launch a new thread to handle it.
          */
-        if(DW_POINTER_TO_INT(params[8]) != 7)
+        if(DW_POINTER_TO_INT(params[8]) != _DW_EVENT_EXPOSE)
         {
 #ifdef _DW_EVENT_THREADING
             /* Make a copy of the params so it isn't allocated from the stack */
@@ -589,7 +590,9 @@
         else
             return _dw_event_handler2(params);
 
-    }
+    } /* If we don't have a handler, destroy the window */
+    else if(messageid == _DW_EVENT_DELETE)
+        dw_window_destroy(object);
     return 0;
 }