System.Windows.Forms.XplatUIX11.SetFocus C# (CSharp) Method

SetFocus() private method

private SetFocus ( IntPtr handle ) : void
handle IntPtr
return void
		internal override void SetFocus(IntPtr handle) {
			Hwnd	hwnd;
			IntPtr	prev_focus_window;

			hwnd = Hwnd.ObjectFromHandle(handle);

			if (hwnd.client_window == FocusWindow) {
				return;
			}

			// Win32 doesn't do anything if disabled
			if (!hwnd.enabled)
				return;

			prev_focus_window = FocusWindow;
			FocusWindow = hwnd.client_window;

			if (prev_focus_window != IntPtr.Zero) {
				SendMessage(prev_focus_window, Msg.WM_KILLFOCUS, FocusWindow, IntPtr.Zero);
			}
			SendMessage(FocusWindow, Msg.WM_SETFOCUS, prev_focus_window, IntPtr.Zero);
			Keyboard.FocusIn (FocusWindow);

			//XSetInputFocus(DisplayHandle, Hwnd.ObjectFromHandle(handle).client_window, RevertTo.None, IntPtr.Zero);
		}
XplatUIX11