xdg-open now runs outside of the GtkEventDispatch thread
This commit is contained in:
parent
7124bb3b5e
commit
48511eebb3
@ -78,10 +78,6 @@ class Desktop {
|
|||||||
// Additionally, xdg-open can cause problems in Linux with Chrome installed but not the default browser. It will crash Chrome
|
// 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 Chrome was open before this app opened a URL
|
||||||
if ((OS.isUnix() || OS.isLinux()) && GtkCheck.isGtkLoaded) {
|
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.
|
// 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
|
// see: https://bugzilla.mozilla.org/show_bug.cgi?id=672671
|
||||||
if (OSUtil.DesktopEnv.isUnity() && OSUtil.Linux.isUbuntu()) {
|
if (OSUtil.DesktopEnv.isUnity() && OSUtil.Linux.isUbuntu()) {
|
||||||
@ -89,7 +85,12 @@ class Desktop {
|
|||||||
// it can be really buggy though, so we only use it for ubuntu...
|
// it can be really buggy though, so we only use it for ubuntu...
|
||||||
ShellExecutor.run("xdg-open", uri.toString());
|
ShellExecutor.run("xdg-open", uri.toString());
|
||||||
}
|
}
|
||||||
else if (GtkCheck.gtkIsGreaterOrEqual(3, 22, 0)) {
|
else {
|
||||||
|
GtkEventDispatch.dispatch(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public
|
||||||
|
void run() {
|
||||||
|
if (GtkCheck.gtkIsGreaterOrEqual(3, 22, 0)) {
|
||||||
Pointer pointer = Gtk2.Gtk2.gdk_display_get_default();
|
Pointer pointer = Gtk2.Gtk2.gdk_display_get_default();
|
||||||
Gtk3.Gtk3.gtk_show_uri_on_window(pointer, uri.toString(), 0, null);
|
Gtk3.Gtk3.gtk_show_uri_on_window(pointer, uri.toString(), 0, null);
|
||||||
}
|
}
|
||||||
@ -99,6 +100,7 @@ class Desktop {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (java.awt.Desktop.isDesktopSupported() && java.awt.Desktop.getDesktop()
|
else if (java.awt.Desktop.isDesktopSupported() && java.awt.Desktop.getDesktop()
|
||||||
.isSupported(java.awt.Desktop.Action.BROWSE)) {
|
.isSupported(java.awt.Desktop.Action.BROWSE)) {
|
||||||
java.awt.Desktop.getDesktop()
|
java.awt.Desktop.getDesktop()
|
||||||
@ -211,10 +213,6 @@ class Desktop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String finalPath = path;
|
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.
|
// 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
|
// see: https://askubuntu.com/questions/788182/nautilus-not-opening-up-showing-glib-error
|
||||||
if (OSUtil.DesktopEnv.isUnity() && OSUtil.Linux.isUbuntu()) {
|
if (OSUtil.DesktopEnv.isUnity() && OSUtil.Linux.isUbuntu()) {
|
||||||
@ -222,7 +220,12 @@ class Desktop {
|
|||||||
// it can be really buggy though, so we only use it for ubuntu...
|
// it can be really buggy though, so we only use it for ubuntu...
|
||||||
ShellExecutor.runShell("xdg-open", finalPath);
|
ShellExecutor.runShell("xdg-open", finalPath);
|
||||||
}
|
}
|
||||||
else if (GtkCheck.gtkIsGreaterOrEqual(3, 22, 0)) {
|
else {
|
||||||
|
GtkEventDispatch.dispatch(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public
|
||||||
|
void run() {
|
||||||
|
if (GtkCheck.gtkIsGreaterOrEqual(3, 22, 0)) {
|
||||||
Pointer pointer = Gtk2.Gtk2.gdk_display_get_default();
|
Pointer pointer = Gtk2.Gtk2.gdk_display_get_default();
|
||||||
Gtk3.Gtk3.gtk_show_uri_on_window(pointer, finalPath, 0, null);
|
Gtk3.Gtk3.gtk_show_uri_on_window(pointer, finalPath, 0, null);
|
||||||
}
|
}
|
||||||
@ -232,6 +235,7 @@ class Desktop {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (java.awt.Desktop.isDesktopSupported() && java.awt.Desktop.getDesktop()
|
else if (java.awt.Desktop.isDesktopSupported() && java.awt.Desktop.getDesktop()
|
||||||
.isSupported(java.awt.Desktop.Action.OPEN)) {
|
.isSupported(java.awt.Desktop.Action.OPEN)) {
|
||||||
java.awt.Desktop.getDesktop()
|
java.awt.Desktop.getDesktop()
|
||||||
|
Loading…
Reference in New Issue
Block a user