Skip to content

Incorrect Zoom Level Applied When Dragging #2174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

ShahzaibIbrahim
Copy link
Contributor

When dragging and dropping a file from the Package Explorer or a field/method from the Outline view, the dragged item appears at an incorrect zoom level. Thats because the zoom for DragSource was not updated on zoom change and we use that zoom in DragListener to update the size of the imageList.

Reproduction
Steps to reproduce the behavior:

Scenario 1

  1. Start the runtime workspace with 175% zoom on primary monitor.
  2. Now change the display zoom from windows setting to 250%
  3. Try to drag the class or method from package explorer as showed below
  4. The dragged item looks bigger than the original one
20250519-0925-57.1484593.mp4

Scenario 2

  1. Start the runtime workspace with 175% zoom on primary monitor.
  2. Now move the window to secondary monitor with 150% Zoom
  3. Try to drag the class or method from package explorer as showed below
  4. The dragged item looks bigger than the original one
20250519-0927-30.9439028.mp4

Expected Behavior
The dragged item should be of the same size as it shows in the package explorer.

Necessary configuration:
Use these arguments before starting the runtime workspace:

-Dswt.autoScale=quarter
-Dswt.autoScale.updateOnRuntime=true

Copy link
Contributor

github-actions bot commented May 21, 2025

Test Results

   545 files  ±0     545 suites  ±0   31m 49s ⏱️ + 1m 52s
 4 399 tests ±0   4 381 ✅ ±0   18 💤 ±0  0 ❌ ±0 
16 723 runs  ±0  16 583 ✅ ±0  140 💤 ±0  0 ❌ ±0 

Results for commit c1b171d. ± Comparison against base commit 8519c60.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@fedejeanne fedejeanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put the code inside the controlListener, just like the other 2 handlers (SWT.Dispose and SWT.DragDetect) and I would also check for if (!DragSource.this.isDisposed()) seems it seems to be a possible source of problems.

Unrelated question: Is this also necessary for Linux / Mac? I ask because I see strong similarities in the 3 versions of the class DragSource. If you don't get to it first, I can check this when I'm home with my private laptops

@ShahzaibIbrahim
Copy link
Contributor Author

I'd put the code inside the controlListener, just like the other 2 handlers (SWT.Dispose and SWT.DragDetect) and I would also check for if (!DragSource.this.isDisposed()) seems it seems to be a possible source of problems.

I agree with your suggestions and have made the required changes.

Unrelated question: Is this also necessary for Linux / Mac? I ask because I see strong similarities in the 3 versions of the class DragSource. If you don't get to it first, I can check this when I'm home with my private laptops

I am not sure about that and don't have mac/linux to test it.

@fedejeanne
Copy link
Contributor

I'd put the code inside the controlListener, just like the other 2 handlers (SWT.Dispose and SWT.DragDetect) and I would also check for if (!DragSource.this.isDisposed()) seems it seems to be a possible source of problems.

I agree with your suggestions and have made the required changes.

👍
PR approved ✔️

I am not sure about that and don't have mac/linux to test it.

No problem. Can you please add a follow-up issue in our board so we can look into it later? I assume this is not an issue since Linux/Mac have had HiDPI support for a longer time and no one reported it. If no one gets to it before me, I can look into it when I come back from my vacation (M1 / M2).

@ShahzaibIbrahim
Copy link
Contributor Author

No problem. Can you please add a follow-up issue in our board so we can look into it later? I assume this is not an issue since Linux/Mac have had HiDPI support for a longer time and no one reported it. If no one gets to it before me, I can look into it when I come back from my vacation (M1 / M2).

Sure, Here's the ticket: vi-eclipse/Eclipse-Platform#318

When dragging and dropping a file from the Package Explorer or a
field/method from the Outline view, the dragged item appears at an
incorrect zoom level. Thats because the zoom for DragSource was not
updated on zoom change and we use that zoom in DragListener to update
the size of the imageList.
@HeikoKlare HeikoKlare merged commit e0f13e7 into eclipse-platform:master Jun 6, 2025
19 of 20 checks passed
@HeikoKlare HeikoKlare deleted the master-309 branch June 6, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Zoom Level Applied When Dragging Files or Elements in Eclipse
3 participants