(#26) Add a flag to enable windowed support back

This commit is contained in:
rexim 2019-12-26 01:00:47 +07:00
parent 098203fe4b
commit 9ce54edb9c
2 changed files with 12 additions and 4 deletions

View File

@ -39,10 +39,16 @@ See issue [#26]. For an experimental Live Update feature compile the application
$ nimble build -d:live
```
Live update feature makes more sense right now in the windowed mode to enabled windowed mode use the following flags:
```console
$ nimble build -d:live -d:windowed
```
For a faster Live Update feature based on MIT-SHM X11 extension use `-d:mitshm`:
```console
$ nimble build -d:live -d:mitshm
$ nimble build -d:live -d:windowed -d:mitshm
```
The MIT-SHM support would probably not work for you until

View File

@ -182,8 +182,9 @@ proc main() =
swa.event_mask = ButtonPressMask or ButtonReleaseMask or
KeyPressMask or KeyReleaseMask or
PointerMotionMask or ExposureMask or ClientMessage
swa.override_redirect = 1
swa.save_under = 1
when not defined(windowed):
swa.override_redirect = 1
swa.save_under = 1
var attributes: TXWindowAttributes
discard XGetWindowAttributes(
@ -303,7 +304,8 @@ proc main() =
let dt = 1.0 / rate.float
while not quitting:
# TODO(#78): Is there a better solution to keep the focus always on the window?
discard XSetInputFocus(display, win, RevertToParent, CurrentTime);
when not defined(windowed):
discard XSetInputFocus(display, win, RevertToParent, CurrentTime);
var wa: TXWindowAttributes
discard XGetWindowAttributes(display, win, addr wa)