Exemple #1
0
    static void WindowArrangement()
    {
        var mod = M.Win | M.Shift;
        var g   = GAP_SIZE;
        var hg  = GAP_SIZE / 2;
        var ghg = GAP_SIZE + hg;

        Map(mod, K.Y, (a, w, h) => W.Move(a, 0, 0, w, h));
        Map(mod, K.U, (a, w, h) => W.Move(a, g, g, w - 2 * g, h - 2 * g));
        Map(mod, K.I, (a, w, h) => W.Move(a, (w - a.w) / 2, (h - a.h) / 2, null, null));
        Map(mod, K.H, (a, w, h) => W.Move(a, g, null, w / 2 - ghg, null));
        Map(mod, K.L, (a, w, h) => W.Move(a, w / 2 + hg, null, w / 2 - ghg, null));
        Map(mod, K.K, (a, w, h) => W.Move(a, null, g, null, h / 2 - ghg));
        Map(mod, K.J, (a, w, h) => W.Move(a, null, h / 2 + hg, null, h / 2 - ghg));
    }
Exemple #2
0
    static void WindowBorder()
    {
        var o = BORDER_OFFSET + BORDER_SIZE / 2;

        activeBorderGraphic = G.New(c => {
            var a = W.Active();
            if (!a.isValid)
            {
                return;
            }
            if (BORDER_IGNORE_TITLES.Contains(W.Title(a)))
            {
                return;
            }
            G.Rect(c, BORDER_COLOR, BORDER_SIZE, a.x - o, a.y - o, a.w + 2 * o, a.h + 2 * o);
        });
        Event.onFocus += w => G.Redraw(activeBorderGraphic.Value);
        Event.onMove  += w => G.Redraw(activeBorderGraphic.Value);
    }
Exemple #3
0
    static void WindowFocus()
    {
        var mod = M.Win;

        Map(mod, K.OEM1, a => W.SetActive(W.All()
                                          .Where(w => w.isVisible)
                                          .Where(w => w != a)
                                          .Where(w => w.x == a.x && w.y == a.y)
                                          .DefaultIfEmpty(a)
                                          .Last()));
        Map(mod, K.H, a => W.SetActive(W.All()
                                       .Where(w => w.isVisible)
                                       .Where(w => w.x < a.x)
                                       .OrderBy(w => Math.Abs(a.y - w.y))
                                       .ThenBy(w => Math.Abs(a.x - w.x))
                                       .DefaultIfEmpty(a)
                                       .First()));
        Map(mod, K.L, a => W.SetActive(W.All()
                                       .Where(w => w.isVisible)
                                       .Where(w => w.x > a.x)
                                       .OrderBy(w => Math.Abs(a.y - w.y))
                                       .ThenBy(w => Math.Abs(a.x - w.x))
                                       .DefaultIfEmpty(a)
                                       .First()));
        Map(mod, K.K, a => W.SetActive(W.All()
                                       .Where(w => w.isVisible)
                                       .Where(w => w.y < a.y)
                                       .OrderBy(w => Math.Abs(a.y - w.y))
                                       .ThenBy(w => Math.Abs(a.x - w.x))
                                       .DefaultIfEmpty(a)
                                       .First()));
        Map(mod, K.J, a => W.SetActive(W.All()
                                       .Where(w => w.isVisible)
                                       .Where(w => w.y > a.y)
                                       .OrderBy(w => Math.Abs(a.y - w.y))
                                       .ThenBy(w => Math.Abs(a.x - w.x))
                                       .DefaultIfEmpty(a)
                                       .First()));
    }