| Summary: | ScrollBar.getVisible() is wrong under gtk | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Michael Seele <mseele> | ||||||||||||
| Component: | SWT | Assignee: | Arun Thondapu <arunkumar.thondapu> | ||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||
| Severity: | normal | ||||||||||||||
| Priority: | P3 | CC: | gheorghe | ||||||||||||
| Version: | 3.6.1 | ||||||||||||||
| Target Milestone: | 4.1 | ||||||||||||||
| Hardware: | PC | ||||||||||||||
| OS: | Linux-GTK | ||||||||||||||
| Whiteboard: | |||||||||||||||
| Attachments: |
|
||||||||||||||
Arun, please check this out. Michael, Can you please provide me with a code snippet which helps me to reproduce the problem stated? I see that getVisible() does return false when the ScrollBar visibility is set to false. Besides, you should use isVisible() to confirm visibility rather than getVisible(). In fact, the javadoc for getVisible() itself states that the behavior you noticed is possible and so might not need to be fixed in my opinion. Please see the relevant javadoc excerpt below: "If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing." Thanks! (In reply to comment #0) > Created attachment 188048 [details] > Solution-patch > > When i use ScrollBar.getVisible() under gtk, it returns true even if the scroll > bar is not visible. > This happens cause getVisible() doesn't check if the scroll bar is visible, > getVisible() check if the policy is not GTK_POLICY_NEVER. > The problem is that the policy can be GTK_POLICY_AUTOMATIC and the scroll bar > can be hidden. In this reason, it returns true instead of false. > > Please see my patch which solves the problem. Created attachment 191730 [details]
Snippet that demonstrates the effect
Created attachment 191731 [details]
Screenshot of the snippet
(In reply to comment #2) > Michael, > > Can you please provide me with a code snippet which helps me to reproduce the > problem stated? Please see the attached snippet and screenshot. For the first table getVisible for the horizontal scrollbar returns true despite the fact that it's clearly not visible. Created attachment 199345 [details]
Proposed patch
This patch incorporates the fix to ensure scrollbar's getVisible() method works correctly.
All JUnit tests passed successfully.
Please review. Thanks!
Created attachment 199429 [details]
Revised patch
Revised the patch to replace deprecated API GTK_WIDGET_VISIBLE() with the suggested newer API gtk_widget_get_visible ().
Please review and suggest whether these changes are fine.
Thanks!
Patch released. Fixed in master > 20111114 |
Created attachment 188048 [details] Solution-patch When i use ScrollBar.getVisible() under gtk, it returns true even if the scroll bar is not visible. This happens cause getVisible() doesn't check if the scroll bar is visible, getVisible() check if the policy is not GTK_POLICY_NEVER. The problem is that the policy can be GTK_POLICY_AUTOMATIC and the scroll bar can be hidden. In this reason, it returns true instead of false. Please see my patch which solves the problem.