2014-11-25 11:46:30 +08:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|
2014-11-25 13:05:04 +08:00
|
|
|
|
2020-02-05 23:05:30 -08:00
|
|
|
#include "ui/events/platform/x11/x11_event_source.h"
|
2020-11-13 16:16:56 -08:00
|
|
|
#include "ui/gfx/x/event.h"
|
2014-11-25 11:46:30 +08:00
|
|
|
|
2019-06-19 13:46:59 -07:00
|
|
|
#include "shell/browser/native_window_views.h"
|
2014-11-25 12:43:25 +08:00
|
|
|
|
2014-11-25 11:46:30 +08:00
|
|
|
namespace electron {
|
|
|
|
|
2020-12-22 14:14:44 -08:00
|
|
|
class WindowStateWatcher : public x11::EventObserver {
|
2014-11-25 11:46:30 +08:00
|
|
|
public:
|
|
|
|
explicit WindowStateWatcher(NativeWindowViews* window);
|
2018-05-16 12:12:45 -07:00
|
|
|
~WindowStateWatcher() override;
|
2014-11-25 11:46:30 +08:00
|
|
|
|
2021-11-03 12:41:45 +01:00
|
|
|
// disable copy
|
|
|
|
WindowStateWatcher(const WindowStateWatcher&) = delete;
|
|
|
|
WindowStateWatcher& operator=(const WindowStateWatcher&) = delete;
|
|
|
|
|
2014-11-25 11:46:30 +08:00
|
|
|
protected:
|
2020-12-22 14:14:44 -08:00
|
|
|
// x11::EventObserver:
|
|
|
|
void OnEvent(const x11::Event& x11_event) override;
|
2014-11-25 11:46:30 +08:00
|
|
|
|
|
|
|
private:
|
2020-12-22 14:14:44 -08:00
|
|
|
bool IsWindowStateEvent(const x11::Event& x11_event) const;
|
2014-11-25 12:43:25 +08:00
|
|
|
|
2014-11-25 11:46:30 +08:00
|
|
|
NativeWindowViews* window_;
|
|
|
|
gfx::AcceleratedWidget widget_;
|
2021-02-02 11:50:32 -06:00
|
|
|
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_;
|
2022-01-17 08:46:52 +01:00
|
|
|
|
|
|
|
bool was_minimized_ = false;
|
|
|
|
bool was_maximized_ = false;
|
2014-11-25 11:46:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace electron
|
2014-11-25 13:05:04 +08:00
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_
|