docs: Make win.getNativeWindowHandle more clear

This commit is contained in:
Cheng Zhao 2016-01-11 13:43:24 +08:00
parent 54e1d7b3bf
commit 1944472c2f
2 changed files with 14 additions and 11 deletions

View file

@ -594,9 +594,8 @@ void Window::SetAspectRatio(double aspect_ratio, mate::Arguments* args) {
v8::Local<v8::Value> Window::GetNativeWindowHandle() { v8::Local<v8::Value> Window::GetNativeWindowHandle() {
gfx::AcceleratedWidget handle = window_->GetAcceleratedWidget(); gfx::AcceleratedWidget handle = window_->GetAcceleratedWidget();
return ToBuffer(isolate(), return ToBuffer(
static_cast<void*>(&handle), isolate(), static_cast<void*>(&handle), sizeof(gfx::AcceleratedWidget));
sizeof(gfx::AcceleratedWidget));
} }
void Window::SetVisibleOnAllWorkspaces(bool visible) { void Window::SetVisibleOnAllWorkspaces(bool visible) {

View file

@ -63,9 +63,10 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
* `frame` Boolean - Specify `false` to create a * `frame` Boolean - Specify `false` to create a
[Frameless Window](frameless-window.md). Default is `true`. [Frameless Window](frameless-window.md). Default is `true`.
* `acceptFirstMouse` Boolean - Whether the web view accepts a single * `acceptFirstMouse` Boolean - Whether the web view accepts a single
mouse-down event that simultaneously activates the window. Default is `false`. mouse-down event that simultaneously activates the window. Default is
* `disableAutoHideCursor` Boolean - Whether to hide cursor when typing. Default `false`.
is `false`. * `disableAutoHideCursor` Boolean - Whether to hide cursor when typing.
Default is `false`.
* `autoHideMenuBar` Boolean - Auto hide the menu bar unless the `Alt` * `autoHideMenuBar` Boolean - Auto hide the menu bar unless the `Alt`
key is pressed. Default is `false`. key is pressed. Default is `false`.
* `enableLargerThanScreen` Boolean - Enable the window to be resized larger * `enableLargerThanScreen` Boolean - Enable the window to be resized larger
@ -157,7 +158,8 @@ The `webPreferences` option is an object that can have following properties:
The `BrowserWindow` object emits the following events: The `BrowserWindow` object emits the following events:
**Note:** Some events are only available on specific operating systems and are labeled as such. **Note:** Some events are only available on specific operating systems and are
labeled as such.
### Event: 'page-title-updated' ### Event: 'page-title-updated'
@ -341,7 +343,8 @@ The unique ID of this window.
Objects created with `new BrowserWindow` have the following instance methods: Objects created with `new BrowserWindow` have the following instance methods:
**Note:** Some methods are only available on specific operating systems and are labeled as such. **Note:** Some methods are only available on specific operating systems and are
labeled as such.
### `win.destroy()` ### `win.destroy()`
@ -573,9 +576,10 @@ Returns whether the window is in kiosk mode.
### `win.getNativeWindowHandle()` ### `win.getNativeWindowHandle()`
Returns the platform-specific handle of the window in a buffer. Returns the platform-specific handle of the window as `Buffer`.
Cast it to the appropriate type, such as HWND for Windows, NSView* for OS X or unsigned long for Linux.
Used for OS's Native API's for windows. The native type of the handle is `HWND` on Windows, `NSView*` on OS X, and
`Window` (`unsigned long`) on Linux.
### `win.hookWindowMessage(message, callback)` _Windows_ ### `win.hookWindowMessage(message, callback)` _Windows_