You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There doesn't seem to be a way to get the id provided by the OS for the window. For example, on Windows there is a window hwnd and it can be used on some win api to manipulate the window.
Is there any known way of doing that?
There is no data type in JavaScript can represent a native handle, we can probably add an API to return a v8::External or node::Buffer which contains an external pointer to the handle of native window, and then users can receive the handle by writing a native module.
It looks fair to say GetAcceleratedWidget() in native_window_views.cc returns the window handle on the windows part.
Is there a known equivalent in osx/linux?
@zcbenz@omrilitov Any updates on this? I am actually in the need of this feature. Thanks!
[ Edit ] It seems to me that using an (unsigned) integer big enough to hold a pointer (even on a 64bit machine) would suffice, as the relevant type AcceleratedWidget is already defined as either a pointer (OS_WIN, OS_IOS, OS_MACOSX, OS_ANDROID) or an integer (USE_X11, USE_OZONE).
I understand that this may not hold true for any and all native handles you might expose at a later stage (although I can't come up with an actual example), and see how making such handles uniformly be stored as Buffers would help standardize them and make them future proof, but I would still like your opinion on this.
Unsigend integer would not suffice as explained here #3256 (comment).
Stroring the pointer in a buffer is a pattern already being used in the pull request mentioned above.
I actually started working on the pull request which should have been simple, but encountered unexpected problems.
I had some difficulties finding time to keep working on it, but I will soon. @skreborn You are more then welcome to help with it if you'd like 😄
@omrilitov Okay, fair point about the inability to guarantee V8's inner workings, so a Buffer might just be the better choice. I would love to help out, although right now I have no idea how to do that.
Also, doesn't GetAcceleratedWidget work on all platforms? If not, why not? Haven't had the time to check out the code regarding this. The type of value it returns (AcceleratedWidget) is defined for most (if not all) supported platforms.
Activity
zcbenz commentedon Oct 27, 2015
There is no data type in JavaScript can represent a native handle, we can probably add an API to return a
v8::Externalornode::Bufferwhich contains an external pointer to the handle of native window, and then users can receive the handle by writing a native module.omrilitov commentedon Oct 27, 2015
It looks fair to say GetAcceleratedWidget() in native_window_views.cc returns the window handle on the windows part.
Is there a known equivalent in osx/linux?
zcbenz commentedon Oct 27, 2015
GetAcceleratedWidget()also works on Linux. On OS X it should be thewindow_member ofNativeWindowMac.omrilitov commentedon Oct 27, 2015
Will start working on a pull request 👍
v8 is not my strongest part, from your experience, is there a preference between v8::External and node:buffer?
zcbenz commentedon Oct 27, 2015
node-ffi uses
node::Bufferto store external pointers, it also usedv8::Externalandv8::Objectin the past, so I guessnode::Bufferworks the best.skreborn commentedon Jan 4, 2016
@zcbenz @omrilitov Any updates on this? I am actually in the need of this feature. Thanks!
[ Edit ] It seems to me that using an (unsigned) integer big enough to hold a pointer (even on a 64bit machine) would suffice, as the relevant type
AcceleratedWidgetis already defined as either a pointer (OS_WIN,OS_IOS,OS_MACOSX,OS_ANDROID) or an integer (USE_X11,USE_OZONE).I understand that this may not hold true for any and all native handles you might expose at a later stage (although I can't come up with an actual example), and see how making such handles uniformly be stored as
Buffers would help standardize them and make them future proof, but I would still like your opinion on this.omrilitov commentedon Jan 6, 2016
Unsigend integer would not suffice as explained here #3256 (comment).
Stroring the pointer in a buffer is a pattern already being used in the pull request mentioned above.
I actually started working on the pull request which should have been simple, but encountered unexpected problems.
I had some difficulties finding time to keep working on it, but I will soon.
@skreborn You are more then welcome to help with it if you'd like 😄
skreborn commentedon Jan 6, 2016
@omrilitov Okay, fair point about the inability to guarantee V8's inner workings, so a
Buffermight just be the better choice. I would love to help out, although right now I have no idea how to do that.Also, doesn't
GetAcceleratedWidgetwork on all platforms? If not, why not? Haven't had the time to check out the code regarding this. The type of value it returns (AcceleratedWidget) is defined for most (if not all) supported platforms.omrilitov commentedon Jan 6, 2016
It does work on all platforms, I actually don't know how to explain the weird behavior.
If you want you can start by looking at the last commit in my fork https://github.com/omrilitov/electron, the basics are there.
Hopefully in the next days I'll find some time to work on it.
omrilitov commentedon Jan 11, 2016
Added in #4023