int main(int argc, char **argv) { for(int i=1; i < argc; i++) { if(strcmp(argv[i], "--version") == 0) { logmsg << DVERSION; return(0); } if(strcmp(argv[i], "-restart") == 0) defaults::start_restart = TRUE; if(strcmp(argv[i], "-c") == 0 && argc > i+1) defaults::cfdir = argv[++i]; } if(defaults::cfdir.isNull()) // get config dir { QString fname(getenv("HOME")); if(! fname.isNull()) defaults::cfdir = fname + "/.qlwm"; } defaults::argc = argc; defaults::argv = argv; qapp a(argc, argv); a.setOverrideCursor( Qt::BlankCursor ); defaults::read_config(); qapp::home = HomeDesktop::instance(); qapp::read_cprops(); make_bpixmaps(); qapp::winf = new winfo(0); XSetErrorHandler(xerrors); XIconSize *isize; if((isize = XAllocIconSize()) != NULL) { isize->min_width = isize->min_height = 2; isize->max_width = isize->max_height = 200; isize->width_inc = isize->height_inc = 1; XSetIconSizes(QX11Info::display(), QX11Info::appRootWindow(), isize, 1); XFree(isize); } XClearWindow(QX11Info::display(), QX11Info::appRootWindow()); qapp::upal = new QPalette(defaults::urgent_bg); if(defaults::inactive_bg == NULL) { qapp::ipal = new QPalette; qapp::ipal->setBrush(QPalette::Window, qapp::ipal->brush(QPalette::Dark)); } else qapp::ipal = new QPalette(*defaults::inactive_bg); XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), SubstructureRedirectMask); XSync(QX11Info::display(), FALSE); if(defaults::sttiled[0]) { qapp::tdesks[0] = TRUE; defaults::sttiled[0] = FALSE; } getrunprocs(); defaults::start_restart = FALSE; XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), SubstructureNotifyMask|SubstructureRedirectMask| StructureNotifyMask| ButtonPressMask| PropertyChangeMask| KeyPressMask| ColormapChangeMask| EnterWindowMask); XSync(QX11Info::display(), FALSE); struct sigaction act; act.sa_handler = sig_hup; act.sa_flags = SA_RESTART; sigaction(SIGHUP, &act, NULL); act.sa_handler = sig_term; sigaction(SIGTERM, &act, NULL); wm_init = FALSE; startprg(); return(a.exec()); }
int main(int argc, char **argv) { for(int i=1; i < argc; i++) { if(strcmp(argv[i], "--version") == 0) { qapp::logmsg << DVERSION; return(0); } if(strcmp(argv[i], "-restart") == 0) defaults::start_restart = TRUE; if(strcmp(argv[i], "-c") == 0 && argc > i+1) defaults::cfdir = argv[++i]; } if(defaults::cfdir.isNull()) // get config dir { QString fname(getenv("HOME")); if(! fname.isNull()) defaults::cfdir = fname + "/.qlwm"; } defaults::argc = argc; defaults::argv = argv; qapp a(argc, argv); clients.setAutoDelete(TRUE); defaults::read_config(); qapp::tb = new Toolbar(0, "Toolbar"); qapp::read_cprops(); make_bpixmaps(); qapp::winf = new winfo(0, "winfo"); a.setMainWidget(qapp::tb); XSetErrorHandler(xerrors); XIconSize *isize; if((isize = XAllocIconSize()) != NULL) { isize->min_width = isize->min_height = 2; isize->max_width = isize->max_height = 200; isize->width_inc = isize->height_inc = 1; XSetIconSizes(qt_xdisplay(), qt_xrootwin(), isize, 1); XFree(isize); } if(defaults::root_pix.isNull()) a.desktop()->setBackgroundColor(defaults::root_bg); else a.desktop()->setBackgroundPixmap(QPixmap(defaults::root_pix)); qapp::upal = new QPalette(defaults::urgent_bg, defaults::urgent_bg); qapp::ipal = new QPalette(defaults::inactive_bg, defaults::inactive_bg); XSelectInput(qt_xdisplay(), qt_xrootwin(), SubstructureRedirectMask); XSync(qt_xdisplay(), FALSE); if(defaults::sttiled[0]) { qapp::tdesks[0] = TRUE; defaults::sttiled[0] = FALSE; } tb_wl->set_pixmap(); getrunprocs(); defaults::start_restart = FALSE; XSelectInput(qt_xdisplay(), qt_xrootwin(), SubstructureNotifyMask|SubstructureRedirectMask| ButtonPressMask| PropertyChangeMask| KeyPressMask| ColormapChangeMask| EnterWindowMask); XSync(qt_xdisplay(), FALSE); struct sigaction act; act.sa_handler = sig_hup; act.sa_flags = SA_RESTART; sigaction(SIGHUP, &act, NULL); act.sa_handler = sig_term; sigaction(SIGTERM, &act, NULL); keyboard::init(); wm_init = FALSE; startprg(); return(a.exec()); }