-
Notifications
You must be signed in to change notification settings - Fork 171
Fit Table Tooltip in a single monitor #62 #2241
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
base: master
Are you sure you want to change the base?
Fit Table Tooltip in a single monitor #62 #2241
Conversation
5a97f16
to
8106e43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change seems to work fine. But I have to admit that I don't know what the actual changes are supposed to do. I see the expected coordinates adjustment for the tooltip, but there are some further changes around, which I do not understand at all (I have added comments to those lines). Can you please elaborate on why these changes are necessary and what they do?
if (hdr.code != OS.TTN_SHOW) tipRequested = true; | ||
long code = callWindowProc (handle, OS.WM_NOTIFY, wParam, lParam); | ||
if (hdr.code != OS.TTN_SHOW) tipRequested = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can this code be removed? It will also result in the code
returned by this method to usually be null (in case we are not in the customToolTip
case with TTN_SHOW
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was made corresponding to this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=178044
Commit id: ec9593c
This was made for rollovers in 2007 but seems to have been fixed for the newer versions of windows. With the block present, the code goes in an infinite loop at 7162 and gets infinite TTN_GETDISPINFO messages, when the tooltip is by default over 2 monitors.
Thus, this could be removed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current windows works fine with rollover tooltips withut this block as well, however this block makes it worse when the tooltip is in the middle of 2 screens. You can try running the code with this block present and try to position your tooltip in the middle of 2 monitors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to admit that I do not fully understand the assessment. The code was not introduced for the mentioned bug and in the mentioned commit. The commit only moved that code to a different place, such that it is also executed for the TTN_SHOW
event. The commit that originally introduced the code is from 2005: dd05f31. So the question remains why the code is now completely unnecessary (not only for TTN_SHOW
but only for the TTN_GETDISPINFO
event).
Just wondering: is the reaction to the TTN_GETDISPINFO
still necessary at all? I tested with the ControlExample
and there it does not make any difference whether I keep the switch-case for TTN_GETDISPINFO
or whether I remove it (even though those events are actually fired). But since I don't know what this is necessary for, I cannot assess if there are remaining cases (maybe with very specific configurations) where it is needed.
In general, I currently still lack understanding of what exactly happens here. I can confirm that the change works as expected in all cases I have tested, but likely I don't know about all the use cases this complex code has been written for. So I am bit concerned that we break something when just removing some code. On the other hand, the code obviously leads to an issue (namely an inifite execution loop), which we definitely need to resolve. So it might lead to the trade-off that we need to accept that we might miss some use case here that we do not understand but therefor resolve a known bug.
Thus, my proposal:
- Please check again what this code is used for (as, like I said above, the existing assessment is not comprehensible for me)
- Have the change reviewed and tested by @fedejeanne, such that he can hopefully merge it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no explanation in the commit dd05f31, however it relates to the bug report mentioned I suppose. (https://bugs.eclipse.org/bugs/show_bug.cgi?id=82739)
There's a snippet in the report and I tried that out and found no issues. I believe the block of code:
tipRequested = true;Add commentMore actions
int code = callWindowProc (handle, OS.WM_NOTIFY, wParam, lParam);
tipRequested = false;
Doesn't have any visual effect anymore.
Anyway it's hard to assess what it was introduced for but I gathered that the tooltip works similar to how it is implemented for Tree. Without having much changes in the original implementation, I tried to bring it as close as possible to Tree. However, I assessed the bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=82739 and the other bug report which was its duplicate (https://bugs.eclipse.org/bugs/show_bug.cgi?id=83703) and it doesn't seem to hamper the table tooltips in externalize stings view, the custom tooltip on the table in the control which comes using (ctrl+3) and also the snippets. These fixes were done for XP and Vista as it seems but I have tested them with the current windows 11 and my PR doesn't change any behaviour at all for them.
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
Outdated
Show resolved
Hide resolved
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
Outdated
Show resolved
Hide resolved
7a66ca6
to
18da1d6
Compare
This commit contributes to the fitting of the table tooltip inside a single monitor if it spans over multiple monitor to avoid any infinite loop because of rescaling triggered by any DPI_CHANGED events. contributes to eclipse-platform#62 and eclipse-platform#128
18da1d6
to
70ef650
Compare
This PR contributes to the fitting of the table tooltip inside a
single monitor if it spans over multiple monitor to avoid any
infinite loop because of rescaling triggered by any DPI_CHANGED events.
Adapted from #2142
contributes to
#62 and
#128
How to test
First we need to create a table with narrow columns.