File tree Expand file tree Collapse file tree 5 files changed +95
-7
lines changed
Expand file tree Collapse file tree 5 files changed +95
-7
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,22 @@ target_include_directories(${MODULE_NAME} PRIVATE "include/saucer")
1515# Add Sources
1616# --------------------------------------------------------------------------------------------------------
1717
18- add_compile_definitions (BOSON_VERSION="0.6.0" )
18+ if (saucer_backend STREQUAL "Default" )
19+ if (WIN32 )
20+ set (saucer_backend WebView2)
21+ elseif (APPLE )
22+ set (saucer_backend WebKit)
23+ else ()
24+ set (saucer_backend WebKitGtk)
25+ endif ()
26+
27+ saucer_message(STATUS "Backend is 'Default', using ${saucer_backend} " )
28+ endif ()
29+
30+ add_compile_definitions (BOSON_VERSION=0.6.0)
31+ add_compile_definitions (SAUCER_BACKEND=${saucer_backend} )
1932
2033target_sources (${MODULE_NAME} PRIVATE
2134 "src/boson.cpp"
35+ "src/desktop_extensions.cpp"
2236)
Original file line number Diff line number Diff line change @@ -7,7 +7,22 @@ extern "C"
77
88#include "export.h"
99
10- BOSON_EXPORT const char * boson_version ();
10+ enum boson_backend
11+ {
12+ BOSON_BACKEND_WEBVIEW2 ,
13+ BOSON_BACKEND_WEBKIT ,
14+ BOSON_BACKEND_WEBKIT_GTK ,
15+ BOSON_BACKEND_QT ,
16+ BOSON_BACKEND_UNKNOWN = -1 ,
17+
18+ BOSON_BACKEND_LAST = BOSON_BACKEND_QT ,
19+ };
20+
21+ BOSON_EXPORT extern const char * boson_version (void );
22+
23+ BOSON_EXPORT extern boson_backend boson_get_backend (void );
24+ BOSON_EXPORT extern const char * boson_get_backend_str (void );
25+
1126
1227#ifdef __cplusplus
1328}
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #ifdef __cplusplus
4+ extern "C"
5+ {
6+ #endif
7+
8+ #include "export.h"
9+
10+ BOSON_EXPORT extern int boson_error_code_canceled ();
11+
12+ #ifdef __cplusplus
13+ }
14+ #endif
Original file line number Diff line number Diff line change 11#include " boson.h"
22
3+ #include < string.h>
4+
35#define BOSON_STRING (value ) #value
46#define BOSON_STRING_EXPAND (value ) BOSON_STRING(value)
57
8+ #ifndef BOSON_VERSION
9+ #define BOSON_VERSION master
10+ #endif
11+
12+ #ifndef SAUCER_BACKEND
13+ #define SAUCER_BACKEND Default
14+ #endif
15+
16+
617extern " C"
718{
8- const char * boson_version ()
19+ const char * boson_version (void )
920 {
10- #ifndef BOSON_VERSION
11- #define unknown -dev
12- #endif
13-
1421 return BOSON_STRING_EXPAND (BOSON_VERSION) " " ;
1522 }
23+
24+ const char * boson_get_backend_str (void )
25+ {
26+ return BOSON_STRING_EXPAND (SAUCER_BACKEND) " " ;
27+ }
28+
29+ boson_backend boson_get_backend (void )
30+ {
31+ const char * boson_backend_str = BOSON_STRING_EXPAND (SAUCER_BACKEND) " " ;
32+
33+ if (strcmp (boson_backend_str, " WebView2" ) == 0 ) {
34+ return boson_backend::BOSON_BACKEND_WEBVIEW2;
35+ }
36+ else if (strcmp (boson_backend_str, " WebKit" ) == 0 ) {
37+ return boson_backend::BOSON_BACKEND_WEBKIT;
38+ }
39+ else if (strcmp (boson_backend_str, " WebKitGtk" ) == 0 ) {
40+ return boson_backend::BOSON_BACKEND_WEBKIT_GTK;
41+ }
42+ else if (strcmp (boson_backend_str, " Qt" ) == 0 ) {
43+ return boson_backend::BOSON_BACKEND_QT;
44+ }
45+
46+ return boson_backend::BOSON_BACKEND_UNKNOWN;
47+ }
1648}
Original file line number Diff line number Diff line change 1+ #include " desktop_extensions.h"
2+
3+ #include < system_error>
4+
5+ extern " C"
6+ {
7+
8+ int boson_error_code_canceled (void )
9+ {
10+ return static_cast <int >(std::errc::operation_canceled);
11+ }
12+
13+ }
You can’t perform that action at this time.
0 commit comments