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

Side by Side Diff: ui/base/x/x11_util.cc

Issue 291583003: Revert of Fix X11TopmostWindowFinder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/x/x11_util.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 XCustomCursorCache() {} 218 XCustomCursorCache() {}
219 ~XCustomCursorCache() { 219 ~XCustomCursorCache() {
220 Clear(); 220 Clear();
221 } 221 }
222 222
223 std::map< ::Cursor, XCustomCursor*> cache_; 223 std::map< ::Cursor, XCustomCursor*> cache_;
224 DISALLOW_COPY_AND_ASSIGN(XCustomCursorCache); 224 DISALLOW_COPY_AND_ASSIGN(XCustomCursorCache);
225 }; 225 };
226 226
227 bool IsShapeAvailable() {
228 int dummy;
229 static bool is_shape_available =
230 XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy);
231 return is_shape_available;
232
233 }
234
227 } // namespace 235 } // namespace
228 236
229 bool IsXInput2Available() { 237 bool IsXInput2Available() {
230 return DeviceDataManager::GetInstance()->IsXInput2Available(); 238 return DeviceDataManager::GetInstance()->IsXInput2Available();
231 } 239 }
232 240
233 static SharedMemorySupport DoQuerySharedMemorySupport(XDisplay* dpy) { 241 static SharedMemorySupport DoQuerySharedMemorySupport(XDisplay* dpy) {
234 int dummy; 242 int dummy;
235 Bool pixmaps_supported; 243 Bool pixmaps_supported;
236 // Query the server's support for XSHM. 244 // Query the server's support for XSHM.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 black.red = black.green = black.blue = 0; 464 black.red = black.green = black.blue = 0;
457 Pixmap blank = XCreateBitmapFromData(xdisplay, 465 Pixmap blank = XCreateBitmapFromData(xdisplay,
458 DefaultRootWindow(xdisplay), 466 DefaultRootWindow(xdisplay),
459 nodata, 8, 8); 467 nodata, 8, 8);
460 invisible_cursor = XCreatePixmapCursor(xdisplay, blank, blank, 468 invisible_cursor = XCreatePixmapCursor(xdisplay, blank, blank,
461 &black, &black, 0, 0); 469 &black, &black, 0, 0);
462 XFreePixmap(xdisplay, blank); 470 XFreePixmap(xdisplay, blank);
463 return invisible_cursor; 471 return invisible_cursor;
464 } 472 }
465 473
466 bool IsShapeExtensionAvailable() {
467 int dummy;
468 static bool is_shape_available =
469 XShapeQueryExtension(gfx::GetXDisplay(), &dummy, &dummy);
470 return is_shape_available;
471 }
472
473 XID GetX11RootWindow() { 474 XID GetX11RootWindow() {
474 return DefaultRootWindow(gfx::GetXDisplay()); 475 return DefaultRootWindow(gfx::GetXDisplay());
475 } 476 }
476 477
477 bool GetCurrentDesktop(int* desktop) { 478 bool GetCurrentDesktop(int* desktop) {
478 return GetIntProperty(GetX11RootWindow(), "_NET_CURRENT_DESKTOP", desktop); 479 return GetIntProperty(GetX11RootWindow(), "_NET_CURRENT_DESKTOP", desktop);
479 } 480 }
480 481
481 void SetHideTitlebarWhenMaximizedProperty(XID window, 482 void SetHideTitlebarWhenMaximizedProperty(XID window,
482 HideTitlebarWhenMaximized property) { 483 HideTitlebarWhenMaximized property) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 bool WindowContainsPoint(XID window, gfx::Point screen_loc) { 572 bool WindowContainsPoint(XID window, gfx::Point screen_loc) {
572 TRACE_EVENT0("ui", "WindowContainsPoint"); 573 TRACE_EVENT0("ui", "WindowContainsPoint");
573 574
574 gfx::Rect window_rect; 575 gfx::Rect window_rect;
575 if (!GetWindowRect(window, &window_rect)) 576 if (!GetWindowRect(window, &window_rect))
576 return false; 577 return false;
577 578
578 if (!window_rect.Contains(screen_loc)) 579 if (!window_rect.Contains(screen_loc))
579 return false; 580 return false;
580 581
581 if (!IsShapeExtensionAvailable()) 582 if (!IsShapeAvailable())
582 return true; 583 return true;
583 584
584 // According to http://www.x.org/releases/X11R7.6/doc/libXext/shapelib.html, 585 // According to http://www.x.org/releases/X11R7.6/doc/libXext/shapelib.html,
585 // if an X display supports the shape extension the bounds of a window are 586 // if an X display supports the shape extension the bounds of a window are
586 // defined as the intersection of the window bounds and the interior 587 // defined as the intersection of the window bounds and the interior
587 // rectangles. This means to determine if a point is inside a window for the 588 // rectangles. This means to determine if a point is inside a window for the
588 // purpose of input handling we have to check the rectangles in the ShapeInput 589 // purpose of input handling we have to check the rectangles in the ShapeInput
589 // list. 590 // list.
590 // According to http://www.x.org/releases/current/doc/xextproto/shape.html, 591 // According to http://www.x.org/releases/current/doc/xextproto/shape.html,
591 // we need to also respect the ShapeBounding rectangles. 592 // we need to also respect the ShapeBounding rectangles.
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 << "request_code " << static_cast<int>(error_event.request_code) << ", " 1372 << "request_code " << static_cast<int>(error_event.request_code) << ", "
1372 << "minor_code " << static_cast<int>(error_event.minor_code) 1373 << "minor_code " << static_cast<int>(error_event.minor_code)
1373 << " (" << request_str << ")"; 1374 << " (" << request_str << ")";
1374 } 1375 }
1375 1376
1376 // ---------------------------------------------------------------------------- 1377 // ----------------------------------------------------------------------------
1377 // End of x11_util_internal.h 1378 // End of x11_util_internal.h
1378 1379
1379 1380
1380 } // namespace ui 1381 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/x/x11_util.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698