remove screen.getMenuBarHeight() deprecation
This commit is contained in:
Родитель
cc30f4c4fd
Коммит
72c63a10ee
|
@ -145,9 +145,6 @@ void Screen::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("dipToScreenPoint", &display::win::ScreenWin::DIPToScreenPoint)
|
||||
.SetMethod("screenToDipRect", &ScreenToDIPRect)
|
||||
.SetMethod("dipToScreenRect", &DIPToScreenRect)
|
||||
#endif
|
||||
#if defined(OS_MACOSX)
|
||||
.SetMethod("getMenuBarHeight", &Screen::getMenuBarHeight)
|
||||
#endif
|
||||
.SetMethod("getDisplayMatching", &Screen::GetDisplayMatching);
|
||||
}
|
||||
|
|
|
@ -40,10 +40,6 @@ class Screen : public mate::EventEmitter<Screen>,
|
|||
display::Display GetDisplayNearestPoint(const gfx::Point& point);
|
||||
display::Display GetDisplayMatching(const gfx::Rect& match_rect);
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
int getMenuBarHeight();
|
||||
#endif
|
||||
|
||||
// display::DisplayObserver:
|
||||
void OnDisplayAdded(const display::Display& new_display) override;
|
||||
void OnDisplayRemoved(const display::Display& old_display) override;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) 2017 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "atom/browser/api/atom_api_screen.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace api {
|
||||
|
||||
// TODO(codebytere): deprecated; remove in 3.0
|
||||
int Screen::getMenuBarHeight() {
|
||||
return [[NSApp mainMenu] menuBarHeight];
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace atom
|
|
@ -95,10 +95,6 @@ Returns [`Point`](structures/point.md)
|
|||
|
||||
The current absolute position of the mouse pointer.
|
||||
|
||||
### `screen.getMenuBarHeight()` _macOS_
|
||||
|
||||
Returns `Integer` - The height of the menu bar in pixels.
|
||||
|
||||
### `screen.getPrimaryDisplay()`
|
||||
|
||||
Returns [`Display`](structures/display.md) - The primary display.
|
||||
|
|
|
@ -40,15 +40,6 @@ nativeImage.createFromBuffer(buffer, {
|
|||
})
|
||||
```
|
||||
|
||||
## `screen`
|
||||
|
||||
```js
|
||||
// Deprecated
|
||||
screen.getMenuBarHeight()
|
||||
// Replace with
|
||||
screen.getPrimaryDisplay().workArea
|
||||
```
|
||||
|
||||
## `session`
|
||||
|
||||
```js
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
const {EventEmitter} = require('events')
|
||||
const {deprecate} = require('electron')
|
||||
const {screen, Screen} = process.atomBinding('screen')
|
||||
|
||||
// Screen is an EventEmitter.
|
||||
Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype)
|
||||
EventEmitter.call(screen)
|
||||
|
||||
const nativeFn = screen.getMenuBarHeight
|
||||
screen.getMenuBarHeight = function () {
|
||||
if (!process.noDeprecations) {
|
||||
deprecate.warn('screen.getMenuBarHeight', 'screen.getPrimaryDisplay().workArea')
|
||||
}
|
||||
return nativeFn.call(this)
|
||||
}
|
||||
|
||||
module.exports = screen
|
||||
|
|
Загрузка…
Ссылка в новой задаче