Fudge PNG macro detection based on version of libpng.
[fvwm.git] / modules / FvwmCommand / FvwmCommand.c
blob1e0aaab9e69fbb9c3d5fbc556f356deff42f405c
1 /* -*-c-*- */
2 /*
3 * Fvwm command input interface.
5 * Copyright 1998, Toshi Isogai.
6 * Use this program at your own risk.
7 * Permission to use this program for any purpose is given,
8 * as long as the copyright is kept intact.
12 /* This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include "config.h"
29 #include "FvwmCommand.h"
30 #include "libs/fvwmsignal.h"
31 #include "libs/fvwmlib.h"
33 #define MYNAME "FvwmCommand"
35 static int Fdr, Fdw; /* file discriptor for fifo */
36 static int Fdrun; /* file discriptor for run file */
37 static char *Fr_name = NULL;
38 static fd_set fdset;
40 static struct timeval Tv;
41 static int Opt_reply; /* wait for replay */
42 static int Opt_monitor;
43 static int Opt_stdin;
44 static int Opt_info;
45 static int Opt_Serv;
46 static int Opt_flags;
48 volatile sig_atomic_t Bg; /* FvwmCommand in background */
51 void err_msg( const char *msg );
52 void err_quit( const char *msg );
53 void sendit( char *cmd );
54 void receive( void );
55 static RETSIGTYPE sig_ttin(int);
56 static RETSIGTYPE sig_quit(int);
57 void usage(void);
58 int read_f(int fd, char *p, int len);
59 void close_fifos(void);
61 void process_message( void ) ;
62 void list( unsigned long *body, char *) ;
63 void list_configure(unsigned long *body);
64 void list_focus_change(unsigned long *body) ;
65 void list_header(unsigned long *body, char *) ;
66 void list_icon_loc(unsigned long *body) ;
67 void list_iconify(unsigned long *body);
68 void list_mini_icon(unsigned long *body) ;
69 void list_new_desk(unsigned long *body) ;
70 void list_new_page(unsigned long *body) ;
71 void list_string (char *str);
72 void spawn_child( void );
77 * send command to and receive message from the server
80 int main ( int argc, char *argv[])
82 char cmd[MAX_MODULE_INPUT_TEXT_LEN + 1];
83 char *f_stem, *fc_name, *fm_name;
84 char *sf_stem;
85 char *s;
86 int i;
87 int opt;
88 int ncnt;
89 int count;
90 int Rc;
91 struct timeval tv2;
92 extern char *optarg;
93 extern int optind;
95 #ifdef HAVE_SIGACTION
97 struct sigaction sigact;
99 sigemptyset(&sigact.sa_mask);
100 #ifdef SA_RESTART
101 sigact.sa_flags = SA_RESTART;
102 #else
103 sigact.sa_flags = 0;
104 #endif
105 sigact.sa_handler = sig_ttin;
106 sigaction(SIGTTIN, &sigact, NULL);
107 sigaction(SIGTTOU, &sigact, NULL);
109 sigaddset(&sigact.sa_mask, SIGINT);
110 sigaddset(&sigact.sa_mask, SIGHUP);
111 sigaddset(&sigact.sa_mask, SIGQUIT);
112 sigaddset(&sigact.sa_mask, SIGTERM);
114 #ifdef SA_INTERRUPT
115 sigact.sa_flags = SA_INTERRUPT;
116 #else
117 sigact.sa_flags = 0;
118 #endif
119 sigact.sa_handler = sig_quit;
120 sigaction(SIGINT, &sigact, NULL);
121 sigaction(SIGHUP, &sigact, NULL);
122 sigaction(SIGQUIT, &sigact, NULL);
123 sigaction(SIGTERM, &sigact, NULL);
124 sigaction(SIGPIPE, &sigact, NULL);
126 #else
127 #ifdef USE_BSD_SIGNALS
128 fvwmSetSignalMask(
129 sigmask(SIGINT) | sigmask(SIGHUP) | sigmask(SIGQUIT) |
130 sigmask(SIGTERM) | sigmask(SIGPIPE));
131 #endif
132 signal(SIGINT, sig_quit);
133 signal(SIGHUP, sig_quit);
134 signal(SIGQUIT, sig_quit);
135 signal(SIGTERM, sig_quit);
136 signal(SIGPIPE, sig_quit);
137 signal(SIGTTIN, sig_ttin);
138 signal(SIGTTOU, sig_ttin);
139 #ifdef HAVE_SIGINTERRUPT
140 siginterrupt(SIGINT, 1);
141 siginterrupt(SIGHUP, 1);
142 siginterrupt(SIGQUIT, 1);
143 siginterrupt(SIGTERM, 1);
144 siginterrupt(SIGPIPE, 1);
145 siginterrupt(SIGTTIN, 0);
146 siginterrupt(SIGTTOU, 0);
147 #endif
148 #endif
150 Opt_reply = 0;
151 Opt_info = -1;
152 f_stem = NULL;
153 sf_stem = NULL;
154 Opt_monitor = 0;
155 Opt_stdin = 0;
156 Opt_Serv = 0;
157 Opt_flags = 2;
158 Tv.tv_sec = 0;
159 Tv.tv_usec = 500000;
160 Rc = 0;
161 Bg = 0;
164 while( (opt = getopt( argc, argv, "S:hvF:f:w:i:rmc" )) != EOF )
166 switch(opt)
168 case 'h':
169 usage();
170 exit(0);
171 break;
172 case 'f':
173 f_stem = optarg;
174 break;
175 case 'F':
176 Opt_flags = atoi (optarg);
177 break;
178 case 'S':
179 sf_stem = optarg;
180 Opt_Serv = 1;
181 break;
182 case 'i':
183 Opt_info = atoi( optarg );
184 break;
185 case 'v':
186 printf("%s %s\n", MYNAME, VERSION );
187 exit(0);
188 case 'w':
189 Tv.tv_usec = atoi( optarg ) % 1000000;
190 Tv.tv_sec = atoi( optarg ) / 1000000;
191 break;
192 case 'm':
193 Opt_monitor = 1;
194 break;
195 case 'r':
196 Opt_reply = 1;
197 break;
198 case 'c':
199 Opt_stdin = 1;
200 break;
201 case '?':
202 exit(3);
206 if( f_stem == NULL )
208 if ((f_stem = fifos_get_default_name()) == NULL)
210 fprintf (stderr, "\n%s can't decide on fifo-name. "
211 "Make sure that $FVWM_USERDIR is set.\n",
212 MYNAME );
213 exit(1);
217 /* create 2 fifos */
218 fm_name = safemalloc( strlen(f_stem) + 2 );
219 strcpy(fm_name,f_stem);
220 strcat(fm_name, "M");
221 fc_name = safemalloc( strlen(f_stem) + 2 );
222 strcpy(fc_name,f_stem);
223 strcat(fc_name, "C");
224 s = safemalloc( strlen(f_stem) + 2 );
225 strcpy(s,f_stem);
226 strcat(s, "R");
228 Fdrun = open(s, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW, 0600);
229 if (Fdrun < 0)
231 FILE *f;
233 if ((f = fopen (s,"r" )) != NULL)
235 *cmd = 0;
236 fgets(cmd, 20, f);
237 fclose(f);
238 fprintf (stderr, "\nFvwmCommand lock file %sR is detected. "
239 "This may indicate another FvwmCommand is running. "
240 "It appears to be running under process ID:\n%s\n",
241 f_stem, (*cmd) ? cmd : "(unknown)" );
242 fprintf (stderr, "You may either kill the process or run FvwmCommand "
243 "with another FIFO set using option -S and -f. "
244 "If the process doesn't exist, simply remove file:\n%sR\n\n",
245 f_stem);
246 exit(1);
248 else
250 err_quit ("writing lock file");
253 Fr_name = s;
255 if( Opt_Serv )
257 sprintf (cmd,"%s '%sS %s'", argv[0], MYNAME, sf_stem);
258 system (cmd);
262 char buf[64];
264 sprintf(buf, "%d\n", (int)getpid());
265 write(Fdrun, buf, strlen(buf));
266 close(Fdrun);
269 Fdr = Fdw = -1;
270 count = 0;
271 while ((Fdr=open (fm_name, O_RDONLY | O_NOFOLLOW)) < 0)
273 if (count++>5)
275 err_quit ("opening message fifo");
277 sleep(1);
279 count = 0;
280 while ((Fdw=open (fc_name, O_WRONLY | O_NOFOLLOW)) < 0)
282 if (count++>2)
284 err_quit ("opening command fifo");
286 sleep(1);
289 i = optind;
291 if (Opt_stdin)
293 while (fgets(cmd, MAX_MODULE_INPUT_TEXT_LEN - 1, stdin))
295 sendit(cmd);
299 else if( Opt_monitor )
302 /* test if its stdin is closed for coprocess */
303 tv2.tv_sec = 0;
304 tv2.tv_usec = 5;
305 FD_ZERO(&fdset);
306 FD_SET(STDIN_FILENO, &fdset);
307 ncnt = fvwmSelect(FD_SETSIZE, &fdset, 0, 0, &tv2);
308 if( ncnt && (fgets( cmd, 1, stdin )==0 || cmd[0] == 0))
310 Bg = 1;
313 /* line buffer stdout for coprocess */
314 setvbuf( stdout, NULL, _IOLBF, 0);
316 /* send arguments first */
317 for( ;i < argc; i++ )
319 strncpy( cmd, argv[i], MAX_MODULE_INPUT_TEXT_LEN - 1 );
320 sendit( cmd );
324 while( !isTerminated )
326 FD_ZERO(&fdset);
327 FD_SET(Fdr, &fdset);
328 if( Bg == 0 )
330 FD_SET(STDIN_FILENO, &fdset);
332 ncnt = fvwmSelect(FD_SETSIZE, &fdset, 0, 0, NULL);
334 /* message from fvwm */
335 if (FD_ISSET(Fdr, &fdset))
337 process_message();
340 if( Bg == 0 )
342 /* command input */
343 if( FD_ISSET(STDIN_FILENO, &fdset) )
345 if( fgets( cmd, MAX_MODULE_INPUT_TEXT_LEN - 1, stdin ) == 0 )
347 if( Bg == 0 )
349 /* other than SIGTTIN */
350 break;
352 continue;
354 sendit( cmd );
359 else
361 for( ;i < argc; i++ )
363 strncpy( cmd, argv[i], MAX_MODULE_INPUT_TEXT_LEN - 1 );
364 sendit( cmd );
365 if (Opt_info >= 0)
366 receive();
369 close_fifos();
370 return Rc;
374 * send exit notice and close fifos
376 void close_fifos (void)
378 unlink (Fr_name);
379 close(Fdr);
380 close(Fdw);
384 * signal handlers
386 static RETSIGTYPE
387 sig_quit(int sig)
389 close_fifos();
390 fvwmSetTerminate(sig);
391 SIGNAL_RETURN;
394 static RETSIGTYPE
395 sig_ttin(int dummy)
397 (void)dummy;
399 Bg = 1;
400 signal(SIGTTIN, SIG_IGN);
401 signal(SIGTTOU, SIG_IGN);
402 SIGNAL_RETURN;
406 * print error message on stderr
408 void err_quit( const char *msg )
410 fprintf (stderr, "%s ", strerror(errno));
411 err_msg(msg);
412 close_fifos();
413 exit(1);
416 void err_msg( const char *msg )
418 fprintf( stderr, "%s error in %s\n", MYNAME , msg );
422 * add cr to the command and send it
424 void sendit( char *cmd )
426 int clen;
428 if( cmd[0] != '\0' )
430 clen = strlen(cmd);
432 /* add cr */
433 if( cmd[clen-1] != '\n' )
435 strcat(cmd, "\n");
436 clen++;
438 if( clen != 1 )
440 write( Fdw, cmd, clen );
445 void receive(void)
447 int ncnt;
448 struct timeval tv;
450 if( Opt_reply )
452 /* wait indefinitely */
453 FD_ZERO(&fdset);
454 FD_SET( Fdr, &fdset);
455 ncnt = select(FD_SETSIZE, SELECT_FD_SET_CAST &fdset, 0, 0, NULL);
458 while (1)
460 tv.tv_sec = Tv.tv_sec;
461 tv.tv_usec = Tv.tv_usec;
462 FD_ZERO(&fdset);
463 FD_SET(Fdr, &fdset);
465 ncnt = select(FD_SETSIZE, SELECT_FD_SET_CAST &fdset, 0, 0, &tv);
467 if( ncnt < 0 )
469 err_quit("receive");
470 break;
472 if( ncnt == 0 )
474 /* timeout */
475 break;
477 if (FD_ISSET(Fdr, &fdset))
479 process_message();
486 * print usage
488 void usage(void)
490 fprintf (stderr, "Usage: %s [OPTION] [COMMAND]...\n", MYNAME);
491 fprintf (stderr, "Send commands to fvwm via %sS\n\n", MYNAME);
492 fprintf (stderr,
493 " -c read and send commands from stdin\n"
494 " The COMMAND if any is ignored.\n");
495 fprintf (stderr,
496 " -S <file name> "
497 "invoke another %s server with fifo <file name>\n",
498 MYNAME);
499 fprintf (stderr,
500 " -f <file name> use fifo <file name> to connect to %sS\n",
501 MYNAME);
502 fprintf (stderr,
503 " -i <info level> 0 - error only\n" );
504 fprintf (stderr,
505 " 1 - above and config info (default)\n" );
506 fprintf (stderr,
507 " 2 - above and static info\n" );
508 fprintf (stderr,
509 " 3 - above and dynamic info\n" );
510 fprintf (stderr,
511 " -1 - none (default, much faster)\n" );
512 fprintf (stderr,
513 " -F <flag info> 0 - no flag info\n");
514 fprintf (stderr,
515 " 2 - full flag info (default)\n");
516 fprintf (stderr,
517 " -m monitor fvwm message transaction\n");
518 fprintf (stderr,
519 " -r "
520 "wait for a reply (overrides waiting time)\n");
521 fprintf (stderr,
522 " -v print version number\n");
523 fprintf (stderr,
524 " -w <micro sec> waiting time for the reponse from fvwm\n");
525 fprintf (stderr, "\nDefault fifo names are ~/.%sC and ~/.%sM\n",
526 MYNAME, MYNAME);
527 fprintf (stderr, "Default waiting time is 500,000 us\n");
531 * read fifo
533 int read_f(int fd, char *p, int len)
535 int i, n;
536 for (i=0; i<len; )
538 n = read(fd, &p[i], len-i);
539 if (n<0 && errno!=EAGAIN)
541 err_quit("reading message");
543 if (n==0)
545 /* eof */
546 close_fifos();
547 exit(0);
549 i += n;
551 return len;
555 * process message
557 void process_message( void )
559 unsigned long type, length, body[sizeof(struct ConfigWinPacket)];
561 read_f( Fdr, (char*)&type, SOL);
562 read_f( Fdr, (char*)&length, SOL);
563 read_f( Fdr, (char*)body, length );
565 if( type==M_ERROR )
567 fprintf( stderr,"%s", (char *)&body[3] );
569 else if( Opt_info >= 1 )
571 switch( type )
574 case M_WINDOW_NAME:
575 list( body, "window");
576 break;
577 case M_ICON_NAME:
578 list(body, "icon");
579 break;
580 case M_RES_CLASS:
581 list(body, "class" );
582 break;
583 case M_RES_NAME:
584 list(body, "resource");
585 break;
587 case M_END_WINDOWLIST:
588 list_string("end windowlist");
589 break;
591 case M_ICON_FILE:
592 list(body, "icon file");
593 break;
594 case M_ICON_LOCATION:
595 list_icon_loc(body);
596 break;
598 case M_END_CONFIG_INFO:
599 list_string("end configinfo");
600 break;
602 case M_DEFAULTICON:
603 list(body, "default icon");
604 break;
606 case M_MINI_ICON:
607 list_mini_icon( body );
608 break;
610 case M_CONFIG_INFO:
611 printf( "%s\n", (char *)&body[3] );
612 break;
614 case MX_REPLY:
615 list(body, "reply");
616 break;
618 default:
619 if( Opt_info >=2 )
621 switch(type)
624 case M_CONFIGURE_WINDOW:
625 list_configure( body);
626 break;
627 case M_STRING:
628 list(body, "string");
629 break;
631 default:
632 if( Opt_info >= 3 )
634 switch( type )
636 case M_NEW_PAGE:
637 list_new_page(body);
638 break;
639 case M_NEW_DESK:
640 list_new_desk(body);
641 break;
642 case M_ADD_WINDOW:
643 list_header(body, "add");
644 list_configure( body);
645 break;
646 case M_RAISE_WINDOW:
647 list_header(body, "raise");
648 break;
649 case M_LOWER_WINDOW:
650 list_header(body, "lower");
651 break;
652 case M_FOCUS_CHANGE:
653 list_focus_change( body );
654 break;
655 case M_DESTROY_WINDOW:
656 list_header(body, "destroy");
657 break;
658 case M_ICONIFY:
659 list_iconify( body );
660 break;
661 case M_DEICONIFY:
662 list_header(body, "deiconify");
663 break;
664 case M_MAP:
665 list_header(body, "map");
666 break;
667 case M_WINDOWSHADE:
668 list_header(body, "windowshade");
669 break;
670 case M_DEWINDOWSHADE:
671 list_header(body, "dewindowshade");
672 break;
673 default:
674 printf("0x%lx type 0x%lx\n", body[0], type );
686 * print configuration info
690 void list_configure(unsigned long *body)
692 struct ConfigWinPacket *cfgpacket = (void *)body;
693 char *grav;
695 printf( "0x%08lx %-20s x %ld, y %ld, width %ld, height %ld\n",
696 cfgpacket->w, "frame", cfgpacket->frame_x, cfgpacket->frame_y,
697 cfgpacket->frame_width, cfgpacket->frame_height );
698 printf( "0x%08lx %-20s %ld\n" ,cfgpacket->w, "desktop", cfgpacket->desk);
700 /* Oooh, you asked for it... */
701 if (Opt_flags == 2)
703 printf( "Packet flags\n" );
704 printf( "is_sticky_across_pages: %d\n",
705 IS_STICKY_ACROSS_PAGES( cfgpacket ) );
706 printf( "is_sticky_across_desks: %d\n",
707 IS_STICKY_ACROSS_DESKS( cfgpacket ) );
708 printf( "has_icon_font: %d\n",
709 HAS_ICON_FONT( cfgpacket ) );
710 printf( "has_window_font: %d\n",
711 HAS_WINDOW_FONT( cfgpacket ) );
712 printf( "do_circulate_skip: %d\n",
713 DO_SKIP_CIRCULATE( cfgpacket ) );
714 printf( "do_circulate_skip_icon: %d\n",
715 DO_SKIP_ICON_CIRCULATE( cfgpacket ) );
716 printf( "do_circulate_skip_shaded: %d\n",
717 DO_SKIP_SHADED_CIRCULATE( cfgpacket ) );
718 printf( "do_grab_focus_when_created: %d\n",
719 FP_DO_GRAB_FOCUS( FW_FOCUS_POLICY(cfgpacket) ) );
720 printf( "do_grab_focus_when_transient_created: %d\n",
721 FP_DO_GRAB_FOCUS_TRANSIENT( FW_FOCUS_POLICY(cfgpacket) ) );
722 printf( "do_ignore_restack: %d\n",
723 DO_IGNORE_RESTACK( cfgpacket ) );
724 printf( "do_lower_transient: %d\n",
725 DO_LOWER_TRANSIENT( cfgpacket ) );
726 printf( "do_not_show_on_map: %d\n",
727 DO_NOT_SHOW_ON_MAP( cfgpacket ) );
728 printf( "do_not_pass_click_focus_click: %d\n",
729 FP_DO_PASS_FOCUS_CLICK( FW_FOCUS_POLICY(cfgpacket) ) );
730 printf( "do_raise_transient: %d\n",
731 DO_RAISE_TRANSIENT( cfgpacket ) );
732 printf( "do_resize_opaque: %d\n",
733 DO_RESIZE_OPAQUE( cfgpacket ) );
734 printf( "do_shrink_windowshade: %d\n",
735 DO_SHRINK_WINDOWSHADE( cfgpacket ) );
736 printf( "do_stack_transient_parent: %d\n",
737 DO_STACK_TRANSIENT_PARENT( cfgpacket ) );
738 printf( "do_window_list_skip: %d\n",
739 DO_SKIP_WINDOW_LIST( cfgpacket ) );
740 printf( "has_depressable_border: %d\n",
741 HAS_DEPRESSABLE_BORDER( cfgpacket ) );
742 printf( "has_mwm_border: %d\n",
743 HAS_MWM_BORDER( cfgpacket ) );
744 printf( "has_mwm_buttons: %d\n",
745 HAS_MWM_BUTTONS( cfgpacket ) );
746 printf( "has_mwm_override: %d\n",
747 HAS_MWM_OVERRIDE_HINTS( cfgpacket ) );
748 printf( "has_no_icon_title: %d\n",
749 HAS_NO_ICON_TITLE( cfgpacket ) );
750 printf( "has_override_size: %d\n",
751 HAS_OVERRIDE_SIZE_HINTS( cfgpacket ) );
752 printf( "has_stippled_title: %d\n",
753 HAS_STIPPLED_TITLE( cfgpacket ) );
754 printf( "is_fixed: %d\n",
755 IS_FIXED( cfgpacket ) );
756 printf( "is_icon_sticky_across_pages: %d\n",
757 IS_ICON_STICKY_ACROSS_PAGES( cfgpacket ) );
758 printf( "is_icon_sticky_across_desks: %d\n",
759 IS_ICON_STICKY_ACROSS_DESKS( cfgpacket ) );
760 printf( "is_icon_suppressed: %d\n",
761 IS_ICON_SUPPRESSED( cfgpacket ) );
762 printf( "is_lenient: %d\n",
763 FP_IS_LENIENT( FW_FOCUS_POLICY(cfgpacket) ) );
764 printf( "does_wm_delete_window: %d\n",
765 WM_DELETES_WINDOW( cfgpacket ) );
766 printf( "does_wm_take_focus: %d\n",
767 WM_TAKES_FOCUS( cfgpacket ) );
768 printf( "do_iconify_after_map: %d\n",
769 DO_ICONIFY_AFTER_MAP( cfgpacket ) );
770 printf( "do_reuse_destroyed: %d\n",
771 DO_REUSE_DESTROYED( cfgpacket ) );
772 printf( "has_border: %d\n",
773 !HAS_NO_BORDER( cfgpacket ) );
774 printf( "has_title: %d\n",
775 HAS_TITLE( cfgpacket ) );
776 printf( "is_iconify_pending: %d\n",
777 IS_ICONIFY_PENDING( cfgpacket ) );
778 printf( "is_fully_visible: %d\n",
779 IS_FULLY_VISIBLE( cfgpacket ) );
780 printf( "is_iconified: %d\n",
781 IS_ICONIFIED( cfgpacket ) );
782 printf( "is_iconfied_by_parent: %d\n",
783 IS_ICONIFIED_BY_PARENT( cfgpacket ) );
784 printf( "is_icon_entered: %d\n",
785 IS_ICON_ENTERED( cfgpacket ) );
786 printf( "is_icon_font_loaded: %d\n",
787 IS_ICON_FONT_LOADED( cfgpacket ) );
788 printf( "is_icon_moved: %d\n",
789 IS_ICON_MOVED( cfgpacket ) );
790 printf( "is_icon_ours: %d\n",
791 IS_ICON_OURS( cfgpacket ) );
792 printf( "is_icon_shaped: %d\n",
793 IS_ICON_SHAPED( cfgpacket ) );
794 printf( "is_icon_unmapped: %d\n",
795 IS_ICON_UNMAPPED( cfgpacket ) );
796 printf( "is_mapped: %d\n",
797 IS_MAPPED( cfgpacket ) );
798 printf( "is_map_pending: %d\n",
799 IS_MAP_PENDING( cfgpacket ) );
800 printf( "is_maximized: %d\n",
801 IS_MAXIMIZED( cfgpacket ) );
802 printf( "is_name_changed: %d\n",
803 IS_NAME_CHANGED( cfgpacket ) );
804 printf( "is_partially_visible: %d\n",
805 IS_PARTIALLY_VISIBLE( cfgpacket ) );
806 printf( "is_pixmap_ours: %d\n",
807 IS_PIXMAP_OURS( cfgpacket ) );
808 printf( "is_size_inc_set: %d\n",
809 IS_SIZE_INC_SET( cfgpacket ) );
810 printf( "is_transient: %d\n",
811 IS_TRANSIENT( cfgpacket ) );
812 printf( "is_window_drawn_once: %d\n",
813 cfgpacket->flags.is_window_drawn_once );
814 printf( "is_viewport_moved: %d\n",
815 IS_VIEWPORT_MOVED( cfgpacket ) );
816 printf( "is_window_being_moved_opaque: %d\n",
817 IS_WINDOW_BEING_MOVED_OPAQUE( cfgpacket ) );
818 printf( "is_window_font_loaded: %d\n",
819 IS_WINDOW_FONT_LOADED( cfgpacket ) );
820 printf( "is_window_shaded %d\n",
821 IS_SHADED( cfgpacket ) );
822 printf( "title_dir: %d\n",
823 GET_TITLE_DIR( cfgpacket ) );
826 printf( "0x%08lx %-20s %hd\n",
827 cfgpacket->w, "title height", cfgpacket->title_height);
828 printf( "0x%08lx %-20s %hd\n",
829 cfgpacket->w, "border width", cfgpacket->border_width);
830 printf( "0x%08lx %-20s width %ld, height %ld\n", cfgpacket->w, "base size",
831 cfgpacket->hints_base_width, cfgpacket->hints_base_height);
832 printf( "0x%08lx %-20s width %ld, height %ld\n", cfgpacket->w,
833 "size increment", cfgpacket->hints_width_inc,
834 cfgpacket->hints_height_inc);
835 printf( "0x%08lx %-20s width %ld, height %ld\n", cfgpacket->w, "min size",
836 cfgpacket->hints_min_width, cfgpacket->hints_min_height);
837 printf( "0x%08lx %-20s width %ld, height %ld\n", cfgpacket->w, "max size",
838 cfgpacket->hints_max_width, cfgpacket->hints_max_height);
840 switch(cfgpacket->hints_win_gravity)
842 case ForgetGravity:
843 grav = "Forget";
844 break;
845 case NorthWestGravity:
846 grav = "NorthWest";
847 break;
848 case NorthGravity:
849 grav = "North";
850 break;
851 case NorthEastGravity:
852 grav = "NorthEast";
853 break;
854 case WestGravity:
855 grav = "West";
856 break;
857 case CenterGravity:
858 grav = "Center";
859 break;
860 case EastGravity:
861 grav = "East";
862 break;
863 case SouthWestGravity:
864 grav = "SouthWest";
865 break;
866 case SouthGravity:
867 grav = "South";
868 break;
869 case SouthEastGravity:
870 grav = "SouthEast";
871 break;
872 case StaticGravity:
873 grav = "Static";
874 break;
875 default:
876 grav = "Unknown";
877 break;
879 printf( "0x%08lx %-20s %s\n", cfgpacket->w, "gravity", grav);
880 printf( "0x%08lx %-20s text 0x%lx, back 0x%lx\n", cfgpacket->w, "pixel",
881 cfgpacket->TextPixel, cfgpacket->BackPixel);
886 * print info icon location
889 void list_icon_loc(unsigned long *body)
891 printf( "0x%08lx %-20s x %ld, y %ld, width %ld, height%ld\n",
892 body[0], "icon location", body[3], body[4], body[5], body[6] );
897 * print info mini icon
900 void list_mini_icon(unsigned long *body)
902 printf( "0x%08lx %-20s width %ld, height %ld, depth %ld\n",
903 body[0], "mini icon",body[5], body[6], body[7] );
908 * print info message body[3]
911 void list( unsigned long *body, char *text )
913 printf( "0x%08lx %-20s %s\n", body[0], text, (char *)&body[3] );
919 * print info new page
922 void list_new_page(unsigned long *body)
924 printf( " %-20s x %ld, y %ld, desk %ld, max x %ld, max y %ld\n",
925 "new page",
926 body[0], body[1], body[2], body[3], body[4]);
931 * print info new desk
934 void list_new_desk(unsigned long *body)
936 printf( " %-20s %ld\n", "new desk", body[0] );
941 * print string
944 void list_string (char *str)
946 printf( "%-20s\n", str );
951 * print info header
954 void list_header(unsigned long *body, char *text)
956 printf("0x%08lx %s\n", body[0], text);
961 * print info focus change
964 void list_focus_change(unsigned long *body)
966 printf( "0x%08lx %-20s highlight 0x%lx, foreground 0x%lx, background 0x%lx\n",
967 body[0], "focus change", body[3], body[4], body[5] );
972 * print info iconify
975 void list_iconify(unsigned long *body)
977 printf( "0x%08lx %-20s x %ld, y %ld, width %ld, hight %ld\n",
978 body[0], "iconify", body[3], body[4], body[5], body[6] );