rendered paste body internal override bool SetVisible (IntPtr handle, bool visible, bool activate)
{
Hwnd hwnd;
hwnd = Hwnd.ObjectFromHandle(handle);
hwnd.visible = visible;
lock (XlibLock) {
if (visible) {
MapWindow(hwnd, WindowType.Both);
if (Control.FromHandle(handle) is Form) {
FormWindowState s;
s = ((Form)Control.FromHandle(handle)).WindowState;
switch(s) {
case FormWindowState.Minimized: SetWindowState(handle, FormWindowState.Minimized); break;
case FormWindowState.Maximized: SetWindowState(handle, FormWindowState.Maximized); break;
}
#if SYNTHETIC_ACTIVATE_ON_SHOW
// this is pretty evil, but we need it so that we match
// MS's behavior in terms of Form.Show() -> WM_ACTIVATE
// synchronously.
if (hwnd.need_initial_activate) {
hwnd.need_initial_activate = false;
hwnd.ignore_activate = true;
if (ActiveWindow != IntPtr.Zero) {
Hwnd active_hwnd = hwnd = Hwnd.ObjectFromHandle (ActiveWindow);
Console.WriteLine ("Deactivating window {0}", ActiveWindow);
Console.WriteLine (Environment.StackTrace);
SendMessage (ActiveWindow, Msg.WM_ACTIVATE, (IntPtr) WindowActiveFlags.WA_INACTIVE, IntPtr.Zero);
}
ActiveWindow = handle;
Console.WriteLine ("Activating window {0}", ActiveWindow);
Console.WriteLine (Environment.StackTrace);
SendMessage (ActiveWindow, Msg.WM_ACTIVATE, (IntPtr) WindowActiveFlags.WA_ACTIVE, IntPtr.Zero);
/* make sure we update the property here, just to be sure */
SendNetWMMessage(ActiveWindow.whole_window, _NET_ACTIVE_WINDOW, (IntPtr)1, IntPtr.Zero, IntPtr.Zero);
}
#endif
}
SendMessage(handle, Msg.WM_WINDOWPOSCHANGED, IntPtr.Zero, IntPtr.Zero);
}
else {
UnmapWindow(hwnd, WindowType.Both);
}
}
return true;
}