5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 05:11:29 +08:00

Revert "Make calls thread safe"

This reverts commit 347d8cf861.
This commit is contained in:
Lea Anthony 2025-04-18 16:36:46 +10:00
parent 76f806fe82
commit de29a0bd6f
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -14,6 +14,9 @@ static float xroot = 0.0f;
static float yroot = 0.0f; static float yroot = 0.0f;
static int dragTime = -1; static int dragTime = -1;
static uint mouseButton = 0; static uint mouseButton = 0;
static int wmIsWayland = -1;
static int decoratorWidth = -1;
static int decoratorHeight = -1;
// casts // casts
void ExecuteOnMainThread(void *f, gpointer jscallback) void ExecuteOnMainThread(void *f, gpointer jscallback)
@ -70,13 +73,23 @@ static bool isNULLRectangle(GdkRectangle input)
static gboolean onWayland() static gboolean onWayland()
{ {
const char *gdkBackend = getenv("XDG_SESSION_TYPE"); switch (wmIsWayland)
if(gdkBackend != NULL && strcmp(gdkBackend, "wayland") == 0)
{ {
return TRUE; case -1:
} char *gdkBackend = getenv("XDG_SESSION_TYPE");
if(gdkBackend != NULL && strcmp(gdkBackend, "wayland") == 0)
{
wmIsWayland = 1;
return TRUE;
}
return FALSE; wmIsWayland = 0;
return FALSE;
case 1:
return TRUE;
default:
return FALSE;
}
} }
static GdkMonitor *getCurrentMonitor(GtkWindow *window) static GdkMonitor *getCurrentMonitor(GtkWindow *window)
@ -257,18 +270,24 @@ void SetMinMaxSize(GtkWindow *window, int min_width, int min_height, int max_wid
size.min_height = min_height; size.min_height = min_height;
size.min_width = min_width; size.min_width = min_width;
// On Wayland window manager get the decorators and calculate the differences from the window size. // On Wayland window manager get the decorators and calculate the differences from the windows' size.
if(onWayland()) if(onWayland())
{ {
int windowWidth, windowHeight; if(decoratorWidth == -1 && decoratorHeight == -1)
gtk_window_get_size(window, &windowWidth, &windowHeight); {
int windowWidth, windowHeight;
gtk_window_get_size(window, &windowWidth, &windowHeight);
GtkAllocation windowAllocation; GtkAllocation windowAllocation;
gtk_widget_get_allocation(GTK_WIDGET(window), &windowAllocation); gtk_widget_get_allocation(GTK_WIDGET(window), &windowAllocation);
decoratorWidth = (windowAllocation.width-windowWidth);
decoratorHeight = (windowAllocation.height-windowHeight);
}
// Add the decorator difference to the window so fullscreen and maximise can fill the window. // Add the decorator difference to the window so fullscreen and maximise can fill the window.
size.max_height = (windowAllocation.height-windowHeight)+size.max_height; size.max_height = decoratorHeight+size.max_height;
size.max_width = (windowAllocation.width-windowWidth)+size.max_width; size.max_width = decoratorWidth+size.max_width;
} }
gtk_window_set_geometry_hints(window, NULL, &size, flags); gtk_window_set_geometry_hints(window, NULL, &size, flags);