Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: maximize/unmaximize firing on linux #32497

Merged
merged 1 commit into from Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions shell/browser/ui/x/window_state_watcher.cc
Expand Up @@ -21,7 +21,9 @@ WindowStateWatcher::WindowStateWatcher(NativeWindowViews* window)
x11::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT")),
net_wm_state_maximized_horz_atom_(
x11::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")),
net_wm_state_fullscreen_atom_(x11::GetAtom("_NET_WM_STATE_FULLSCREEN")) {
net_wm_state_fullscreen_atom_(x11::GetAtom("_NET_WM_STATE_FULLSCREEN")),
was_minimized_(window_->IsMinimized()),
was_maximized_(window_->IsMaximized()) {
ui::X11EventSource::GetInstance()->connection()->AddEventObserver(this);
}

Expand All @@ -31,9 +33,6 @@ WindowStateWatcher::~WindowStateWatcher() {

void WindowStateWatcher::OnEvent(const x11::Event& x11_event) {
if (IsWindowStateEvent(x11_event)) {
const bool was_minimized_ = window_->IsMinimized();
const bool was_maximized_ = window_->IsMaximized();

std::vector<x11::Atom> wm_states;
if (GetArrayProperty(
static_cast<x11::Window>(window_->GetAcceleratedWidget()),
Expand Down Expand Up @@ -67,6 +66,9 @@ void WindowStateWatcher::OnEvent(const x11::Event& x11_event) {
else
window_->NotifyWindowLeaveFullScreen();
}

was_minimized_ = is_minimized;
was_maximized_ = is_maximized;
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions shell/browser/ui/x/window_state_watcher.h
Expand Up @@ -32,6 +32,9 @@ class WindowStateWatcher : public x11::EventObserver {
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);
};

Expand Down