summary refs log tree commit diff stats
path: root/compiler/nimfix
Commit message (Collapse)AuthorAgeFilesLines
* remove shallowCopy for ARC/ORC (#20070)ringabout2022-07-261-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | * remove shallowCopy for ARC/ORC * use move * fix * more fixes * typo * Update lib/system.nim * follow * add nodestroy * move * copy string * add a changelog entry Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* [backport] use old style hints in .cfg files (#18917)Miran2021-09-291-1/+1
| | | refs #18085
* change `--hint[X] => --hint:X` in nim repo (avoids shell quoting issues) ↵Timothee Cour2021-05-261-1/+1
| | | | (#18085)
* followup #17225: simplify code after removing gc2, generational (#17242)Timothee Cour2021-03-031-1/+1
|
* cmdline: improve command processing (#16056)Timothee Cour2020-11-261-1/+1
|
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
|
* [refactoring] remove unused imports in the compiler and in some stdlib modulesAraq2019-07-181-2/+0
|
* implements a --nep1:on switch to make the compiler enforce the naming ↵Andreas Rumpf2018-06-133-167/+4
| | | | conventions outlined in NEP-1
* cleanup compiler/prettybase to not use redudant global variablesAndreas Rumpf2018-05-272-61/+16
|
* refactoring: remove idents.legacy global variable and pass the IdentCache ↵Andreas Rumpf2018-05-271-7/+7
| | | | around explicitly
* remove more global variables in the Nim compilerAndreas Rumpf2018-05-272-2/+2
|
* preparations of making compiler/msgs.nim free of global variablesAndreas Rumpf2018-05-172-14/+14
|
* fixes testament compilationAraq2018-05-141-1/+1
|\
| * pretty, prettybase: simplify relative paths (#7779)alaviss2018-05-072-2/+2
| | | | | | This allows nimble to be built with compiler as a nimble package
* | options.nim: no global variables anymoreAndreas Rumpf2018-05-131-1/+1
| |
* | more modules compile againAndreas Rumpf2018-05-121-2/+2
| |
* | move more global variables into ConfigRefAndreas Rumpf2018-05-111-1/+1
| |
* | guards.nim does compileAndreas Rumpf2018-05-111-12/+13
|/
* make nimfix compile again (#7708)alaviss2018-04-271-7/+7
|
* refactoring: make FileIndex a distinct type; make line information an ↵Andreas Rumpf2018-04-212-13/+13
| | | | uint16; fixes #7654
* fixes #7522Araq2018-04-062-3/+3
|
* removed compiler internal list implementation (#5371)Arne Döring2017-02-221-3/+3
|
* implements module grouping for the import statementAndreas Rumpf2016-12-211-5/+5
|
* make nimfix compile with newer compiler APIAraq2016-12-201-2/+3
|
* Fix few typosFederico Ceratto2016-10-171-1/+1
|
* get rid of deprecated toLower/toUpperAndreas Rumpf2016-07-191-4/+4
|
* Fixes #1801.Dominik Picheta2016-06-061-1/+1
|
* renamed writeln to writeLine in compilerpatrick dw2015-06-191-1/+1
|
* Hopefully fixes nimsuggest building against the compiler package.Dominik Picheta2015-06-043-18/+23
|
* Fixed the paths of nimfix and nimsuggest to be relative.Joey Payne2015-04-251-1/+1
|
* Merge pull request #2598 from jyapayne/develAndreas Rumpf2015-04-241-1/+1
|\ | | | | Added explicit imports for compiler modules to fix compiling nimsuggest on it's own.
| * Removed explicit imports in compiler/nimfix/*.nim and added cfg path ↵Joey Payne2015-04-244-10/+6
| | | | | | | | modification
| * Added explicit imports for compiler modules to fix compiling nimsuggest.Joey Payne2015-04-243-5/+9
| | | | | | | | See https://github.com/nim-lang/nimsuggest/issues/1
* | Changed project relative path to include the right directory.Hans Raaf2015-02-201-1/+1
| |
* | Happy new year!Guillaume Gelin2015-01-063-3/+3
| |
* | implemented --bestEffort switch for nimfixAraq2014-12-261-2/+4
|/
* documented nimfixAraq2014-11-041-1/+1
|
* nimfix now in its own directory; single file mode now the defaultAraq2014-10-054-0/+368
/span>int i, num; Window *wins, d1, d2; XWindowAttributes wa; wins = NULL; if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { for(i = 0; i < num; i++) { if(!XGetWindowAttributes(dpy, wins[i], &wa)) continue; if(wa.override_redirect || XGetTransientForHint(dpy, wins[i], &d1)) continue; if(wa.map_state == IsViewable) manage(wins[i], &wa); } } if(wins) XFree(wins); } static void setup(void) { int i, j; unsigned int mask; Window w; XModifierKeymap *modmap; XSetWindowAttributes wa; /* init atoms */ wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False); netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast); /* init cursors */ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); /* init modifier map */ modmap = XGetModifierMapping(dpy); for (i = 0; i < 8; i++) { for (j = 0; j < modmap->max_keypermod; j++) { if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock)) numlockmask = (1 << i); } } XFree(modmap); /* select for events */ wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask | LeaveWindowMask; wa.cursor = cursor[CurNormal]; XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); grabkeys(); initrregs(); for(ntags = 0; tags[ntags]; ntags++); seltag = emallocz(sizeof(Bool) * ntags); seltag[0] = True; /* style */ dc.norm[ColBG] = getcolor(NORMBGCOLOR); dc.norm[ColFG] = getcolor(NORMFGCOLOR); dc.sel[ColBG] = getcolor(SELBGCOLOR); dc.sel[ColFG] = getcolor(SELFGCOLOR); dc.status[ColBG] = getcolor(STATUSBGCOLOR); dc.status[ColFG] = getcolor(STATUSFGCOLOR); setfont(FONT); /* geometry */ bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL); sx = sy = 0; sw = DisplayWidth(dpy, screen); sh = DisplayHeight(dpy, screen); master = MASTER; /* bar */ bx = by = 0; bw = sw; dc.h = bh = dc.font.height + 2; wa.override_redirect = 1; wa.background_pixmap = ParentRelative; wa.event_mask = ButtonPressMask | ExposureMask; barwin = XCreateWindow(dpy, root, bx, by, bw, bh, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); XDefineCursor(dpy, barwin, cursor[CurNormal]); XMapRaised(dpy, barwin); strcpy(stext, "dwm-"VERSION); /* pixmap for everything */ dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); dc.gc = XCreateGC(dpy, root, 0, 0); XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); /* multihead support */ issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); } /* * Startup Error handler to check if another window manager * is already running. */ static int xerrorstart(Display *dsply, XErrorEvent *ee) { otherwm = True; return -1; } /* extern */ int getproto(Window w) { int i, format, protos, status; unsigned long extra, res; Atom *protocols, real; protos = 0; status = XGetWindowProperty(dpy, w, wmatom[WMProtocols], 0L, 20L, False, XA_ATOM, &real, &format, &res, &extra, (unsigned char **)&protocols); if(status != Success || protocols == 0) return protos; for(i = 0; i < res; i++) if(protocols[i] == wmatom[WMDelete]) protos |= PROTODELWIN; free(protocols); return protos; } void sendevent(Window w, Atom a, long value) { XEvent e; e.type = ClientMessage; e.xclient.window = w; e.xclient.message_type = a; e.xclient.format = 32; e.xclient.data.l[0] = value; e.xclient.data.l[1] = CurrentTime; XSendEvent(dpy, w, False, NoEventMask, &e); XSync(dpy, False); } void quit(Arg *arg) { readin = running = False; } /* There's no way to check accesses to destroyed windows, thus those cases are * ignored (especially on UnmapNotify's). Other types of errors call Xlibs * default error handler, which may call exit. */ int xerror(Display *dpy, XErrorEvent *ee) { if(ee->error_code == BadWindow || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) || (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch) || (ee->request_code == X_GrabKey && ee->error_code == BadAccess) || (ee->request_code == X_CopyArea && ee->error_code == BadDrawable)) return 0; fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", ee->request_code, ee->error_code); return xerrorxlib(dpy, ee); /* may call exit */ } int main(int argc, char *argv[]) { int r, xfd; fd_set rd; if(argc == 2 && !strncmp("-v", argv[1], 3)) { fputs("dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout); exit(EXIT_SUCCESS); } else if(argc != 1) eprint("usage: dwm [-v]\n"); dpy = XOpenDisplay(0); if(!dpy) eprint("dwm: cannot open display\n"); xfd = ConnectionNumber(dpy); screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); otherwm = False; XSetErrorHandler(xerrorstart); /* this causes an error if some other window manager is running */ XSelectInput(dpy, root, SubstructureRedirectMask); XSync(dpy, False); if(otherwm) eprint("dwm: another window manager is already running\n"); XSync(dpy, False); XSetErrorHandler(NULL); xerrorxlib = XSetErrorHandler(xerror); XSync(dpy, False); setup(); drawstatus(); scan(); /* main event loop, also reads status text from stdin */ XSync(dpy, False); procevent(); readin = True; while(running) { FD_ZERO(&rd); if(readin) FD_SET(STDIN_FILENO, &rd); FD_SET(xfd, &rd); r = select(xfd + 1, &rd, NULL, NULL, NULL); if((r == -1) && (errno == EINTR)) continue; if(r > 0) { if(readin && FD_ISSET(STDIN_FILENO, &rd)) { readin = NULL != fgets(stext, sizeof(stext), stdin); if(readin) stext[strlen(stext) - 1] = 0; else strcpy(stext, "broken pipe"); drawstatus(); } } else if(r < 0) eprint("select failed\n"); procevent(); } cleanup(); XCloseDisplay(dpy); return 0; }