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 57888 Details for
Bug 77174
Reparenting support on MacOS X
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Third iteration of the patch - with Webkit fix
patch2.txt (text/plain), 8.72 KB, created by
Fred Wulff
on 2007-01-30 23:49:12 EST
(
hide
)
Description:
Third iteration of the patch - with Webkit fix
Filename:
MIME Type:
Creator:
Fred Wulff
Created:
2007-01-30 23:49:12 EST
Size:
8.72 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java,v >retrieving revision 1.241 >diff -u -r1.241 Control.java >--- Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java 29 Jan 2007 21:25:52 -0000 1.241 >+++ Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java 31 Jan 2007 04:46:31 -0000 >@@ -729,6 +729,10 @@ > return (state & PARENT_BACKGROUND) != 0 ? parent.findBackgroundControl () : null; > } > >+protected void fixChildren (Shell newShell, Shell oldShell) { >+ oldShell.fixShell (newShell, this); >+} >+ > void fixFocus (Control focusControl) { > Shell shell = getShell (); > Control control = this; >@@ -837,7 +841,7 @@ > return control.getBackgroundColor (); > } > >-Color getBackgroundColor () { >+protected Color getBackgroundColor () { > return background != null ? Color.carbon_new (display, background) : defaultBackground (); > } > >@@ -1544,7 +1548,7 @@ > */ > public boolean isReparentable () { > checkWidget(); >- return false; >+ return true; > } > > boolean isShowing () { >@@ -3010,8 +3014,30 @@ > */ > public boolean setParent (Composite parent) { > checkWidget(); >+ >+ if (parent == null) SWT.error(SWT.ERROR_INVALID_ARGUMENT); > if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); >- return false; >+ if (this.parent == parent) return true; >+ if (!isReparentable ()) return false; >+ >+ releaseParent (); >+ >+ Shell newShell = parent.getShell (), oldShell = this.parent.getShell (); >+ >+ >+ >+ int topHandle = topHandle (); >+ >+ if (OS.EmbedControl(topHandle, parent.topHandle ()) < 0) return false; >+ >+ if (oldShell != newShell) >+ fixChildren (newShell, oldShell); >+ >+ this.parent = parent; >+ >+ setVisible (topHandle, true); >+ >+ return true; > } > > /** >Index: Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java,v >retrieving revision 1.83 >diff -u -r1.83 Composite.java >--- Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java 29 Jan 2007 19:01:28 -0000 1.83 >+++ Eclipse SWT/carbon/org/eclipse/swt/widgets/Composite.java 31 Jan 2007 04:46:23 -0000 >@@ -298,6 +298,14 @@ > return layoutCount > 0 ? this : parent.findDeferredControl (); > } > >+protected void fixChildren (Shell newShell, Shell oldShell) { >+ super.fixChildren (newShell, oldShell); >+ Control [] children = _getChildren (); >+ for (int i=0; i<children.length; i++) { >+ children [i].fixChildren (newShell, oldShell); >+ } >+} >+ > void fixTabList (Control control) { > if (tabList == null) return; > int count = 0; >Index: Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java,v >retrieving revision 1.130 >diff -u -r1.130 Shell.java >--- Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java 29 Jan 2007 19:01:30 -0000 1.130 >+++ Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java 31 Jan 2007 04:46:35 -0000 >@@ -10,7 +10,6 @@ > *******************************************************************************/ > package org.eclipse.swt.widgets; > >- > import org.eclipse.swt.internal.carbon.OS; > import org.eclipse.swt.internal.carbon.Rect; > import org.eclipse.swt.internal.carbon.CGPoint; >@@ -626,6 +625,13 @@ > return layoutCount > 0 ? this : null; > } > >+void fixShell (Shell newShell, Control control) { >+ if (this == newShell) return; >+ if (control == lastActive) setActiveControl (null); >+ if (control == savedFocus) setSavedFocus(null); >+ if (control == defaultButton) setDefaultButton(null); >+} >+ > Cursor findCursor () { > return cursor; > } >Index: Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java,v >retrieving revision 1.4 >diff -u -r1.4 Browser.java >--- Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java 26 Jan 2007 19:46:03 -0000 1.4 >+++ Eclipse SWT Browser/common/org/eclipse/swt/browser/Browser.java 31 Jan 2007 04:46:18 -0000 >@@ -109,6 +109,12 @@ > webBrowser.create (parent, style); > } > >+public void fixChildren(Shell newShell, Shell oldShell) >+{ >+ super.fixChildren(newShell, oldShell); >+ webBrowser.fixParent(); >+} >+ > static Composite checkParent (Composite parent) { > String platform = SWT.getPlatform (); > if (!"gtk".equals (platform)) return parent; //$NON-NLS-1$ >Index: Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java,v >retrieving revision 1.1 >diff -u -r1.1 WebBrowser.java >--- Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java 19 Jan 2007 22:15:24 -0000 1.1 >+++ Eclipse SWT Browser/common/org/eclipse/swt/browser/WebBrowser.java 31 Jan 2007 04:46:19 -0000 >@@ -85,6 +85,10 @@ > > public abstract boolean execute(String script); > >+void fixParent() { >+ >+} >+ > public abstract boolean forward(); > > public abstract String getUrl(); >Index: Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java,v >retrieving revision 1.3 >diff -u -r1.3 Safari.java >--- Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java 29 Jan 2007 21:25:53 -0000 1.3 >+++ Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Safari.java 31 Jan 2007 04:46:16 -0000 >@@ -41,6 +41,12 @@ > Point location; > Point size; > boolean statusBar = true, toolBar = true, ignoreDispose; >+ >+ //Keep the state around so we can use it for reparenting fixup >+ private Listener listener; >+ private Control oldBrowserParent; >+ private Shell oldBrowserShell; >+ > //TEMPORARY CODE > // boolean doit; > >@@ -154,7 +160,7 @@ > > final int notificationCenter = Cocoa.objc_msgSend(Cocoa.C_NSNotificationCenter, Cocoa.S_defaultCenter); > >- Listener listener = new Listener() { >+ listener = new Listener() { > public void handleEvent(Event e) { > switch (e.type) { > case SWT.Dispose: { >@@ -278,16 +284,15 @@ > }; > browser.addListener(SWT.Dispose, listener); > browser.addListener(SWT.Resize, listener); >+ browser.addListener(SWT.Show, listener); >+ browser.addListener(SWT.Hide, listener); >+ > Shell shell = browser.getShell(); > shell.addListener(SWT.Resize, listener); > shell.addListener(SWT.Show, listener); > shell.addListener(SWT.Hide, listener); >- Control c = browser; >- do { >- c.addListener(SWT.Show, listener); >- c.addListener(SWT.Hide, listener); >- c = c.getParent(); >- } while (c != shell); >+ >+ addListenerToBrowserParents(); > > if (Callback3 == null) Callback3 = new Callback(this.getClass(), "eventProc3", 3); //$NON-NLS-1$ > int callback3Address = Callback3.getAddress(); >@@ -345,6 +350,21 @@ > return 0; > } > >+private void addListenerToBrowserParents() >+{ >+ Shell shell = browser.getShell(); >+ Control c = browser.getParent(); >+ >+ oldBrowserShell = shell; >+ oldBrowserParent = c; >+ >+ while(c != shell) { >+ c.addListener(SWT.Show, listener); >+ c.addListener(SWT.Hide, listener); >+ c = c.getParent(); >+ } >+} >+ > public boolean back() { > html = null; > int webView = Cocoa.HIWebViewGetWebView(webViewHandle); >@@ -363,6 +383,21 @@ > return value != 0; > } > >+//Since Safari is separately embedded, we need to reparent it separately >+void fixParent() { >+ //At this point the browser has already been updated >+ int window = OS.GetControlOwner(browser.handle); >+ int[] contentView = new int[1]; >+ OS.HIViewFindByID(OS.HIViewGetRoot(window), OS.kHIViewWindowContentID(), contentView); >+ //Remove the view from its old parent >+ OS.HIViewRemoveFromSuperview(webViewHandle); >+ OS.HIViewAddSubview(contentView[0], webViewHandle); >+ >+ //Fix up the listeners >+ removeListenerFromOldBrowserParents(); >+ addListenerToBrowserParents(); >+} >+ > public boolean forward() { > html = null; > int webView = Cocoa.HIWebViewGetWebView(webViewHandle); >@@ -490,6 +525,25 @@ > Cocoa.objc_msgSend(webView, Cocoa.S_reload, 0); > } > >+private void removeListenerFromOldBrowserParents() >+{ >+ Control c = oldBrowserParent; >+ Shell shell = oldBrowserShell; >+ >+ oldBrowserParent = null; >+ oldBrowserShell = null; >+ >+ if (c == null || shell == null) { >+ return; >+ } >+ >+ while(c != shell) { >+ c.removeListener(SWT.Show, listener); >+ c.removeListener(SWT.Hide, listener); >+ c = c.getParent(); >+ } >+} >+ > public boolean setText(String html) { > /* > * Bug in Safari. The web view segment faults in some circunstances
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 77174
:
21955
|
57800
|
57888