Fixed GTK display issues and race conditions in certain Linux
configurations
This commit is contained in:
parent
0f7ffe1866
commit
bdd3bbf671
@ -191,7 +191,7 @@ class Gtk {
|
|||||||
public
|
public
|
||||||
void run() {
|
void run() {
|
||||||
// prep for the event loop.
|
// 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 (!gtk_init_check(0)) {
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
@ -200,13 +200,13 @@ class Gtk {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_threads_enter();
|
// gdk_threads_enter(); would be needed for g_idle_add()
|
||||||
|
|
||||||
// blocks unit quit
|
// blocks unit quit
|
||||||
gtk_main();
|
gtk_main();
|
||||||
|
|
||||||
// clean up threads
|
// clean up threads
|
||||||
gdk_threads_leave();
|
// gdk_threads_leave(); would be needed for g_idle_add()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gtkUpdateThread.setName("GTK Native Event Loop");
|
gtkUpdateThread.setName("GTK Native Event Loop");
|
||||||
@ -331,7 +331,7 @@ class Gtk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// non-swt/javafx
|
// not swt/javafx
|
||||||
if (isDispatch) {
|
if (isDispatch) {
|
||||||
// Run directly on the dispatch thread
|
// Run directly on the dispatch thread
|
||||||
runnable.run();
|
runnable.run();
|
||||||
@ -468,8 +468,6 @@ class Gtk {
|
|||||||
public static native void gtk_widget_destroy(Pointer widget);
|
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);
|
public static native int gdk_threads_add_idle_full(int priority, FuncCallback function, Pointer data, Pointer notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class GtkMenu extends MenuBase implements NativeUI {
|
|||||||
|
|
||||||
public
|
public
|
||||||
void shutdown() {
|
void shutdown() {
|
||||||
dispatchAndWait(new Runnable() {
|
dispatch(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void run() {
|
void run() {
|
||||||
@ -171,9 +171,6 @@ class GtkMenu extends MenuBase implements NativeUI {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public here so that Swing/Gtk/AppIndicator can override this
|
// public here so that Swing/Gtk/AppIndicator can override this
|
||||||
@Override
|
@Override
|
||||||
public
|
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'
|
// 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);
|
Gtk.gtk_menu_shell_append(this._native, entry._native);
|
||||||
Gobject.g_object_ref_sink(entry._native); // undoes "floating"
|
Gobject.g_object_ref_sink(entry._native); // undoes "floating"
|
||||||
|
Gtk.gtk_widget_show_all(entry._native);
|
||||||
}
|
}
|
||||||
else if (menuEntry__ instanceof GtkMenu) {
|
else if (menuEntry__ instanceof GtkMenu) {
|
||||||
GtkMenu subMenu = (GtkMenu) menuEntry__;
|
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'
|
// 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);
|
Gtk.gtk_menu_shell_append(this._native, subMenu.menuEntry._native);
|
||||||
Gobject.g_object_ref_sink(subMenu.menuEntry._native); // undoes "floating"
|
Gobject.g_object_ref_sink(subMenu.menuEntry._native); // undoes "floating"
|
||||||
|
Gtk.gtk_widget_show_all(subMenu.menuEntry._native);
|
||||||
|
|
||||||
if (subMenu.getParent() != GtkMenu.this) {
|
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
|
// we don't want to "createMenu" on our sub-menu that is assigned to us directly, as they are already doing it
|
||||||
|
Loading…
Reference in New Issue
Block a user