Mercurial > dwindows
comparison android/dw.cpp @ 2983:81611e54ff1d
Android: Fix DW_SIGNAL_HTML_MESSAGE, there were 3 problems in the last commit.
Passed HTML_CHANGE instead of HTML_MESSAGE in a copy and paste problem.
The injected javascript code needed the first parameter quoted.
The interface callback seems to be run on a thread that was not initialized.
Presumably the web content has its own thread so need to initialize the environment.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 27 Mar 2023 04:34:29 +0000 |
parents | e6fb2558e29e |
children | ebb94fc2b19f |
comparison
equal
deleted
inserted
replaced
2982:e6fb2558e29e | 2983:81611e54ff1d |
---|---|
270 { _DW_EVENT_TREE_EXPAND, DW_SIGNAL_TREE_EXPAND }, | 270 { _DW_EVENT_TREE_EXPAND, DW_SIGNAL_TREE_EXPAND }, |
271 { _DW_EVENT_COLUMN_CLICK, DW_SIGNAL_COLUMN_CLICK }, | 271 { _DW_EVENT_COLUMN_CLICK, DW_SIGNAL_COLUMN_CLICK }, |
272 { _DW_EVENT_HTML_RESULT, DW_SIGNAL_HTML_RESULT }, | 272 { _DW_EVENT_HTML_RESULT, DW_SIGNAL_HTML_RESULT }, |
273 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED }, | 273 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED }, |
274 { _DW_EVENT_HTML_MESSAGE, DW_SIGNAL_HTML_MESSAGE }, | 274 { _DW_EVENT_HTML_MESSAGE, DW_SIGNAL_HTML_MESSAGE }, |
275 { 0, "" } | 275 { 0, "" } |
276 }; | 276 }; |
277 | 277 |
278 #define _DW_EVENT_PARAM_SIZE 10 | 278 #define _DW_EVENT_PARAM_SIZE 10 |
279 | 279 |
280 int _dw_event_handler2(void **params) | 280 int _dw_event_handler2(void **params) |
590 if (handler) | 590 if (handler) |
591 { | 591 { |
592 params[9] = (void *)handler; | 592 params[9] = (void *)handler; |
593 | 593 |
594 /* We have to handle draw events in the main thread... | 594 /* We have to handle draw events in the main thread... |
595 * If it isn't a draw event, either queue the event | 595 * If it isn't a draw event, queue the event. |
596 * or launch a new thread to handle it. | |
597 */ | 596 */ |
598 if(DW_POINTER_TO_INT(params[8]) != _DW_EVENT_EXPOSE) | 597 if(DW_POINTER_TO_INT(params[8]) != _DW_EVENT_EXPOSE) |
599 { | 598 { |
600 /* Push the new event onto the queue if it fits */ | 599 /* Push the new event onto the queue if it fits */ |
601 _dw_queue_event(params); | 600 _dw_queue_event(params); |
688 const char *body = env->GetStringUTFChars(htmlBody, nullptr); | 687 const char *body = env->GetStringUTFChars(htmlBody, nullptr); |
689 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, DW_POINTER(name ? strdup(name) : nullptr), | 688 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, DW_POINTER(name ? strdup(name) : nullptr), |
690 DW_POINTER(body ? strdup(body) : nullptr), | 689 DW_POINTER(body ? strdup(body) : nullptr), |
691 nullptr, nullptr, nullptr, nullptr, nullptr, | 690 nullptr, nullptr, nullptr, nullptr, nullptr, |
692 DW_INT_TO_POINTER(message), nullptr }; | 691 DW_INT_TO_POINTER(message), nullptr }; |
692 | |
693 // This seems callback seems to run on an uninitialized thread... | |
694 pthread_setspecific(_dw_env_key, env); | |
693 | 695 |
694 _dw_event_handler(obj1, params); | 696 _dw_event_handler(obj1, params); |
695 if(name) | 697 if(name) |
696 env->ReleaseStringUTFChars(htmlName, name); | 698 env->ReleaseStringUTFChars(htmlName, name); |
697 if(body) | 699 if(body) |