diff options
author | Felipe Heidrich <fheidric> | 2004-05-03 23:12:28 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2004-05-03 23:12:28 +0000 |
commit | 78b56da73aaece31c0684550745b7a7104823835 (patch) | |
tree | eb58478334b763bfbb4cb65f8ff75ebe61cd05e2 /bundles/org.eclipse.swt/Eclipse SWT Printing | |
parent | 192bca2bd6434dfda5a504db3c14ba8c2299a945 (diff) | |
download | eclipse.platform.swt-78b56da73aaece31c0684550745b7a7104823835.tar.gz eclipse.platform.swt-78b56da73aaece31c0684550745b7a7104823835.tar.xz eclipse.platform.swt-78b56da73aaece31c0684550745b7a7104823835.zip |
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Printing')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java index 64ad9015d0..38e0bb827a 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java @@ -40,6 +40,7 @@ public final class Printer extends Device { PrinterData data; int printContext, xScreen, xDrawable, xtContext; Font defaultFont; + boolean isGCCreated; static String APP_NAME = "SWT_Printer"; @@ -362,9 +363,8 @@ protected void destroy() { * @return the platform specific GC handle */ public int internal_new_GC(GCData data) { - int xGC = OS.XCreateGC(xDisplay, xDrawable, 0, null); - if (xGC == 0) SWT.error(SWT.ERROR_NO_HANDLES); if (data != null) { + if (isGCCreated) SWT.error(SWT.ERROR_INVALID_ARGUMENT); int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; if ((data.style & mask) == 0) { data.style |= SWT.LEFT_TO_RIGHT; @@ -380,8 +380,11 @@ public int internal_new_GC(GCData data) { OS.XGetGCValues(xDisplay, defaultGC, OS.GCBackground | OS.GCForeground, values); data.foreground = values.foreground; data.background = values.background; - } + } + isGCCreated = true; } + int xGC = OS.XCreateGC(xDisplay, xDrawable, 0, null); + if (xGC == 0) SWT.error(SWT.ERROR_NO_HANDLES); return xGC; } @@ -400,6 +403,7 @@ public int internal_new_GC(GCData data) { */ public void internal_dispose_GC(int xGC, GCData data) { OS.XFreeGC(xDisplay, xGC); + if (data != null) isGCCreated = false; } /** |