private void HandleWindowMoveStart(WindowsWindow window) { if (_mouseMoveWindow != null) { _mouseMoveWindow.IsMouseMoving = false; } _mouseMoveWindow = window; window.IsMouseMoving = true; }
private bool ShouldIgnoreWindow(WindowsWindow window) { var id = -1; try { id = window.ProcessId; } catch (Exception e) { } return(window.Class == "ConsoleWindowClass" && id == Process.GetCurrentProcess().Id); }
private void HandleWindowMoveEnd() { lock (_mouseMoveLock) { if (_mouseMoveWindow != null) { _mouseMoveWindow.IsMouseMoving = false; _mouseMoveWindow = null; } } }
private void RegisterWindow(IntPtr handle, bool emitEvent = true) { if (!_windows.ContainsKey(handle)) { var window = new WindowsWindow(handle); if (!ShouldIgnoreWindow(window)) { window.WindowFocused += () => HandleWindowFocused(window); _windows[handle] = window; if (emitEvent) { HandleWindowAdd(window, true); } } } }
private void HandleWindowRemove(WindowsWindow window) { WindowDestroyed?.Invoke(window); }
private void HandleWindowAdd(WindowsWindow window, bool firstCreate) { WindowCreated?.Invoke(window, firstCreate); }
private void HandleWindowFocused(WindowsWindow window) { WindowFocused?.Invoke(window); }