3 * FvwmButtons, copyright 1996, Jarl Totland
5 * This module, and the entire GoodStuff program, and the concept for
6 * interfacing this module to the Window Manager, are all original work
9 * Copyright 1993, Robert Nation. No guarantees or warantees or anything
10 * are provided or implied in any way whatsoever. Use this program at your
11 * own risk. Permission to use this program for any purpose is given,
12 * as long as the copyright is kept intact.
16 /* This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 #include <X11/Intrinsic.h>
37 #include "FvwmButtons.h"
41 *** Debug function. May only be called after ShuffleButtons has been called.
43 void DumpButtons(button_info
*b
)
47 fprintf(stderr
, "NULL\n");
52 int button
= buttonNum(b
);
54 "0x%lx(%ix%i@(%i,%i)): ",
55 (unsigned long)b
, b
->BWidth
, b
->BHeight
,
56 buttonXPos(b
, button
), buttonYPos(b
, button
));
62 (unsigned long)b
, b
->BWidth
, b
->BHeight
);
68 b
->font_string
, (unsigned long)b
->Ffont
);
69 if (b
->flags
.b_Padding
)
70 fprintf(stderr
, "Padding(%i,%i) ", b
->xpad
, b
->ypad
);
72 fprintf(stderr
, "Framew(%i) ", b
->framew
);
74 fprintf(stderr
, "Title(%s) ", b
->title
);
76 fprintf(stderr
, "Icon(%s,%i) ", b
->icon_file
, (int)b
->IconWin
);
78 fprintf(stderr
, "Panelw(%i) ", (int)b
->PanelWin
);
79 if (b
->flags
.b_Action
)
81 "\n Action(%s,%s,%s,%s) ",
82 b
->action
[0] ? b
->action
[0] : "",
83 b
->action
[1] ? b
->action
[1] : "",
84 b
->action
[2] ? b
->action
[2] : "",
85 b
->action
[3] ? b
->action
[3] : "");
86 if (b
->flags
.b_Swallow
)
88 fprintf(stderr
, "Swallow(0x%02x) ", b
->swallow
);
89 if (b
->swallow
& b_Respawn
)
90 fprintf(stderr
, "\n Respawn(%s) ", b
->spawn
);
91 if (b
->newflags
.do_swallow_new
)
92 fprintf(stderr
, "\n SwallowNew(%s) ", b
->spawn
);
96 fprintf(stderr
, "Panel(0x%02x) ", b
->swallow
);
97 if (b
->swallow
& b_Respawn
)
98 fprintf(stderr
, "\n Respawn(%s) ", b
->spawn
);
99 if (b
->newflags
.do_swallow_new
)
100 fprintf(stderr
, "\n SwallowNew(%s) ", b
->spawn
);
102 if (b
->flags
.b_Hangon
)
103 fprintf(stderr
, "Hangon(%s) ", b
->hangon
);
104 fprintf(stderr
, "\n");
105 if (b
->flags
.b_Container
)
109 " Container(%ix%i=%i buttons (alloc %i),"
110 " size %ix%i, pos %i,%i)\n{ ",
111 b
->c
->num_columns
, b
->c
->num_rows
, b
->c
->num_buttons
,
112 b
->c
->allocated_buttons
,
113 b
->c
->width
, b
->c
->height
, b
->c
->xpos
, b
->c
->ypos
);
115 fprintf(stderr," font(%s,%i) framew(%i) pad(%i,%i) { ",
116 b->c->font_string,(int)b->c->Ffont,b->c->framew,b->c->xpad,
119 while (i
<b
->c
->num_buttons
)
122 "0x%lx ", (unsigned long)b
->c
->buttons
[i
++]);
124 fprintf(stderr
, "}\n");
126 while (i
< b
->c
->num_buttons
)
128 DumpButtons(b
->c
->buttons
[i
++]);
134 void SaveButtons(button_info
*b
)
139 if (b
->BWidth
>1 || b
->BHeight
> 1)
140 fprintf(stderr
, "%ix%i ", b
->BWidth
, b
->BHeight
);
142 fprintf(stderr
, "Font %s ", b
->font_string
);
144 fprintf(stderr
, "Fore %s ", b
->fore
);
146 fprintf(stderr
, "Back %s ", b
->back
);
147 if (b
->flags
.b_Frame
)
148 fprintf(stderr
, "Frame %i ", b
->framew
);
149 if (b
->flags
.b_Padding
)
150 fprintf(stderr
, "Padding %i %i ", b
->xpad
, b
->ypad
);
151 if (b
->flags
.b_Title
)
153 fprintf(stderr
, "Title ");
154 if (b
->flags
.b_Justify
)
156 fprintf(stderr
, "(");
157 switch (b
->justify
& b_TitleHoriz
)
160 fprintf(stderr
, "Left");
163 fprintf(stderr
, "Center");
166 fprintf(stderr
, "Right");
169 if (b
->justify
& b_Horizontal
)
171 fprintf(stderr
, ", Side");
173 fprintf(stderr
, ") ");
175 fprintf(stderr
, "\"%s\" ", b
->title
);
179 fprintf(stderr
, "Icon \"%s\" ", b
->icon_file
);
181 if (b
->flags
.b_Swallow
|| b
->flags
.b_Panel
)
183 if (b
->flags
.b_Swallow
)
184 fprintf(stderr
, "Swallow ");
186 fprintf(stderr
, "Panel ");
189 fprintf(stderr
, "(");
190 if (b
->swallow_mask
& b_NoHints
)
192 if (b
->swallow
& b_NoHints
)
193 fprintf(stderr
, "NoHints ");
195 fprintf(stderr
, "Hints ");
198 if (b
->swallow_mask
& b_Kill
)
200 if (b
->swallow
& b_Kill
)
201 fprintf(stderr
, "Kill ");
203 fprintf(stderr
, "NoKill ");
206 if (b
->swallow_mask
& b_NoClose
)
208 if (b
->swallow
& b_NoClose
)
209 fprintf(stderr
, "NoClose ");
211 fprintf(stderr
, "Close ");
214 if (b
->swallow_mask
& b_Respawn
)
216 if (b
->swallow
& b_Respawn
)
217 fprintf(stderr
, "Respawn ");
219 fprintf(stderr
, "NoRespawn ");
222 if (b
->swallow_mask
& b_UseOld
)
224 if (b
->swallow
& b_UseOld
)
225 fprintf(stderr
, "UseOld ");
227 fprintf(stderr
, "NoOld ");
230 if (b
->swallow_mask
& b_UseTitle
)
232 if (b
->swallow
& b_UseTitle
)
233 fprintf(stderr
, "UseTitle ");
235 fprintf(stderr
, "NoTitle ");
238 fprintf(stderr
, ") ");
240 fprintf(stderr
, "\"%s\" \"%s\" ", b
->hangon
, b
->spawn
);
242 if (b
->flags
.b_Action
)
245 fprintf(stderr
, "Action `%s` ", b
->action
[0]);
246 for (i
= 1; i
< 4; i
++)
250 "Action (Mouse %i) `%s` ",
256 if (b
->flags
.b_Container
)
259 "Container (Columns %i Rows %i ",
260 b
->c
->num_columns
, b
->c
->num_rows
);
262 if (b
->c
->flags
.b_Font
)
263 fprintf(stderr
, "Font %s ", b
->c
->font_string
);
264 if (b
->c
->flags
.b_Fore
)
265 fprintf(stderr
, "Fore %s ", b
->c
->fore
);
266 if (b
->c
->flags
.b_Back
)
267 fprintf(stderr
, "Back %s ", b
->c
->back
);
268 if (b
->c
->flags
.b_Frame
)
269 fprintf(stderr
, "Frame %i ", b
->c
->framew
);
270 if (b
->c
->flags
.b_Padding
)
273 b
->c
->xpad
, b
->c
->ypad
);
274 if (b
->c
->flags
.b_Justify
)
276 fprintf(stderr
, "Title (");
277 switch (b
->c
->justify
& b_TitleHoriz
)
280 fprintf(stderr
, "Left");
283 fprintf(stderr
, "Center");
286 fprintf(stderr
, "Right");
289 if (b
->c
->justify
& b_Horizontal
)
291 fprintf(stderr
, ", Side");
293 fprintf(stderr
, ") ");
295 if (b
->c
->swallow_mask
)
297 fprintf(stderr
, "Swallow (");
298 if (b
->c
->swallow_mask
& b_NoHints
)
300 if (b
->c
->swallow
& b_NoHints
)
301 fprintf(stderr
, "NoHints ");
303 fprintf(stderr
, "Hints ");
306 if (b
->c
->swallow_mask
& b_Kill
)
308 if (b
->c
->swallow
& b_Kill
)
309 fprintf(stderr
, "Kill ");
311 fprintf(stderr
, "NoKill ");
314 if (b
->c
->swallow_mask
& b_NoClose
)
316 if (b
->c
->swallow
& b_NoClose
)
317 fprintf(stderr
, "NoClose ");
319 fprintf(stderr
, "Close ");
322 if (b
->c
->swallow_mask
& b_Respawn
)
324 if (b
->c
->swallow
& b_Respawn
)
325 fprintf(stderr
, "Respawn ");
327 fprintf(stderr
, "NoRespawn ");
330 if (b
->c
->swallow_mask
& b_UseOld
)
332 if (b
->c
->swallow
& b_UseOld
)
333 fprintf(stderr
, "UseOld ");
335 fprintf(stderr
, "NoOld ");
338 if (b
->c
->swallow_mask
& b_UseTitle
)
340 if (b
->c
->swallow
& b_UseTitle
)
341 fprintf(stderr
, "UseTitle ");
343 fprintf(stderr
, "NoTitle ");
346 fprintf(stderr
, ") ");
349 fprintf(stderr
, ")");
351 fprintf(stderr
, "\n");
353 if (b
->flags
.b_Container
)
356 while (i
<b
->c
->num_buttons
)
358 SaveButtons(b
->c
->buttons
[i
++]);
360 fprintf(stderr
, "End\n");