예제 #1
0
파일: node.cpp 프로젝트: koekeishiya/kwm
void RemovePseudoNode()
{
    ax_display *Display = AXLibMainDisplay();
    space_info *SpaceInfo = &WindowTree[Display->Space->Identifier];
    if(!FocusedApplication)
        return;

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

    tree_node *Node = GetTreeNodeFromWindowID(SpaceInfo->RootNode, Window->ID);
    if(Node && Node->Parent)
    {
        tree_node *Parent = Node->Parent;
        tree_node *PseudoNode = IsLeftChild(Node) ? Parent->RightChild : Parent->LeftChild;
        if(!PseudoNode || !IsLeafNode(PseudoNode) || PseudoNode->WindowID != 0)
            return;

        Parent->WindowID = Node->WindowID;
        Parent->LeftChild = NULL;
        Parent->RightChild = NULL;
        free(Node);
        free(PseudoNode);
        ApplyTreeNodeContainer(Parent);
    }
}
예제 #2
0
파일: tree.cpp 프로젝트: JakimLi/kwm
tree_node *GetTreeNodeFromWindowIDOrLinkNode(tree_node *Node, int WindowID)
{
    tree_node *Result = NULL;
    Result = GetTreeNodeFromWindowID(Node, WindowID);
    if(!Result)
    {
        link_node *Link = GetLinkNodeFromWindowID(Node, WindowID);
        Result = GetTreeNodeFromLink(Node, Link);
    }

    return Result;
}
예제 #3
0
파일: node.cpp 프로젝트: koekeishiya/kwm
void CreatePseudoNode()
{
    ax_display *Display = AXLibMainDisplay();
    space_info *SpaceInfo = &WindowTree[Display->Space->Identifier];
    if(!FocusedApplication)
        return;

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

    tree_node *Node = GetTreeNodeFromWindowID(SpaceInfo->RootNode, Window->ID);
    if(Node)
    {
        split_type SplitMode = KWMSettings.SplitMode == SPLIT_OPTIMAL ? GetOptimalSplitMode(Node) : KWMSettings.SplitMode;
        CreateLeafNodePair(Display, Node, Node->WindowID, 0, SplitMode);
        ApplyTreeNodeContainer(Node);
    }
}
예제 #4
0
파일: node.cpp 프로젝트: koekeishiya/kwm
void ResizeWindowToContainerSize(ax_window *Window)
{
    if(Window)
    {
        ax_window *Window = FocusedApplication ? FocusedApplication->Focus : NULL;
        if(!Window)
            return;

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

        tree_node *Node = GetTreeNodeFromWindowID(SpaceInfo->RootNode, Window->ID);
        if(Node)
            ResizeWindowToContainerSize(Node);

        if(!Node)
        {
            link_node *Link = GetLinkNodeFromWindowID(SpaceInfo->RootNode, Window->ID);
            if(Link)
                ResizeWindowToContainerSize(Link);
        }
    }
}
예제 #5
0
파일: node.cpp 프로젝트: koekeishiya/kwm
void ToggleFocusedNodeSplitMode()
{
    ax_display *Display = AXLibMainDisplay();
    space_info *SpaceInfo = &WindowTree[Display->Space->Identifier];
    if(!FocusedApplication)
        return;

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

    tree_node *Node = GetTreeNodeFromWindowID(SpaceInfo->RootNode, Window->ID);
    if(!Node)
        return;

    tree_node *Parent = Node->Parent;
    if(!Parent || IsLeafNode(Parent))
        return;

    Parent->SplitMode = Parent->SplitMode == SPLIT_VERTICAL ? SPLIT_HORIZONTAL : SPLIT_VERTICAL;
    CreateNodeContainers(Display, Parent, false);
    ApplyTreeNodeContainer(Parent);
}