]> Dogcows Code - chaz/openbox/blob - openbox/frame.h
have the clientpadding color show during resize, and no flashing on unmap. we win !
[chaz/openbox] / openbox / frame.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 frame.h for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #ifndef __frame_h
21 #define __frame_h
22
23 #include "geom.h"
24 #include "render/render.h"
25
26 typedef struct _ObFrame ObFrame;
27
28 struct _ObClient;
29
30 typedef void (*ObFrameIconifyAnimateFunc)(gpointer data);
31
32 typedef enum {
33 OB_FRAME_CONTEXT_NONE,
34 OB_FRAME_CONTEXT_DESKTOP,
35 OB_FRAME_CONTEXT_ROOT,
36 OB_FRAME_CONTEXT_CLIENT,
37 OB_FRAME_CONTEXT_TITLEBAR,
38 OB_FRAME_CONTEXT_FRAME,
39 OB_FRAME_CONTEXT_BLCORNER,
40 OB_FRAME_CONTEXT_BRCORNER,
41 OB_FRAME_CONTEXT_TLCORNER,
42 OB_FRAME_CONTEXT_TRCORNER,
43 OB_FRAME_CONTEXT_TOP,
44 OB_FRAME_CONTEXT_BOTTOM,
45 OB_FRAME_CONTEXT_LEFT,
46 OB_FRAME_CONTEXT_RIGHT,
47 OB_FRAME_CONTEXT_MAXIMIZE,
48 OB_FRAME_CONTEXT_ALLDESKTOPS,
49 OB_FRAME_CONTEXT_SHADE,
50 OB_FRAME_CONTEXT_ICONIFY,
51 OB_FRAME_CONTEXT_ICON,
52 OB_FRAME_CONTEXT_CLOSE,
53 /*! This is a special context, which occurs while dragging a window in
54 a move/resize */
55 OB_FRAME_CONTEXT_MOVE_RESIZE,
56 OB_FRAME_NUM_CONTEXTS
57 } ObFrameContext;
58
59 /*! The decorations the client window wants to be displayed on it */
60 typedef enum {
61 OB_FRAME_DECOR_TITLEBAR = 1 << 0, /*!< Display a titlebar */
62 OB_FRAME_DECOR_HANDLE = 1 << 1, /*!< Display a handle (bottom) */
63 OB_FRAME_DECOR_GRIPS = 1 << 2, /*!< Display grips in the handle */
64 OB_FRAME_DECOR_BORDER = 1 << 3, /*!< Display a border */
65 OB_FRAME_DECOR_ICON = 1 << 4, /*!< Display the window's icon */
66 OB_FRAME_DECOR_ICONIFY = 1 << 5, /*!< Display an iconify button */
67 OB_FRAME_DECOR_MAXIMIZE = 1 << 6, /*!< Display a maximize button */
68 /*! Display a button to toggle the window's placement on
69 all desktops */
70 OB_FRAME_DECOR_ALLDESKTOPS = 1 << 7,
71 OB_FRAME_DECOR_SHADE = 1 << 8, /*!< Displays a shade button */
72 OB_FRAME_DECOR_CLOSE = 1 << 9 /*!< Display a close button */
73 } ObFrameDecorations;
74
75 struct _ObFrame
76 {
77 struct _ObClient *client;
78
79 Window window;
80
81 Strut size;
82 Rect area;
83 gboolean visible;
84
85 guint functions;
86 guint decorations;
87
88 Window title;
89 Window label;
90 Window max;
91 Window close;
92 Window desk;
93 Window shade;
94 Window icon;
95 Window iconify;
96 Window handle;
97 Window lgrip;
98 Window rgrip;
99
100 /* These are borders of the frame and its elements */
101 Window titleleft;
102 Window titletop;
103 Window titletopleft;
104 Window titletopright;
105 Window titleright;
106 Window titlebottom;
107 Window left;
108 Window right;
109 Window handleleft;
110 Window handletop;
111 Window handleright;
112 Window handlebottom;
113 Window lgriptop;
114 Window lgripleft;
115 Window lgripbottom;
116 Window rgriptop;
117 Window rgripright;
118 Window rgripbottom;
119 Window innerleft; /*!< For drawing the inner client border */
120 Window innertop; /*!< For drawing the inner client border */
121 Window innerright; /*!< For drawing the inner client border */
122 Window innerbottom; /*!< For drawing the inner client border */
123 Window backback; /*!< A colored window shown while resizing */
124 Window backfront; /*!< An undrawn-in window, to prevent flashing on
125 unmap */
126
127 /* These are resize handles inside the titlebar */
128 Window topresize;
129 Window tltresize;
130 Window tllresize;
131 Window trtresize;
132 Window trrresize;
133
134 Colormap colormap;
135
136 RrAppearance *a_unfocused_title;
137 RrAppearance *a_focused_title;
138 RrAppearance *a_unfocused_label;
139 RrAppearance *a_focused_label;
140 RrAppearance *a_icon;
141 RrAppearance *a_unfocused_handle;
142 RrAppearance *a_focused_handle;
143
144 GSList *clients;
145
146 gint icon_on; /* if the window icon button is on */
147 gint label_on; /* if the window title is on */
148 gint iconify_on; /* if the window iconify button is on */
149 gint desk_on; /* if the window all-desktops button is on */
150 gint shade_on; /* if the window shade button is on */
151 gint max_on; /* if the window maximize button is on */
152 gint close_on; /* if the window close button is on */
153
154 gint width; /* width of the titlebar and handle */
155 gint label_width; /* width of the label in the titlebar */
156 gint icon_x; /* x-position of the window icon button */
157 gint label_x; /* x-position of the window title */
158 gint iconify_x; /* x-position of the window iconify button */
159 gint desk_x; /* x-position of the window all-desktops button */
160 gint shade_x; /* x-position of the window shade button */
161 gint max_x; /* x-position of the window maximize button */
162 gint close_x; /* x-position of the window close button */
163 gint bwidth; /* border width */
164 gint rbwidth; /* border width between the title and client */
165 gint cbwidth_x; /* client border width */
166 gint cbwidth_y; /* client border width */
167 gboolean max_horz; /* when maxed some decorations are hidden */
168 gboolean max_vert; /* when maxed some decorations are hidden */
169
170 /* the leftmost and rightmost elements in the titlebar */
171 ObFrameContext leftmost;
172 ObFrameContext rightmost;
173
174 gboolean max_press;
175 gboolean close_press;
176 gboolean desk_press;
177 gboolean shade_press;
178 gboolean iconify_press;
179 gboolean max_hover;
180 gboolean close_hover;
181 gboolean desk_hover;
182 gboolean shade_hover;
183 gboolean iconify_hover;
184
185 gboolean focused;
186
187 gboolean flashing;
188 gboolean flash_on;
189 GTimeVal flash_end;
190
191 /*! Is the frame currently in an animation for iconify or restore.
192 0 means that it is not animating. > 0 means it is animating an iconify.
193 < 0 means it is animating a restore.
194 */
195 gint iconify_animation_going;
196 GTimeVal iconify_animation_end;
197 };
198
199 ObFrame *frame_new(struct _ObClient *c);
200 void frame_free(ObFrame *self);
201
202 void frame_show(ObFrame *self);
203 void frame_hide(ObFrame *self);
204 void frame_adjust_theme(ObFrame *self);
205 void frame_adjust_shape(ObFrame *self);
206 void frame_adjust_area(ObFrame *self, gboolean moved,
207 gboolean resized, gboolean fake);
208 void frame_adjust_client_area(ObFrame *self);
209 void frame_adjust_state(ObFrame *self);
210 void frame_adjust_focus(ObFrame *self, gboolean hilite);
211 void frame_adjust_title(ObFrame *self);
212 void frame_adjust_icon(ObFrame *self);
213 void frame_grab_client(ObFrame *self);
214 void frame_release_client(ObFrame *self);
215
216 ObFrameContext frame_context_from_string(const gchar *name);
217
218 ObFrameContext frame_context(struct _ObClient *self, Window win,
219 gint x, gint y);
220
221 /*! Applies gravity to the client's position to find where the frame should
222 be positioned.
223 @return The proper coordinates for the frame, based on the client.
224 */
225 void frame_client_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h);
226
227 /*! Reversly applies gravity to the frame's position to find where the client
228 should be positioned.
229 @return The proper coordinates for the client, based on the frame.
230 */
231 void frame_frame_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h);
232
233 void frame_flash_start(ObFrame *self);
234 void frame_flash_stop(ObFrame *self);
235
236 /*! Start an animation for iconifying or restoring a frame. The callback
237 will be called when the animation finishes. But if another animation is
238 started in the meantime, the callback will never get called. */
239 void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying);
240 void frame_end_iconify_animation(ObFrame *self);
241
242 #define frame_iconify_animating(f) (f->iconify_animation_going != 0)
243
244 #endif
This page took 0.048524 seconds and 5 git commands to generate.