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

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

Issue 56053005: linux_aura: Improve window drag performance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 7 years, 1 month 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/aura/root_window.cc ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc » ('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
11 #include <ctype.h> 11 #include <ctype.h>
12 #include <sys/ipc.h> 12 #include <sys/ipc.h>
13 #include <sys/shm.h> 13 #include <sys/shm.h>
14 14
15 #include <list> 15 #include <list>
16 #include <map> 16 #include <map>
17 #include <utility> 17 #include <utility>
18 #include <vector> 18 #include <vector>
19 19
20 #include <X11/extensions/shape.h> 20 #include <X11/extensions/shape.h>
21 #include <X11/extensions/XInput2.h> 21 #include <X11/extensions/XInput2.h>
22 22
23 #include "base/bind.h" 23 #include "base/bind.h"
24 #include "base/command_line.h" 24 #include "base/command_line.h"
25 #include "base/debug/trace_event.h"
25 #include "base/logging.h" 26 #include "base/logging.h"
26 #include "base/memory/scoped_ptr.h" 27 #include "base/memory/scoped_ptr.h"
27 #include "base/memory/singleton.h" 28 #include "base/memory/singleton.h"
28 #include "base/message_loop/message_loop.h" 29 #include "base/message_loop/message_loop.h"
29 #include "base/metrics/histogram.h" 30 #include "base/metrics/histogram.h"
30 #include "base/strings/string_number_conversions.h" 31 #include "base/strings/string_number_conversions.h"
31 #include "base/strings/string_util.h" 32 #include "base/strings/string_util.h"
32 #include "base/strings/stringprintf.h" 33 #include "base/strings/stringprintf.h"
33 #include "base/sys_byteorder.h" 34 #include "base/sys_byteorder.h"
34 #include "base/threading/thread.h" 35 #include "base/threading/thread.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 GC gc = XCreateGC(display, root_window, GCForeground, &gc_values); 580 GC gc = XCreateGC(display, root_window, GCForeground, &gc_values);
580 XFillRectangle(display, root_window, gc, 581 XFillRectangle(display, root_window, gc,
581 root_bounds.x(), 582 root_bounds.x(),
582 root_bounds.y(), 583 root_bounds.y(),
583 root_bounds.width(), 584 root_bounds.width(),
584 root_bounds.height()); 585 root_bounds.height());
585 XFreeGC(display, gc); 586 XFreeGC(display, gc);
586 } 587 }
587 588
588 bool IsWindowVisible(XID window) { 589 bool IsWindowVisible(XID window) {
590 TRACE_EVENT0("ui", "IsWindowVisible");
591
589 XWindowAttributes win_attributes; 592 XWindowAttributes win_attributes;
590 if (!XGetWindowAttributes(gfx::GetXDisplay(), window, &win_attributes)) 593 if (!XGetWindowAttributes(gfx::GetXDisplay(), window, &win_attributes))
591 return false; 594 return false;
592 if (win_attributes.map_state != IsViewable) 595 if (win_attributes.map_state != IsViewable)
593 return false; 596 return false;
594 // Some compositing window managers (notably kwin) do not actually unmap 597 // Some compositing window managers (notably kwin) do not actually unmap
595 // windows on desktop switch, so we also must check the current desktop. 598 // windows on desktop switch, so we also must check the current desktop.
596 int window_desktop, current_desktop; 599 int window_desktop, current_desktop;
597 return (!GetWindowDesktop(window, &window_desktop) || 600 return (!GetWindowDesktop(window, &window_desktop) ||
598 !GetCurrentDesktop(&current_desktop) || 601 !GetCurrentDesktop(&current_desktop) ||
(...skipping 14 matching lines...) Expand all
613 if (!XTranslateCoordinates(gfx::GetXDisplay(), window, root, 616 if (!XTranslateCoordinates(gfx::GetXDisplay(), window, root,
614 0, 0, &x, &y, &child)) 617 0, 0, &x, &y, &child))
615 return false; 618 return false;
616 619
617 *rect = gfx::Rect(x, y, width, height); 620 *rect = gfx::Rect(x, y, width, height);
618 return true; 621 return true;
619 } 622 }
620 623
621 624
622 bool WindowContainsPoint(XID window, gfx::Point screen_loc) { 625 bool WindowContainsPoint(XID window, gfx::Point screen_loc) {
626 TRACE_EVENT0("ui", "WindowContainsPoint");
627
623 gfx::Rect window_rect; 628 gfx::Rect window_rect;
624 if (!GetWindowRect(window, &window_rect)) 629 if (!GetWindowRect(window, &window_rect))
625 return false; 630 return false;
626 631
627 if (!window_rect.Contains(screen_loc)) 632 if (!window_rect.Contains(screen_loc))
628 return false; 633 return false;
629 634
630 if (!IsShapeAvailable()) 635 if (!IsShapeAvailable())
631 return true; 636 return true;
632 637
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 << "request_code " << static_cast<int>(error_event.request_code) << ", " 1488 << "request_code " << static_cast<int>(error_event.request_code) << ", "
1484 << "minor_code " << static_cast<int>(error_event.minor_code) 1489 << "minor_code " << static_cast<int>(error_event.minor_code)
1485 << " (" << request_str << ")"; 1490 << " (" << request_str << ")";
1486 } 1491 }
1487 1492
1488 // ---------------------------------------------------------------------------- 1493 // ----------------------------------------------------------------------------
1489 // End of x11_util_internal.h 1494 // End of x11_util_internal.h
1490 1495
1491 1496
1492 } // namespace ui 1497 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/root_window.cc ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698