Mercurial > dwindows
comparison gtk3/dw.c @ 2007:3a26e6f6691d
GTK3: Enable javascript and use webkit_web_view_execute_script() when using
webkit1, this has no callback to see results but hopefully it will work.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 06 Nov 2019 14:37:01 +0000 |
parents | 6f1adc77de02 |
children | 74facb490f5a |
comparison
equal
deleted
inserted
replaced
2006:6f1adc77de02 | 2007:3a26e6f6691d |
---|---|
11506 * Returns: | 11506 * Returns: |
11507 * DW_ERROR_NONE (0) on success. | 11507 * DW_ERROR_NONE (0) on success. |
11508 */ | 11508 */ |
11509 int dw_html_javascript_run(HWND handle, char *script, void *scriptdata) | 11509 int dw_html_javascript_run(HWND handle, char *script, void *scriptdata) |
11510 { | 11510 { |
11511 #ifdef USE_WEBKIT2 | 11511 #ifdef USE_WEBKIT |
11512 int _locked_by_me = FALSE; | 11512 int _locked_by_me = FALSE; |
11513 WebKitWebView *web_view; | 11513 WebKitWebView *web_view; |
11514 | 11514 |
11515 DW_MUTEX_LOCK; | 11515 DW_MUTEX_LOCK; |
11516 if((web_view = _dw_html_web_view(handle))) | 11516 if((web_view = _dw_html_web_view(handle))) |
11517 webkit_web_view_run_javascript (web_view, script, NULL, _html_result_event, scriptdata); | 11517 #ifdef USE_WEBKIT2 |
11518 webkit_web_view_run_javascript(web_view, script, NULL, _html_result_event, scriptdata); | |
11519 #else | |
11520 webkit_web_view_execute_script(web_view, script); | |
11521 #endif | |
11518 DW_MUTEX_UNLOCK; | 11522 DW_MUTEX_UNLOCK; |
11519 return DW_ERROR_NONE; | 11523 return DW_ERROR_NONE; |
11520 #else | 11524 #else |
11521 return DW_ERROR_UNKNOWN; | 11525 return DW_ERROR_UNKNOWN; |
11522 #endif | 11526 #endif |
11556 { | 11560 { |
11557 GtkWidget *widget = NULL; | 11561 GtkWidget *widget = NULL; |
11558 #ifdef USE_WEBKIT | 11562 #ifdef USE_WEBKIT |
11559 int _locked_by_me = FALSE; | 11563 int _locked_by_me = FALSE; |
11560 WebKitWebView *web_view; | 11564 WebKitWebView *web_view; |
11565 WebKitSettings *settings; | |
11561 | 11566 |
11562 DW_MUTEX_LOCK; | 11567 DW_MUTEX_LOCK; |
11563 web_view = (WebKitWebView *)webkit_web_view_new(); | 11568 web_view = (WebKitWebView *)webkit_web_view_new(); |
11569 settings = webkit_web_view_get_settings(web_view); | |
11570 /* Make sure java script is enabled */ | |
11571 webkit_settings_set_enable_javascript(settings, TRUE); | |
11572 webkit_web_view_set_settings(web_view, settings); | |
11564 /* WebKit2 no longer requires a scrolled window... | 11573 /* WebKit2 no longer requires a scrolled window... |
11565 * So only create a scrolled window and pack it in older versions. | 11574 * So only create a scrolled window and pack it in older versions. |
11566 */ | 11575 */ |
11567 #ifndef USE_WEBKIT2 | 11576 #ifndef USE_WEBKIT2 |
11568 widget = gtk_scrolled_window_new(NULL, NULL); | 11577 widget = gtk_scrolled_window_new(NULL, NULL); |