refactor: make NativeWindow::has_client_frame_
const (#47156)
This commit is contained in:
parent
21155679a0
commit
9f8bcc4d98
2 changed files with 21 additions and 13 deletions
|
@ -127,17 +127,6 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options,
|
||||||
if (parent)
|
if (parent)
|
||||||
options.Get("modal", &is_modal_);
|
options.Get("modal", &is_modal_);
|
||||||
|
|
||||||
#if defined(USE_OZONE)
|
|
||||||
// Ozone X11 likes to prefer custom frames, but we don't need them unless
|
|
||||||
// on Wayland.
|
|
||||||
if (base::FeatureList::IsEnabled(features::kWaylandWindowDecorations) &&
|
|
||||||
!ui::OzonePlatform::GetInstance()
|
|
||||||
->GetPlatformRuntimeProperties()
|
|
||||||
.supports_server_side_window_decorations) {
|
|
||||||
has_client_frame_ = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WindowList::AddWindow(this);
|
WindowList::AddWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -837,6 +826,22 @@ bool NativeWindow::IsTranslucent() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool NativeWindow::PlatformHasClientFrame() {
|
||||||
|
#if defined(USE_OZONE)
|
||||||
|
// Ozone X11 likes to prefer custom frames,
|
||||||
|
// but we don't need them unless on Wayland.
|
||||||
|
static const bool has_client_frame =
|
||||||
|
base::FeatureList::IsEnabled(features::kWaylandWindowDecorations) &&
|
||||||
|
!ui::OzonePlatform::GetInstance()
|
||||||
|
->GetPlatformRuntimeProperties()
|
||||||
|
.supports_server_side_window_decorations;
|
||||||
|
return has_client_frame;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void NativeWindowRelay::CreateForWebContents(
|
void NativeWindowRelay::CreateForWebContents(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
|
|
|
@ -397,7 +397,8 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
|
|
||||||
bool has_frame() const { return has_frame_; }
|
bool has_frame() const { return has_frame_; }
|
||||||
|
|
||||||
bool has_client_frame() const { return has_client_frame_; }
|
[[nodiscard]] bool has_client_frame() const { return has_client_frame_; }
|
||||||
|
|
||||||
bool transparent() const { return transparent_; }
|
bool transparent() const { return transparent_; }
|
||||||
bool enable_larger_than_screen() const { return enable_larger_than_screen_; }
|
bool enable_larger_than_screen() const { return enable_larger_than_screen_; }
|
||||||
|
|
||||||
|
@ -478,6 +479,8 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
std::list<NativeWindow*> child_windows_;
|
std::list<NativeWindow*> child_windows_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static bool PlatformHasClientFrame();
|
||||||
|
|
||||||
std::unique_ptr<views::Widget> widget_;
|
std::unique_ptr<views::Widget> widget_;
|
||||||
|
|
||||||
static inline int32_t next_id_ = 0;
|
static inline int32_t next_id_ = 0;
|
||||||
|
@ -496,7 +499,7 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
// Whether window has standard frame, but it's drawn by Electron (the client
|
// Whether window has standard frame, but it's drawn by Electron (the client
|
||||||
// application) instead of the OS. Currently only has meaning on Linux for
|
// application) instead of the OS. Currently only has meaning on Linux for
|
||||||
// Wayland hosts.
|
// Wayland hosts.
|
||||||
bool has_client_frame_ = false;
|
const bool has_client_frame_ = PlatformHasClientFrame();
|
||||||
|
|
||||||
// Whether window is transparent.
|
// Whether window is transparent.
|
||||||
bool transparent_ = false;
|
bool transparent_ = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue