Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 21077 Details for
Bug 38436
Locating Widgets in display coordinates for automated whitebox testing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
adaption of code that fixes bad menu-picking as demonstrated in https://bugs.eclipse.org/bugs/show_bug.cgi?id=38436#c102
MenuItem.patch.txt (text/plain), 2.67 KB, created by
Tom Roche
on 2005-05-12 19:45:07 EDT
(
hide
)
Description:
adaption of code that fixes bad menu-picking as demonstrated in https://bugs.eclipse.org/bugs/show_bug.cgi?id=38436#c102
Filename:
MIME Type:
Creator:
Tom Roche
Created:
2005-05-12 19:45:07 EDT
Size:
2.67 KB
patch
obsolete
>Index: MenuItem.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java,v >retrieving revision 1.73 >diff -u -r1.73 MenuItem.java >--- MenuItem.java 25 Apr 2005 14:09:12 -0000 1.73 >+++ MenuItem.java 12 May 2005 23:40:37 -0000 >@@ -303,42 +303,28 @@ > if (OS.IsWinCE) return new Rectangle (0, 0, 0, 0); > int index = parent.indexOf (this); > if (index == -1) return new Rectangle (0, 0, 0, 0); >- if ((parent.style & SWT.BAR) != 0) { >- Decorations shell = parent.parent; >- if (shell.menuBar != parent) { >- return new Rectangle (0, 0, 0, 0); >- } >- int hwndShell = shell.handle; >- MENUBARINFO info1 = new MENUBARINFO (); >- info1.cbSize = MENUBARINFO.sizeof; >- if (!OS.GetMenuBarInfo (hwndShell, OS.OBJID_MENU, 1, info1)) { >- return new Rectangle (0, 0, 0, 0); >- } >- MENUBARINFO info2 = new MENUBARINFO (); >- info2.cbSize = MENUBARINFO.sizeof; >- if (!OS.GetMenuBarInfo (hwndShell, OS.OBJID_MENU, index + 1, info2)) { >- return new Rectangle (0, 0, 0, 0); >- } >- int x = info2.left - info1.left; >- int y = info2.top - info1.top; >- int width = info1.right - info1.left; >- int height = info1.bottom - info1.top; >- return new Rectangle (x, y, width, height); >+ RECT rect = new RECT(); >+ boolean success = OS.GetMenuItemRect(((parent.getStyle()&SWT.BAR)==SWT.BAR)?parentControl.handle:0, >+ parent.handle, >+ index, >+ rect); >+ if (!success) { >+ /* the OS API call couldn't get the MenuItem bounds, so return an empty rectangle */ >+ return new Rectangle(0, 0, 0, 0); >+ } >+ if ((parentControl.getStyle() & SWT.MIRRORED) == 0) { >+ /* coordinates are not mirrored */ >+ Point p = parentControl.toControl(rect.left,rect.top); >+ int width = rect.right - rect.left; >+ int height = rect.bottom - rect.top; >+ return new Rectangle(p.x,p.y,width,height); > } else { >- int hMenu = parent.handle; >- RECT rect1 = new RECT (); >- if (!OS.GetMenuItemRect (0, hMenu, 0, rect1)) { >- return new Rectangle (0, 0, 0, 0); >- } >- RECT rect2 = new RECT (); >- if (!OS.GetMenuItemRect (0, hMenu, index, rect2)) { >- return new Rectangle (0, 0, 0, 0); >- } >- int x = rect2.left - rect1.left + 2; >- int y = rect2.top - rect1.top + 2; >- int width = rect2.right - rect2.left; >- int height = rect2.bottom - rect2.top; >- return new Rectangle (x, y, width, height); >+ /* coordinates are mirrored */ >+ /* TODO: this has not been tested */ >+ Point p = parentControl.toControl(rect.left,rect.top); >+ int width = rect.left - rect.right; >+ int height = rect.bottom - rect.top; >+ return new Rectangle(p.x,p.y,width,height); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 38436
:
10629
|
10676
|
11493
|
11498
|
16239
| 21077 |
23906
|
25375
|
25431
|
25499
|
25568
|
56919
|
74636