Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Unified Diff: ui/base/x/active_window_watcher_x.cc

Issue 7981030: aura: Have aura and aura_demo build and run without gtk on linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/base/x/active_window_watcher_x.cc
diff --git a/ui/base/x/active_window_watcher_x.cc b/ui/base/x/active_window_watcher_x.cc
index 01c4a88ccc786c611229532659ba660fc34a49a7..53459100f4638748bd48686f9a00623133ce2cf9 100644
--- a/ui/base/x/active_window_watcher_x.cc
+++ b/ui/base/x/active_window_watcher_x.cc
@@ -2,11 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ui/base/x/active_window_watcher_x.h"
+
#include <X11/Xlib.h>
+
+#include "ui/base/x/x11_util.h"
+
+#if defined(TOOLKIT_USES_GTK)
Daniel Erat 2011/09/21 20:27:08 nit: move this above the x11_util.h include
sadrul 2011/09/21 21:56:18 I just realized that this file shouldn't be necess
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-
-#include "ui/base/x/active_window_watcher_x.h"
+#endif
namespace ui {
@@ -29,9 +34,14 @@ void ActiveWindowWatcherX::RemoveObserver(Observer* observer) {
// static
bool ActiveWindowWatcherX::WMSupportsActivation() {
+#if defined(TOOLKIT_USES_GTK)
return gdk_x11_screen_supports_net_wm_hint(
gdk_screen_get_default(),
gdk_atom_intern_static_string("_NET_ACTIVE_WINDOW"));
+#else
+ NOTIMPLEMENTED();
+ return false;
Daniel Erat 2011/09/21 20:27:08 true may be a better default for us; WMs that don'
+#endif
}
ActiveWindowWatcherX::ActiveWindowWatcherX() {
@@ -42,6 +52,7 @@ ActiveWindowWatcherX::~ActiveWindowWatcherX() {
}
void ActiveWindowWatcherX::Init() {
+#if defined(TOOLKIT_USES_GTK)
GdkAtom net_active_window =
gdk_atom_intern_static_string("_NET_ACTIVE_WINDOW");
g_net_active_window_atom = gdk_x11_atom_to_xatom_for_display(
@@ -57,6 +68,7 @@ void ActiveWindowWatcherX::Init() {
static_cast<GdkEventMask>(gdk_window_get_events(root) |
GDK_PROPERTY_CHANGE_MASK));
gdk_window_add_filter(NULL, &ActiveWindowWatcherX::OnWindowXEventThunk, this);
+#endif
}
void ActiveWindowWatcherX::NotifyActiveWindowChanged() {
@@ -68,8 +80,8 @@ void ActiveWindowWatcherX::NotifyActiveWindowChanged() {
long unsigned int num_items = 0, remaining_bytes = 0;
unsigned char* property = NULL;
- XGetWindowProperty(gdk_x11_get_default_xdisplay(),
- GDK_WINDOW_XID(gdk_get_default_root_window()),
+ XGetWindowProperty(GetXDisplay(),
+ GetX11RootWindow(),
g_net_active_window_atom,
0, // offset into property data to read
1, // length to get in 32-bit quantities
@@ -81,6 +93,7 @@ void ActiveWindowWatcherX::NotifyActiveWindowChanged() {
&remaining_bytes,
&property);
+#if defined(TOOLKIT_USES_GTK)
// Check that the property was set and contained a single 32-bit item (we
// don't check that remaining_bytes is 0, though, as XFCE's window manager
// seems to actually store two values in the property for some unknown
@@ -93,10 +106,13 @@ void ActiveWindowWatcherX::NotifyActiveWindowChanged() {
observers_,
ActiveWindowChanged(active_window));
}
+#endif
+
if (property)
XFree(property);
}
+#if defined(TOOLKIT_USES_GTK)
GdkFilterReturn ActiveWindowWatcherX::OnWindowXEvent(GdkXEvent* xevent,
GdkEvent* event) {
XEvent* xev = static_cast<XEvent*>(xevent);
@@ -108,5 +124,6 @@ GdkFilterReturn ActiveWindowWatcherX::OnWindowXEvent(GdkXEvent* xevent,
return GDK_FILTER_CONTINUE;
}
+#endif
} // namespace ui
« no previous file with comments | « ui/base/x/active_window_watcher_x.h ('k') | ui/base/x/x11_util.h » ('j') | ui/base/x/x11_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698