comparison gtk/dw.c @ 2081:24875681eec5

Added htmlEngine to DWEnv
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 31 May 2020 05:25:18 +0000
parents c2f13c5eefac
children 94ea915bd917
comparison
equal deleted inserted replaced
2080:8f08d4c9d3fc 2081:24875681eec5
1252 { 1252 {
1253 SignalHandler work = _get_signal_handler(data); 1253 SignalHandler work = _get_signal_handler(data);
1254 char *location = (char *)webkit_web_view_get_uri(web_view); 1254 char *location = (char *)webkit_web_view_get_uri(web_view);
1255 int status = 0; 1255 int status = 0;
1256 void **params = data; 1256 void **params = data;
1257 1257
1258 if(params) 1258 if(params)
1259 status = DW_POINTER_TO_INT(params[3]); 1259 status = DW_POINTER_TO_INT(params[3]);
1260 1260
1261 if(status && location && work.window && work.func) 1261 if(status && location && work.window && work.func)
1262 { 1262 {
1263 int (*htmlchangedfunc)(HWND, int, char *, void *) = work.func; 1263 int (*htmlchangedfunc)(HWND, int, char *, void *) = work.func;
1264 1264
1265 htmlchangedfunc(work.window, status, location, work.data); 1265 htmlchangedfunc(work.window, status, location, work.data);
1266 } 1266 }
1267 } 1267 }
1268 #endif 1268 #endif
1269 1269
2109 if(!_dw_app_id[0]) 2109 if(!_dw_app_id[0])
2110 { 2110 {
2111 /* Generate an Application ID based on the PID if all else fails. */ 2111 /* Generate an Application ID based on the PID if all else fails. */
2112 snprintf(_dw_app_id, 100, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid()); 2112 snprintf(_dw_app_id, 100, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid());
2113 } 2113 }
2114 2114
2115 /* Initialize the application subsystem on supported versions... 2115 /* Initialize the application subsystem on supported versions...
2116 * we generate an application ID based on the binary name or PID 2116 * we generate an application ID based on the binary name or PID
2117 * instead of passing NULL to enable full application support. 2117 * instead of passing NULL to enable full application support.
2118 */ 2118 */
2119 _DWApp = g_application_new(_dw_app_id, G_APPLICATION_FLAGS_NONE); 2119 _DWApp = g_application_new(_dw_app_id, G_APPLICATION_FLAGS_NONE);
12333 * or NULL if none is necessary. 12333 * or NULL if none is necessary.
12334 * Returns: 12334 * Returns:
12335 * A handle to the notification which can be used to attach a "clicked" event if desired, 12335 * A handle to the notification which can be used to attach a "clicked" event if desired,
12336 * or NULL if it fails or notifications are not supported by the system. 12336 * or NULL if it fails or notifications are not supported by the system.
12337 * Remarks: 12337 * Remarks:
12338 * This will create a system notification that will show in the notifaction panel 12338 * This will create a system notification that will show in the notifaction panel
12339 * on supported systems, which may be clicked to perform another task. 12339 * on supported systems, which may be clicked to perform another task.
12340 */ 12340 */
12341 HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...) 12341 HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...)
12342 { 12342 {
12343 #if GLIB_CHECK_VERSION(2,40,0) 12343 #if GLIB_CHECK_VERSION(2,40,0)
12344 GNotification *notification = g_notification_new(title); 12344 GNotification *notification = g_notification_new(title);
12345 12345
12346 if(notification) 12346 if(notification)
12347 { 12347 {
12348 if(description) 12348 if(description)
12349 { 12349 {
12350 va_list args; 12350 va_list args;
12358 } 12358 }
12359 #if GTK_MAJOR_VERSION > 1 12359 #if GTK_MAJOR_VERSION > 1
12360 /* GTK 1.x is not implemented as pixbuf, so only allow icons on 2.x */ 12360 /* GTK 1.x is not implemented as pixbuf, so only allow icons on 2.x */
12361 if(pixmap && pixmap->pixbuf) 12361 if(pixmap && pixmap->pixbuf)
12362 g_notification_set_icon(notification, G_ICON(pixmap->pixbuf)); 12362 g_notification_set_icon(notification, G_ICON(pixmap->pixbuf));
12363 #endif 12363 #endif
12364 } 12364 }
12365 return (HWND)notification; 12365 return (HWND)notification;
12366 #else 12366 #else
12367 return NULL; 12367 return NULL;
12368 #endif 12368 #endif
12379 { 12379 {
12380 #if GLIB_CHECK_VERSION(2,40,0) 12380 #if GLIB_CHECK_VERSION(2,40,0)
12381 if(notification) 12381 if(notification)
12382 { 12382 {
12383 char id[101] = {0}; 12383 char id[101] = {0};
12384 12384
12385 /* Generate a unique ID based on the notification handle, 12385 /* Generate a unique ID based on the notification handle,
12386 * so we can use it to remove the notification in dw_window_destroy(). 12386 * so we can use it to remove the notification in dw_window_destroy().
12387 */ 12387 */
12388 snprintf(id, 100, "dw-notification-%llu", (unsigned long long)notification); 12388 snprintf(id, 100, "dw-notification-%llu", (unsigned long long)notification);
12389 g_application_send_notification(_DWApp, id, (GNotification *)notification); 12389 g_application_send_notification(_DWApp, id, (GNotification *)notification);
12390 return DW_ERROR_NONE; 12390 return DW_ERROR_NONE;
12414 env->DWMinorVersion = DW_MINOR_VERSION; 12414 env->DWMinorVersion = DW_MINOR_VERSION;
12415 #ifdef VER_REV 12415 #ifdef VER_REV
12416 env->DWSubVersion = VER_REV; 12416 env->DWSubVersion = VER_REV;
12417 #else 12417 #else
12418 env->DWSubVersion = DW_SUB_VERSION; 12418 env->DWSubVersion = DW_SUB_VERSION;
12419 #endif
12420 #ifdef USE_WEBKIT
12421 strncpy(env->htmlEngine, "WEBKIT", sizeof(env->htmlEngine)-1);
12422 #else
12423 strncpy(env->htmlEngine, "N/A", sizeof(env->htmlEngine)-1);
12419 #endif 12424 #endif
12420 12425
12421 if((dot = strchr(tempbuf, '.')) != NULL) 12426 if((dot = strchr(tempbuf, '.')) != NULL)
12422 { 12427 {
12423 *dot = '\0'; 12428 *dot = '\0';
12910 DW_MUTEX_LOCK; 12915 DW_MUTEX_LOCK;
12911 web_view = (WebKitWebView *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_web_view"); 12916 web_view = (WebKitWebView *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_web_view");
12912 if(web_view) 12917 if(web_view)
12913 { 12918 {
12914 WebKitWebFrame *frame; 12919 WebKitWebFrame *frame;
12915 12920
12916 switch(action) 12921 switch(action)
12917 { 12922 {
12918 case DW_HTML_GOBACK: 12923 case DW_HTML_GOBACK:
12919 webkit_web_view_go_back(web_view); 12924 webkit_web_view_go_back(web_view);
12920 break; 12925 break;
13013 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) 13018 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata)
13014 { 13019 {
13015 #ifdef USE_WEBKIT 13020 #ifdef USE_WEBKIT
13016 int _locked_by_me = FALSE; 13021 int _locked_by_me = FALSE;
13017 WebKitWebView *web_view; 13022 WebKitWebView *web_view;
13018 13023
13019 DW_MUTEX_LOCK; 13024 DW_MUTEX_LOCK;
13020 if((web_view = (WebKitWebView *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_web_view"))) 13025 if((web_view = (WebKitWebView *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_web_view")))
13021 webkit_web_view_execute_script(web_view, script); 13026 webkit_web_view_execute_script(web_view, script);
13022 DW_MUTEX_UNLOCK; 13027 DW_MUTEX_UNLOCK;
13023 return DW_ERROR_NONE; 13028 return DW_ERROR_NONE;