void WnckScreenDefaultWindowClosed(object o, WindowClosedArgs args) { if (base_window == args.Window) { base_window = ManagedWindows .Where(w => w != args.Window) .DefaultIfEmpty(null) .FirstOrDefault(); } UpdateWindows(base_window); SetNameAndIcon(); }
protected override void OnScrolled(Gdk.ScrollDirection direction, Gdk.ModifierType mod) { int count = ManagedWindows.Count(); if (count < 1 || (DateTime.UtcNow - last_scroll) < scroll_rate) { return; } last_scroll = DateTime.UtcNow; // This block will make sure that if we're scrolling on an app that is already active // that when we scroll we move on the next window instead of appearing to do nothing Wnck.Window focused = ManagedWindows.Where(w => w.IsActive).FirstOrDefault(); if (focused != null) { for (; last_raised < count - 1; last_raised++) { if (ManagedWindows.ElementAt(last_raised).Pid == focused.Pid) { break; } } } switch (direction) { case ScrollDirection.Up: case ScrollDirection.Right: last_raised++; break; case ScrollDirection.Down: case ScrollDirection.Left: last_raised--; break; } if (last_raised < 0) { last_raised = count - 1; } else if (last_raised >= count) { last_raised = 0; } ManagedWindows.ElementAt(last_raised).CenterAndFocusWindow(); }