comparison 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
comparison
equal deleted inserted replaced
2669:2ad924c6493d 2670:e3a95940c18f
561 } 561 }
562 #endif 562 #endif
563 563
564 int _dw_event_handler(jobject object, void **params) 564 int _dw_event_handler(jobject object, void **params)
565 { 565 {
566 DWSignalHandler *handler = _dw_get_handler(object, DW_POINTER_TO_INT(params[8])); 566 int messageid = DW_POINTER_TO_INT(params[8]);
567 DWSignalHandler *handler = _dw_get_handler(object, messageid);
567 568
568 if (handler) 569 if (handler)
569 { 570 {
570 params[9] = (void *)handler; 571 params[9] = (void *)handler;
571 572
572 /* We have to handle draw events in the main thread... 573 /* We have to handle draw events in the main thread...
573 * If it isn't a draw event, either queue the event 574 * If it isn't a draw event, either queue the event
574 * or launch a new thread to handle it. 575 * or launch a new thread to handle it.
575 */ 576 */
576 if(DW_POINTER_TO_INT(params[8]) != 7) 577 if(DW_POINTER_TO_INT(params[8]) != _DW_EVENT_EXPOSE)
577 { 578 {
578 #ifdef _DW_EVENT_THREADING 579 #ifdef _DW_EVENT_THREADING
579 /* Make a copy of the params so it isn't allocated from the stack */ 580 /* Make a copy of the params so it isn't allocated from the stack */
580 void *newparams = calloc(_DW_EVENT_PARAM_SIZE, sizeof(void *)); 581 void *newparams = calloc(_DW_EVENT_PARAM_SIZE, sizeof(void *));
581 582
587 #endif 588 #endif
588 } 589 }
589 else 590 else
590 return _dw_event_handler2(params); 591 return _dw_event_handler2(params);
591 592
592 } 593 } /* If we don't have a handler, destroy the window */
594 else if(messageid == _DW_EVENT_DELETE)
595 dw_window_destroy(object);
593 return 0; 596 return 0;
594 } 597 }
595 598
596 /* 599 /*
597 * Entry location for all event handlers from the Android UI 600 * Entry location for all event handlers from the Android UI