comparison gtk3/dw.c @ 2989:fed8a986d565

GTK3: Fix compiling with pre-2.22 WebKit2GTK. Missing exception variable, so just introduce a NULL one. Also the WebKitUserContentManager is NULL, causing it not to work. So make one during widget creation, allowing proper function. Might want to do this in the GTK4 code too just in case.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 04 Apr 2023 07:06:20 +0000
parents 0c5abc2ad5c5
children 9220cbf90ed3
comparison
equal deleted inserted replaced
2988:dfab2dfa9bc1 2989:fed8a986d565
1338 gchar *str_value = jsc_value_to_string(value); 1338 gchar *str_value = jsc_value_to_string(value);
1339 JSCException *exception = jsc_context_get_exception(jsc_value_get_context(value)); 1339 JSCException *exception = jsc_context_get_exception(jsc_value_get_context(value));
1340 #else 1340 #else
1341 context = webkit_javascript_result_get_global_context(js_result); 1341 context = webkit_javascript_result_get_global_context(js_result);
1342 value = webkit_javascript_result_get_value(js_result); 1342 value = webkit_javascript_result_get_value(js_result);
1343 if (JSValueIsString(context, value)) 1343 if(JSValueIsString(context, value))
1344 { 1344 {
1345 JSStringRef js_str_value; 1345 JSStringRef js_str_value;
1346 gchar *str_value; 1346 gchar *str_value;
1347 gsize str_length; 1347 gsize str_length;
1348 void *exception = NULL;
1348 1349
1349 js_str_value = JSValueToStringCopy(context, value, NULL); 1350 js_str_value = JSValueToStringCopy(context, value, NULL);
1350 str_length = JSStringGetMaximumUTF8CStringSize(js_str_value); 1351 str_length = JSStringGetMaximumUTF8CStringSize(js_str_value);
1351 str_value = (gchar *)g_malloc (str_length); 1352 str_value = (gchar *)g_malloc (str_length);
1352 JSStringGetUTF8CString(js_str_value, str_value, str_length); 1353 JSStringGetUTF8CString(js_str_value, str_value, str_length);
12055 #ifdef USE_WEBKIT 12056 #ifdef USE_WEBKIT
12056 int _dw_locked_by_me = FALSE; 12057 int _dw_locked_by_me = FALSE;
12057 WebKitWebView *web_view; 12058 WebKitWebView *web_view;
12058 #ifdef USE_WEBKIT2 12059 #ifdef USE_WEBKIT2
12059 WebKitSettings *settings; 12060 WebKitSettings *settings;
12061 WebKitUserContentManager *manager;
12060 #else 12062 #else
12061 WebKitWebSettings *settings; 12063 WebKitWebSettings *settings;
12062 #endif 12064 #endif
12063 12065
12064 DW_MUTEX_LOCK; 12066 DW_MUTEX_LOCK;
12067 #ifdef USE_WEBKIT2
12068 manager = webkit_user_content_manager_new();
12069 web_view = (WebKitWebView *)webkit_web_view_new_with_user_content_manager(manager);
12070 #else
12065 web_view = (WebKitWebView *)webkit_web_view_new(); 12071 web_view = (WebKitWebView *)webkit_web_view_new();
12072 #endif
12066 /* WebKit2 no longer requires a scrolled window... 12073 /* WebKit2 no longer requires a scrolled window...
12067 * So only create a scrolled window and pack it in older versions. 12074 * So only create a scrolled window and pack it in older versions.
12068 */ 12075 */
12069 #ifndef USE_WEBKIT2 12076 #ifndef USE_WEBKIT2
12070 widget = gtk_scrolled_window_new(NULL, NULL); 12077 widget = gtk_scrolled_window_new(NULL, NULL);