1 #ifndef FRAME_H
2 #define FRAME_H
3 
4 #include <stdbool.h>
5 #include "util/ptr-array.h"
6 
7 typedef struct Frame {
8     struct Frame *parent;
9 
10     // Every frame contains either one window or multiple subframes
11     PointerArray frames;
12     struct Window *window;
13 
14     // Width and height
15     int w, h;
16 
17     bool vertical;
18     bool equal_size;
19 } Frame;
20 
21 typedef enum {
22     RESIZE_DIRECTION_AUTO,
23     RESIZE_DIRECTION_HORIZONTAL,
24     RESIZE_DIRECTION_VERTICAL,
25 } ResizeDirection;
26 
27 extern Frame *root_frame;
28 
29 Frame *new_root_frame(struct Window *w);
30 void set_frame_size(Frame *f, int w, int h);
31 void equalize_frame_sizes(Frame *parent);
32 void add_to_frame_size(Frame *f, ResizeDirection dir, int amount);
33 void resize_frame(Frame *f, ResizeDirection dir, int size);
34 void update_window_coordinates(void);
35 Frame *split_frame(struct Window *w, bool vertical, bool before);
36 Frame *split_root(bool vertical, bool before);
37 void remove_frame(Frame *f);
38 
39 #ifdef DEBUG_FRAMES
40   void debug_frames(void);
41 #else
debug_frames(void)42   static inline void debug_frames(void) {}
43 #endif
44 
45 #endif
46