WINGs: fix memory leak in getStreamObjects (Coverity #50119)
[wmaker-crm.git] / src / framewin.h
blob22e0edfdd5ec2919fa35eda5ff1b01efe7cdcdbe
1 /*
2 * Window Maker window manager
4 * Copyright (c) 1997-2003 Alfredo K. Kojima
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.
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.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef WMFRAMEWINDOW_H_
22 #define WMFRAMEWINDOW_H_
24 #include "wcore.h"
25 #include "pixmap.h"
27 #define BORDER_TOP 1
28 #define BORDER_BOTTOM 2
29 #define BORDER_LEFT 4
30 #define BORDER_RIGHT 8
31 #define BORDER_ALL (1|2|4|8)
34 #define WFF_TITLEBAR (1<<0)
35 #define WFF_LEFT_BUTTON (1<<1)
36 #define WFF_RIGHT_BUTTON (1<<2)
37 #define WFF_RESIZEBAR (1<<3)
38 #define WFF_BORDER (1<<4)
39 #define WFF_SINGLE_STATE (1<<5)
40 #ifdef XKB_BUTTON_HINT
41 #define WFF_LANGUAGE_BUTTON (1<<6)
42 #endif
43 #define WFF_SELECTED (1<<7)
46 #define WFF_IS_SHADED (1<<16)
48 typedef struct WFrameWindow {
49 WScreen *screen_ptr; /* pointer to the screen structure */
51 WCoreWindow *core;
53 WCoreWindow *titlebar; /* the titlebar */
54 WCoreWindow *left_button; /* miniaturize button */
55 #ifdef XKB_BUTTON_HINT
56 WCoreWindow *language_button;
57 #endif
58 WCoreWindow *right_button; /* close button */
60 short workspace; /* workspace that the window occupies */
62 short top_width;
63 int *title_clearance;
64 int *title_min_height;
65 int *title_max_height;
66 short bottom_width;
68 short resizebar_corner_width;
70 WCoreWindow *resizebar; /* bottom resizebar */
72 Pixmap title_back[3]; /* focused, unfocused, pfocused */
73 Pixmap resizebar_back[3]; /* any, None, None */
74 Pixmap lbutton_back[3];
75 Pixmap rbutton_back[3];
76 #ifdef XKB_BUTTON_HINT
77 Pixmap languagebutton_back[3];
78 #endif
80 WPixmap *lbutton_image;
81 WPixmap *rbutton_image;
82 #ifdef XKB_BUTTON_HINT
83 WPixmap *languagebutton_image;
84 #endif
86 union WTexture **title_texture;
87 union WTexture **resizebar_texture;
88 WMColor **title_color;
89 WMFont **font;
91 char *title; /* window name (title) */
93 #ifdef KEEP_XKB_LOCK_STATUS
94 int languagemode;
95 int last_languagemode;
96 #endif /* KEEP_XKB_LOCK_STATUS */
98 /* thing that uses this frame. passed as data to callbacks */
99 void *child;
101 /* callbacks */
102 void (*on_click_left)(WCoreWindow *sender, void *data, XEvent *event);
103 #ifdef XKB_BUTTON_HINT
104 void (*on_click_language)(WCoreWindow *sender, void *data, XEvent *event);
105 #endif
107 void (*on_click_right)(WCoreWindow *sender, void *data, XEvent *event);
108 void (*on_dblclick_right)(WCoreWindow *sender, void *data, XEvent *event);
110 void (*on_mousedown_titlebar)(WCoreWindow *sender, void *data, XEvent *event);
111 void (*on_dblclick_titlebar)(WCoreWindow *sender, void *data, XEvent *event);
113 void (*on_mousedown_resizebar)(WCoreWindow *sender, void *data, XEvent *event);
115 struct {
116 unsigned int state:2; /* 3 possible states */
117 unsigned int justification:2;
118 unsigned int titlebar:1;
119 unsigned int resizebar:1;
120 unsigned int left_button:1;
121 unsigned int right_button:1;
122 #ifdef XKB_BUTTON_HINT
123 unsigned int language_button:1;
124 #endif
126 unsigned int need_texture_remake:1;
128 unsigned int single_texture:1;
130 unsigned int hide_left_button:1;
131 unsigned int hide_right_button:1;
132 #ifdef XKB_BUTTON_HINT
133 unsigned int hide_language_button:1;
134 #endif
136 unsigned int need_texture_change:1;
138 unsigned int lbutton_dont_fit:1;
139 unsigned int rbutton_dont_fit:1;
140 #ifdef XKB_BUTTON_HINT
141 unsigned int languagebutton_dont_fit:1;
142 #endif
144 unsigned int repaint_only_titlebar:1;
145 unsigned int repaint_only_resizebar:1;
147 unsigned int is_client_window_frame:1;
149 unsigned int incomplete_title:1;
150 } flags;
151 int depth;
152 Visual *visual;
153 Colormap colormap;
154 unsigned long *border_pixel;
155 unsigned long *selected_border_pixel;
156 } WFrameWindow;
159 WFrameWindow*
160 wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
161 int width, int height, int *clearance,
162 int *title_min, int *title_max, int flags,
163 union WTexture **title_texture,
164 union WTexture **resize_texture,
165 WMColor **color, WMFont **font,
166 int depth, Visual *visual, Colormap colormap);
168 void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
170 void wFrameWindowDestroy(WFrameWindow *fwin);
172 void wFrameWindowChangeState(WFrameWindow *fwin, int state);
174 void wFrameWindowPaint(WFrameWindow *fwin);
176 void wFrameWindowConfigure(WFrameWindow *fwin, int x, int y, int width, int height);
178 void wFrameWindowResize(WFrameWindow *fwin, int width, int height);
180 void wFrameWindowShowButton(WFrameWindow *fwin, int flags);
182 void wFrameWindowHideButton(WFrameWindow *fwin, int flags);
184 int wFrameWindowChangeTitle(WFrameWindow *fwin, const char *new_title);
186 #ifdef XKB_BUTTON_HINT
187 void wFrameWindowUpdateLanguageButton(WFrameWindow *fwin);
188 #endif
190 #endif