chore: bump chromium to 28254008f9e7a2aea5d4426906bfd (master) (#22025)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
c8fe25e109
commit
42a9d72ce1
12 changed files with 142 additions and 132 deletions
|
@ -3,8 +3,6 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/ui/x/window_state_watcher.h"
|
||||
|
||||
#include "ui/events/platform/platform_event_source.h"
|
||||
#include "ui/gfx/x/x11.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
|
||||
|
@ -12,22 +10,22 @@ namespace electron {
|
|||
|
||||
WindowStateWatcher::WindowStateWatcher(NativeWindowViews* window)
|
||||
: window_(window), widget_(window->GetAcceleratedWidget()) {
|
||||
ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
|
||||
ui::X11EventSource::GetInstance()->AddXEventObserver(this);
|
||||
}
|
||||
|
||||
WindowStateWatcher::~WindowStateWatcher() {
|
||||
ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(this);
|
||||
ui::X11EventSource::GetInstance()->RemoveXEventObserver(this);
|
||||
}
|
||||
|
||||
void WindowStateWatcher::WillProcessEvent(const ui::PlatformEvent& event) {
|
||||
if (IsWindowStateEvent(event)) {
|
||||
void WindowStateWatcher::WillProcessXEvent(XEvent* xev) {
|
||||
if (IsWindowStateEvent(xev)) {
|
||||
was_minimized_ = window_->IsMinimized();
|
||||
was_maximized_ = window_->IsMaximized();
|
||||
}
|
||||
}
|
||||
|
||||
void WindowStateWatcher::DidProcessEvent(const ui::PlatformEvent& event) {
|
||||
if (IsWindowStateEvent(event)) {
|
||||
void WindowStateWatcher::DidProcessXEvent(XEvent* xev) {
|
||||
if (IsWindowStateEvent(xev)) {
|
||||
bool is_minimized = window_->IsMinimized();
|
||||
bool is_maximized = window_->IsMaximized();
|
||||
bool is_fullscreen = window_->IsFullscreen();
|
||||
|
@ -55,10 +53,10 @@ void WindowStateWatcher::DidProcessEvent(const ui::PlatformEvent& event) {
|
|||
}
|
||||
}
|
||||
|
||||
bool WindowStateWatcher::IsWindowStateEvent(const ui::PlatformEvent& event) {
|
||||
::Atom changed_atom = event->xproperty.atom;
|
||||
bool WindowStateWatcher::IsWindowStateEvent(XEvent* xev) {
|
||||
::Atom changed_atom = xev->xproperty.atom;
|
||||
return (changed_atom == gfx::GetAtom("_NET_WM_STATE") &&
|
||||
event->type == PropertyNotify && event->xproperty.window == widget_);
|
||||
xev->type == PropertyNotify && xev->xproperty.window == widget_);
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -5,24 +5,24 @@
|
|||
#ifndef SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|
||||
#define SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|
||||
|
||||
#include "ui/events/platform/platform_event_observer.h"
|
||||
#include "ui/events/platform/x11/x11_event_source.h"
|
||||
|
||||
#include "shell/browser/native_window_views.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
class WindowStateWatcher : public ui::PlatformEventObserver {
|
||||
class WindowStateWatcher : public ui::XEventObserver {
|
||||
public:
|
||||
explicit WindowStateWatcher(NativeWindowViews* window);
|
||||
~WindowStateWatcher() override;
|
||||
|
||||
protected:
|
||||
// ui::PlatformEventObserver:
|
||||
void WillProcessEvent(const ui::PlatformEvent& event) override;
|
||||
void DidProcessEvent(const ui::PlatformEvent& event) override;
|
||||
// ui::XEventObserver:
|
||||
void WillProcessXEvent(XEvent* xev) override;
|
||||
void DidProcessXEvent(XEvent* xev) override;
|
||||
|
||||
private:
|
||||
bool IsWindowStateEvent(const ui::PlatformEvent& event);
|
||||
bool IsWindowStateEvent(XEvent* xev);
|
||||
|
||||
NativeWindowViews* window_;
|
||||
gfx::AcceleratedWidget widget_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue