On Windows we need to take another way of detecting window state events.
'atom/browser/ui/views/submenu_button.h',
'atom/browser/ui/views/win_frame_view.cc',
'atom/browser/ui/views/win_frame_view.h',
- 'atom/browser/ui/views/window_state_watcher.cc',
- 'atom/browser/ui/views/window_state_watcher.h',
'atom/browser/ui/win/notify_icon_host.cc',
'atom/browser/ui/win/notify_icon_host.h',
'atom/browser/ui/win/notify_icon.cc',
'atom/browser/ui/win/notify_icon.h',
+ 'atom/browser/ui/x/window_state_watcher.cc',
+ 'atom/browser/ui/x/window_state_watcher.h',
'atom/browser/ui/x/x_window_utils.cc',
'atom/browser/ui/x/x_window_utils.h',
'atom/browser/web_view/web_view_manager.cc',
#include "atom/browser/ui/views/menu_bar.h"
#include "atom/browser/ui/views/menu_layout.h"
-#include "atom/browser/ui/views/window_state_watcher.h"
#include "atom/common/draggable_region.h"
#include "atom/common/options_switches.h"
#include "base/strings/utf_string_conversions.h"
#include "atom/browser/browser.h"
#include "atom/browser/ui/views/global_menu_bar_x11.h"
#include "atom/browser/ui/views/frameless_view.h"
+#include "atom/browser/ui/x/window_state_watcher.h"
#include "atom/browser/ui/x/x_window_utils.h"
#include "base/environment.h"
#include "base/nix/xdg_util.h"
window_->Init(params);
+#if defined(USE_X11)
// Start monitoring window states.
window_state_watcher_.reset(new WindowStateWatcher(this));
-#if defined(USE_X11)
// Set _GTK_THEME_VARIANT to dark if we have "dark-theme" option set.
bool use_dark_theme = false;
if (options.Get(switches::kDarkTheme, &use_dark_theme) && use_dark_theme) {
#if defined(USE_X11)
scoped_ptr<GlobalMenuBarX11> global_menu_bar_;
-#endif
// Handles window state events.
scoped_ptr<WindowStateWatcher> window_state_watcher_;
+#endif
// Handles unhandled keyboard messages coming back from the renderer process.
scoped_ptr<views::UnhandledKeyboardEventHandler> keyboard_event_handler_;
// 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"
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);
}
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
// 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 {
NativeWindowViews* window_;
gfx::AcceleratedWidget widget_;
-#if defined(USE_X11)
ui::X11AtomCache atom_cache_;
-#endif
bool was_minimized_;
bool was_maximized_;
};
} // namespace atom
+
+#endif // ATOM_BROWSER_UI_X_WINDOW_STATE_WATCHER_H_