Fixed GTK display issues and race conditions in certain Linux

configurations
This commit is contained in:
nathan 2016-10-15 14:14:11 +02:00
parent 0f7ffe1866
commit bdd3bbf671
2 changed files with 7 additions and 10 deletions

View File

@ -191,7 +191,7 @@ class Gtk {
public
void run() {
// prep for the event loop.
GThread.g_thread_init(null);
// GThread.g_thread_init(null); would be needed for g_idle_add()
if (!gtk_init_check(0)) {
if (SystemTray.DEBUG) {
@ -200,13 +200,13 @@ class Gtk {
return;
}
gdk_threads_enter();
// gdk_threads_enter(); would be needed for g_idle_add()
// blocks unit quit
gtk_main();
// clean up threads
gdk_threads_leave();
// gdk_threads_leave(); would be needed for g_idle_add()
}
};
gtkUpdateThread.setName("GTK Native Event Loop");
@ -331,7 +331,7 @@ class Gtk {
}
}
else {
// non-swt/javafx
// not swt/javafx
if (isDispatch) {
// Run directly on the dispatch thread
runnable.run();
@ -468,8 +468,6 @@ class Gtk {
public static native void gtk_widget_destroy(Pointer widget);
public static native void gdk_threads_enter();
public static native void gdk_threads_leave();
public static native int gdk_threads_add_idle_full(int priority, FuncCallback function, Pointer data, Pointer notify);
}

View File

@ -112,7 +112,7 @@ class GtkMenu extends MenuBase implements NativeUI {
public
void shutdown() {
dispatchAndWait(new Runnable() {
dispatch(new Runnable() {
@Override
public
void run() {
@ -171,9 +171,6 @@ class GtkMenu extends MenuBase implements NativeUI {
// public here so that Swing/Gtk/AppIndicator can override this
@Override
public
@ -317,6 +314,7 @@ class GtkMenu extends MenuBase implements NativeUI {
// will also get: gsignal.c:2516: signal 'child-added' is invalid for instance '0x7f1df8244080' of type 'GtkMenu'
Gtk.gtk_menu_shell_append(this._native, entry._native);
Gobject.g_object_ref_sink(entry._native); // undoes "floating"
Gtk.gtk_widget_show_all(entry._native);
}
else if (menuEntry__ instanceof GtkMenu) {
GtkMenu subMenu = (GtkMenu) menuEntry__;
@ -324,6 +322,7 @@ class GtkMenu extends MenuBase implements NativeUI {
// will also get: gsignal.c:2516: signal 'child-added' is invalid for instance '0x7f1df8244080' of type 'GtkMenu'
Gtk.gtk_menu_shell_append(this._native, subMenu.menuEntry._native);
Gobject.g_object_ref_sink(subMenu.menuEntry._native); // undoes "floating"
Gtk.gtk_widget_show_all(subMenu.menuEntry._native);
if (subMenu.getParent() != GtkMenu.this) {
// we don't want to "createMenu" on our sub-menu that is assigned to us directly, as they are already doing it