Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java

Issue 8893018: Greedy searchbox focus fix (http://code.google.com/p/dart/issues/detail?id=749). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java (revision 2318)
+++ editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/omni/OmniBoxControlContribution.java (working copy)
@@ -138,7 +138,7 @@
}
public void giveFocus() {
- previousFocusControl = control.getDisplay().getFocusControl();
+ cacheFocusControl(control.getDisplay().getFocusControl());
control.setFocus();
clearWatermark();
}
@@ -163,7 +163,7 @@
protected void handleMouseEnter() {
inControl = true;
//cache on mouse enter to ensure we can restore focus after an invocation initiated by a mouse click
- previousFocusControl = Display.getDefault().getFocusControl();
+ cacheFocusControl(control.getDisplay().getFocusControl());
}
protected void handleMouseExit() {
@@ -180,6 +180,14 @@
}
}
+ private void cacheFocusControl(Control focusControl) {
+ //since the point of caching the control is to restore focus away from us,
+ //ignore any sets to "self"
+ if (focusControl != control) {
+ previousFocusControl = focusControl;
+ }
+ }
+
private void clearWatermark() {
//ensure watermark (or valid text) does not get re-cleared
if (control.getForeground().equals(OmniBoxColors.SEARCHBOX_TEXT_COLOR)) {
@@ -301,7 +309,6 @@
}
}
});
-
}
private void openPopup() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698