From aefd6df293931ec0a824c70bdb2f09a5cf154a54 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Mon, 8 Jul 2024 00:49:02 -0400 Subject: [PATCH] move gtk_init; expose headers --- CMakeLists.txt | 1 - preview/preview.cpp | 2 -- src/CMakeLists.txt | 2 +- src/linux.cpp | 1 + 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c04391..716ad25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,6 @@ if(LINUX) endif() include_directories(pugixml/src) -include_directories(webview) if(NOT "${WKWEBVIEW_PROTOCOL}" STREQUAL "") add_definitions(-DWKWEBVIEW_PROTOCOL="${WKWEBVIEW_PROTOCOL}") diff --git a/preview/preview.cpp b/preview/preview.cpp index 100dc29..2025e6a 100644 --- a/preview/preview.cpp +++ b/preview/preview.cpp @@ -13,8 +13,6 @@ int main(int argc, char *argv[]) { #ifdef __APPLE__ @autoreleasepool { NSApplication *application = [NSApplication sharedApplication]; -#elif defined(__linux__) - gtk_init(&argc, &argv); #endif std::unique_ptr candidateWindow = std::make_unique(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a0b1678..8d7321f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,7 +11,7 @@ endif() add_library(WebviewCandidateWindow ${SOURCES}) -target_include_directories(WebviewCandidateWindow PRIVATE "${PROJECT_SOURCE_DIR}/include") +target_include_directories(WebviewCandidateWindow PUBLIC "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/webview") if(APPLE) target_link_libraries(WebviewCandidateWindow "-framework WebKit" PkgConfig::NlohmannJson) diff --git a/src/linux.cpp b/src/linux.cpp index bf69d30..3ab967e 100644 --- a/src/linux.cpp +++ b/src/linux.cpp @@ -4,6 +4,7 @@ namespace candidate_window { void *WebviewCandidateWindow::create_window() { + gtk_init(nullptr, nullptr); auto window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 400, 300); gtk_window_set_decorated(GTK_WINDOW(window), FALSE);