| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/fullscreen.h" | 5 #include "chrome/browser/fullscreen.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "ui/base/x/x11_util.h" | 14 #include "ui/base/x/x11_util.h" |
| 15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // TODO (jianli): Merge with ui::EnumerateTopLevelWindows. | 19 // TODO (jianli): Merge with ui::EnumerateTopLevelWindows. |
| 20 void EnumerateAllChildWindows(ui::EnumerateWindowsDelegate* delegate, | 20 void EnumerateAllChildWindows(ui::EnumerateWindowsDelegate* delegate, |
| 21 XID window) { | 21 XID window) { |
| 22 std::vector<XID> windows; | 22 std::vector<XID> windows; |
| 23 | 23 |
| 24 if (!ui::GetXWindowStack(window, &windows)) { | 24 if (!ui::GetXWindowStack(window, &windows)) { |
| 25 // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back | 25 // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back |
| 26 // to old school enumeration of all X windows. | 26 // to old school enumeration of all X windows. |
| 27 XID root, parent, *children; | 27 XID root, parent, *children; |
| 28 unsigned int num_children; | 28 unsigned int num_children; |
| 29 int status = XQueryTree(ui::GetXDisplay(), window, &root, &parent, | 29 int status = XQueryTree(gfx::GetXDisplay(), window, &root, &parent, |
| 30 &children, &num_children); | 30 &children, &num_children); |
| 31 if (status) { | 31 if (status) { |
| 32 for (long i = static_cast<long>(num_children) - 1; i >= 0; i--) | 32 for (long i = static_cast<long>(num_children) - 1; i >= 0; i--) |
| 33 windows.push_back(children[i]); | 33 windows.push_back(children[i]); |
| 34 XFree(children); | 34 XFree(children); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 std::vector<XID>::iterator iter; | 38 std::vector<XID>::iterator iter; |
| 39 for (iter = windows.begin(); iter != windows.end(); iter++) { | 39 for (iter = windows.begin(); iter != windows.end(); iter++) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool IsFullScreenMode() { | 138 bool IsFullScreenMode() { |
| 139 gdk_error_trap_push(); | 139 gdk_error_trap_push(); |
| 140 bool result = IsTopMostWindowFullScreen(); | 140 bool result = IsTopMostWindowFullScreen(); |
| 141 bool got_error = gdk_error_trap_pop(); | 141 bool got_error = gdk_error_trap_pop(); |
| 142 return result && !got_error; | 142 return result && !got_error; |
| 143 } | 143 } |
| OLD | NEW |