Removed unnecessary SWT specific code

This commit is contained in:
nathan 2017-07-14 18:46:07 +02:00
parent 7c528918f5
commit 4ecafbf50c

View File

@ -39,7 +39,6 @@ import dorkbox.util.Framework;
import dorkbox.util.MathUtil; import dorkbox.util.MathUtil;
import dorkbox.util.OS; import dorkbox.util.OS;
import dorkbox.util.OSUtil; import dorkbox.util.OSUtil;
import dorkbox.util.Swt;
import dorkbox.util.jna.linux.structs.GtkRequisition; import dorkbox.util.jna.linux.structs.GtkRequisition;
import dorkbox.util.jna.linux.structs.GtkStyle; import dorkbox.util.jna.linux.structs.GtkStyle;
import dorkbox.util.jna.linux.structs.PangoRectangle; import dorkbox.util.jna.linux.structs.PangoRectangle;
@ -143,22 +142,19 @@ class GtkTheme {
screenScale.set(0D); screenScale.set(0D);
screenDPI.set(0); screenDPI.set(0);
if (Framework.isSwtLoaded) {
screenDPI.set(Swt.getDpi());
} else {
GtkEventDispatch.dispatchAndWait(new Runnable() { GtkEventDispatch.dispatchAndWait(new Runnable() {
@Override @Override
public public
void run() { void run() {
// screen DPI // screen DPI
Pointer screen = Gtk2.gdk_screen_get_default(); // DOES NOT like SWT Pointer screen = Gtk2.gdk_screen_get_default();
if (screen != null) { if (screen != null) {
// this call makes NO SENSE, but reading the documentation shows it is the CORRECT call. // this call makes NO SENSE, but reading the documentation shows it is the CORRECT call.
screenDPI.set((int) Gtk2.gdk_screen_get_resolution(screen)); screenDPI.set((int) Gtk2.gdk_screen_get_resolution(screen));
} }
if (Gtk2.isGtk3) { if (Gtk2.isGtk3) {
Pointer window = Gtk2.gdk_get_default_root_window(); // DOES NOT LIKE SWT Pointer window = Gtk2.gdk_get_default_root_window();
if (window != null) { if (window != null) {
double scale = Gtk3.gdk_window_get_scale_factor(window); double scale = Gtk3.gdk_window_get_scale_factor(window);
screenScale.set(scale); screenScale.set(scale);
@ -166,7 +162,6 @@ class GtkTheme {
} }
} }
}); });
}
// fallback // fallback
if (screenDPI.get() == 0) { if (screenDPI.get() == 0) {