mirror of
https://github.com/electron/electron.git
synced 2026-02-26 03:01:17 -05:00
* fix: don't call X11 functions in file dialog and message box * refactor: remove unused GtkUiPlatform declaration * fix: set gtk darktheme only when running under X11 * fix: replace X11 window state watcher with implementation using ozone * fix: make sure global menu barr is used only when supported * fix: don't call X11 function in native window views under wayland * style: fix lint issues * fix: use GtkUiPlatform::ShowGtkWindow instead of gtk_window_present directly * refactor: extract CreateGlobalMenuBar into separate function * refactor: move checking for WaylandWindowDecorations inside class * fix: check if we run under X11 only in ozone build * refactor: drop including unused ui/base/ui_base_features.h header * fix: modify ui_gtk_public_header.patch to also export gtk_ui.h * fix: refactor guarding of X11 calls - Introduce patch exposing new electron_can_call_x11 property - Replace defined(USE_OZONE) with BUILDFLAG(OZONE_PLATFORM_X11) flags * fix: remove the last remaining usage of USE_X11 * fix: usage of BUILDFLAG(OZONE_PLATFORM_X11) not building on non ozone * fix: call UpdateWindowState from OnBoundsChanged only under X11
76 lines
2.8 KiB
C++
76 lines
2.8 KiB
C++
// Copyright (c) 2021 Ryan Gonzalez.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
// Portions of this file are sourced from
|
|
// chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.h,
|
|
// Copyright (c) 2019 The Chromium Authors,
|
|
// which is governed by a BSD-style license
|
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_UI_ELECTRON_DESKTOP_WINDOW_TREE_HOST_LINUX_H_
|
|
#define ELECTRON_SHELL_BROWSER_UI_ELECTRON_DESKTOP_WINDOW_TREE_HOST_LINUX_H_
|
|
|
|
#include "base/scoped_observation.h"
|
|
#include "shell/browser/native_window_views.h"
|
|
#include "shell/browser/ui/views/client_frame_view_linux.h"
|
|
#include "third_party/skia/include/core/SkRRect.h"
|
|
#include "ui/native_theme/native_theme_observer.h"
|
|
#include "ui/platform_window/platform_window.h"
|
|
#include "ui/views/linux_ui/device_scale_factor_observer.h"
|
|
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
|
|
|
|
namespace electron {
|
|
|
|
class ElectronDesktopWindowTreeHostLinux
|
|
: public views::DesktopWindowTreeHostLinux,
|
|
public ui::NativeThemeObserver,
|
|
public views::DeviceScaleFactorObserver {
|
|
public:
|
|
ElectronDesktopWindowTreeHostLinux(
|
|
NativeWindowViews* native_window_view,
|
|
views::DesktopNativeWidgetAura* desktop_native_widget_aura);
|
|
~ElectronDesktopWindowTreeHostLinux() override;
|
|
|
|
// disable copy
|
|
ElectronDesktopWindowTreeHostLinux(
|
|
const ElectronDesktopWindowTreeHostLinux&) = delete;
|
|
ElectronDesktopWindowTreeHostLinux& operator=(
|
|
const ElectronDesktopWindowTreeHostLinux&) = delete;
|
|
|
|
bool SupportsClientFrameShadow() const;
|
|
|
|
protected:
|
|
// views::DesktopWindowTreeHostLinuxImpl:
|
|
void OnWidgetInitDone() override;
|
|
|
|
// ui::PlatformWindowDelegate
|
|
void OnBoundsChanged(const BoundsChange& change) override;
|
|
void OnWindowStateChanged(ui::PlatformWindowState old_state,
|
|
ui::PlatformWindowState new_state) override;
|
|
|
|
// ui::NativeThemeObserver:
|
|
void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
|
|
|
|
// views::OnDeviceScaleFactorChanged:
|
|
void OnDeviceScaleFactorChanged() override;
|
|
|
|
private:
|
|
void UpdateFrameHints();
|
|
void UpdateClientDecorationHints(ClientFrameViewLinux* view);
|
|
void UpdateWindowState(ui::PlatformWindowState new_state);
|
|
|
|
NativeWindowViews* native_window_view_; // weak ref
|
|
|
|
base::ScopedObservation<ui::NativeTheme, ui::NativeThemeObserver>
|
|
theme_observation_{this};
|
|
base::ScopedObservation<views::LinuxUI,
|
|
views::DeviceScaleFactorObserver,
|
|
&views::LinuxUI::AddDeviceScaleFactorObserver,
|
|
&views::LinuxUI::RemoveDeviceScaleFactorObserver>
|
|
scale_observation_{this};
|
|
ui::PlatformWindowState window_state_ = ui::PlatformWindowState::kUnknown;
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_ELECTRON_DESKTOP_WINDOW_TREE_HOST_LINUX_H_
|