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

Bug 494194

Summary: Display - getMonitors() and gtk_monitor_get_monitor() => wrong window resolution
Product: [Eclipse Project] Platform Reporter: Iulia Darie <iulia_hudita>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, ericwill, mircea.banu
Version: 3.8.1Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

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.