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 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
8 | 8 |
9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
10 | 10 |
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1309 } | 1309 } |
1310 | 1310 |
1311 bool IsX11WindowFullScreen(XID window) { | 1311 bool IsX11WindowFullScreen(XID window) { |
1312 // First check if _NET_WM_STATE property contains _NET_WM_STATE_FULLSCREEN. | 1312 // First check if _NET_WM_STATE property contains _NET_WM_STATE_FULLSCREEN. |
1313 static Atom atom = GetAtom("_NET_WM_STATE_FULLSCREEN"); | 1313 static Atom atom = GetAtom("_NET_WM_STATE_FULLSCREEN"); |
1314 | 1314 |
1315 std::vector<Atom> atom_properties; | 1315 std::vector<Atom> atom_properties; |
1316 if (GetAtomArrayProperty(window, | 1316 if (GetAtomArrayProperty(window, |
1317 "_NET_WM_STATE", | 1317 "_NET_WM_STATE", |
1318 &atom_properties) && | 1318 &atom_properties) && |
1319 std::find(atom_properties.begin(), atom_properties.end(), atom) | 1319 std::find(atom_properties.begin(), atom_properties.end(), atom) |
Daniel Erat
2013/06/01 03:05:59
i don't think that this is correct. see http://sta
| |
1320 != atom_properties.end()) | 1320 != atom_properties.end()) |
1321 return true; | 1321 return true; |
1322 | 1322 |
1323 gfx::Rect window_rect; | |
1324 if (!ui::GetWindowRect(window, &window_rect)) | |
1325 return false; | |
1326 | |
1323 #if defined(TOOLKIT_GTK) | 1327 #if defined(TOOLKIT_GTK) |
1324 // As the last resort, check if the window size is as large as the main | 1328 // As the last resort, check if the window size is as large as the main |
1325 // screen. | 1329 // screen. |
1326 GdkRectangle monitor_rect; | 1330 GdkRectangle monitor_rect; |
1327 gdk_screen_get_monitor_geometry(gdk_screen_get_default(), 0, &monitor_rect); | 1331 gdk_screen_get_monitor_geometry(gdk_screen_get_default(), 0, &monitor_rect); |
1328 | 1332 |
1329 gfx::Rect window_rect; | |
1330 if (!ui::GetWindowRect(window, &window_rect)) | |
1331 return false; | |
1332 | |
1333 return monitor_rect.x == window_rect.x() && | 1333 return monitor_rect.x == window_rect.x() && |
1334 monitor_rect.y == window_rect.y() && | 1334 monitor_rect.y == window_rect.y() && |
1335 monitor_rect.width == window_rect.width() && | 1335 monitor_rect.width == window_rect.width() && |
1336 monitor_rect.height == window_rect.height(); | 1336 monitor_rect.height == window_rect.height(); |
1337 #else | 1337 #else |
1338 NOTIMPLEMENTED(); | 1338 // We can't use gfx::Screen here because we don't have an aura::Window. So |
1339 return false; | 1339 // instead just look at the size of the default display. |
1340 ::Display* display = ui::GetXDisplay(); | |
Daniel Erat
2013/06/01 03:05:59
this will probably break in the multi-monitor case
| |
1341 ::Screen* screen = DefaultScreenOfDisplay(display); | |
1342 int width = WidthOfScreen(screen); | |
1343 int height = HeightOfScreen(screen); | |
1344 return window_rect.size() == gfx::Size(width, height); | |
1340 #endif | 1345 #endif |
1341 } | 1346 } |
1342 | 1347 |
1343 bool IsMotionEvent(XEvent* event) { | 1348 bool IsMotionEvent(XEvent* event) { |
1344 int type = event->type; | 1349 int type = event->type; |
1345 if (type == GenericEvent) | 1350 if (type == GenericEvent) |
1346 type = event->xgeneric.evtype; | 1351 type = event->xgeneric.evtype; |
1347 return type == MotionNotify; | 1352 return type == MotionNotify; |
1348 } | 1353 } |
1349 | 1354 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1540 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1545 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1541 << "minor_code " << static_cast<int>(error_event.minor_code) | 1546 << "minor_code " << static_cast<int>(error_event.minor_code) |
1542 << " (" << request_str << ")"; | 1547 << " (" << request_str << ")"; |
1543 } | 1548 } |
1544 | 1549 |
1545 // ---------------------------------------------------------------------------- | 1550 // ---------------------------------------------------------------------------- |
1546 // End of x11_util_internal.h | 1551 // End of x11_util_internal.h |
1547 | 1552 |
1548 | 1553 |
1549 } // namespace ui | 1554 } // namespace ui |
OLD | NEW |