Handle focus out event restoring the last valid selected path.
548685
def focusOutEvent(self, event):
        """"""
        # Calling asynchronously the 'add_current_text' to avoid crash
        # https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd
        if not self.is_valid():
            lineedit = self.lineEdit()
            QTimer.singleShot(50, lambda: lineedit.setText(self.selected_text))

        hide_status = getattr(self.lineEdit(), 'hide_status_icon', None)
        if hide_status:
            hide_status()
        QComboBox.focusOutEvent(self, event)
608193
function(restoreFocus) {
			var actionTaken = false;
			if (this.isVisible()) {
				this._triggerNode.classList.remove("dropdownTriggerOpen"); //$NON-NLS-0$
				this._triggerNode.setAttribute("aria-expanded", "false"); //$NON-NLS-1$ //$NON-NLS-0$
				if (this._selectionClass) {
					this._triggerNode.classList.remove(this._selectionClass);
				}
				this._dropdownNode.classList.remove("dropdownMenuOpen"); //$NON-NLS-0$
				lib.setFramesEnabled(true);
				if (restoreFocus) {
					lib.returnFocus(this._dropdownNode, this._triggerNode);
				}
				
				this._isVisible = false;
				if (this._selectedItem) {
					this._selectedItem.classList.remove("dropdownMenuItemSelected"); //$NON-NLS-0$		
					this._selectedItem = null;	
				}
				
				if (this._boundAutoDismiss) {
					lib.removeAutoDismiss(this._boundAutoDismiss);
					this._boundAutoDismiss = null;
				} 
				updateScrollButtonVisibility.call(this, true);
				actionTaken = true;
			}
			return actionTaken;
		}
1054509
function _onFocus(event) {
            var $scope = $(event.target).parent();
            $("#mrof-container #mrof-list > li.highlight").removeClass("highlight");
            $(event.target).parent().addClass("highlight");
            $mrofContainer.find("#recent-file-path").text($scope.data("path"));
            $mrofContainer.find("#recent-file-path").attr('title', ($scope.data("path")));
            $currentContext = $scope;
        }
568549
def _resetSelection(self, moveToTop=False):
        
        ancor, pos = self._qpart.selectedPosition
        dst = min(ancor, pos) if moveToTop else pos
        self._qpart.cursorPosition = dst
797666
def focusOutEvent(self, ev):
        """"""
        Kittens.widgets.ClickableTreeWidget.focusOutEvent(self, ev)
        # if focus is going to a child of ours, do nothing
        wid = QApplication.focusWidget()
        while wid:
            if wid is self:
                return
            wid = wid.parent()
        # else we're truly losing focus -- stop the editor
        self._startOrStopEditing()
860964
function handleMousedown(event) {

  // get currently open dialogue
  var dialogue = getDialogueCurrent();

  if (dialogue.options.hardClose) {
    return;
  }

  var result = helper.isInside(event.target, dialogue.dialogue);
  if (!result) {
    closeInstance(dialogue);
  }
}
1181921
def change_last_focused_widget(self, old, now):
        """"""
        if (now is None and QApplication.activeWindow() is not None):
            QApplication.activeWindow().setFocus()
            self.last_focused_widget = QApplication.focusWidget()
        elif now is not None:
            self.last_focused_widget = now

        self.previous_focused_widget =  old
433712
void handleFileTreeValueChange() {

        Item resourceItem = m_treeContainer.getItem(m_fileTree.getValue());
        if (resourceItem != null) {
            if ((resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_DISABLED).getValue() != null)
                && ((Boolean)resourceItem.getItemProperty(
                    CmsResourceTableProperty.PROPERTY_DISABLED).getValue()).booleanValue()) {
                // in case the folder is disabled due to missing visibility, reset the value to the previous one
                m_fileTree.setValue(m_selectTreeFolder);

            } else {
                m_selectTreeFolder = (CmsUUID)m_fileTree.getValue();
            }
        }
    }
794718
@Override
    public final void onLeaveFocus(FocusChangeDirection direction, Interactable nextInFocus) {
        inFocus = false;
        afterLeaveFocus(direction, nextInFocus);
    }
443305
def focus_last_child(self):
        """"""
        w, focuspos = self.get_focus()
        child = self._tree.last_child_position(focuspos)
        if child is not None:
            self.set_focus(child)
575904
function endTraversal() {
        var pane = _getPane(ACTIVE_PANE);

        if (_traversingFileList) {
            _traversingFileList = false;

            _makeFileMostRecent(pane.id, pane.getCurrentlyViewedFile());
        }
    }
479118
function locationBar_focus(event) {
    switch (event.type) {
      case "click":
        this._controller.click(this.urlbar);
        break;
      case "shortcut":
        var cmdKey = utils.getEntity(this.getDtds(), "openCmd.commandkey");
        this._controller.keypress(null, cmdKey, {accelKey: true});
        break;
      default:
        throw new Error(arguments.callee.name + ": Unkown event type - " + event.type);
    }

    // Wait until the location bar has been focused
    this._controller.waitForEval("subject.getAttribute('focused') == 'true'",
                                 TIMEOUT, 100, this.urlbar.getNode());
  }
457738
@Override
    public void windowLostFocus(WindowEvent e) {
        // This section is part of the bug fix for blank popup windows in linux.
        if (!enableHideWhenFocusIsLost) {
            e.getWindow().requestFocus();
            return;
        }
        // This fixes a linux-specific behavior where the focus can be "lost" by clicking a child
        // component (inside the same panel!).
        if (InternalUtilities.isMouseWithinComponent(displayWindow)) {
            return;
        }
        hide();
    }
299429
function() {
				// Webkit requires to blur any previous focused page element, in
				// order to properly fire the "focus" event.
				if ( CKEDITOR.env.webkit ) {
					var active = CKEDITOR.document.getActive();
					active && !active.equals( this._.iframe ) && active.$.blur();
				}

				// Restore last focused element or simply focus panel window.
				var focus = this._.lastFocused || this._.iframe.getFrameDocument().getWindow();
				focus.focus();
			}
1297087
def focusOutEvent(self, event):
        """"""
        self.focus_changed.emit()
        QPlainTextEdit.focusOutEvent(self, event)
20628
@Override
    protected void onFocusChanged(boolean focused, int direction,
                                  Rect previouslyFocusedRect) {
        super.onFocusChanged(focused, direction, previouslyFocusedRect);
        showErrorIconHax(lastErrorIcon);
    }
1062568
function () {
            if (savedToStatePath) {
              toState.path = savedToStatePath;
              savedToStatePath = null;
            }

            if (savedFromStatePath) {
              fromState.path = savedFromStatePath;
              savedFromStatePath = null;
            }

            angular.forEach(restore.restoreFunctions, function (restoreFunction) {
              restoreFunction();
            });
            // Restore is done, now set the restore function to noop in case it gets called again.
            restore = noop;
            // pendingRestore keeps track of a transition that is in progress.  It allows the decorated transitionTo
            // method to be re-entrant (for example, when superceding a transition, i.e., redirect).  The decorated
            // transitionTo checks right away if there is a pending transition in progress and restores the paths
            // if so using pendingRestore.
            pendingRestore = null;
            pendingTransitions.splice(idx, 1); // Remove this transition from the list
          }