/
window_state_watcher.h
43 lines (31 loc) · 1.18 KB
/
window_state_watcher.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
#define SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/x/event.h"
#include "shell/browser/native_window_views.h"
namespace electron {
class WindowStateWatcher : public x11::EventObserver {
public:
explicit WindowStateWatcher(NativeWindowViews* window);
~WindowStateWatcher() override;
protected:
// x11::EventObserver:
void OnEvent(const x11::Event& x11_event) override;
private:
bool IsWindowStateEvent(const x11::Event& x11_event) const;
NativeWindowViews* window_;
gfx::AcceleratedWidget widget_;
const x11::Atom net_wm_state_atom_;
const x11::Atom net_wm_state_hidden_atom_;
const x11::Atom net_wm_state_maximized_vert_atom_;
const x11::Atom net_wm_state_maximized_horz_atom_;
const x11::Atom net_wm_state_fullscreen_atom_;
bool was_minimized_ = false;
bool was_maximized_ = false;
DISALLOW_COPY_AND_ASSIGN(WindowStateWatcher);
};
} // namespace electron
#endif // SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_