]> icculus.org git repositories - dana/openbox.git/blob - openbox/frame.h
save the stacking order of the windows, and sort the saved session data based on...
[dana/openbox.git] / 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_DESKTOP,
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_TLCORNER,
21     OB_FRAME_CONTEXT_TRCORNER,
22     OB_FRAME_CONTEXT_MAXIMIZE,
23     OB_FRAME_CONTEXT_ALLDESKTOPS,
24     OB_FRAME_CONTEXT_SHADE,
25     OB_FRAME_CONTEXT_ICONIFY,
26     OB_FRAME_CONTEXT_ICON,
27     OB_FRAME_CONTEXT_CLOSE,
28     OB_FRAME_NUM_CONTEXTS
29 } ObFrameContext;
30
31 /*! The decorations the client window wants to be displayed on it */
32 typedef enum {
33     OB_FRAME_DECOR_TITLEBAR    = 1 << 0, /*!< Display a titlebar */
34     OB_FRAME_DECOR_HANDLE      = 1 << 1, /*!< Display a handle (bottom) */
35     OB_FRAME_DECOR_GRIPS       = 1 << 2, /*!< Display grips in the handle */
36     OB_FRAME_DECOR_BORDER      = 1 << 3, /*!< Display a border */
37     OB_FRAME_DECOR_ICON        = 1 << 4, /*!< Display the window's icon */
38     OB_FRAME_DECOR_ICONIFY     = 1 << 5, /*!< Display an iconify button */
39     OB_FRAME_DECOR_MAXIMIZE    = 1 << 6, /*!< Display a maximize button */
40     /*! Display a button to toggle the window's placement on
41       all desktops */
42     OB_FRAME_DECOR_ALLDESKTOPS = 1 << 7,
43     OB_FRAME_DECOR_SHADE       = 1 << 8, /*!< Displays a shade button */
44     OB_FRAME_DECOR_CLOSE       = 1 << 9  /*!< Display a close button */
45 } ObFrameDecorations;
46
47 struct _ObFrame
48 {
49     struct _ObClient *client;
50
51     Window    window;
52     Window    plate;
53
54     Strut     size;
55     Rect      area;
56     gboolean  visible;
57
58     /*! Whether the window is obscured at all or fully visible. */
59     gboolean obscured;
60
61     guint     decorations;
62
63     Window    title;
64     Window    label;
65     Window    max;
66     Window    close;
67     Window    desk;
68     Window    shade;
69     Window    icon;
70     Window    iconify;
71     Window    handle;
72     Window    lgrip;
73     Window    rgrip;
74
75     Window    tlresize;
76     Window    trresize;
77
78     RrAppearance *a_unfocused_title;
79     RrAppearance *a_focused_title;
80     RrAppearance *a_unfocused_label;
81     RrAppearance *a_focused_label;
82     RrAppearance *a_icon;
83     RrAppearance *a_unfocused_handle;
84     RrAppearance *a_focused_handle;
85
86     Strut     innersize;
87
88     GSList   *clients;
89
90     gint      width;         /* title and handle */
91     gint      label_width;
92     gint      icon_x;        /* x-position of the window icon button */
93     gint      label_x;       /* x-position of the window title */
94     gint      iconify_x;     /* x-position of the window iconify button */
95     gint      desk_x;        /* x-position of the window all-desktops button */
96     gint      shade_x;       /* x-position of the window shade button */
97     gint      max_x;         /* x-position of the window maximize button */
98     gint      close_x;       /* x-position of the window close button */
99     gint      bwidth;        /* border width */
100     gint      rbwidth;       /* title border width */
101     gint      cbwidth_x;     /* client border width */
102     gint      cbwidth_y;     /* client border width */
103
104     gboolean  max_press;
105     gboolean  close_press;
106     gboolean  desk_press;
107     gboolean  shade_press;
108     gboolean  iconify_press;
109     gboolean  max_hover;
110     gboolean  close_hover;
111     gboolean  desk_hover;
112     gboolean  shade_hover;
113     gboolean  iconify_hover;
114
115     gboolean  focused;
116 };
117
118 ObFrame *frame_new();
119 void frame_show(ObFrame *self);
120 void frame_hide(ObFrame *self);
121 void frame_adjust_shape(ObFrame *self);
122 void frame_adjust_area(ObFrame *self, gboolean moved,
123                        gboolean resized, gboolean fake);
124 void frame_adjust_state(ObFrame *self);
125 void frame_adjust_focus(ObFrame *self, gboolean hilite);
126 void frame_adjust_title(ObFrame *self);
127 void frame_adjust_icon(ObFrame *self);
128 void frame_grab_client(ObFrame *self, struct _ObClient *client);
129 void frame_release_client(ObFrame *self, struct _ObClient *client);
130
131 ObFrameContext frame_context_from_string(char *name);
132
133 ObFrameContext frame_context(struct _ObClient *self, Window win);
134
135 /*! Applies gravity to the client's position to find where the frame should
136   be positioned.
137   @return The proper coordinates for the frame, based on the client.
138 */
139 void frame_client_gravity(ObFrame *self, int *x, int *y);
140
141 /*! Reversly applies gravity to the frame's position to find where the client
142   should be positioned.
143     @return The proper coordinates for the client, based on the frame.
144 */
145 void frame_frame_gravity(ObFrame *self, int *x, int *y);
146
147
148 #endif