Exemplo n.º 1
0
        /// <summary>
        /// Moves the current viewport to the selected window and then raises it
        /// </summary>
        /// <param name="w">
        /// A <see cref="Window"/>
        /// </param>
        public static void CenterAndFocusWindow(this Window w)
        {
            if (w == null)
            {
                return;
            }

            uint time = Gtk.Global.CurrentEventTime;

            if (w.Workspace != null && w.Workspace != w.Screen.ActiveWorkspace)
            {
                w.Workspace.Activate(time);
            }

            if (w.IsMinimized)
            {
                w.Unminimize(time);
            }

            w.ActivateTransient(time);
        }