| Summary: | [GTK3] [hidpi] Dragging and dropping editor tabs does not work when "Scale for menu and title bar" (Unity/Ubuntu Display Settings) is other than "1" | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Janis Danisevskis <werwurm> | ||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||
| Status: | VERIFIED FIXED | QA Contact: | Sravan Kumar Lakkimsetti <sravankumarl> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | jan.public, lorenzo.bettini, loskutov, lshanmug, lufimtse, michael.weirauch, niraj.modi, sravankumarl | ||||
| Version: | 4.7.2 | Keywords: | triaged | ||||
| Target Milestone: | 4.7.3 | Flags: | niraj.modi:
review+
sravankumarl: review+ |
||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| See Also: |
https://bugs.eclipse.org/bugs/show_bug.cgi?id=506326 https://git.eclipse.org/r/117088 https://git.eclipse.org/r/117089 https://git.eclipse.org/c/platform/e.git/commit/?id=fe40b71bf454aca078e8f0be9f2171b9803901cd https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=34bfe2b05ea6e6107d7a1aeae76e639811959eb5 https://bugs.eclipse.org/bugs/show_bug.cgi?id=531169 |
||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 517055 | ||||||
| Attachments: |
|
||||||
|
Description
Janis Danisevskis
Thank you for the bug report. Do you know if this bug occurs only on linux, or on Windows/OSX as well? I just tried it on Windows 10 with a scale factor of 250%. It worked flawlessly. So it seems to be an issue only on Linux. I cannot test it on MacOS. This is off topic, but it could help me address this issue myself: Is there a good introduction to Eclipse platform development? All I found was outdated or only plugin development is covered. Basically, how do I build Eclispe Oxygen from source and run it? (In reply to Janis Danisevskis from comment #2) > This is off topic, but it could help me address this issue myself: > Is there a good introduction to Eclipse platform development? All I found > was outdated or only plugin development is covered. Basically, how do I > build Eclispe Oxygen from source and run it? https://wiki.eclipse.org/Platform-releng/Platform_Build Thanks Andrew, for the link. I investigated a little and here is what I found: Assume a scale factor of 2. When I start the drag event in the top left quarter of the leftmost tab, it works. If the event is started in the top right quarter of the leftmost tab, the second to the left tab is dragged. If the event is started in the bottom half of the tab, nothing happens. I instrumented the code a little and took screen shots and measured pixels with gimp. Consider a physical and a virtual coordinate system. Functions like Control.getBounds() return coordinates in the virtual system. What I measure with gimp I'll call the physical system. If the scaling factor is 1 both are essentially the same. But at scaling factor of 2, WxH in the virtual system corresponds to 2Wx2H in the physical. So getBounds and also Display.map() operate on the virtual system. And this is also what gets used in CTabFolder.getItem(int pos) to determine the drag source. Interestingly, the coordinates in the DragDetectEvent are in physical coordinates. Which is why things go awry. With this information I actually tried dragging something else, like a file in the Package Explorer, and yes, this is also broken. I just never used it. I tracked the DragDetectEvent back to the handleEvent function. I would guess that it is actually generated in the native GTK layer, and I would assume that the bug is to be found somewhere in the glue between the libgtk and the eclipse swt. And it boils down to a missing application of the scale factor in the drag detect case. But I did not go further for now. Can someone who is actually familiar with the code base take it from here? This looks related to Bug 506326. Created attachment 272580 [details] Proposed patch hiDPI DND bug I think I found the the root cause of the issue. As opposed to sendMouseEvent, sendDragEvent does not subject the event coordinates to DPIUtil.autoScaleDown. This patch scales the coordinates at the two call sites gtk_button_press_event and gtk_motion_notify_event. It is somewhat inconsistent that sendMounseEvent scales the coordinates which sendDragEvent does not. However, sendDragEvent is also called from dragDetect which passes scaled coordinates. This patch is untested. I would have loved to test this patch but, I can for the life of me not get the Maven build system to compile org.eclipse.swt without replacing the build artifact with the baseline. I have never used Maven before, and I have not figured out a usable development cycle. This was the most frustrating experience I ever had with a build system. I must say the link https://wiki.eclipse.org/Platform-releng/Platform_Build explains how to build eclipse from source. But for getting started with development it is completely useless. (In reply to Janis Danisevskis from comment #6) > Created attachment 272580 [details] [diff] > Proposed patch hiDPI DND bug > Thanks for contributing the patch! Can you please provide the patch via gerrit? For setup details, please see: https://wiki.eclipse.org/Gerrit For testing: - If the problem is reproducible in self-hosted Eclipse, then you can test it in the Eclipse instance launched from your workspace which has the patch. - Another option is to replace the SWT fragment in the Eclipse/plugins folder and test it on Eclipse. First setup SWT from Git (https://www.eclipse.org/swt/git.php). Since the patch involves only java changes you don't have to rebuild the native libraries. Just export the SWT fragment (org.eclipse.swt.linux.gtk.x86_64.v<build-id>.jar) with the matching build id version and replace it in your Eclipse/plugins and test the fix. Please post here if you have any questions. New Gerrit change created: https://git.eclipse.org/r/117088 New Gerrit change created: https://git.eclipse.org/r/117089 I have uploaded a patch to master and R4_7_maintenance for review.
I still don't quiet get how to I can test this. What does self-hosted Eclipse mean, and what is a fragment?
I tried to build org.eclipse.swt with the following command
mvn -Pbuild-individual-bundles -Dtycho.baseline.replace=none package -Dnative=gtk.linux.x86_64
But then I always get something like this, indicating that the resulting .jar does not have my changes.
[WARNING] MavenProject: org.eclipse.swt:org.eclipse.swt:3.106.3-SNAPSHOT @ /home/janis/eclipse/eclipse-source/eclipse.platform.releng.aggregator/eclipse.platform.swt/bundles/org.eclipse.swt/pom.xml: baseline and build artifacts have same version but different contents
no-classifier: different
META-INF/ECLIPSE_.RSA: present in baseline only
META-INF/ECLIPSE_.SF: present in baseline only
[INFO] MavenProject: org.eclipse.swt:org.eclipse.swt:3.106.3-SNAPSHOT @ /home/janis/eclipse/eclipse-source/eclipse.platform.releng.aggregator/eclipse.platform.swt/bundles/org.eclipse.swt/pom.xml
The main artifact has been replaced with the baseline version.
For some other bundles the strategy of replacing the jar in the plugin directory worked but not for swt, because maven does not like me.
I guess there should be a way to change something, save, have eclipse autobuild, restart and see the changes, right? I mean this is an IDE. There must be a convenient way to develop this :-)
I finally managed to get a build of R4_7_maintenance going that contained my patch. I can confirm that it fixes the issue. (In reply to Janis Danisevskis from comment #10) Thanks for creating the gerrit patch. >What does self-hosted Eclipse mean Sorry, it means the Eclipse launch configuration [1] which used for testing and debugging the plugins/code in your workspace. You can launch another Eclipse instance from your workspace and it'll use the plugins from your workspace. [1] https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Flaunchers%2Feclipse_application_launcher.htm&cp=4_3_3_0 Sravan, can you please review the patch? Also, please verify if it fixes Bug 506326 as well? (In reply to Lakshmi Shanmugam from comment #13) > Sravan, can you please review the patch? Also, please verify if it fixes Bug > 506326 as well? The patch works well and it fixes Bug 506326 as well. Gerrit change https://git.eclipse.org/r/117088 was merged to [master]. Commit: http://git.eclipse.org/c/platform/e.git/commit/?id=fe40b71bf454aca078e8f0be9f2171b9803901cd Verified in I20180213-2000 Gerrit change https://git.eclipse.org/r/117089 was merged to [R4_7_maintenance]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=34bfe2b05ea6e6107d7a1aeae76e639811959eb5 Merged to master and R4_7_maintenance *** Bug 506326 has been marked as a duplicate of this bug. *** Verified in MBuild id: M20180214-1700 using Ubuntu 16.04 at 1.75 OS zoom settings. |