Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328145 - [cocoa, gef] Guide markers not fully visible on Cocoa
Summary: [cocoa, gef] Guide markers not fully visible on Cocoa
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X
: P3 major (vote)
Target Milestone: 3.6.2   Edit
Assignee: Scott Kovatch CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
Depends on: 313315
Blocks:
  Show dependency tree
 
Reported: 2010-10-19 11:27 EDT by Scott Kovatch CLA
Modified: 2010-11-03 13:19 EDT (History)
3 users (show)

See Also:
Silenio_Quarti: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Kovatch CLA 2010-10-19 11:27:08 EDT
+++ This bug was initially created as a clone of Bug #313315 +++

Build Identifier: I20100312-1448

Guide markers are only half visible on Cocoa - they extend below the bottom/right edge of the ruler.

Issue is due to the following method not taking Cocoa into account when detecting Mac OS X:

> private static Rectangle calculateRulerTrim(Canvas canvas) {
> 	if ("carbon".equals(SWT.getPlatform())) { //$NON-NLS-1$


Will supply a patch changing the offending line to:

> if (Platform.OS_MACOSX.equals(Platform.getOS())) {


Reproducible: Always

Steps to Reproduce:
1. Open a GEF editor with a ruler on Cocoa
2. Click in the ruler area to create a guide
3. Observe that the guide is only partly visible
Comment 1 Scott Kovatch CLA 2010-10-19 11:29:07 EDT
(In reply to comment #6)
> It turns out that in the GuideFigure drawing code, where it draws the 'V' or
> '>' part of the guide (depending on whether vertical/horizontal) it is using
> drawLine() to draw each point - these calls are not actually drawing anything
> on Cocoa where P1 = P2.

> Alternatively another SWT bug needs to be raised as to why
> o.e.swt.graphics.GC.drawLine(x,y, x,y) draws nothing under Cocoa.

Carbon had this bug as well, and the fix never propagated to Cocoa. This should
do it:


### Eclipse Workspace Patch 1.0
#P org.eclipse.swt
Index: Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse
SWT/cocoa/org/eclipse/swt/graphics/GC.java,v
retrieving revision 1.78
diff -u -r1.78 GC.java
--- Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java    7 May 2010 19:40:38
-0000    1.78
+++ Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java    24 May 2010 22:17:00
-0000
@@ -1147,6 +1147,10 @@
  */
 public void drawLine(int x1, int y1, int x2, int y2) {
     if (handle == null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+    if (x1 == x2 && y1 == y2 && data.lineWidth <= 1) {
+        drawPoint(x1, y1);
+        return;
+    }
     NSAutoreleasePool pool = checkGC(DRAW);
     try {
         NSBezierPath path = data.path;
Comment 2 Scott Kovatch CLA 2010-10-19 11:29:27 EDT
No rush yet on the review; just tracking for 3.6.2.
Comment 3 Scott Kovatch CLA 2010-11-03 13:19:16 EDT
Fixed in R3_6_maintenance branch > 20101103.