qapp::qapp(int &argc, char **argv) : QApplication(argc, argv) { // get WM protocols required by ICCCM wm_protocols = XInternAtom(qt_xdisplay(), "WM_PROTOCOLS", FALSE); wm_delete = XInternAtom(qt_xdisplay(), "WM_DELETE_WINDOW", FALSE); wm_change_state = XInternAtom(qt_xdisplay(), "WM_CHANGE_STATE", FALSE); wm_state = XInternAtom(qt_xdisplay(), "WM_STATE", FALSE); wm_take_focus = XInternAtom(qt_xdisplay(), "WM_TAKE_FOCUS", FALSE); wm_resource_manager = XInternAtom(qt_xdisplay(), "RESOURCE_MANAGER", FALSE); wm_colormaps = XInternAtom(qt_xdisplay(), "WM_COLORMAP_WINDOWS", FALSE); // save defaults modification time QString fname = get_cfile("defaults"); if(! fname.isNull()) { QFileInfo fi(fname); lmtime = fi.lastModified(); } // check if server supports nonrectangular windows int err; servershapes = XShapeQueryExtension(qt_xdisplay(), &ShapeEventBase, &err); }
qapp::qapp(int &argc, char **argv) : QApplication(argc, argv) { // get WM protocols required by ICCCM wm_protocols = XInternAtom(QX11Info::display(), "WM_PROTOCOLS", FALSE); wm_delete = XInternAtom(QX11Info::display(), "WM_DELETE_WINDOW", FALSE); wm_change_state = XInternAtom(QX11Info::display(), "WM_CHANGE_STATE", FALSE); wm_state = XInternAtom(QX11Info::display(), "WM_STATE", FALSE); wm_take_focus = XInternAtom(QX11Info::display(), "WM_TAKE_FOCUS", FALSE); wm_resource_manager = XInternAtom(QX11Info::display(), "RESOURCE_MANAGER", FALSE); wm_colormaps = XInternAtom(QX11Info::display(), "WM_COLORMAP_WINDOWS", FALSE); // Extensions kde_net_wm_system_tray_window_for = XInternAtom(QX11Info::display(), "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", FALSE); net_wm_name = XInternAtom(QX11Info::display(), "_NET_WM_NAME", FALSE); net_wm_icon_name = XInternAtom(QX11Info::display(), "_NET_WM_ICON_NAME", FALSE); net_supported = XInternAtom(QX11Info::display(), "_NET_SUPPORTED", FALSE); //net_wm_window_opacity = XInternAtom(QX11Info::display(), "_NET_WM_WINDOW_OPACITY", FALSE ); mb_grab_transfer = XInternAtom(QX11Info::display(), "_MB_GRAB_TRANSFER", FALSE ); // save defaults modification time QString fname = get_cfile("defaults"); if(! fname.isNull()) { QFileInfo fi(fname); lmtime = fi.lastModified(); } // check if server supports nonrectangular windows int err; servershapes = XShapeQueryExtension(QX11Info::display(), &ShapeEventBase, &err); }
static int compressionfs_open(const char *path, struct fuse_file_info *fi) { int fd; struct cfile* f; mode_t mode; int r; BPATH(path); if (IS_NULL(BP)) return -EACCES; r = 0; mode = 0640; // lock required, the same file may be opened at the same time pthread_mutex_lock(&cinfo.open_lock); // veifiry if it's openned already f = get_cfile(BP); // if it's null, then it's not openned yet if (!f) { // open file on backstore fd = open(BP, fi->flags, mode); if (fd == -1) r = -errno; else f = new_cfile(fd, 1, 1, fi->flags, mode, path); } pthread_mutex_unlock(&cinfo.open_lock); // file's open, but compressed if (r == 0 && f->compressed) { if (decompress(f)) { // decompression failled close(f->fd); free_cfile(f); // what the heck... r = -EIO; } } // on success, keeps file pointer on fuse special structure if (r == 0) fi->fh = (uint64_t)f; return r; }
void qapp::read_cprops(void) // read app defaults { QString fname,cline,name,par; int flags; int apnum = 1; fname = get_cfile("appdefaults"); if(fname.isNull()) return; QFile istr(fname); if(! istr.open(IO_ReadOnly)) { perror("cannot open appdefaults"); return; } cprops.clear(); apclients.clear(); while(! istr.atEnd()) { istr.readLine(cline, 1024); QTextIStream si(&cline); si >> name; par = si.readLine(); if(par.find("ToolBar") != -1) { apclients.insert(name, apnum++); continue; } flags = 0; int i; int paf[] = { WindowListSkip,Sticky,SmallFrame,NoResize,NoTile,NoKey,NoScreen }; char *pas[] = { "WindowListSkip","Sticky","SmallFrame","NoResize","NoTile","NoKey","NoScreen" }; for(i=0; i < 7; i++) { if(par.find(pas[i]) != -1) flags |= paf[i]; } if(flags) cprops.insert(name, flags); } istr.close(); // check for clients to update xwindow *client; for(client = clients.first(); client != NULL; client = clients.next()) client->set_pflags(); tb_ap->remove(); // update clients on toolbar }
void qapp::wm_restart(void) { xwindow *client; int i; QString fname = get_cfile("defaults"); if(fname.isNull()) return; QFileInfo fi(fname); if(fi.lastModified() == lmtime || fi.lastModified().addSecs(180) < QDateTime::currentDateTime()) return; lmtime = fi.lastModified(); if(smode) keyboard::tscreen(); for(i=0; i < defaults::vdesks; i++) { if(tdesks[i]) { tb_pg->change_desk(i); toggle_tiled(); } } winf->release_cancel(); tb_pg->change_desk(0); tb_pb->remove_all(); for(client = clients.first(); client != NULL; client = clients.next()) { XRemoveFromSaveSet(qt_xdisplay(), client->client_id()); XReparentWindow(qt_xdisplay(), client->client_id(), qt_xrootwin(), client->x(), client->y()); XMapWindow(qt_xdisplay(), client->client_id()); } clients.clear(); tb_ap->release_all(); delete tb; XSync(qt_xdisplay(), FALSE); char *argv[20]; int rst=TRUE; for(i=0; i < defaults::argc && i < 18; i++) { argv[i] = defaults::argv[i]; if(strcmp(argv[i], "-restart") == 0) rst = FALSE; } if(rst) argv[i++] = "-restart"; argv[i] = NULL; execvp(argv[0], argv); perror(argv[0]); exit(1); }