]> Dogcows Code - chaz/openbox/blob - openbox/frame.h
change the "handle" context to "bottom". add a "top" context. make the top
[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_CLIENT,
36 OB_FRAME_CONTEXT_TITLEBAR,
37 OB_FRAME_CONTEXT_FRAME,
38 OB_FRAME_CONTEXT_BLCORNER,
39 OB_FRAME_CONTEXT_BRCORNER,
40 OB_FRAME_CONTEXT_TLCORNER,
41 OB_FRAME_CONTEXT_TRCORNER,
42 OB_FRAME_CONTEXT_TOP,
43 OB_FRAME_CONTEXT_BOTTOM,
44 OB_FRAME_CONTEXT_MAXIMIZE,
45 OB_FRAME_CONTEXT_ALLDESKTOPS,
46 OB_FRAME_CONTEXT_SHADE,
47 OB_FRAME_CONTEXT_ICONIFY,
48 OB_FRAME_CONTEXT_ICON,
49 OB_FRAME_CONTEXT_CLOSE,
50 /*! This is a special context, which occurs while dragging a window in
51 a move/resize */
52 OB_FRAME_CONTEXT_MOVE_RESIZE,
53 OB_FRAME_NUM_CONTEXTS
54 } ObFrameContext;
55
56 /*! The decorations the client window wants to be displayed on it */
57 typedef enum {
58 OB_FRAME_DECOR_TITLEBAR = 1 << 0, /*!< Display a titlebar */
59 OB_FRAME_DECOR_HANDLE = 1 << 1, /*!< Display a handle (bottom) */
60 OB_FRAME_DECOR_GRIPS = 1 << 2, /*!< Display grips in the handle */
61 OB_FRAME_DECOR_BORDER = 1 << 3, /*!< Display a border */
62 OB_FRAME_DECOR_ICON = 1 << 4, /*!< Display the window's icon */
63 OB_FRAME_DECOR_ICONIFY = 1 << 5, /*!< Display an iconify button */
64 OB_FRAME_DECOR_MAXIMIZE = 1 << 6, /*!< Display a maximize button */
65 /*! Display a button to toggle the window's placement on
66 all desktops */
67 OB_FRAME_DECOR_ALLDESKTOPS = 1 << 7,
68 OB_FRAME_DECOR_SHADE = 1 << 8, /*!< Displays a shade button */
69 OB_FRAME_DECOR_CLOSE = 1 << 9 /*!< Display a close button */
70 } ObFrameDecorations;
71
72 struct _ObFrame
73 {
74 struct _ObClient *client;
75
76 Window window;
77 Window plate;
78
79 Strut size;
80 Rect area;
81 gboolean visible;
82
83 guint decorations;
84 gboolean max_horz;
85
86 Window inner; /*!< The window for drawing the inner client border */
87 Window title;
88 Window label;
89 Window max;
90 Window close;
91 Window desk;
92 Window shade;
93 Window icon;
94 Window iconify;
95 Window handle;
96 Window lgrip;
97 Window rgrip;
98
99 Window topresize;
100 Window tltresize;
101 Window tllresize;
102 Window trtresize;
103 Window trrresize;
104
105 Colormap colormap;
106
107 RrAppearance *a_unfocused_title;
108 RrAppearance *a_focused_title;
109 RrAppearance *a_unfocused_label;
110 RrAppearance *a_focused_label;
111 RrAppearance *a_icon;
112 RrAppearance *a_unfocused_handle;
113 RrAppearance *a_focused_handle;
114
115 Strut innersize;
116
117 GSList *clients;
118
119 gint icon_on; /* if the window icon button is on */
120 gint label_on; /* if the window title is on */
121 gint iconify_on; /* if the window iconify button is on */
122 gint desk_on; /* if the window all-desktops button is on */
123 gint shade_on; /* if the window shade button is on */
124 gint max_on; /* if the window maximize button is on */
125 gint close_on; /* if the window close button is on */
126
127 gint width; /* width of the titlebar and handle */
128 gint label_width; /* width of the label in the titlebar */
129 gint icon_x; /* x-position of the window icon button */
130 gint label_x; /* x-position of the window title */
131 gint iconify_x; /* x-position of the window iconify button */
132 gint desk_x; /* x-position of the window all-desktops button */
133 gint shade_x; /* x-position of the window shade button */
134 gint max_x; /* x-position of the window maximize button */
135 gint close_x; /* x-position of the window close button */
136 gint bwidth; /* border width */
137 gint rbwidth; /* title border width */
138 gint cbwidth_x; /* client border width */
139 gint cbwidth_y; /* client border width */
140
141 /* the leftmost and rightmost elements in the titlebar */
142 ObFrameContext leftmost;
143 ObFrameContext rightmost;
144
145 gboolean max_press;
146 gboolean close_press;
147 gboolean desk_press;
148 gboolean shade_press;
149 gboolean iconify_press;
150 gboolean max_hover;
151 gboolean close_hover;
152 gboolean desk_hover;
153 gboolean shade_hover;
154 gboolean iconify_hover;
155
156 gboolean focused;
157
158 gboolean flashing;
159 gboolean flash_on;
160 GTimeVal flash_end;
161
162 /*! Is the frame currently in an animation for iconify or restore.
163 0 means that it is not animating. > 0 means it is animating an iconify.
164 < 0 means it is animating a restore.
165 */
166 gint iconify_animation_going;
167 GTimeVal iconify_animation_end;
168 };
169
170 ObFrame *frame_new(struct _ObClient *c);
171 void frame_free(ObFrame *self);
172
173 void frame_show(ObFrame *self);
174 void frame_hide(ObFrame *self);
175 void frame_adjust_theme(ObFrame *self);
176 void frame_adjust_shape(ObFrame *self);
177 void frame_adjust_area(ObFrame *self, gboolean moved,
178 gboolean resized, gboolean fake);
179 void frame_adjust_client_area(ObFrame *self);
180 void frame_adjust_state(ObFrame *self);
181 void frame_adjust_focus(ObFrame *self, gboolean hilite);
182 void frame_adjust_title(ObFrame *self);
183 void frame_adjust_icon(ObFrame *self);
184 void frame_grab_client(ObFrame *self);
185 void frame_release_client(ObFrame *self);
186
187 ObFrameContext frame_context_from_string(const gchar *name);
188
189 ObFrameContext frame_context(struct _ObClient *self, Window win,
190 gint x, gint y);
191
192 /*! Applies gravity to the client's position to find where the frame should
193 be positioned.
194 @return The proper coordinates for the frame, based on the client.
195 */
196 void frame_client_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h);
197
198 /*! Reversly applies gravity to the frame's position to find where the client
199 should be positioned.
200 @return The proper coordinates for the client, based on the frame.
201 */
202 void frame_frame_gravity(ObFrame *self, gint *x, gint *y, gint w, gint h);
203
204 void frame_flash_start(ObFrame *self);
205 void frame_flash_stop(ObFrame *self);
206
207 /*! Start an animation for iconifying or restoring a frame. The callback
208 will be called when the animation finishes. But if another animation is
209 started in the meantime, the callback will never get called. */
210 void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying);
211 void frame_end_iconify_animation(ObFrame *self);
212
213 #define frame_iconify_animating(f) (f->iconify_animation_going != 0)
214
215 #endif
This page took 0.04418 seconds and 5 git commands to generate.