]> icculus.org git repositories - dana/openbox.git/blob - openbox/frame.h
fix brain damage in lineto
[dana/openbox.git] / openbox / frame.h
1 #ifndef __frame_h
2 #define __frame_h
3
4 #include "geom.h"
5 #include "client.h"
6 /*#include "render2/render.h"*/
7 #include "window.h"
8
9 typedef enum {
10     Context_None,
11     Context_Root,
12     Context_Client,
13     Context_Titlebar,
14     Context_Handle,
15     Context_Frame,
16     Context_BLCorner,
17     Context_BRCorner,
18     Context_TLCorner,
19     Context_TRCorner,
20     Context_Maximize,
21     Context_AllDesktops,
22     Context_Shade,
23     Context_Iconify,
24     Context_Icon,
25     Context_Close,
26     NUM_CONTEXTS
27 } Context;
28
29 typedef enum {
30     Decor_TopLeft,
31     Decor_Top,
32     Decor_TopRight,
33     Decor_Left,
34     Decor_Right,
35     Decor_BottomLeft,
36     Decor_Bottom,
37     Decor_BottomRight
38 } Anchor;
39
40 struct Frame;
41
42 typedef enum {
43     Decor_Absolute,
44     Decor_Relative
45 } DecorSizeType;
46
47 typedef struct FrameDecor {
48     ObWindow obwin;
49     Window window;
50
51     Context context;
52     Anchor anchor;
53     Rect area;
54     DecorSizeType sizetypex;
55     DecorSizeType sizetypey;
56     Decoration type;
57     struct Frame *frame;
58     int xoff, yoff; /* offsets for shape*/
59     struct RrSurface *surface;
60 } FrameDecor;
61
62 typedef struct Frame {
63     /* external stuff */
64     Client *client;
65
66     Window window;
67     Window shapewindow;
68
69     Strut  size;
70     Rect   area;
71     gboolean visible;
72
73     /* internal stuff */
74     Window plate;
75
76     struct RrSurface *surface;
77     int framedecors;
78     struct FrameDecor *framedecor;
79
80     gboolean max_press;
81     gboolean close_press;
82     gboolean desk_press;
83     gboolean shade_press;
84     gboolean iconify_press;
85
86     gboolean focused;
87 } Frame;
88
89 void frame_startup();
90 void frame_shutdown();
91
92 Frame *frame_new();
93 void frame_show(Frame *self);
94 void frame_hide(Frame *self);
95 void frame_adjust_shape(Frame *self);
96 void frame_adjust_area(Frame *self, gboolean moved, gboolean resized);
97 void frame_adjust_state(Frame *self);
98 void frame_adjust_focus(Frame *self, gboolean hilite);
99 void frame_adjust_title(Frame *self);
100 void frame_adjust_icon(Frame *self);
101 void frame_grab_client(Frame *self, Client *client);
102 void frame_release_client(Frame *self, Client *client);
103
104 Context frame_context_from_string(char *name);
105
106 Context frame_context(Client *self, Window win);
107
108 /*! Applies gravity to the client's position to find where the frame should
109   be positioned.
110   @return The proper coordinates for the frame, based on the client.
111 */
112 void frame_client_gravity(Frame *self, int *x, int *y);
113
114 /*! Reversly applies gravity to the frame's position to find where the client
115   should be positioned.
116     @return The proper coordinates for the client, based on the frame.
117 */
118 void frame_frame_gravity(Frame *self, int *x, int *y);
119
120
121 #endif