Esempio n. 1
0
		private bool FocusHookFilter(InputEventMessageRedirector.MessageType type, EventArgs e)
		{
			if (Sandbox.State == SandboxState.Playing)
			{
				// Don't capture keys in sandbox mode. They're likely to be needed in the current Game View
				if (type == InputEventMessageRedirector.MessageType.KeyDown) return false;
			}
			
			return true;
		}
Esempio n. 2
0
		private void InstallFocusHook()
		{
			if (this.glControl.Focused) return;

			// Hook global message filter
			if (this.waitForInputFilter == null)
			{
				this.waitForInputFilter = new InputEventMessageRedirector(this.glControl, this.FocusHookFilter,
					InputEventMessageRedirector.MessageType.MouseWheel, 
					InputEventMessageRedirector.MessageType.KeyDown);
				Application.AddMessageFilter(this.waitForInputFilter);
			}
		}
Esempio n. 3
0
		private void RemoveFocusHook()
		{
			// Remove global message filter
			if (this.waitForInputFilter != null)
			{
				Application.RemoveMessageFilter(this.waitForInputFilter);
				this.waitForInputFilter = null;
			}
		}
Esempio n. 4
0
		private bool FocusHookFilter(InputEventMessageRedirector.MessageType type, EventArgs e)
		{
			// Don't capture stuff in sandbox mode. Input is likely to be needed in the current Game View
			if (Sandbox.State == SandboxState.Playing)
				return false;
			
			return true;
		}