View Single Post
Old 10-15-2018, 12:37 PM   #43
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,752
Default

Quote:
Originally Posted by mespotine View Post
Some of the functions want "void" as datatype in their functions(at least, the error-message tells that), I found that with several functions that want HDCs or HWNDs as parameters.
They should return as error-message the type they actually want, even if it's called "Identifier" or something to make debugging easier.
...
Maybe it would be a good idea to include a check, if the parameter is a valid bitmap, to prevent such things.
This is a known problem: The API can only pass void* and cannot distinguish between the different pointer types. The script coder must be very careful!
FR: Extension API: Validation for custom pointer types
SWS ReaScript: How to pass HWND from Lua to C++: Unknown type HWND

I'll think about ways to safely test pointers. In the case of HWNDs, it is possible to check using IsWindow, but this function is relatively slow on Mac and Linux, so I thought it would be better to leave it in the hands of the scripter.


Quote:
JS_LICE_Blit()
When passing a HWND as parameter destBitmap, the script crashes Lua, and I can't restart the script anymore, that includes that faulty line, until I restart Reaper.
LICE_Blit blits between LICE bitmaps, and GDI_Blit blits between two device contexts (retrieved by LICE_GetDC for a system bitmap, or GDI_GetWindowDC and GDI_GetClientDC for windows on the screen).


Quote:
Is there a way to remove the pin from a window again?
Not AFAIK. (I haven't thought about this, though.)


Quote:
Is there a chance to include another function, that returns keyboard inputs, maybe for UNICODe characters and for multiple keys as well? The gfx.getchar doesn't support multikey-inputs and has big problems with UNICODE-stuff
Capturing keyboard input is one of the things that I couldn't get working. REAPER doesn't seem to send keyboard input into the normal message queue. (If anyone has advice on how to capture keyboard input, please let me know!)


Quote:
And is there a documentation on how to build it on Win and Mac? I would love to attempt adding some more functions myself but want to check the builds before submitting any commits...
1) Check out the threads in the developer subforum, where I asked many questions about this.
2) Clone the files at https://github.com/juliansader/js_ReaScriptAPI, where I have uploaded the minimum necessary files, as well as the build commands for Mac and Linux in the .travis.yml file.
juliansader is offline   Reply With Quote