Skip to content

Conversation

@HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Jul 24, 2025

The GC#getClipping(Region) call sets the passed region to the current clipping region of the GC. Currently, this is not represented as an operation inside the passed Region, such that when calculating a handle for a different zoom of that region or when copying that region the according application of GC#getClipping(Region) to that region is missing.

This change adds the missing operation to the Region. Since the clipping needs to be calculated at the of executing the GC#getClipping(Region) method and not at the time of applying the region operation when retrieving a handle, the GC#getClipping(Region) stores an operation inside GC that maintains handles for the according clipping region at the time of executing the GC#getClipping(Region) method for every zoom at which the GC is requested. This ensures that the proper clipping state is available to the Region.

Fixes #2346

Supercedes and thus closes #2347

@HeikoKlare HeikoKlare force-pushed the issue-2346 branch 2 times, most recently from 2c12ddf to b587241 Compare July 24, 2025 10:36
@HeikoKlare HeikoKlare linked an issue Jul 24, 2025 that may be closed by this pull request
@HeikoKlare HeikoKlare marked this pull request as ready for review July 24, 2025 10:46
@github-actions
Copy link
Contributor

github-actions bot commented Jul 24, 2025

Test Results

   546 files  + 7     546 suites  +7   31m 1s ⏱️ - 1m 7s
 4 412 tests +54   4 395 ✅ +52   17 💤 +3  0 ❌ ±0 
16 718 runs  +54  16 591 ✅ +52  127 💤 +3  0 ❌ ±0 

Results for commit 53ae3d3. ± Comparison against base commit 0334215.

♻️ This comment has been updated with latest results.

@amartya4256
Copy link
Contributor

I have tested the behaviour and it seems to fix the regression by storing getClipping operation in gc and calling the getClippingRegion on opertaion apply, and also registering as a set operation inside the region which references the gc getClipping operation object's zoomToHandleStorage to get the manipulated handle as per the operation. However, I have added a few comments here and there.

Comment on lines +3801 to +3803
if (!zoomToRegionHandle.containsKey(zoom)) {
System.err.println("No clipping handle for zoom " + zoom + " has been created on this GC");
return zoomToRegionHandle.values().iterator().next();
Copy link
Contributor

@arunjose696 arunjose696 Jul 24, 2025

Choose a reason for hiding this comment

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

I tried going through it just have a question, could this lead to visual inconsistencies if the returned handle doesn't match the requested zoom? Since iterator().next() returns an arbitrary value for the region when GetClippingOperation has not been run for this zoom

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it can. In such a situation we cannot create a proper handle (i.e., one at the correct zoom), which is why the error message is printed. This situation should actually not occur at all, as it would not make any sense to use the region in any other zoom context than in the context of the GC from which the clipping is applied.
However, I just found that this leads to issues when some operation is executed on a region that has no handle yet (e.g., for only retrieving its bounds). Then a temporary handle for an arbitrary zoom (more precisely the device zoom) is used. If that device zoom does not fit to the GC context, we run into the error case. I currently try to store a zoom hint inside region so that a temporary handle is created at a proper zoom if such a hint is given. I will update the PR soon.

Copy link
Contributor

@arunjose696 arunjose696 Jul 24, 2025

Choose a reason for hiding this comment

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

This situation should actually not occur at all, as it would not make any sense to use the region in any other zoom context than in the context of the GC from which the clipping is applied. However, I just found that this leads to issues when some operation is executed on a region that has no handle yet (e.g., for only retrieving its bounds).

I get this error in my console when I move the search window across monitors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get this error in my console when I move the search window across monitors.

Yes, exactly. You may test again with the recent change, which should resolve that issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Tested the latest changes the issue is resolved

…platform#2346

The GC#getClipping(Region) call sets the passed region to the current
clipping region of the GC. Currently, this is not represented as an
operation inside the passed Region, such that when calculating a handle
for a different zoom of that region or when copying that region the
according application of GC#getClipping(Region) to that region is
missing.

This change adds the missing operation to the Region. Since the clipping
needs to be calculated at the of executing the GC#getClipping(Region)
method and not at the time of applying the region operation when
retrieving a handle, the GC#getClipping(Region) stores an operation
inside GC that maintains handles for the according clipping region at
the time of executing the GC#getClipping(Region) method for every zoom
at which the GC is requested. This ensures that the proper clipping
state is available to the Region.

Fixes eclipse-platform#2346
@HeikoKlare
Copy link
Contributor Author

I have extended the PR so that a region stores a zoom hint for temporary handles, in order to ensure that when a temporary handle is necessary, its zoom fits to the GC context such that a potential clipping region can be retrieved.

This is the according change:
https://github.com/eclipse-platform/eclipse.platform.swt/compare/01413be107dbe816b83ecc0a0ff170c0610c9eb5..53ae3d3f9bceb1a8bf7dc0216ad05ac13ea2ac9b

The behavior can be tested as follows:

  • Have two monitors with different zooms
  • Start an Eclipse SDK and open two workbench windows, place one on each of the monitors
  • Open something that uses the CTabFolderRenderer on both of them, for example the MANIFEST file of a project (the multi-page editor for Manifest, build.properties etc. uses that renderer)
  • Move around the windows on both monitors

Before the recent change you will have seen No clipping handle zoom ... errors being printed, which is not the case with the recent extensions.

@arunjose696
Copy link
Contributor

Before the recent change you will have seen No clipping handle zoom ... errors being printed, which is not the case with the recent extensions.

I’ve tested the changes , and they seem to have resolved the regression and the issue where No clipping handle for zoom ... errors were previously being printed.
Additionally, another issue related to inconsistent behavior when maximizing and minimizing widgets using CTabFolderRenderer also appears to be fixed with this new commit.

I’ve briefly reviewed the code, but I’m not confident approving it as I’m not familiar with the Region implementation or the need for temporary handles.

@HeikoKlare
Copy link
Contributor Author

Thank you for testing the PR!

Additionally, another issue related to inconsistent behavior when maximizing and minimizing widgets using CTabFolderRenderer also appears to be fixed with this new commit.

Can give explain which kind of issue that was? It that inconsistent behavior present in current master state or was it only in the "intermediate" state of this PR?

@arunjose696
Copy link
Contributor

Thank you for testing the PR!

Additionally, another issue related to inconsistent behavior when maximizing and minimizing widgets using CTabFolderRenderer also appears to be fixed with this new commit.

Can give explain which kind of issue that was? It that inconsistent behavior present in current master state or was it only in the "intermediate" state of this PR?

It was in intermediate state of the PR before the latest push.

@HeikoKlare
Copy link
Contributor Author

Alright, thank you!

Then I'll merge this to have the CTabFolder issue fixed in M2. We still have some time after M2 to check if there is anything left to do that we might have missed so far.

@HeikoKlare HeikoKlare merged commit a68fd8d into eclipse-platform:master Jul 24, 2025
21 of 22 checks passed
@HeikoKlare HeikoKlare deleted the issue-2346 branch July 24, 2025 15:43
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.

[Win32] CTabFolder header is missing [Win32] CTabFolder header is missing

3 participants