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

Side by Side Diff: ui/gfx/screen_aurax11.cc

Issue 10020048: Work on USE_ASH/USE_AURA split. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 8 years, 8 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 | « chrome/chrome_browser.gypi ('k') | ui/ui.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/gfx/screen.h"
6
7 #include <X11/Xlib.h>
8
9 #include "base/logging.h"
10 #include "ui/base/x/x11_util.h"
11
12 #if !defined(USE_ASH)
13
14 namespace gfx {
15
16 // TODO(piman,erg): This file needs to be rewritten by someone who understands
17 // the subtlety of X11. That is not erg.
18
19 gfx::Point Screen::GetCursorScreenPoint() {
20 Display* display = ui::GetXDisplay();
21
22 // Unsure if I can leave these as NULL.
23 ::Window root, child;
24 int root_x, root_y, win_x, win_y;
25 unsigned int mask;
26 XQueryPointer(display,
27 DefaultRootWindow(display),
28 &root,
29 &child,
30 &root_x,
31 &root_y,
32 &win_x,
33 &win_y,
34 &mask);
35
36 return gfx::Point(root_x, root_y);
37 }
38
39 gfx::Rect Screen::GetMonitorWorkAreaNearestWindow(
40 gfx::NativeView view) {
41 // TODO(erg): There was a comment about how we shouldn't use _NET_WORKAREA
42 // here by danakj@.
43 return GetMonitorAreaNearestWindow(view);
44 }
45
46 gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeView view) {
47 // TODO(erg): Yet another stub.
48 return GetPrimaryMonitorBounds();
49 }
50
51 // static
52 gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
53 // TODO(jamiewalch): Restrict this to the work area of the monitor.
54 return GetMonitorAreaNearestPoint(point);
55 }
56
57 // static
58 gfx::Rect Screen::GetMonitorAreaNearestPoint(const gfx::Point& point) {
59 // TODO(erg): gdk actually has a description for this! We can implement this
60 // one.
61 return GetPrimaryMonitorBounds();
62 }
63
64 gfx::Rect Screen::GetPrimaryMonitorWorkArea() {
65 // TODO(erg): Also needs a real implementation.
66 return gfx::Rect(gfx::Point(0, 0), GetPrimaryMonitorSize());
67 }
68
69 gfx::Rect Screen::GetPrimaryMonitorBounds() {
70 // TODO(erg): Probably needs to be smarter?
71 return gfx::Rect(gfx::Point(0, 0), GetPrimaryMonitorSize());
72 }
73
74 gfx::Rect Screen::GetMonitorWorkAreaMatching(const gfx::Rect& match_rect) {
75 // TODO(erg): We need to eventually support multiple monitors.
76 return GetPrimaryMonitorWorkArea();
77 }
78
79 gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() {
80 // TODO(erg): I have no clue. May need collaboration with
81 // RootWindowHostLinux?
82 return NULL;
83 }
84
85 gfx::Size Screen::GetPrimaryMonitorSize() {
86 ::Display* display = ui::GetXDisplay();
87 ::Screen* screen = DefaultScreenOfDisplay(display);
88 int width = WidthOfScreen(screen);
89 int height = HeightOfScreen(screen);
90
91 return gfx::Size(width, height);
92 }
93
94 int Screen::GetNumMonitors() {
95 // TODO(erg): Figure this out with oshima or piman because I have no clue
96 // about the Xinerama implications here.
97 return 1;
98 }
99
100 } // namespace gfx
101
102 #endif // !defined(USE_ASH)
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698