private bool StartCaptureHandler(MouseButtonMessage buttonMessage) { if (this.CaptureHandler == null) { return(false); } if (SuppressContextMenu(this.CaptureHandler)) { _contextMenuEnabled = false; } if (CancelStartDueToDoubleClick()) { Trace.WriteLine(String.Format("Double-click release {0}", this.CaptureHandler.GetType())); ReleaseCapture(true); StartNewHandler(buttonMessage); } else { Trace.WriteLine(String.Format("Start (Clicks: {0}, Count: {1})", _clickCount, _startCount)); StartHandler(this.CaptureHandler); SetCursorToken(); } //we only release capture on button up, so just consume. return(true); }
private bool ProcessMouseButtonUpMessage(MouseButtonMessage buttonMessage) { if (_activeButton != buttonMessage.Shortcut.MouseButton) { return(true); } _activeButton = 0; _clickCount = 0; if (this.CaptureHandler != null) { if (StopHandler(this.CaptureHandler)) { if (_capturedOnThisClick && !HasMoved(buttonMessage.Location) && buttonMessage.Shortcut.MouseButton == XMouseButtons.Right) { _delayedContextMenuRequestPublisher.Publish(this, new ItemEventArgs <Point>(buttonMessage.Location)); } return(true); } //Trace.WriteLine(String.Format("Release capture {0}", this.CaptureHandler.GetType())); ReleaseCapture(false); return(true); } return(false); }
protected virtual void SendMouseButtonData(int mouseButton, bool value) { // send button data MouseButtonMessage msg = new MouseButtonMessage(); msg.MouseButton = mouseButton; msg.ButtonState = value; this.Client.Send(InputMsgType.MouseButtonPress, msg); }
private bool StartNewHandler(MouseButtonMessage buttonMessage) { if (StartNewGraphicHandler()) { return(true); } else { return(StartNewToolHandler(buttonMessage)); } }
private bool StartNewToolHandler(MouseButtonMessage buttonMessage) { foreach (IMouseButtonHandler handler in _shortcutManager.GetMouseButtonHandlers(buttonMessage.Shortcut)) { if (CanStartNewHandler(handler) && StartHandler(handler)) { SetCapture(handler); return(true); } } return(false); }
private bool ProcessMouseButtonDownMessage(MouseButtonMessage buttonMessage) { this.CaptureMouseWheelHandler = null; //don't allow multiple buttons, it's just cleaner and easier to manage behaviour. if (_activeButton != 0) { _contextMenuEnabled = false; return(true); } _activeButton = buttonMessage.Shortcut.MouseButton; _clickCount = buttonMessage.ClickCount; if (StartCaptureHandler(buttonMessage)) { return(true); } if (_key.Shortcut.Shift) { _tile.Select(XKeys.Shift, buttonMessage.Shortcut.MouseButton); } else if (_key.Shortcut.Control) { _tile.Select(XKeys.Control, buttonMessage.Shortcut.MouseButton); } else { _tile.Select(XKeys.None, buttonMessage.Shortcut.MouseButton); } _contextMenuEnabled = (buttonMessage.Shortcut.MouseButton == XMouseButtons.Right); _startMousePoint = buttonMessage.Location; if (_tile.PresentationImage == null || !_tile.Enabled) { return(true); } //give unfocused graphics a chance to focus (in the case of going straight from context menu to a graphic). FindHandlingGraphic(TrackHandler); return(StartNewHandler(buttonMessage)); }
protected virtual void OnReceiveMouseButton(NetworkMessage netMsg) { MouseButtonMessage msg = netMsg.ReadMessage <MouseButtonMessage> (); if (!this._mouseButtonState.ContainsKey(msg.MouseButton)) { this._mouseButtonState [msg.MouseButton] = InputState.None; } if (msg.ButtonState) { this._mouseButtonState [msg.MouseButton] |= InputState.BecomePressed; } else { this._mouseButtonState [msg.MouseButton] |= InputState.BecomeIdle; } }
private void OnGlobalHookMouseUp(object sender, MouseButtonEventArgs e) { if (ClientState.CurrentClientFocused) { return; } //don't process a hook event within 2 seconds #if BailClient if (ShouldHookBailMouse()) { return; } ClientState.LastHookEvent_Mouse = DateTime.UtcNow; #endif #if QUEUE_CLIENT _dispatcher.Process(new MouseButtonMessage(e.Button, false)); #else _dispatcher.Send(MouseButtonMessage.GetBytes(e.Button, false)); #endif e.Handled = true; }
private bool ProcessMouseButtonMessage(MouseButtonMessage buttonMessage) { this.Location = buttonMessage.Location; bool returnValue; if (buttonMessage.ButtonAction == MouseButtonMessage.ButtonActions.Down) { _selectedOnThisClick = !_tile.Selected; _capturedOnThisClick = this.CaptureHandler == null; returnValue = ProcessMouseButtonDownMessage(buttonMessage); _capturedOnThisClick = _capturedOnThisClick && (this.CaptureHandler != null); _selectedOnThisClick = false; } else { returnValue = ProcessMouseButtonUpMessage(buttonMessage); } return(returnValue); }