Example #1
0
    private void UpdateManagerWindow(bool dock_if_realized)
    {
        if (Handle == IntPtr.Zero || Display == null || Display.Handle == IntPtr.Zero)
        {
            return;
        }

        IntPtr xdisplay = gdk_x11_display_get_xdisplay(Display.Handle);

        if (manager_window != IntPtr.Zero)
        {
            return;
        }

        XGrabServer(xdisplay);

        manager_window = XGetSelectionOwner(xdisplay, selection_atom);
        if (manager_window != IntPtr.Zero)
        {
            XSelectInput(xdisplay, manager_window, (IntPtr)(EventMask.StructureNotifyMask | EventMask.PropertyChangeMask));
        }

        XUngrabServer(xdisplay);
        XFlush(xdisplay);

        if (manager_window != IntPtr.Zero)
        {
            Gdk.Window gdkwin = Gdk.Window.ForeignNewForDisplay(Display, (uint)manager_window);
            if (gdkwin != null)
            {
                gdkwin.AddFilter(filter);
            }

            GetOrientationProperty();
            GetVisualProperty();

            if (IsRealized)
            {
                if ((visual == null && Visual == Screen.SystemVisual) ||
                    visual == Visual)
                {
                    // Already have the right visual, can just dock
                    if (dock_if_realized)
                    {
                        SendDockRequest();
                    }
                }
                else
                {
                    // Need to re-realize the widget to get the right visual
                    Hide();
                    Unrealize();
                    Show();
                }
            }
        }
    }
Example #2
0
    private void UpdateManagerWindow(bool dock_if_realized)
    {
        if (Handle == IntPtr.Zero || Display == null || Display.Handle == IntPtr.Zero)
        {
            return;
        }

        IntPtr xdisplay = gdk_x11_display_get_xdisplay(Display.Handle);

        if (manager_window != IntPtr.Zero)
        {
            return;
        }

        XGrabServer(xdisplay);

        manager_window = XGetSelectionOwner(xdisplay, selection_atom);
        if (manager_window != IntPtr.Zero)
        {
            XSelectInput(xdisplay, manager_window, (IntPtr)(EventMask.StructureNotifyMask | EventMask.PropertyChangeMask));
        }

        XUngrabServer(xdisplay);
        XFlush(xdisplay);

        if (manager_window != IntPtr.Zero)
        {
            Gdk.Window gdkwin = Gdk.Window.ForeignNewForDisplay(Display, (uint)manager_window);
            if (gdkwin != null)
            {
                gdkwin.AddFilter(filter);
            }

            if (dock_if_realized && IsRealized)
            {
                SendDockRequest();
            }

            GetOrientationProperty();
        }
    }