]> Dogcows Code - chaz/openbox/blob - openbox/frame.h
add copyright headers, adjust --version output to include copyright, and --help outpu...
[chaz/openbox] / openbox / frame.h
1 /* -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
2
3 frame.h for the Openbox window manager
4 Copyright (c) 2003 Ben Jansens
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __frame_h
20 #define __frame_h
21
22 #include "geom.h"
23 #include "render/render.h"
24
25 typedef struct _ObFrame ObFrame;
26
27 struct _ObClient;
28
29 typedef enum {
30 OB_FRAME_CONTEXT_NONE,
31 OB_FRAME_CONTEXT_DESKTOP,
32 OB_FRAME_CONTEXT_CLIENT,
33 OB_FRAME_CONTEXT_TITLEBAR,
34 OB_FRAME_CONTEXT_HANDLE,
35 OB_FRAME_CONTEXT_FRAME,
36 OB_FRAME_CONTEXT_BLCORNER,
37 OB_FRAME_CONTEXT_BRCORNER,
38 OB_FRAME_CONTEXT_TLCORNER,
39 OB_FRAME_CONTEXT_TRCORNER,
40 OB_FRAME_CONTEXT_MAXIMIZE,
41 OB_FRAME_CONTEXT_ALLDESKTOPS,
42 OB_FRAME_CONTEXT_SHADE,
43 OB_FRAME_CONTEXT_ICONIFY,
44 OB_FRAME_CONTEXT_ICON,
45 OB_FRAME_CONTEXT_CLOSE,
46 /*! This is a special context, which occurs while dragging a window in
47 a move/resize */
48 OB_FRAME_CONTEXT_MOVE_RESIZE,
49 OB_FRAME_NUM_CONTEXTS
50 } ObFrameContext;
51
52 /*! The decorations the client window wants to be displayed on it */
53 typedef enum {
54 OB_FRAME_DECOR_TITLEBAR = 1 << 0, /*!< Display a titlebar */
55 OB_FRAME_DECOR_HANDLE = 1 << 1, /*!< Display a handle (bottom) */
56 OB_FRAME_DECOR_GRIPS = 1 << 2, /*!< Display grips in the handle */
57 OB_FRAME_DECOR_BORDER = 1 << 3, /*!< Display a border */
58 OB_FRAME_DECOR_ICON = 1 << 4, /*!< Display the window's icon */
59 OB_FRAME_DECOR_ICONIFY = 1 << 5, /*!< Display an iconify button */
60 OB_FRAME_DECOR_MAXIMIZE = 1 << 6, /*!< Display a maximize button */
61 /*! Display a button to toggle the window's placement on
62 all desktops */
63 OB_FRAME_DECOR_ALLDESKTOPS = 1 << 7,
64 OB_FRAME_DECOR_SHADE = 1 << 8, /*!< Displays a shade button */
65 OB_FRAME_DECOR_CLOSE = 1 << 9 /*!< Display a close button */
66 } ObFrameDecorations;
67
68 struct _ObFrame
69 {
70 struct _ObClient *client;
71
72 Window window;
73 Window plate;
74
75 Strut size;
76 Rect area;
77 gboolean visible;
78
79 /*! Whether the window is obscured at all or fully visible. */
80 gboolean obscured;
81
82 guint decorations;
83 gboolean max_horz;
84
85 Window title;
86 Window label;
87 Window max;
88 Window close;
89 Window desk;
90 Window shade;
91 Window icon;
92 Window iconify;
93 Window handle;
94 Window lgrip;
95 Window rgrip;
96
97 Window tlresize;
98 Window trresize;
99
100 RrAppearance *a_unfocused_title;
101 RrAppearance *a_focused_title;
102 RrAppearance *a_unfocused_label;
103 RrAppearance *a_focused_label;
104 RrAppearance *a_icon;
105 RrAppearance *a_unfocused_handle;
106 RrAppearance *a_focused_handle;
107
108 Strut innersize;
109
110 GSList *clients;
111
112 gint width; /* title and handle */
113 gint label_width;
114 gint icon_x; /* x-position of the window icon button */
115 gint label_x; /* x-position of the window title */
116 gint iconify_x; /* x-position of the window iconify button */
117 gint desk_x; /* x-position of the window all-desktops button */
118 gint shade_x; /* x-position of the window shade button */
119 gint max_x; /* x-position of the window maximize button */
120 gint close_x; /* x-position of the window close button */
121 gint bwidth; /* border width */
122 gint rbwidth; /* title border width */
123 gint cbwidth_x; /* client border width */
124 gint cbwidth_y; /* client border width */
125
126 gboolean max_press;
127 gboolean close_press;
128 gboolean desk_press;
129 gboolean shade_press;
130 gboolean iconify_press;
131 gboolean max_hover;
132 gboolean close_hover;
133 gboolean desk_hover;
134 gboolean shade_hover;
135 gboolean iconify_hover;
136
137 gboolean focused;
138
139 gboolean flashing;
140 gboolean flash_on;
141 GTimeVal flash_end;
142 };
143
144 ObFrame *frame_new();
145 void frame_show(ObFrame *self);
146 void frame_hide(ObFrame *self);
147 void frame_adjust_theme(ObFrame *self);
148 void frame_adjust_shape(ObFrame *self);
149 void frame_adjust_area(ObFrame *self, gboolean moved,
150 gboolean resized, gboolean fake);
151 void frame_adjust_state(ObFrame *self);
152 void frame_adjust_focus(ObFrame *self, gboolean hilite);
153 void frame_adjust_title(ObFrame *self);
154 void frame_adjust_icon(ObFrame *self);
155 void frame_grab_client(ObFrame *self, struct _ObClient *client);
156 void frame_release_client(ObFrame *self, struct _ObClient *client);
157
158 ObFrameContext frame_context_from_string(char *name);
159
160 ObFrameContext frame_context(struct _ObClient *self, Window win);
161
162 /*! Applies gravity to the client's position to find where the frame should
163 be positioned.
164 @return The proper coordinates for the frame, based on the client.
165 */
166 void frame_client_gravity(ObFrame *self, int *x, int *y);
167
168 /*! Reversly applies gravity to the frame's position to find where the client
169 should be positioned.
170 @return The proper coordinates for the client, based on the frame.
171 */
172 void frame_frame_gravity(ObFrame *self, int *x, int *y);
173
174 void frame_flash_start(ObFrame *self);
175 void frame_flash_stop(ObFrame *self);
176
177 #endif
This page took 0.043699 seconds and 5 git commands to generate.