about summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* geoms are now drawed in the status barAnselm R Garbe2008-03-172-8/+16
* removed the string-based setgeom approach, introduced a new Geom type instead...Anselm R Garbe2008-03-172-87/+40
* made the string-based setgeom workingAnselm R Garbe2008-03-153-75/+68
* some experimental state DO NOT USE THIS, I plan to have a nicer interface to ...Anselm R Garbe2008-03-143-196/+98
* some changes towards 4.9Anselm R Garbe2008-03-144-31/+38
* Added tag 4.8 for changeset 607015ddb091Anselm R Garbe2008-03-131-0/+1
* removed the comment again 4.8Anselm R Garbe2008-03-131-2/+1
* some polishing in tileh/tilevAnselm R Garbe2008-03-131-52/+50
* minor bugfixAnselm R Garbe2008-03-131-1/+1
* added a new commentAnselm R Garbe2008-03-131-1/+2
* some cleanupAnselm R Garbe2008-03-132-4/+3
* updated my geoms functionAnselm R Garbe2008-03-131-3/+3
* updateAnselm R Garbe2008-03-131-0/+2
* set layout already hereAnselm R Garbe2008-03-131-2/+2
* well I use a different default tileAnselm R Garbe2008-03-131-2/+2
* added updatebarpos()Anselm R Garbe2008-03-132-8/+12
* removed all defines of geoms, implemented setgeoms() instead, added config.an...Anselm R Garbe2008-03-134-96/+115
* some polishingAnselm R Garbe2008-03-121-19/+5
* updated dwm(1)Anselm R Garbe2008-03-122-26/+24
* added bx, by, bw, wx, wy, ww, wh, mx, my, mw, mh, mox, moy, mow, moh, tx, ty,...anselm@anselm12008-03-111-41/+72
* changed config.def.hAnselm R Garbe2008-03-061-2/+2
* new stuffAnselm R Garbe2008-03-064-16/+177
* implemented setlayout in the way proposed on the ml, split tile() into two fu...Anselm R Garbe2008-03-062-103/+109
* allow for vstackAnselm R Garbe2008-03-061-0/+1
* added some comments what the TODOs are for 4.8Anselm R Garbe2008-03-061-0/+7
* changed config.def.hAnselm R Garbe2008-03-051-32/+9
* integrated the new -x -y -w toggles of dmenu into my setupAnselm R Garbe2008-03-051-1/+6
* removed some more useless clunkAnselm R Garbe2008-03-052-9/+4
* implemented the stuff as I discussed on dwm@Anselm R Garbe2008-03-054-225/+124
* fixed urgent hint handlingAnselm R Garbe2008-03-051-3/+4
* renamed maximise to monocle again.Anselm R Garbe2008-03-053-18/+7
* fixed urgency hint, though Xinerama integration is still ongoingAnselm R Garbe2008-03-051-9/+17
* next on TODOanselm@anselm12008-03-051-10/+54
* renamed MAXLEN into MAXTAGLEN (backward compliance)anselm@anselm12008-03-042-2/+2
* renamed monocle into maxmise, documented the keybindings in dwm(1)anselm@anselm12008-03-043-23/+31
* monocle goes mainstreamAnselm R Garbe2008-03-042-2/+15
* fixed applyrules bugAnselm R Garbe2008-03-041-2/+2
* removed View cruft, now back to the rootsanselm@anselm12008-03-032-349/+201
* made tag names snappierAnselm R Garbe2008-02-291-1/+1
* fixed some issues nsz reported in IRC loganselm@anselm12008-02-281-1/+3
* well, AIM_XINERAMA should not be enabledanselm@anselm12008-02-281-1/+1
* made the basics of the tagging concept working -- if people want dynamic tags...anselm@anselm12008-02-282-54/+93
* removed initags -- we autoselect the first tag in each view insteadanselm@anselm12008-02-282-25/+31
* a small fix to buttonpressAnselm R Garbe2008-02-281-2/+2
* some more changes towards a better dwmAnselm R Garbe2008-02-282-61/+49
* proceeded, though we still miss a real Tag structanselm@anselm12008-02-272-25/+39
* disabled AIM_XINERAMAanselm@anselm12008-02-262-2/+2
* simplified dwmanselm@anselm12008-02-263-115/+65
* certain fixes, though still a lot of the mutex stuff missinganselm@anselm12008-02-251-6/+4
* pushing my changes of tonight upstream (hg tip is NOW very UNSTABLE -- but th...anselm@anselm12008-02-232-366/+345
kind == QUIT: runGame = false break if evt.kind == KEY_DOWN: if evt.key.keysym.scancode == SCANCODE_ESCAPE: runGame = false elif evt.key.keysym.scancode == SCANCODE_F9: #*** reload this logic.nim module on the F9 keypress *** performCodeReload() # draw a bouncing rectangle: posX += dX posY += dY if posX >= 640: dX = -2 if posX <= 0: dX = +2 if posY >= 480: dY = -2 if posY <= 0: dY = +2 discard renderer.setRenderDrawColor(0, 0, 255, 255) discard renderer.renderClear() discard renderer.setRenderDrawColor(255, 128, 128, 0) var rect: Rect(x: posX - 25, y: posY - 25, w: 50, h: 50) discard renderer.renderFillRect(rect.addr) delay(16) renderer.renderPresent() .. code-block:: nim # mymain.nim import logic proc main() = init() while runGame: update() destroy() main() Compile this example via:: nim c --hotcodereloading:on mymain.nim Now start the program and KEEP it running! :: # Unix: mymain & # or Windows (click on the .exe) mymain.exe # edit For example, change the line:: discard renderer.setRenderDrawColor(255, 128, 128, 0) into:: discard renderer.setRenderDrawColor(255, 255, 128, 0) (This will change the color of the rectangle.) Then recompile the project, but do not restart or quit the mymain.exe program! :: nim c --hotcodereloading:on mymain.nim Now give the ``mymain`` SDL window the focus, press F9 and watch the updated version of the program. Reloading API ============= One can use the special event handlers ``beforeCodeReload`` and ``afterCodeReload`` to reset the state of a particular variable or to force the execution of certain statements: .. code-block:: Nim var settings = initTable[string, string]() lastReload: Time for k, v in loadSettings(): settings[k] = v initProgram() afterCodeReload: lastReload = now() resetProgramState() On each code reload, Nim will first execute all `beforeCodeReload`:idx: handlers registered in the previous version of the program and then all `afterCodeReload`:idx: handlers appearing in the newly loaded code. Please note that any handlers appearing in modules that weren't reloaded will also be executed. To prevent this behavior, one can guard the code with the `hasModuleChanged()`:idx: API: .. code-block:: Nim import mydb var myCache = initTable[Key, Value]() afterCodeReload: if hasModuleChanged(mydb): resetCache(myCache) The hot code reloading is based on dynamic library hot swapping in the native targets and direct manipulation of the global namespace in the JavaScript target. The Nim compiler does not specify the mechanism for detecting the conditions when the code must be reloaded. Instead, the program code is expected to call `performCodeReload()`:idx: every time it wishes to reload its code. It's expected that most projects will implement the reloading with a suitable build-system triggered IPC notification mechanism, but a polling solution is also possible through the provided `hasAnyModuleChanged()`:idx: API. In order to access ``beforeCodeReload``, ``afterCodeReload``, ``hasModuleChanged`` or ``hasAnyModuleChanged`` one must import the `hotcodereloading`:idx: module. Native code targets =================== Native projects using the hot code reloading option will be implicitly compiled with the `-d:useNimRtl` option and they will depend on both the ``nimrtl`` library and the ``nimhcr`` library which implements the hot code reloading run-time. All modules of the project will be compiled to separate dynamic link libraries placed in the ``nimcache`` directory. Please note that during the execution of the program, the hot code reloading run-time will load only copies of these libraries in order to not interfere with any newly issued build commands. The main module of the program is considered non-reloadable. Please note that procs from reloadable modules should not appear in the call stack of program while ``performCodeReload`` is being called. Thus, the main module is a suitable place for implementing a program loop capable of calling ``performCodeReload``. Please note that reloading won't be possible when any of the type definitions in the program has been changed. When closure iterators are used (directly or through async code), the reloaded refinitions will affect only newly created instances. Existing iterator instancess will execute their original code to completion. JavaScript target ================= Once your code is compiled for hot reloading, the ``nim-livereload`` NPM package provides a convenient solution for implementing the actual reloading in the browser using a framework such as [LiveReload](http://livereload.com/) or [BrowserSync](https://browsersync.io/).