xdg-open now runs outside of the GtkEventDispatch thread
This commit is contained in:
parent
7124bb3b5e
commit
48511eebb3
@ -78,26 +78,28 @@ class Desktop {
|
||||
// Additionally, xdg-open can cause problems in Linux with Chrome installed but not the default browser. It will crash Chrome
|
||||
// if Chrome was open before this app opened a URL
|
||||
if ((OS.isUnix() || OS.isLinux()) && GtkCheck.isGtkLoaded) {
|
||||
GtkEventDispatch.dispatch(new Runnable() {
|
||||
@Override
|
||||
public
|
||||
void run() {
|
||||
// there are problems with ubuntu and practically everything. Errors galore, and sometimes things don't even work.
|
||||
// see: https://bugzilla.mozilla.org/show_bug.cgi?id=672671
|
||||
if (OSUtil.DesktopEnv.isUnity() && OSUtil.Linux.isUbuntu()) {
|
||||
// use xdg-open, because it launches in a new shell and suppresses these errors/warnings.
|
||||
// it can be really buggy though, so we only use it for ubuntu...
|
||||
ShellExecutor.run("xdg-open", uri.toString());
|
||||
// there are problems with ubuntu and practically everything. Errors galore, and sometimes things don't even work.
|
||||
// see: https://bugzilla.mozilla.org/show_bug.cgi?id=672671
|
||||
if (OSUtil.DesktopEnv.isUnity() && OSUtil.Linux.isUbuntu()) {
|
||||
// use xdg-open, because it launches in a new shell and suppresses these errors/warnings.
|
||||
// it can be really buggy though, so we only use it for ubuntu...
|
||||
ShellExecutor.run("xdg-open", uri.toString());
|
||||
}
|
||||
else {
|
||||
GtkEventDispatch.dispatch(new Runnable() {
|
||||
@Override
|
||||
public
|
||||
void run() {
|
||||
if (GtkCheck.gtkIsGreaterOrEqual(3, 22, 0)) {
|
||||
Pointer pointer = Gtk2.Gtk2.gdk_display_get_default();
|
||||
Gtk3.Gtk3.gtk_show_uri_on_window(pointer, uri.toString(), 0, null);
|
||||
}
|
||||
else {
|
||||
Gtk2.Gtk2.gtk_show_uri(Gtk2.Gtk2.gdk_screen_get_default(), uri.toString(), 0, null);
|
||||
}
|
||||
}
|
||||
else if (GtkCheck.gtkIsGreaterOrEqual(3, 22, 0)) {
|
||||
Pointer pointer = Gtk2.Gtk2.gdk_display_get_default();
|
||||
Gtk3.Gtk3.gtk_show_uri_on_window(pointer, uri.toString(), 0, null);
|
||||
}
|
||||
else {
|
||||
Gtk2.Gtk2.gtk_show_uri(Gtk2.Gtk2.gdk_screen_get_default(), uri.toString(), 0, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (java.awt.Desktop.isDesktopSupported() && java.awt.Desktop.getDesktop()
|
||||
.isSupported(java.awt.Desktop.Action.BROWSE)) {
|
||||
@ -211,26 +213,28 @@ class Desktop {
|
||||
}
|
||||
|
||||
final String finalPath = path;
|
||||
GtkEventDispatch.dispatch(new Runnable() {
|
||||
@Override
|
||||
public
|
||||
void run() {
|
||||
// there are problems with ubuntu and practically everything. Errors galore, and sometimes things don't even work.
|
||||
// see: https://askubuntu.com/questions/788182/nautilus-not-opening-up-showing-glib-error
|
||||
if (OSUtil.DesktopEnv.isUnity() && OSUtil.Linux.isUbuntu()) {
|
||||
// use xdg-open, because it launches in a new shell and suppresses these errors/warnings.
|
||||
// it can be really buggy though, so we only use it for ubuntu...
|
||||
ShellExecutor.runShell("xdg-open", finalPath);
|
||||
// there are problems with ubuntu and practically everything. Errors galore, and sometimes things don't even work.
|
||||
// see: https://askubuntu.com/questions/788182/nautilus-not-opening-up-showing-glib-error
|
||||
if (OSUtil.DesktopEnv.isUnity() && OSUtil.Linux.isUbuntu()) {
|
||||
// use xdg-open, because it launches in a new shell and suppresses these errors/warnings.
|
||||
// it can be really buggy though, so we only use it for ubuntu...
|
||||
ShellExecutor.runShell("xdg-open", finalPath);
|
||||
}
|
||||
else {
|
||||
GtkEventDispatch.dispatch(new Runnable() {
|
||||
@Override
|
||||
public
|
||||
void run() {
|
||||
if (GtkCheck.gtkIsGreaterOrEqual(3, 22, 0)) {
|
||||
Pointer pointer = Gtk2.Gtk2.gdk_display_get_default();
|
||||
Gtk3.Gtk3.gtk_show_uri_on_window(pointer, finalPath, 0, null);
|
||||
}
|
||||
else {
|
||||
Gtk2.Gtk2.gtk_show_uri(Gtk2.Gtk2.gdk_screen_get_default(), finalPath, 0, null);
|
||||
}
|
||||
}
|
||||
else if (GtkCheck.gtkIsGreaterOrEqual(3, 22, 0)) {
|
||||
Pointer pointer = Gtk2.Gtk2.gdk_display_get_default();
|
||||
Gtk3.Gtk3.gtk_show_uri_on_window(pointer, finalPath, 0, null);
|
||||
}
|
||||
else {
|
||||
Gtk2.Gtk2.gtk_show_uri(Gtk2.Gtk2.gdk_screen_get_default(), finalPath, 0, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (java.awt.Desktop.isDesktopSupported() && java.awt.Desktop.getDesktop()
|
||||
.isSupported(java.awt.Desktop.Action.OPEN)) {
|
||||
|
Loading…
Reference in New Issue
Block a user