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,30 +142,26 @@ class GtkTheme {
screenScale.set(0D); screenScale.set(0D);
screenDPI.set(0); screenDPI.set(0);
if (Framework.isSwtLoaded) { GtkEventDispatch.dispatchAndWait(new Runnable() {
screenDPI.set(Swt.getDpi()); @Override
} else { public
GtkEventDispatch.dispatchAndWait(new Runnable() { void run() {
@Override // screen DPI
public Pointer screen = Gtk2.gdk_screen_get_default();
void run() { if (screen != null) {
// screen DPI // this call makes NO SENSE, but reading the documentation shows it is the CORRECT call.
Pointer screen = Gtk2.gdk_screen_get_default(); // DOES NOT like SWT screenDPI.set((int) Gtk2.gdk_screen_get_resolution(screen));
if (screen != null) { }
// this call makes NO SENSE, but reading the documentation shows it is the CORRECT call.
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);
}
} }
} }
}); }
} });
// fallback // fallback
if (screenDPI.get() == 0) { if (screenDPI.get() == 0) {