Exemplo n.º 1
0
void ModifyContainerSplitRatio(double Offset)
{
    if(!FocusedApplication)
        return;

    ax_window *Window = FocusedApplication->Focus;
    if(!Window)
        return;

    ax_display *Display = AXLibWindowDisplay(Window);
    space_info *SpaceInfo = &WindowTree[Display->Space->Identifier];

    tree_node *Root = SpaceInfo->RootNode;
    if(!Root || IsLeafNode(Root) || Root->WindowID != 0)
        return;

    tree_node *Node = GetTreeNodeFromWindowIDOrLinkNode(Root, Window->ID);
    if(Node && Node->Parent)
    {
        if(Node->Parent->SplitRatio + Offset > 0.0 &&
           Node->Parent->SplitRatio + Offset < 1.0)
        {
            Node->Parent->SplitRatio += Offset;
            ResizeNodeContainer(Display, Node->Parent);
            ApplyTreeNodeContainer(Node->Parent);
        }
    }
}
Exemplo n.º 2
0
void ChangeTypeOfFocusedNode(node_type Type)
{
    ax_window *Window = FocusedApplication ? FocusedApplication->Focus : NULL;
    if(!Window)
        return;

    ax_display *Display = AXLibWindowDisplay(Window);
    space_info *SpaceInfo = &WindowTree[Display->Space->Identifier];

    tree_node *TreeNode = GetTreeNodeFromWindowIDOrLinkNode(SpaceInfo->RootNode, Window->ID);
    if(TreeNode && TreeNode != SpaceInfo->RootNode)
        TreeNode->Type = Type;
}
Exemplo n.º 3
0
void ModifyContainerSplitRatio(double Offset, int Degrees)
{
    if(!FocusedApplication)
        return;

    ax_window *Window = FocusedApplication->Focus;
    if(!Window)
        return;

    ax_display *Display = AXLibWindowDisplay(Window);
    space_info *SpaceInfo = &WindowTree[Display->Space->Identifier];

    tree_node *Root = SpaceInfo->RootNode;
    if(!Root || IsLeafNode(Root) || Root->WindowID != 0)
        return;

    tree_node *Node = GetTreeNodeFromWindowIDOrLinkNode(Root, Window->ID);
    if(Node)
    {
        ax_window *ClosestWindow = NULL;
        if(FindClosestWindow(Degrees, &ClosestWindow, false))
        {
            tree_node *Target = GetTreeNodeFromWindowIDOrLinkNode(Root, ClosestWindow->ID);
            tree_node *Ancestor = FindLowestCommonAncestor(Node, Target);

            if(Ancestor)
            {
                if(!(Node == Ancestor->LeftChild || IsLeftChildInSubTree(Ancestor->LeftChild, Node)))
                    Offset = -Offset;

                double NewSplitRatio = Ancestor->SplitRatio + Offset;
                SetContainerSplitRatio(NewSplitRatio, Node, Ancestor, Display, true);
            }
        }
    }
}
Exemplo n.º 4
0
Arquivo: query.cpp Projeto: cHoco/kwm
internal std::string
GetSplitModeOfWindow(ax_window *Window)
{
    std::string Output;
    if(!Window)
        return "";

    ax_display *Display = AXLibWindowDisplay(Window);
    space_info *SpaceInfo = &WindowTree[Display->Space->Identifier];

    tree_node *Node = GetTreeNodeFromWindowIDOrLinkNode(SpaceInfo->RootNode, Window->ID);
    if(Node)
    {
        if(Node->SplitMode == SPLIT_VERTICAL)
            Output = "Vertical";
        else if(Node->SplitMode == SPLIT_HORIZONTAL)
            Output = "Horizontal";
    }

    return Output;
}