/****************************************************************************** Main - Setup the XConnection,request the window list and loop forever Based on main() from FvwmIdent: Copyright 1994, Robert Nation and Nobutaka Suzuki. ******************************************************************************/ int main(int argc, char **argv) { char *temp, *s; /* Save the program name for error messages and config parsing */ temp = argv[0]; s=strrchr(argv[0], '/'); if (s != NULL) temp = s + 1; /* Setup my name */ Module = safemalloc(strlen(temp)+2); strcpy(Module,"*"); strcat(Module, temp); Clength = strlen(Module); /* Open the console for messages */ OpenConsole(); if((argc != 6)&&(argc != 7)) { fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",Module, VERSION); ConsoleMessage("%s Version %s should only be executed by fvwm!\n",Module, VERSION); exit(1); } if ((argc==7)&&(!strcasecmp(argv[6],"Transient"))) Transient=1; Fvwm_fd[0] = atoi(argv[1]); Fvwm_fd[1] = atoi(argv[2]); signal (SIGPIPE, DeadPipe); /* Parse the config file */ ParseConfig(); /* Setup the XConnection */ StartMeUp(); XSetErrorHandler((XErrorHandler) ErrorHandler); InitPictureCMap(dpy, Root); InitArray(&buttons,0,0,win_width, fontheight+6); InitList(&windows); fd_width = GetFdWidth(); /* Request a list of all windows, * wait for ConfigureWindow packets */ SendFvwmPipe("Send_WindowList",0); /* SetMessageMask(Fvwm_fd,M_ADD_WINDOW|M_CONFIGURE_WINDOW| M_DESTROY_WINDOW| M_WINDOW_NAME|M_ICON_NAME|M_DEICONIFY|M_ICONIFY|M_END_WINDOWLIST| M_NEW_DESK| M_NEW_PAGE);*/ /* Recieve all messages from Fvwm */ EndLessLoop(); return 0; }
/****************************************************************************** Main - Setup the XConnection,request the window list and loop forever Based on main() from FvwmIdent: Copyright 1994, Robert Nation and Nobutaka Suzuki. ******************************************************************************/ int main(int argc, char **argv) { char *temp, *s; #ifdef HAVE_SIGACTION struct sigaction sigact; #endif /* Save the program name for error messages and config parsing */ temp = argv[0]; s=strrchr(argv[0], '/'); if (s != NULL) temp = s + 1; /* Setup my name */ Module = safemalloc(strlen(temp)+2); strcpy(Module,"*"); strcat(Module, temp); Clength = strlen(Module); /* Open the console for messages */ OpenConsole(); if((argc != 6)&&(argc != 7)) { fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",Module, VERSION); ConsoleMessage("%s Version %s should only be executed by fvwm!\n",Module, VERSION); exit(1); } if ((argc==7)&&(!strcasecmp(argv[6],"Transient"))) Transient=1; Fvwm_fd[0] = atoi(argv[1]); Fvwm_fd[1] = atoi(argv[2]); #ifdef HAVE_SIGACTION #ifdef SA_INTERRUPT sigact.sa_flags = SA_INTERRUPT; #else sigact.sa_flags = 0; #endif sigemptyset(&sigact.sa_mask); sigact.sa_handler = TerminateHandler; sigaction(SIGPIPE, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); #else signal(SIGPIPE, TerminateHandler); signal(SIGTERM, TerminateHandler); #ifdef HAVE_SIGINTERRUPT siginterrupt(SIGPIPE, True); siginterrupt(SIGTERM, True); #endif #endif /* Parse the config file */ ParseConfig(); /* Setup the XConnection */ StartMeUp(); XSetErrorHandler(ErrorHandler); InitPictureCMap(dpy, Root); InitArray(&buttons,0,0,win_width, fontheight+6); InitList(&windows); fd_width = GetFdWidth(); /* Request a list of all windows, * wait for ConfigureWindow packets */ SetMessageMask(Fvwm_fd,M_CONFIGURE_WINDOW | M_RES_CLASS | M_RES_NAME | M_ADD_WINDOW | M_DESTROY_WINDOW | M_ICON_NAME | M_DEICONIFY | M_ICONIFY | M_END_WINDOWLIST | M_NEW_DESK | M_NEW_PAGE | M_FOCUS_CHANGE | M_WINDOW_NAME | #ifdef MINI_ICONS M_MINI_ICON | #endif M_STRING); SendFvwmPipe("Send_WindowList",0); /* Recieve all messages from Fvwm */ atexit(ShutMeDown); MainEventLoop(); return 0; }