]> Dogcows Code - chaz/openbox/blob - openbox/frame.h
i am the king of copy/paste errors
[chaz/openbox] / openbox / frame.h
1 #ifndef __frame_h
2 #define __frame_h
3
4 #include "geom.h"
5 #include "render/render.h"
6
7 typedef struct _ObFrame ObFrame;
8
9 struct _ObClient;
10
11 typedef enum {
12 OB_FRAME_CONTEXT_NONE,
13 OB_FRAME_CONTEXT_ROOT,
14 OB_FRAME_CONTEXT_CLIENT,
15 OB_FRAME_CONTEXT_TITLEBAR,
16 OB_FRAME_CONTEXT_HANDLE,
17 OB_FRAME_CONTEXT_FRAME,
18 OB_FRAME_CONTEXT_BLCORNER,
19 OB_FRAME_CONTEXT_BRCORNER,
20 OB_FRAME_CONTEXT_MAXIMIZE,
21 OB_FRAME_CONTEXT_ALLDESKTOPS,
22 OB_FRAME_CONTEXT_SHADE,
23 OB_FRAME_CONTEXT_ICONIFY,
24 OB_FRAME_CONTEXT_ICON,
25 OB_FRAME_CONTEXT_CLOSE,
26 OB_FRAME_NUM_CONTEXTS
27 } ObFrameContext;
28
29 /*! The decorations the client window wants to be displayed on it */
30 typedef enum {
31 OB_FRAME_DECOR_TITLEBAR = 1 << 0, /*!< Display a titlebar */
32 OB_FRAME_DECOR_HANDLE = 1 << 1, /*!< Display a handle (bottom) */
33 OB_FRAME_DECOR_GRIPS = 1 << 2, /*!< Display grips in the handle */
34 OB_FRAME_DECOR_BORDER = 1 << 3, /*!< Display a border */
35 OB_FRAME_DECOR_ICON = 1 << 4, /*!< Display the window's icon */
36 OB_FRAME_DECOR_ICONIFY = 1 << 5, /*!< Display an iconify button */
37 OB_FRAME_DECOR_MAXIMIZE = 1 << 6, /*!< Display a maximize button */
38 /*! Display a button to toggle the window's placement on
39 all desktops */
40 OB_FRAME_DECOR_ALLDESKTOPS = 1 << 7,
41 OB_FRAME_DECOR_SHADE = 1 << 8, /*!< Displays a shade button */
42 OB_FRAME_DECOR_CLOSE = 1 << 9 /*!< Display a close button */
43 } ObFrameDecorations;
44
45 struct _ObFrame
46 {
47 struct _ObClient *client;
48
49 Window window;
50 Window plate;
51
52 Strut size;
53 Rect area;
54 gboolean visible;
55 guint decorations;
56
57 Window title;
58 Window label;
59 Window max;
60 Window close;
61 Window desk;
62 Window shade;
63 Window icon;
64 Window iconify;
65 Window handle;
66 Window lgrip;
67 Window rgrip;
68
69 RrAppearance *a_unfocused_title;
70 RrAppearance *a_focused_title;
71 RrAppearance *a_unfocused_label;
72 RrAppearance *a_focused_label;
73 RrAppearance *a_icon;
74 RrAppearance *a_unfocused_handle;
75 RrAppearance *a_focused_handle;
76
77 Strut innersize;
78
79 GSList *clients;
80
81 gint width; /* title and handle */
82 gint label_width;
83 gint icon_x; /* x-position of the window icon button */
84 gint label_x; /* x-position of the window title */
85 gint iconify_x; /* x-position of the window iconify button */
86 gint desk_x; /* x-position of the window all-desktops button */
87 gint shade_x; /* x-position of the window shade button */
88 gint max_x; /* x-position of the window maximize button */
89 gint close_x; /* x-position of the window close button */
90 gint bwidth; /* border width */
91 gint cbwidth; /* client border width */
92
93 gboolean max_press;
94 gboolean close_press;
95 gboolean desk_press;
96 gboolean shade_press;
97 gboolean iconify_press;
98 gboolean max_hover;
99 gboolean close_hover;
100 gboolean desk_hover;
101 gboolean shade_hover;
102 gboolean iconify_hover;
103
104 gboolean focused;
105 };
106
107 ObFrame *frame_new();
108 void frame_show(ObFrame *self);
109 void frame_hide(ObFrame *self);
110 void frame_adjust_shape(ObFrame *self);
111 void frame_adjust_area(ObFrame *self, gboolean moved, gboolean resized);
112 void frame_adjust_state(ObFrame *self);
113 void frame_adjust_focus(ObFrame *self, gboolean hilite);
114 void frame_adjust_title(ObFrame *self);
115 void frame_adjust_icon(ObFrame *self);
116 void frame_grab_client(ObFrame *self, struct _ObClient *client);
117 void frame_release_client(ObFrame *self, struct _ObClient *client);
118
119 ObFrameContext frame_context_from_string(char *name);
120
121 ObFrameContext frame_context(struct _ObClient *self, Window win);
122
123 /*! Applies gravity to the client's position to find where the frame should
124 be positioned.
125 @return The proper coordinates for the frame, based on the client.
126 */
127 void frame_client_gravity(ObFrame *self, int *x, int *y);
128
129 /*! Reversly applies gravity to the frame's position to find where the client
130 should be positioned.
131 @return The proper coordinates for the client, based on the frame.
132 */
133 void frame_frame_gravity(ObFrame *self, int *x, int *y);
134
135
136 #endif
This page took 0.03877 seconds and 4 git commands to generate.