зеркало из https://github.com/electron/electron.git
fix: sync api::Screen wrapper method sigs to upstream (#38597)
refactor: sync api::Screen getter sigs to upstream ui::Display GetAllDisplays(), GetPrimaryDisplay(), GetDisplayMatching(), and GetDisplayNearestPoint() methods are all const, so make our wrappers const too. ui::Display GetAllDisplays() returns a const reference, so make our wrapper return a const reference too. This avoids creating a new std::vector<display::Display> each time it's called.
This commit is contained in:
Родитель
80246cf97f
Коммит
5931f69f18
|
@ -87,22 +87,6 @@ gfx::Point Screen::GetCursorScreenPoint(v8::Isolate* isolate) {
|
||||||
return screen_->GetCursorScreenPoint();
|
return screen_->GetCursorScreenPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
display::Display Screen::GetPrimaryDisplay() {
|
|
||||||
return screen_->GetPrimaryDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<display::Display> Screen::GetAllDisplays() {
|
|
||||||
return screen_->GetAllDisplays();
|
|
||||||
}
|
|
||||||
|
|
||||||
display::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) {
|
|
||||||
return screen_->GetDisplayNearestPoint(point);
|
|
||||||
}
|
|
||||||
|
|
||||||
display::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) {
|
|
||||||
return screen_->GetDisplayMatching(match_rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
|
|
||||||
static gfx::Rect ScreenToDIPRect(electron::NativeWindow* window,
|
static gfx::Rect ScreenToDIPRect(electron::NativeWindow* window,
|
||||||
|
|
|
@ -42,10 +42,18 @@ class Screen : public gin::Wrappable<Screen>,
|
||||||
~Screen() override;
|
~Screen() override;
|
||||||
|
|
||||||
gfx::Point GetCursorScreenPoint(v8::Isolate* isolate);
|
gfx::Point GetCursorScreenPoint(v8::Isolate* isolate);
|
||||||
display::Display GetPrimaryDisplay();
|
display::Display GetPrimaryDisplay() const {
|
||||||
std::vector<display::Display> GetAllDisplays();
|
return screen_->GetPrimaryDisplay();
|
||||||
display::Display GetDisplayNearestPoint(const gfx::Point& point);
|
}
|
||||||
display::Display GetDisplayMatching(const gfx::Rect& match_rect);
|
const std::vector<display::Display>& GetAllDisplays() const {
|
||||||
|
return screen_->GetAllDisplays();
|
||||||
|
}
|
||||||
|
display::Display GetDisplayNearestPoint(const gfx::Point& point) const {
|
||||||
|
return screen_->GetDisplayNearestPoint(point);
|
||||||
|
}
|
||||||
|
display::Display GetDisplayMatching(const gfx::Rect& match_rect) const {
|
||||||
|
return screen_->GetDisplayMatching(match_rect);
|
||||||
|
}
|
||||||
|
|
||||||
// display::DisplayObserver:
|
// display::DisplayObserver:
|
||||||
void OnDisplayAdded(const display::Display& new_display) override;
|
void OnDisplayAdded(const display::Display& new_display) override;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче