Make WindowStateWatcher X11 only
On Windows we need to take another way of detecting window state events.
This commit is contained in:
parent
b77e6c369a
commit
588cc3c7ab
5 changed files with 11 additions and 19 deletions
|
@ -2,11 +2,9 @@
|
|||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/ui/views/window_state_watcher.h"
|
||||
#include "atom/browser/ui/x/window_state_watcher.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#include "ui/events/platform/platform_event_source.h"
|
||||
|
||||
|
@ -24,9 +22,7 @@ const char* kAtomsToCache[] = {
|
|||
WindowStateWatcher::WindowStateWatcher(NativeWindowViews* window)
|
||||
: window_(window),
|
||||
widget_(window->GetAcceleratedWidget()),
|
||||
#if defined(USE_X11)
|
||||
atom_cache_(gfx::GetXDisplay(), kAtomsToCache),
|
||||
#endif
|
||||
was_minimized_(false),
|
||||
was_maximized_(false) {
|
||||
ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this);
|
||||
|
@ -73,14 +69,10 @@ void WindowStateWatcher::DidProcessEvent(const ui::PlatformEvent& event) {
|
|||
}
|
||||
|
||||
bool WindowStateWatcher::IsWindowStateEvent(const ui::PlatformEvent& event) {
|
||||
#if defined(USE_X11)
|
||||
::Atom changed_atom = event->xproperty.atom;
|
||||
return (changed_atom == atom_cache_.GetAtom("_NET_WM_STATE") &&
|
||||
event->type == PropertyNotify &&
|
||||
event->xproperty.window == widget_);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace atom
|
|
@ -2,13 +2,13 @@
|
|||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|
||||
#define ATOM_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|
||||
|
||||
#include "ui/events/platform/platform_event_observer.h"
|
||||
|
||||
#include "atom/browser/native_window_views.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
#endif
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -28,9 +28,7 @@ class WindowStateWatcher : public ui::PlatformEventObserver {
|
|||
NativeWindowViews* window_;
|
||||
gfx::AcceleratedWidget widget_;
|
||||
|
||||
#if defined(USE_X11)
|
||||
ui::X11AtomCache atom_cache_;
|
||||
#endif
|
||||
|
||||
bool was_minimized_;
|
||||
bool was_maximized_;
|
||||
|
@ -39,3 +37,5 @@ class WindowStateWatcher : public ui::PlatformEventObserver {
|
|||
};
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|
Loading…
Add table
Add a link
Reference in a new issue