Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/llvm/moonrt_gui_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include <string>
#include <unordered_map>

#ifdef __cplusplus
extern "C" {
#endif

// Detect WebKit version for API compatibility
// webkit2gtk-4.1 deprecates webkit_web_view_run_javascript in favor of webkit_web_view_evaluate_javascript
#if WEBKIT_MAJOR_VERSION > 2 || (WEBKIT_MAJOR_VERSION == 2 && WEBKIT_MINOR_VERSION >= 40)
Expand Down Expand Up @@ -491,7 +495,10 @@ MoonValue* moon_gui_create(MoonValue* options) {

// Store window
g_windows[win->id] = win;


// By default, show window after webview finished loading
win->showPending = true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear pending auto-show when creating hidden windows

Initializing win->showPending = true for every new window means the first WEBKIT_LOAD_FINISHED will always call gtk_widget_show_all. If an app hides the window before load completion via gui_show(false) or gui_show_win(id,false), those hide paths do not clear showPending, so the load callback re-shows the window unexpectedly; this regresses hidden/tray startup flows.

Useful? React with 👍 / 👎.


return moon_int(win->id);
}

Expand Down Expand Up @@ -1085,3 +1092,7 @@ void moon_gui_tray_on_click(MoonValue* callback) {}
void moon_gui_show_window(MoonValue* show) {}

#endif // MOON_PLATFORM_LINUX && !MOON_NO_GUI

#ifdef __cplusplus
}
Comment on lines +1096 to +1097

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep extern "C" close inside the same preprocessor branch

The added #ifdef __cplusplus ... } is placed after #endif // MOON_PLATFORM_LINUX && !MOON_NO_GUI, while the matching extern "C" { is only emitted inside the Linux+GUI branch. When this file is compiled with MOON_NO_GUI (the CMake ENABLE_GUI=OFF path still compiles moonrt_gui_linux.cpp), the opener is skipped but the closer remains, producing a hard compile error (expected declaration before '}' token) and breaking no-GUI Linux builds.

Useful? React with 👍 / 👎.

#endif