merge the C branch into HEAD
[openbox.git] / c / frame.h
blob7d841673868623e5ad935474873d7898ab0e52e8
1 #ifndef __frame_h
2 #define __frame_h
4 #include <X11/Xlib.h>
5 #include "geom.h"
6 #include "client.h"
8 /*! Varius geometry settings in the frame decorations */
9 typedef struct {
10 int width; /* title and handle */
11 int font_height;
12 /* int title_height() { return font_height + bevel*2; } */
13 int title_height;
14 int label_width;
15 /* int label_height() { return font_height; } */
16 int handle_height; /* static, from the style */
17 int icon_x; /* x-position of the window icon button */
18 int title_x; /* x-position of the window title */
19 int iconify_x; /* x-position of the window iconify button */
20 int desktop_x; /* x-position of the window all-desktops button */
21 int max_x; /* x-position of the window maximize button */
22 int close_x; /* x-position of the window close button */
23 int handle_y;
24 int button_size; /* static, from the style */
25 /* int grip_width() { return button_size * 2; } */
26 int grip_width;
27 int bevel; /* static, from the style */
28 int bwidth; /* frame elements' border width */
29 int cbwidth; /* client border width */
30 } FrameGeometry;
32 typedef struct Frame {
33 Window window;
34 Window plate;
35 Window title;
36 Window label;
37 Window max;
38 Window close;
39 Window desk;
40 Window icon;
41 Window iconify;
42 Window handle;
43 Window lgrip;
44 Window rgrip;
46 Strut size;
47 Strut innersize;
48 Rect area;
49 FrameGeometry geom;
51 Client *client;
52 int decorations;
54 gboolean visible;
55 } Frame;
57 Frame *frame_new(struct Client *client);
58 void frame_free(Frame *self);
60 void frame_grab_client(Frame *self);
61 void frame_release_client(Frame *self);
63 /*! Update the frame's size to match the client */
64 void frame_adjust_size(Frame *self);
65 /*! Update the frame's position to match the client */
66 void frame_adjust_position(Frame *self);
67 /*! Shape the frame window to the client window */
68 void frame_adjust_shape(Frame *self);
69 /*! Update the frame to match the client's new state (for things like toggle
70 buttons, focus, and the title) XXX break this up */
71 void frame_adjust_state(Frame *self);
72 /*! Update the frame to match the client's focused state */
73 void frame_adjust_focus(Frame *self);
74 /*! Update the frame to display the client's current title */
75 void frame_adjust_title(Frame *self);
76 /*! Update the frame to display the client's current icon */
77 void frame_adjust_icon(Frame *self);
79 /*! Applies gravity to the client's position to find where the frame should
80 be positioned.
81 @return The proper coordinates for the frame, based on the client.
83 void frame_client_gravity(Frame *self, int *x, int *y);
85 /*! Reversly applies gravity to the frame's position to find where the client
86 should be positioned.
87 @return The proper coordinates for the client, based on the frame.
89 void frame_frame_gravity(Frame *self, int *x, int *y);
91 /*! Shows the frame */
92 void frame_show(Frame *self);
93 /*! Hides the frame */
94 void frame_hide(Frame *self);
96 /*! inits quarks - this will go in engines later */
97 void frame_startup(void);
99 GQuark frame_get_context(Client *client, Window win);
101 #endif