Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 494218

Summary: MouseEvent coordinates over 32767 are lost
Product: [Eclipse Project] Platform Reporter: Mircea Banu <mircea.banu>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: ericwill
Version: 3.8.2Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
sample code none

Description Mircea Banu CLA 2016-05-21 03:03:43 EDT
Created attachment 261917 [details]
sample code

If you add a MouseListener to a Canvas in SWT, x and y pointer events will be limited to 32767.
Mouse events on a canvas bigger than that will have invalid mouse coordinates.

Same behavior on Linux and Windows.

See the code below as example.
Comment 1 Eric Williams CLA 2018-04-09 17:08:13 EDT
This is due to a platform limitation on GTK, please see bug 472743.
Comment 2 Leo Ufimtsev CLA 2018-04-10 09:36:16 EDT
(In reply to Mircea Banu from comment #0)
> Created attachment 261917 [details]
> sample code
> 
> If you add a MouseListener to a Canvas in SWT, x and y pointer events will
> be limited to 32767.
> Mouse events on a canvas bigger than that will have invalid mouse
> coordinates.
> 
> Same behavior on Linux and Windows.
> 
> See the code below as example.

Out of curiosity, what's your use case?
Comment 3 Mircea Banu CLA 2018-04-10 14:56:12 EDT
A legacy API utilizing an SVG Canvas for drawing an interactive picture.
In one of the cases I had really big picture (e.g. 60000 pixels wide).
All mouse events over 32767 got negative x coordinates...

At the time, I had no time to work around the API and implement a proper algorithm.
Comment 4 Leo Ufimtsev CLA 2018-04-10 15:52:42 EDT
(In reply to Mircea Banu from comment #3)
> A legacy API utilizing an SVG Canvas for drawing an interactive picture.
> In one of the cases I had really big picture (e.g. 60000 pixels wide).
> All mouse events over 32767 got negative x coordinates...
> 
> At the time, I had no time to work around the API and implement a proper
> algorithm.

Interesting.

I guess for such large pictures one would probably have to do some partitioning or reduce resolution.

An exotic and interesting bug report never the less.