Skip to content

Commit 413426e

Browse files
akoch-yattaHeikoKlare
authored andcommitted
Unify internal strict mode flag for win32 and gtk
This contribution renames the internal strict mode flag in GTK from org.eclipse.swt.internal.gtk.enableStrictChecks to org.eclipse.swt.internal.enableStrictChecks and adds it to win32 to be used to check for correctly configured GCs for monitor-specific-scaling
1 parent 3cd1f36 commit 413426e

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
*/
117117
public class Display extends Device implements Executor {
118118

119-
static boolean strictChecks = System.getProperty("org.eclipse.swt.internal.gtk.enableStrictChecks") != null;
119+
static boolean strictChecks = System.getProperty("org.eclipse.swt.internal.enableStrictChecks") != null;
120120

121121
private static final int SLOT_IN_USE = -2;
122122
private static final int LAST_TABLE_INDEX = -1;

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
*/
3434
public abstract class Device implements Drawable {
3535

36+
static boolean strictChecks = System.getProperty("org.eclipse.swt.internal.enableStrictChecks") != null;
37+
3638
/* Debugging */
3739
public static boolean DEBUG;
3840
boolean debug = DEBUG;

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,6 +3950,10 @@ void init(Drawable drawable, GCData data, long hDC) {
39503950
}
39513951

39523952
private static int extractZoom(long hDC) {
3953+
if (Device.strictChecks) {
3954+
System.err.println("***WARNING: GC is initialized with a missing zoom. This indicates an "
3955+
+ "incompatible custom Drawable implementation.");
3956+
}
39533957
long hwnd = OS.WindowFromDC(hDC);
39543958
long parentWindow = OS.GetAncestor(hwnd, OS.GA_ROOT);
39553959
long monitorParent = OS.MonitorFromWindow(parentWindow, OS.MONITOR_DEFAULTTONEAREST);

tests/org.eclipse.swt.tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<argLine>@{tycho.testArgLine} -Dorg.eclipse.swt.internal.gtk.disablePrinting ${os-jvm-flags}</argLine>
5252
<systemPropertyVariables>
5353
<user.home>${project.build.directory}</user.home> <!-- used as cache directory for SWT native libraries -->
54-
<org.eclipse.swt.internal.gtk.enableStrictChecks>true</org.eclipse.swt.internal.gtk.enableStrictChecks> <!-- see bug 532632 -->
54+
<org.eclipse.swt.internal.enableStrictChecks>true</org.eclipse.swt.internal.enableStrictChecks> <!-- see bug 532632 -->
5555
<swt.autoScale>quarter</swt.autoScale>
5656
</systemPropertyVariables>
5757
<!-- Trim does not only remove the entries before entering the test method but

tests/org.eclipse.swt.tests/test.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<property name="plugin-name" value="${plugin-name}"/>
3232
<property name="classname" value="org.eclipse.swt.tests.junit.AllNonBrowserTests"/>
3333
<!-- workaround for https://bugs.eclipse.org/502410 and checks for bug 532632 -->
34-
<property name="vmargs" value="-Dorg.eclipse.swt.internal.gtk.disablePrinting -Dorg.eclipse.swt.internal.gtk.enableStrictChecks"/>
34+
<property name="vmargs" value="-Dorg.eclipse.swt.internal.gtk.disablePrinting -Dorg.eclipse.swt.internal.enableStrictChecks"/>
3535
</ant>
3636
</target>
3737

0 commit comments

Comments
 (0)