mirror of
https://github.com/electron/electron.git
synced 2026-01-11 16:38:04 -05:00
[UI] Remove alias of mojom 'WindowShowState'
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5854304
This commit is contained in:
@@ -411,9 +411,9 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Save initial window state.
|
||||
if (fullscreen)
|
||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||
last_window_state_ = ui::mojom::WindowShowState::kFullscreen;
|
||||
else
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
last_window_state_ = ui::mojom::WindowShowState::kNormal;
|
||||
#endif
|
||||
|
||||
// Listen to mouse events.
|
||||
@@ -641,8 +641,8 @@ void NativeWindowViews::Maximize() {
|
||||
if (IsVisible()) {
|
||||
widget()->Maximize();
|
||||
} else {
|
||||
widget()->native_widget_private()->Show(ui::SHOW_STATE_MAXIMIZED,
|
||||
gfx::Rect());
|
||||
widget()->native_widget_private()->Show(
|
||||
ui::mojom::WindowShowState::kMaximized, gfx::Rect());
|
||||
NotifyWindowShow();
|
||||
}
|
||||
}
|
||||
@@ -690,8 +690,8 @@ void NativeWindowViews::Minimize() {
|
||||
if (IsVisible())
|
||||
widget()->Minimize();
|
||||
else
|
||||
widget()->native_widget_private()->Show(ui::SHOW_STATE_MINIMIZED,
|
||||
gfx::Rect());
|
||||
widget()->native_widget_private()->Show(
|
||||
ui::mojom::WindowShowState::kMinimized, gfx::Rect());
|
||||
}
|
||||
|
||||
void NativeWindowViews::Restore() {
|
||||
@@ -715,10 +715,10 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||
bool leaving_fullscreen = IsFullscreen() && !fullscreen;
|
||||
|
||||
if (fullscreen) {
|
||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||
last_window_state_ = ui::mojom::WindowShowState::kFullscreen;
|
||||
NotifyWindowEnterFullScreen();
|
||||
} else {
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
last_window_state_ = ui::mojom::WindowShowState::kNormal;
|
||||
NotifyWindowLeaveFullScreen();
|
||||
}
|
||||
|
||||
@@ -768,8 +768,8 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||
if (IsVisible())
|
||||
widget()->SetFullscreen(fullscreen);
|
||||
else if (fullscreen)
|
||||
widget()->native_widget_private()->Show(ui::SHOW_STATE_FULLSCREEN,
|
||||
gfx::Rect());
|
||||
widget()->native_widget_private()->Show(
|
||||
ui::mojom::WindowShowState::kFullscreen, gfx::Rect());
|
||||
|
||||
// Auto-hide menubar when in fullscreen.
|
||||
if (fullscreen) {
|
||||
@@ -1777,22 +1777,22 @@ void NativeWindowViews::OnMouseEvent(ui::MouseEvent* event) {
|
||||
#endif
|
||||
}
|
||||
|
||||
ui::WindowShowState NativeWindowViews::GetRestoredState() {
|
||||
ui::mojom::WindowShowState NativeWindowViews::GetRestoredState() {
|
||||
if (IsMaximized()) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Only restore Maximized state when window is NOT transparent style
|
||||
if (!transparent()) {
|
||||
return ui::SHOW_STATE_MAXIMIZED;
|
||||
return ui::mojom::WindowShowState::kMaximized;
|
||||
}
|
||||
#else
|
||||
return ui::SHOW_STATE_MAXIMIZED;
|
||||
return ui::mojom::WindowShowState::kMinimized;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (IsFullscreen())
|
||||
return ui::SHOW_STATE_FULLSCREEN;
|
||||
return ui::mojom::WindowShowState::kFullscreen;
|
||||
|
||||
return ui::SHOW_STATE_NORMAL;
|
||||
return ui::mojom::WindowShowState::kNormal;
|
||||
}
|
||||
|
||||
void NativeWindowViews::MoveBehindTaskBarIfNeeded() {
|
||||
|
||||
@@ -262,7 +262,7 @@ class NativeWindowViews : public NativeWindow,
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
||||
ui::WindowShowState last_window_state_;
|
||||
ui::mojom::WindowShowState last_window_state_;
|
||||
|
||||
gfx::Rect last_normal_placement_bounds_;
|
||||
|
||||
|
||||
@@ -213,8 +213,8 @@ void NativeWindowViews::Maximize() {
|
||||
if (IsVisible()) {
|
||||
widget()->Maximize();
|
||||
} else {
|
||||
widget()->native_widget_private()->Show(ui::SHOW_STATE_MAXIMIZED,
|
||||
gfx::Rect());
|
||||
widget()->native_widget_private()->Show(
|
||||
ui::mojom::WindowShowState::kMaximized, gfx::Rect());
|
||||
NotifyWindowShow();
|
||||
}
|
||||
} else {
|
||||
@@ -458,31 +458,31 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
|
||||
// Note that SIZE_MAXIMIZED and SIZE_MINIMIZED might be emitted for
|
||||
// multiple times for one resize because of the SetWindowPlacement call.
|
||||
if (w_param == SIZE_MAXIMIZED &&
|
||||
last_window_state_ != ui::SHOW_STATE_MAXIMIZED) {
|
||||
if (last_window_state_ == ui::SHOW_STATE_MINIMIZED)
|
||||
last_window_state_ != ui::mojom::WindowShowState::kMaximized) {
|
||||
if (last_window_state_ == ui::mojom::WindowShowState::kMinimized)
|
||||
NotifyWindowRestore();
|
||||
last_window_state_ = ui::SHOW_STATE_MAXIMIZED;
|
||||
last_window_state_ = ui::mojom::WindowShowState::kMaximized;
|
||||
NotifyWindowMaximize();
|
||||
ResetWindowControls();
|
||||
} else if (w_param == SIZE_MINIMIZED &&
|
||||
last_window_state_ != ui::SHOW_STATE_MINIMIZED) {
|
||||
last_window_state_ = ui::SHOW_STATE_MINIMIZED;
|
||||
last_window_state_ != ui::mojom::WindowShowState::kMinimized) {
|
||||
last_window_state_ = ui::mojom::WindowShowState::kMinimized;
|
||||
NotifyWindowMinimize();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SIZE_RESTORED: {
|
||||
switch (last_window_state_) {
|
||||
case ui::SHOW_STATE_MAXIMIZED:
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
case ui::mojom::WindowShowState::kMaximized:
|
||||
last_window_state_ = ui::mojom::WindowShowState::kNormal;
|
||||
NotifyWindowUnmaximize();
|
||||
break;
|
||||
case ui::SHOW_STATE_MINIMIZED:
|
||||
case ui::mojom::WindowShowState::kMinimized:
|
||||
if (IsFullscreen()) {
|
||||
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
|
||||
last_window_state_ = ui::mojom::WindowShowState::kFullscreen;
|
||||
NotifyWindowEnterFullScreen();
|
||||
} else {
|
||||
last_window_state_ = ui::SHOW_STATE_NORMAL;
|
||||
last_window_state_ = ui::mojom::WindowShowState::kNormal;
|
||||
NotifyWindowRestore();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -37,13 +37,14 @@ ViewsDelegate::~ViewsDelegate() = default;
|
||||
void ViewsDelegate::SaveWindowPlacement(const views::Widget* window,
|
||||
const std::string& window_name,
|
||||
const gfx::Rect& bounds,
|
||||
ui::WindowShowState show_state) {}
|
||||
ui::mojom::WindowShowState show_state) {
|
||||
}
|
||||
|
||||
bool ViewsDelegate::GetSavedWindowPlacement(
|
||||
const views::Widget* widget,
|
||||
const std::string& window_name,
|
||||
gfx::Rect* bounds,
|
||||
ui::WindowShowState* show_state) const {
|
||||
ui::mojom::WindowShowState* show_state) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,11 +27,12 @@ class ViewsDelegate : public views::ViewsDelegate {
|
||||
void SaveWindowPlacement(const views::Widget* window,
|
||||
const std::string& window_name,
|
||||
const gfx::Rect& bounds,
|
||||
ui::WindowShowState show_state) override;
|
||||
bool GetSavedWindowPlacement(const views::Widget* widget,
|
||||
const std::string& window_name,
|
||||
gfx::Rect* bounds,
|
||||
ui::WindowShowState* show_state) const override;
|
||||
ui::mojom::WindowShowState show_state) override;
|
||||
bool GetSavedWindowPlacement(
|
||||
const views::Widget* widget,
|
||||
const std::string& window_name,
|
||||
gfx::Rect* bounds,
|
||||
ui::mojom::WindowShowState* show_state) const override;
|
||||
void NotifyMenuItemFocused(const std::u16string& menu_name,
|
||||
const std::u16string& menu_item_name,
|
||||
int item_index,
|
||||
|
||||
Reference in New Issue
Block a user