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

Fix fullscreen on linux arm64 (#1209)

* Fix fatal error on otherwise clean exit.

* Fix race condition while setting title during window creation.

* Fix unexpected signal error when clicking webview should initiate a drag window operation.

* Ensure ExecuteOnMainThread callbacks are removed from the event source list on completion.

* Ensure all ExecuteOnMainThread callbacks use the expected return value on completion.

* Fix potential memory leak when exiting early from startDrag.

* Fix using runtime.WindowFullscreen on Linux ARM64.
This commit is contained in:
Ian M. Jones 2022-03-04 12:07:40 +00:00 committed by GitHub
parent cdfd70d3f7
commit e9aa0d5c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,16 +45,28 @@ static void SetMinMaxSize(GtkWindow* window, int min_width, int min_height, int
gtk_window_set_geometry_hints(window, NULL, &size, flags);
}
GdkRectangle getCurrentMonitorGeometry(GtkWindow *window) {
// Get the monitor that the window is currently on
GdkDisplay *display = gtk_widget_get_display(GTK_WIDGET(window));
GdkWindow *gdk_window = gtk_widget_get_window(GTK_WIDGET(window));
GdkMonitor *monitor = gdk_display_get_monitor_at_window (display, gdk_window);
GdkMonitor* getCurrentMonitor(GtkWindow *window) {
// Get the monitor that the window is currently on
GdkDisplay *display = gtk_widget_get_display(GTK_WIDGET(window));
GdkWindow *gdk_window = gtk_widget_get_window(GTK_WIDGET(window));
GdkMonitor *monitor = gdk_display_get_monitor_at_window(display, gdk_window);
// Get the geometry of the monitor
GdkRectangle result;
gdk_monitor_get_geometry (monitor,&result);
return result;
return GDK_MONITOR(monitor);
}
GdkRectangle getCurrentMonitorGeometry(GtkWindow *window) {
GdkMonitor *monitor = getCurrentMonitor(window);
// Get the geometry of the monitor
GdkRectangle result;
gdk_monitor_get_geometry (monitor,&result);
return result;
}
int getCurrentMonitorScaleFactor(GtkWindow *window) {
GdkMonitor *monitor = getCurrentMonitor(window);
return gdk_monitor_get_scale_factor(monitor);
}
gboolean Center(gpointer data) {
@ -503,7 +515,14 @@ gboolean UnMinimise(gpointer data) {
}
gboolean Fullscreen(gpointer data) {
gtk_window_fullscreen((GtkWindow*)data);
GtkWindow* window = (GtkWindow*)data;
// Get the geometry of the monitor.
GdkRectangle m = getCurrentMonitorGeometry(window);
int scale = getCurrentMonitorScaleFactor(window);
SetMinMaxSize(window, 0, 0, m.width * scale, m.height * scale);
gtk_window_fullscreen(window);
return G_SOURCE_REMOVE;
}
@ -632,7 +651,6 @@ func (w *Window) cWebKitUserContentManager() *C.WebKitUserContentManager {
}
func (w *Window) Fullscreen() {
C.SetMinMaxSize(w.asGTKWindow(), C.int(0), C.int(0), C.int(0), C.int(0))
C.ExecuteOnMainThread(C.Fullscreen, C.gpointer(w.asGTKWindow()))
}