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

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

Issue 9151007: GTK: Seal up GSEALs, focusing on GtkSelectionData. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add gtk_widget_style_attach to make minimal version 2.18 Created 8 years, 11 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
« no previous file with comments | « ui/gfx/gtk_preserve_window.cc ('k') | no next file » | 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) 2011 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 "ui/gfx/screen.h" 5 #include "ui/gfx/screen.h"
6 6
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 11
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // static 74 // static
75 gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeView view) { 75 gfx::Rect Screen::GetMonitorAreaNearestWindow(gfx::NativeView view) {
76 GdkScreen* screen = gdk_screen_get_default(); 76 GdkScreen* screen = gdk_screen_get_default();
77 gint monitor_num = 0; 77 gint monitor_num = 0;
78 if (view) { 78 if (view) {
79 GtkWidget* top_level = gtk_widget_get_toplevel(view); 79 GtkWidget* top_level = gtk_widget_get_toplevel(view);
80 DCHECK(GTK_IS_WINDOW(top_level)); 80 DCHECK(GTK_IS_WINDOW(top_level));
81 GtkWindow* window = GTK_WINDOW(top_level); 81 GtkWindow* window = GTK_WINDOW(top_level);
82 screen = gtk_window_get_screen(window); 82 screen = gtk_window_get_screen(window);
83 monitor_num = gdk_screen_get_monitor_at_window(screen, top_level->window); 83 monitor_num = gdk_screen_get_monitor_at_window(
84 screen,
85 gtk_widget_get_window(top_level));
84 } 86 }
85 GdkRectangle bounds; 87 GdkRectangle bounds;
86 gdk_screen_get_monitor_geometry(screen, monitor_num, &bounds); 88 gdk_screen_get_monitor_geometry(screen, monitor_num, &bounds);
87 return gfx::Rect(bounds); 89 return gfx::Rect(bounds);
88 } 90 }
89 91
90 // static 92 // static
91 gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) { 93 gfx::Rect Screen::GetMonitorWorkAreaNearestPoint(const gfx::Point& point) {
92 // TODO(jamiewalch): Restrict this to the work area of the monitor. 94 // TODO(jamiewalch): Restrict this to the work area of the monitor.
93 return GetMonitorAreaNearestPoint(point); 95 return GetMonitorAreaNearestPoint(point);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 151
150 // static 152 // static
151 int Screen::GetNumMonitors() { 153 int Screen::GetNumMonitors() {
152 // This query is kinda bogus for Linux -- do we want number of X screens? 154 // This query is kinda bogus for Linux -- do we want number of X screens?
153 // The number of monitors Xinerama has? We'll just use whatever GDK uses. 155 // The number of monitors Xinerama has? We'll just use whatever GDK uses.
154 GdkScreen* screen = gdk_screen_get_default(); 156 GdkScreen* screen = gdk_screen_get_default();
155 return gdk_screen_get_n_monitors(screen); 157 return gdk_screen_get_n_monitors(screen);
156 } 158 }
157 159
158 } // namespace gfx 160 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gtk_preserve_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698