summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2010-10-21 15:03:16 +0000
committerFelipe Heidrich <fheidric>2010-10-21 15:03:16 +0000
commit550e8a8e9bc83f6157c95ef4f9d89d7b16a7ca9e (patch)
tree81960ba6dd1ab7b61beb456413f48f904309f688 /bundles/org.eclipse.swt
parenta4bbd67cab044afd6baa06e06152d08898b8d5a8 (diff)
downloadeclipse.platform.swt-550e8a8e9bc83f6157c95ef4f9d89d7b16a7ca9e.tar.gz
eclipse.platform.swt-550e8a8e9bc83f6157c95ef4f9d89d7b16a7ca9e.tar.xz
eclipse.platform.swt-550e8a8e9bc83f6157c95ef4f9d89d7b16a7ca9e.zip
Bug 328290 - Need some way to intercept 'fixfocus'
Diffstat (limited to 'bundles/org.eclipse.swt')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java16
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java1
4 files changed, 14 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
index 510111dbae..d05f1c9e1c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
@@ -921,14 +921,15 @@ void setDefault (boolean value) {
OS.SendMessage (handle, OS.BM_SETSTYLE, bits, 1);
}
-boolean setFixedFocus () {
+public boolean setFocus () {
+ checkWidget ();
/*
* Feature in Windows. When a radio button gets focus,
* it selects the button in WM_SETFOCUS. The fix is to
* not assign focus to an unselected radio button.
*/
- if ((style & SWT.RADIO) != 0 && !getSelection ()) return false;
- return super.setFixedFocus ();
+ if ((style & SWT.RADIO) != 0 && !getSelection () && display.fixFocus) return false;
+ return super.setFocus ();
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
index 3320443da4..a05a909eba 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
@@ -1025,20 +1025,6 @@ void setBounds (int x, int y, int width, int height, int flags, boolean defer) {
}
}
-boolean setFixedFocus () {
- checkWidget ();
- Control [] children = _getChildren ();
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.setRadioFocus (false)) return true;
- }
- for (int i=0; i<children.length; i++) {
- Control child = children [i];
- if (child.setFixedFocus ()) return true;
- }
- return super.setFixedFocus ();
-}
-
public boolean setFocus () {
checkWidget ();
Control [] children = _getChildren ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index 2c66f602b9..93fcdde884 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -949,8 +949,15 @@ void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, De
void fixFocus (Control focusControl) {
Shell shell = getShell ();
Control control = this;
- while (control != shell && (control = control.parent) != null) {
- if (control.setFixedFocus ()) return;
+ Display display = this.display;
+ boolean oldFixFocus = display.fixFocus;
+ display.fixFocus = true;
+ try {
+ while (control != shell && (control = control.parent) != null) {
+ if (control.setFocus ()) return;
+ }
+ } finally {
+ display.fixFocus = oldFixFocus;
}
shell.setSavedFocus (focusControl);
OS.SetFocus (0);
@@ -2978,11 +2985,6 @@ public void setEnabled (boolean enabled) {
if (fixFocus) fixFocus (control);
}
-boolean setFixedFocus () {
- if ((style & SWT.NO_FOCUS) != 0) return false;
- return forceFocus ();
-}
-
/**
* Causes the receiver to have the <em>keyboard focus</em>,
* such that all keyboard events will be delivered to it. Focus
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index db08e4f72a..89b891d12f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -168,6 +168,7 @@ public class Display extends Device {
/* Focus */
int focusEvent;
Control focusControl;
+ boolean fixFocus;
/* Menus */
Menu [] bars, popups;