2014-01-13 04:18:48 -08:00
|
|
|
#ifndef WINDOW_TREE_H
|
2014-02-04 08:24:44 -08:00
|
|
|
# define WINDOW_TREE_H
|
|
|
|
# include <e.h>
|
2014-01-13 04:18:48 -08:00
|
|
|
|
2014-01-21 06:53:35 -08:00
|
|
|
/* XXX: First two have to be 0 and 1 because I use them with modulo. */
|
2014-02-04 08:24:44 -08:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TILING_SPLIT_HORIZONTAL = 0,
|
|
|
|
TILING_SPLIT_VERTICAL = 1,
|
|
|
|
TILING_SPLIT_FLOAT,
|
|
|
|
TILING_SPLIT_LAST
|
2014-01-13 06:53:12 -08:00
|
|
|
} Tiling_Split_Type;
|
|
|
|
|
2014-01-13 04:18:48 -08:00
|
|
|
typedef struct _Window_Tree Window_Tree;
|
|
|
|
|
2014-01-14 04:36:08 -08:00
|
|
|
/* Root is level 0. Each node's split type is (level % 2). */
|
2014-01-13 04:18:48 -08:00
|
|
|
struct _Window_Tree
|
|
|
|
{
|
|
|
|
EINA_INLIST;
|
|
|
|
Window_Tree *parent;
|
|
|
|
/* FIXME: client is falid iff children is null. Sholud enforce it. */
|
2014-02-10 01:27:57 -08:00
|
|
|
Eina_Inlist *children; /* Window_Tree * type */
|
|
|
|
E_Client *client;
|
2019-08-10 02:57:09 -07:00
|
|
|
struct {
|
|
|
|
int x, y, w, h;
|
|
|
|
} space;
|
2014-02-10 01:27:57 -08:00
|
|
|
double weight;
|
2014-01-13 04:18:48 -08:00
|
|
|
};
|
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
# define TILING_WINDOW_TREE_EDGE_LEFT (1 << 0)
|
|
|
|
# define TILING_WINDOW_TREE_EDGE_RIGHT (1 << 1)
|
|
|
|
# define TILING_WINDOW_TREE_EDGE_TOP (1 << 2)
|
2014-02-04 08:24:44 -08:00
|
|
|
# define TILING_WINDOW_TREE_EDGE_BOTTOM (1 << 3)
|
2014-01-16 09:18:29 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
int tiling_window_tree_edges_get(Window_Tree *node);
|
2014-01-16 09:18:29 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
void tiling_window_tree_free(Window_Tree *root);
|
|
|
|
void tiling_window_tree_walk(Window_Tree *root, void (*func)(void *));
|
2014-01-13 06:53:12 -08:00
|
|
|
|
2017-08-12 13:26:32 -07:00
|
|
|
/**
|
|
|
|
* Insert a new client into the tree
|
|
|
|
*
|
|
|
|
* @param root the root node where to insert in some subtree
|
|
|
|
* @param buddy the buddy where you want to place client to, buddy MUST be a node with a associated client OR NULL
|
|
|
|
* @param split_type the split type you want to insert the client
|
|
|
|
* @param before true to insert the client before the buddy false to insert it after the buddy
|
|
|
|
*
|
|
|
|
* @return the new root node
|
|
|
|
*/
|
2017-03-09 02:14:44 -08:00
|
|
|
Window_Tree *tiling_window_tree_insert(Window_Tree *root, Window_Tree *buddy,
|
|
|
|
E_Client *client, Tiling_Split_Type split_type, Eina_Bool before);
|
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
Window_Tree *tiling_window_tree_remove(Window_Tree *root, Window_Tree *item);
|
2014-01-13 06:53:12 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
Window_Tree *tiling_window_tree_client_find(Window_Tree *root,
|
|
|
|
E_Client *client);
|
2014-01-13 06:53:12 -08:00
|
|
|
|
2019-08-10 02:57:09 -07:00
|
|
|
Eina_Bool tiling_window_tree_apply(Window_Tree *root, Evas_Coord x, Evas_Coord y,
|
|
|
|
Evas_Coord w, Evas_Coord h, Evas_Coord padding,
|
|
|
|
Eina_Bool force_float);
|
2014-01-13 06:53:12 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
Eina_Bool tiling_window_tree_node_resize(Window_Tree *node, int w_dir,
|
|
|
|
double w_diff, int h_dir, double h_diff);
|
2014-01-14 09:25:32 -08:00
|
|
|
|
2014-10-29 01:10:01 -07:00
|
|
|
void tiling_window_tree_node_change_pos(Window_Tree *node, int key);
|
2017-02-24 09:18:37 -08:00
|
|
|
|
|
|
|
Eina_Bool tiling_window_tree_repair(void);
|
2014-01-13 04:18:48 -08:00
|
|
|
#endif
|