Bug 494194 - Display - getMonitors() and gtk_monitor_get_monitor() => wrong window resolution
Summary: Display - getMonitors() and gtk_monitor_get_monitor() => wrong window resolution
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.8.1   Edit
Hardware: PC Linux
: P3 normal with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-05-20 12:50 EDT by Iulia Darie CLA
Modified: 2018-07-06 14:32 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Iulia Darie CLA 2016-05-20 12:50:26 EDT
If having an application running on two monitors,"gtk_monitor_get_monitor(int screen, int monitorNumber)" method from Display class (SWT Linux library) associates to the first Monitor (the one with monitorNumber==0) a clientWidth much larger than its own width.

In Window class (jface library)the issue mentioned above has as consequence the fact that "getClosestMonitor(Display toSearch, Point toFind)" identifies a point belonging to the second monitor - as being part of the first monitor. 

And further in Window class, in method "getConstrainedShellBounds(Rectangle preferredSize)", the dimensions of the second monitor are over-written with the dimensions of the first monitor, if the latter are smaller.

Therefore, if you have a java application (using these libraries) running on two monitors, the dimensions of the second monitor's screen will be affected by the first monitor's dimension.  

This issue is not present on Windows. Running the same application on Windows (by using the windows SWT library), getConstrainedShellBounds() does not end in updating the second monitor's dimension with the first one's (and this happens because the getMonitors() method from Display class returns Monitors having attached their real dimension).   

PS: the main problem might be in Display class, "getWorkArea()" method, which calls "OS.gdk_property_get()"; from here it is read a much larger width for the monitor's-working-area. 
   "getWorkArea()" is being called by "gtk_monitor_get_monitor()", which is called by "getMonitors()".
Comment 1 Alexander Kurtakov CLA 2016-06-14 03:34:58 EDT
Is this really an issue in version 3.8.1? If yes I would recommend trying with the latest SWT version.
Comment 2 Mircea Banu CLA 2016-06-25 03:00:34 EDT
Latest would mean switching to version 4.x which is not always an option for legacy applications.
Comment 3 Eric Williams CLA 2018-07-06 14:32:02 EDT
3.x issues are not being fixed, please reopen this bug ticket if the issue is reproducible on 4.8 with GTK3.22.