Wait for a window to have or lose focus.

        :param window: The window to wait on
        :param want_focus: If 1, wait for focus. If 0, wait for loss of focus.
16718
def wait_for_window_focus(self, window, want_focus):
        
        _libxdo.xdo_wait_for_window_focus(self._xdo, window, want_focus)
890105
def focus_next_matching(self, querystring):
        """"""
        self.focus_property(lambda x: x._message.matches(querystring),
                            self._tree.next_position)
150437
def set_window_pos_callback(window, cbfun):
    
    window_addr = ctypes.cast(ctypes.pointer(window),
                              ctypes.POINTER(ctypes.c_long)).contents.value
    if window_addr in _window_pos_callback_repository:
        previous_callback = _window_pos_callback_repository[window_addr]
    else:
        previous_callback = None
    if cbfun is None:
        cbfun = 0
    c_cbfun = _GLFWwindowposfun(cbfun)
    _window_pos_callback_repository[window_addr] = (cbfun, c_cbfun)
    cbfun = c_cbfun
    _glfw.glfwSetWindowPosCallback(window, cbfun)
    if previous_callback is not None and previous_callback[0] != 0:
        return previous_callback[0]
150183
def set_window_focus_callback(window, cbfun):
    
    window_addr = ctypes.cast(ctypes.pointer(window),
                              ctypes.POINTER(ctypes.c_long)).contents.value
    if window_addr in _window_focus_callback_repository:
        previous_callback = _window_focus_callback_repository[window_addr]
    else:
        previous_callback = None
    if cbfun is None:
        cbfun = 0
    c_cbfun = _GLFWwindowfocusfun(cbfun)
    _window_focus_callback_repository[window_addr] = (cbfun, c_cbfun)
    cbfun = c_cbfun
    _glfw.glfwSetWindowFocusCallback(window, cbfun)
    if previous_callback is not None and previous_callback[0] != 0:
        return previous_callback[0]
662256
def focusInEvent(self, event):
        """"""
        self.focus_changed.emit()
        return super(PageControlWidget, self).focusInEvent(event)
998315
public boolean shouldYieldFocus(JComponent input) {
        boolean isValidInput = verify(input);
        if (isValidInput) {
            input.setBackground(background);
        } else {
            input.setBackground(warningBackground);
        }
        return isValidInput;
    }
952878
private static WindowListener createWeakWindowFocusListener(WindowFocusListener windowFocusListener) {
        final WeakReference<WindowFocusListener> weakReference = new WeakReference<WindowFocusListener>(windowFocusListener);

        return new WindowAdapter() {
            public void windowActivated(WindowEvent e) {
                // TODO if the WeakReference's object is null, remove the
                // WeakReference as a FocusListener.
                if (weakReference.get() != null) {
                    weakReference.get().windowGainedFocus(e);
                }
            }

            public void windowDeactivated(WindowEvent e) {
                if (weakReference.get() != null) {
                    weakReference.get().windowLostFocus(e);
                }
            }
        };
    }
1205628
def Focus(self):
        
        self._Skype._Api.allow_focus(self._Skype.Timeout)
        self._Skype._DoCommand('FOCUS')
959017
def _move_focus(pymux, get_x, get_y):
    "  "
    window = pymux.arrangement.get_active_window()

    try:
        write_pos = pymux.get_client_state().layout_manager.pane_write_positions[window.active_pane]
    except KeyError:
        pass
    else:
        x = get_x(write_pos)
        y = get_y(write_pos)

        # Look for the pane at this position.
        for pane, wp in pymux.get_client_state().layout_manager.pane_write_positions.items():
            if (wp.xpos <= x < wp.xpos + wp.width and
                    wp.ypos <= y < wp.ypos + wp.height):
                window.active_pane = pane
                return
148219
public int waitForWindowShown(String windowName) {
    if (getScopeServices().getConnection() == null) {
      throw new CommunicationException(
          "waiting for a window failed because Opera is not connected.");
    }

    return getScopeServices()
        .waitForDesktopWindowShown(windowName, OperaIntervals.WINDOW_EVENT_TIMEOUT.getMs());
  }
1105642
def on_focusout(self, event, a):
		
		if event.widget.get() == '':
			event.widget.insert(0, default_text[a])
			event.widget.config(fg = 'grey')
492088
def interruptwait():
    
    evt = NSEvent.otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(NSApplicationDefined, NSPoint(), NSApplicationDefined, 0, 1, None, LIGHTBLUE_NOTIFY_ID, 0, 0)
    NSApplication.sharedApplication().postEvent_atStart_(evt, True)
448952
def focusOutEvent(self, event):
        """"""
        self.focus_changed.emit()
        return super(ControlWidget, self).focusOutEvent(event)
1323124
protected boolean activateAndFocusWindow(Stage window) {
        if (!window.isFocused()) {
            if (!window.isShowing()) {
                LOGGER.trace("cannot activate and focus the window '" + window.getTitle() + "' cause its window is not showing");
                return false;
            }
            LOGGER.trace("try to activate and focus the window  '" + window.getTitle() + "' cause its window is not focused");
            StageFocusedListener stageFocusedListener = new StageFocusedListener(window);
            window.focusedProperty().addListener(stageFocusedListener);

            PlatformImpl.runAndWait(() -> {
                window.toFront();
                window.requestFocus();
            });

            boolean windowFocused = stageFocusedListener.waitUntilWindowFocused();
            window.focusedProperty().removeListener(stageFocusedListener);
            LOGGER.trace("window focused ? " + windowFocused);
            if (!window.isFocused()) {
                LOGGER.warn("The window activation/focus process failed!!!");
                return false;
            }
            LOGGER.trace("The window activation/focus process is completed!!!");
        } else {
            LOGGER.trace("the window '" + window.getTitle() + "' is already focused");
        }
        return true;
    }
701910
def focus_next(self, count=1):
        "  "
        panes = self.panes
        if panes:
            self.active_pane = panes[(panes.index(self.active_pane) + count) % len(panes)]
        else:
            self.active_pane = None
778833
function(){
			var ls;
			
			if (lookingForNewDocument && FuncUnit.checkForNewDocument() ) {
				
				ls = loadSuccess;
				
				loadSuccess = null;
				if (ls) {
					FuncUnit.win.focus();
					FuncUnit.win.document.documentElement.tabIndex = 0;
					
					ls();
				}
			}
			
		setTimeout(arguments.callee, 500)
	}
67598
def for_window(cls, window):
        
        utcnow = datetime.datetime.utcnow()
        return cls(utcnow - window, 0)