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

Side by Side Diff: content/browser/renderer_host/gtk_window_utils.cc

Issue 23460052: Move XID, XDisplay, GetXDisplay and a few other types to ui/gfx/x/x11_types.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sdf Created 7 years, 3 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
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 #include "content/browser/renderer_host/gtk_window_utils.h" 5 #include "content/browser/renderer_host/gtk_window_utils.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "third_party/WebKit/public/web/WebScreenInfo.h"
13 #include "ui/base/x/x11_util.h" 14 #include "ui/base/x/x11_util.h"
14 #include "ui/gfx/gtk_compat.h" 15 #include "ui/gfx/gtk_compat.h"
15 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
16 #include "third_party/WebKit/public/web/WebScreenInfo.h" 17 #include "ui/gfx/x/x11_types.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 namespace { 21 namespace {
21 22
22 // Returns the region of |window|'s desktop that isn't occupied by docks or 23 // Returns the region of |window|'s desktop that isn't occupied by docks or
23 // panels. Returns an empty rect on failure. 24 // panels. Returns an empty rect on failure.
24 gfx::Rect GetWorkArea(Window window) { 25 gfx::Rect GetWorkArea(Window window) {
25 Window root = ui::GetX11RootWindow(); 26 Window root = ui::GetX11RootWindow();
26 int desktop = -1; 27 int desktop = -1;
(...skipping 10 matching lines...) Expand all
37 return gfx::Rect(); 38 return gfx::Rect();
38 39
39 size_t start_index = 4 * desktop; 40 size_t start_index = 4 * desktop;
40 if (property.size() < start_index + 4) 41 if (property.size() < start_index + 4)
41 return gfx::Rect(); 42 return gfx::Rect();
42 43
43 return gfx::Rect(property[start_index], property[start_index + 1], 44 return gfx::Rect(property[start_index], property[start_index + 1],
44 property[start_index + 2], property[start_index + 3]); 45 property[start_index + 2], property[start_index + 3]);
45 } 46 }
46 47
47 WebKit::WebScreenInfo GetScreenInfo(Display* display, int screenNumber) { 48 WebKit::WebScreenInfo GetScreenInfo(XDisplay* display, int screenNumber) {
48 // XDisplayWidth() and XDisplayHeight() return cached values. To ensure that 49 // XDisplayWidth() and XDisplayHeight() return cached values. To ensure that
49 // we return the correct dimensions after the screen is resized, query the 50 // we return the correct dimensions after the screen is resized, query the
50 // root window's geometry each time. 51 // root window's geometry each time.
51 Window root = RootWindow(display, screenNumber); 52 Window root = RootWindow(display, screenNumber);
52 Window root_ret; 53 Window root_ret;
53 int x, y; 54 int x, y;
54 unsigned int width, height, border, depth; 55 unsigned int width, height, border, depth;
55 XGetGeometry( 56 XGetGeometry(
56 display, root, &root_ret, &x, &y, &width, &height, &border, &depth); 57 display, root, &root_ret, &x, &y, &width, &height, &border, &depth);
57 58
(...skipping 21 matching lines...) Expand all
79 monitor_rect.width, monitor_rect.height); 80 monitor_rect.width, monitor_rect.height);
80 81
81 gfx::Rect available_rect = results->rect; 82 gfx::Rect available_rect = results->rect;
82 gfx::Rect work_area = GetWorkArea(GDK_WINDOW_XID(gdk_window)); 83 gfx::Rect work_area = GetWorkArea(GDK_WINDOW_XID(gdk_window));
83 if (!work_area.IsEmpty()) 84 if (!work_area.IsEmpty())
84 available_rect.Intersect(work_area); 85 available_rect.Intersect(work_area);
85 results->availableRect = available_rect; 86 results->availableRect = available_rect;
86 } 87 }
87 88
88 } // namespace content 89 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/backing_store_gtk.cc ('k') | content/browser/renderer_host/web_input_event_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698