OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/x/active_window_watcher_x.h" | 5 #include "ui/base/x/active_window_watcher_x.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
| 9 #include "ui/base/gtk/gtk_compat.h" |
| 10 #include "ui/base/gtk/gdk_x_compat.h" |
9 | 11 |
10 #include "ui/base/x/active_window_watcher_x_observer.h" | 12 #include "ui/base/x/active_window_watcher_x_observer.h" |
11 #include "ui/base/x/root_window_property_watcher_x.h" | 13 #include "ui/base/x/root_window_property_watcher_x.h" |
12 #include "ui/base/x/x11_util.h" | 14 #include "ui/base/x/x11_util.h" |
13 | 15 |
14 namespace ui { | 16 namespace ui { |
15 | 17 |
16 static const char* const kNetActiveWindow = "_NET_ACTIVE_WINDOW"; | 18 static const char* const kNetActiveWindow = "_NET_ACTIVE_WINDOW"; |
17 | 19 |
18 // static | 20 // static |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 &num_items, | 79 &num_items, |
78 &remaining_bytes, | 80 &remaining_bytes, |
79 &property); | 81 &property); |
80 | 82 |
81 // Check that the property was set and contained a single 32-bit item (we | 83 // Check that the property was set and contained a single 32-bit item (we |
82 // don't check that remaining_bytes is 0, though, as XFCE's window manager | 84 // don't check that remaining_bytes is 0, though, as XFCE's window manager |
83 // seems to actually store two values in the property for some unknown | 85 // seems to actually store two values in the property for some unknown |
84 // reason.) | 86 // reason.) |
85 if (format == 32 && num_items == 1) { | 87 if (format == 32 && num_items == 1) { |
86 int xid = *reinterpret_cast<int*>(property); | 88 int xid = *reinterpret_cast<int*>(property); |
87 GdkWindow* active_window = gdk_window_lookup(xid); | 89 GdkDisplay* display = gdk_display_get_default(); |
| 90 GdkWindow* active_window = gdk_x11_window_lookup_for_display(display, xid); |
88 FOR_EACH_OBSERVER(ActiveWindowWatcherXObserver, observers_, | 91 FOR_EACH_OBSERVER(ActiveWindowWatcherXObserver, observers_, |
89 ActiveWindowChanged(active_window)); | 92 ActiveWindowChanged(active_window)); |
90 } | 93 } |
91 if (property) | 94 if (property) |
92 XFree(property); | 95 XFree(property); |
93 } | 96 } |
94 | 97 |
95 } // namespace ui | 98 } // namespace ui |
OLD | NEW |