mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
fix: make toplevel icon Wayland protocol work (#49414)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Alex Schwartz <alexschwartz01@gmail.com>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "ui/gfx/geometry/skia_conversions.h"
|
||||
#include "ui/linux/linux_ui.h"
|
||||
#include "ui/ozone/public/ozone_platform.h"
|
||||
#include "ui/platform_window/extensions/wayland_extension.h"
|
||||
#include "ui/platform_window/platform_window.h"
|
||||
#include "ui/platform_window/platform_window_init_properties.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
|
||||
@@ -58,6 +59,24 @@ bool ElectronDesktopWindowTreeHostLinux::IsShowingFrame() const {
|
||||
!native_window_view_->IsMinimized();
|
||||
}
|
||||
|
||||
void ElectronDesktopWindowTreeHostLinux::SetWindowIcons(
|
||||
const gfx::ImageSkia& window_icon,
|
||||
const gfx::ImageSkia& app_icon) {
|
||||
DesktopWindowTreeHostLinux::SetWindowIcons(window_icon, app_icon);
|
||||
|
||||
if (ui::GetWaylandToplevelExtension(*platform_window()))
|
||||
saved_window_icon_ = window_icon;
|
||||
}
|
||||
|
||||
void ElectronDesktopWindowTreeHostLinux::Show(
|
||||
ui::mojom::WindowShowState show_state,
|
||||
const gfx::Rect& restore_bounds) {
|
||||
DesktopWindowTreeHostLinux::Show(show_state, restore_bounds);
|
||||
|
||||
if (!saved_window_icon_.isNull())
|
||||
DesktopWindowTreeHostLinux::SetWindowIcons(saved_window_icon_, {});
|
||||
}
|
||||
|
||||
gfx::Insets ElectronDesktopWindowTreeHostLinux::CalculateInsetsInDIP(
|
||||
ui::PlatformWindowState window_state) const {
|
||||
// If we are not showing frame, the insets should be zero.
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/scoped_observation.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
#include "ui/linux/device_scale_factor_observer.h"
|
||||
#include "ui/linux/linux_ui.h"
|
||||
#include "ui/native_theme/native_theme_observer.h"
|
||||
@@ -44,6 +45,10 @@ class ElectronDesktopWindowTreeHostLinux
|
||||
protected:
|
||||
// views::DesktopWindowTreeHostLinuxImpl:
|
||||
void OnWidgetInitDone() override;
|
||||
void SetWindowIcons(const gfx::ImageSkia& window_icon,
|
||||
const gfx::ImageSkia& app_icon) override;
|
||||
void Show(ui::mojom::WindowShowState show_state,
|
||||
const gfx::Rect& restore_bounds) override;
|
||||
|
||||
// ui::PlatformWindowDelegate
|
||||
gfx::Insets CalculateInsetsInDIP(
|
||||
@@ -71,6 +76,8 @@ class ElectronDesktopWindowTreeHostLinux
|
||||
|
||||
bool IsShowingFrame() const;
|
||||
|
||||
gfx::ImageSkia saved_window_icon_;
|
||||
|
||||
raw_ptr<NativeWindowViews> native_window_view_; // weak ref
|
||||
|
||||
base::ScopedObservation<ui::NativeTheme, ui::NativeThemeObserver>
|
||||
|
||||
Reference in New Issue
Block a user