1
/* This module, and the entire FvwmDebug program, and the concept for
2
* interfacing this module to the Window Manager, are all original work
5
* Copyright 1994, Robert Nation. No guarantees or warantees or anything
6
* are provided or implied in any way whatsoever. Use this program at your
7
* own risk. Permission to use this program for any purpose is given,
8
* as long as the copyright is kept intact. */
13
#include "../../configure.h"
24
#include "../../fvwm/module.h"
26
#include "FvwmDebug.h"
27
#include "../../version.h"
33
/***********************************************************************
36
* main - start of module
38
***********************************************************************/
39
void main(int argc, char **argv)
43
/* Save our program name - for error messages */
45
s=strrchr(argv[0], '/');
49
MyName = safemalloc(strlen(temp)+2);
53
if((argc != 6)&&(argc != 7))
55
fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
60
/* Dead pipe == Fvwm died */
61
signal (SIGPIPE, DeadPipe);
63
fd[0] = atoi(argv[1]);
64
fd[1] = atoi(argv[2]);
66
/* Data passed in command line */
67
fprintf(stderr,"Application Window 0x%s\n",argv[4]);
68
fprintf(stderr,"Application Context %s\n",argv[5]);
70
fd_width = GetFdWidth();
72
/* Create a list of all windows */
73
/* Request a list of all windows,
74
* wait for ConfigureWindow packets */
75
SendInfo(fd,"Send_WindowList",0);
80
/***********************************************************************
83
* Loop - wait for data to process
85
***********************************************************************/
88
unsigned long header[3], *body;
90
int body_length,count,count2=0, total;
94
if(count = ReadFvwmPacket(fd[1],header,&body) > 0)
96
process_message(header[1],body);
103
/***********************************************************************
106
* Process message - examines packet types, and takes appropriate action
108
***********************************************************************/
109
void process_message(unsigned long type,unsigned long *body)
115
case M_CONFIGURE_WINDOW:
116
list_configure(body);
118
case M_DESTROY_WINDOW:
124
case M_TOGGLE_PAGING:
145
case M_ICON_LOCATION:
149
list_deiconify(body);
152
list_window_name(body);
155
list_icon_name(body);
163
case M_END_WINDOWLIST:
174
/***********************************************************************
177
* SIGPIPE handler - SIGPIPE means fvwm is dying
179
***********************************************************************/
180
void DeadPipe(int nonsense)
185
/***********************************************************************
188
* list_add - displays packet contents to stderr
190
***********************************************************************/
191
void list_add(unsigned long *body)
193
fprintf(stderr,"Add Window\n");
194
fprintf(stderr,"\t ID %lx\n",body[0]);
195
fprintf(stderr,"\t frame ID %lx\n",body[1]);
196
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
197
fprintf(stderr,"\t frame x %ld\n",(long)body[3]);
198
fprintf(stderr,"\t frame y %ld\n",(long)body[4]);
199
fprintf(stderr,"\t frame w %ld\n",(long)body[5]);
200
fprintf(stderr,"\t frame h %ld\n",(long)body[6]);
201
fprintf(stderr,"\t desk %ld\n",(long)body[7]);
202
fprintf(stderr,"\t flags %lx\n",body[8]);
203
fprintf(stderr,"\t title height %ld\n",(long)body[9]);
204
fprintf(stderr,"\t border width %ld\n",(long)body[10]);
205
fprintf(stderr,"\t window base width %ld\n",(long)body[11]);
206
fprintf(stderr,"\t window base height %ld\n",(long)body[12]);
207
fprintf(stderr,"\t window resize width increment %ld\n",(long)body[13]);
208
fprintf(stderr,"\t window resize height increment %ld\n",(long)body[14]);
209
fprintf(stderr,"\t window min width %ld\n",(long)body[15]);
210
fprintf(stderr,"\t window min height %ld\n",(long)body[16]);
211
fprintf(stderr,"\t window max %ld\n",(long)body[17]);
212
fprintf(stderr,"\t window max %ld\n",(long)body[18]);
213
fprintf(stderr,"\t icon label window %lx\n",body[19]);
214
fprintf(stderr,"\t icon pixmap window %lx\n",body[20]);
215
fprintf(stderr,"\t window gravity %lx\n",body[21]);
218
/***********************************************************************
221
* list_configure - displays packet contents to stderr
223
***********************************************************************/
224
void list_configure(unsigned long *body)
226
fprintf(stderr,"Configure Window\n");
227
fprintf(stderr,"\t ID %lx\n",body[0]);
228
fprintf(stderr,"\t frame ID %lx\n",body[1]);
229
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
230
fprintf(stderr,"\t frame x %ld\n",(long)body[3]);
231
fprintf(stderr,"\t frame y %ld\n",(long)body[4]);
232
fprintf(stderr,"\t frame w %ld\n",(long)body[5]);
233
fprintf(stderr,"\t frame h %ld\n",(long)body[6]);
234
fprintf(stderr,"\t desk %ld\n",(long)body[7]);
235
fprintf(stderr,"\t flags %lx\n",body[8]);
236
fprintf(stderr,"\t title height %ld\n",(long)body[9]);
237
fprintf(stderr,"\t border width %ld\n",(long)body[10]);
238
fprintf(stderr,"\t window base width %ld\n",(long)body[11]);
239
fprintf(stderr,"\t window base height %ld\n",(long)body[12]);
240
fprintf(stderr,"\t window resize width increment %ld\n",(long)body[13]);
241
fprintf(stderr,"\t window resize height increment %ld\n",(long)body[14]);
242
fprintf(stderr,"\t window min width %ld\n",(long)body[15]);
243
fprintf(stderr,"\t window min height %ld\n",(long)body[16]);
244
fprintf(stderr,"\t window max %ld\n",(long)body[17]);
245
fprintf(stderr,"\t window max %ld\n",(long)body[18]);
246
fprintf(stderr,"\t icon label window %lx\n",body[19]);
247
fprintf(stderr,"\t icon pixmap window %lx\n",body[20]);
248
fprintf(stderr,"\t window gravity %lx\n",body[21]);
251
/***********************************************************************
254
* list_destroy - displays packet contents to stderr
256
***********************************************************************/
257
void list_destroy(unsigned long *body)
259
fprintf(stderr,"destroy\n");
260
fprintf(stderr,"\t ID %lx\n",body[0]);
261
fprintf(stderr,"\t frame ID %lx\n",body[1]);
262
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
265
/***********************************************************************
268
* list_focus - displays packet contents to stderr
270
***********************************************************************/
271
void list_focus(unsigned long *body)
273
fprintf(stderr,"focus\n");
274
fprintf(stderr,"\t ID %lx\n",body[0]);
275
fprintf(stderr,"\t frame ID %lx\n",body[1]);
276
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
280
/***********************************************************************
283
* list_toggle - displays packet contents to stderr
285
***********************************************************************/
286
void list_toggle(unsigned long *body)
288
fprintf(stderr,"toggle\n");
289
fprintf(stderr,"\t value %ld\n",body[0]);
293
/***********************************************************************
296
* list_new_page - displays packet contents to stderr
298
***********************************************************************/
299
void list_new_page(unsigned long *body)
301
fprintf(stderr,"new page\n");
302
fprintf(stderr,"\t x %ld\n",(long)body[0]);
303
fprintf(stderr,"\t y %ld\n",(long)body[1]);
304
fprintf(stderr,"\t desk %ld\n",(long)body[2]);
307
/***********************************************************************
310
* list_new_desk - displays packet contents to stderr
312
***********************************************************************/
313
void list_new_desk(unsigned long *body)
315
fprintf(stderr,"new desk\n");
316
fprintf(stderr,"\t desk %ld\n",(long)body[0]);
319
/***********************************************************************
322
* list_raise - displays packet contents to stderr
324
***********************************************************************/
325
void list_raise(unsigned long *body)
327
fprintf(stderr,"raise\n");
328
fprintf(stderr,"\t ID %lx\n",body[0]);
329
fprintf(stderr,"\t frame ID %lx\n",body[1]);
330
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
334
/***********************************************************************
337
* list_lower - displays packet contents to stderr
339
***********************************************************************/
340
void list_lower(unsigned long *body)
342
fprintf(stderr,"lower\n");
343
fprintf(stderr,"\t ID %lx\n",body[0]);
344
fprintf(stderr,"\t frame ID %lx\n",body[1]);
345
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
349
/***********************************************************************
352
* list_unknow - handles an unrecognized packet.
354
***********************************************************************/
355
void list_unknown(unsigned long *body)
357
fprintf(stderr,"Unknown packet type\n");
360
/***********************************************************************
363
* list_iconify - displays packet contents to stderr
365
***********************************************************************/
366
void list_iconify(unsigned long *body)
368
fprintf(stderr,"iconify\n");
369
fprintf(stderr,"\t ID %lx\n",body[0]);
370
fprintf(stderr,"\t frame ID %lx\n",body[1]);
371
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
372
fprintf(stderr,"\t icon x %ld\n",(long)body[3]);
373
fprintf(stderr,"\t icon y %ld\n",(long)body[4]);
374
fprintf(stderr,"\t icon w %ld\n",(long)body[5]);
375
fprintf(stderr,"\t icon h %ld\n",(long)body[6]);
379
/***********************************************************************
382
* list_map - displays packet contents to stderr
384
***********************************************************************/
385
void list_map(unsigned long *body)
387
fprintf(stderr,"map\n");
388
fprintf(stderr,"\t ID %lx\n",body[0]);
389
fprintf(stderr,"\t frame ID %lx\n",body[1]);
390
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
394
/***********************************************************************
397
* list_icon_loc - displays packet contents to stderr
399
***********************************************************************/
400
void list_icon_loc(unsigned long *body)
402
fprintf(stderr,"icon location\n");
403
fprintf(stderr,"\t ID %lx\n",body[0]);
404
fprintf(stderr,"\t frame ID %lx\n",body[1]);
405
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
406
fprintf(stderr,"\t icon x %ld\n",(long)body[3]);
407
fprintf(stderr,"\t icon y %ld\n",(long)body[4]);
408
fprintf(stderr,"\t icon w %ld\n",(long)body[5]);
409
fprintf(stderr,"\t icon h %ld\n",(long)body[6]);
414
/***********************************************************************
417
* list_deiconify - displays packet contents to stderr
419
***********************************************************************/
421
void list_deiconify(unsigned long *body)
423
fprintf(stderr,"de-iconify\n");
424
fprintf(stderr,"\t ID %lx\n",body[0]);
425
fprintf(stderr,"\t frame ID %lx\n",body[1]);
426
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
429
/***********************************************************************
432
* list_window_name - displays packet contents to stderr
434
***********************************************************************/
436
void list_window_name(unsigned long *body)
438
fprintf(stderr,"window name\n");
439
fprintf(stderr,"\t ID %lx\n",body[0]);
440
fprintf(stderr,"\t frame ID %lx\n",body[1]);
441
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
442
fprintf(stderr,"\t window name %s\n",(char *)(&body[3]));
447
/***********************************************************************
450
* list_icon_name - displays packet contents to stderr
452
***********************************************************************/
453
void list_icon_name(unsigned long *body)
455
fprintf(stderr,"icon name\n");
456
fprintf(stderr,"\t ID %lx\n",body[0]);
457
fprintf(stderr,"\t frame ID %lx\n",body[1]);
458
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
459
fprintf(stderr,"\t icon name %s\n",(char *)(&body[3]));
464
/***********************************************************************
467
* list_class - displays packet contents to stderr
469
***********************************************************************/
470
void list_class(unsigned long *body)
472
fprintf(stderr,"window class\n");
473
fprintf(stderr,"\t ID %lx\n",body[0]);
474
fprintf(stderr,"\t frame ID %lx\n",body[1]);
475
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
476
fprintf(stderr,"\t window class %s\n",(char *)(&body[3]));
480
/***********************************************************************
483
* list_res_name - displays packet contents to stderr
485
***********************************************************************/
486
void list_res_name(unsigned long *body)
488
fprintf(stderr,"class resource name\n");
489
fprintf(stderr,"\t ID %lx\n",body[0]);
490
fprintf(stderr,"\t frame ID %lx\n",body[1]);
491
fprintf(stderr,"\t fvwm ptr %lx\n",body[2]);
492
fprintf(stderr,"\t resource name %s\n",(char *)(&body[3]));
495
/***********************************************************************
498
* list_end - displays packet contents to stderr
500
***********************************************************************/
503
fprintf(stderr,"Send_WindowList End\n");