Commit b07f8f14 authored by erg@chromium.org's avatar erg@chromium.org

content: Move touchui's RenderWidgetHostView::GetDefaultScreenInfo() into a...

content: Move touchui's RenderWidgetHostView::GetDefaultScreenInfo() into a place to make things link

(Fixes trybot linkage on linux_touch)

BUG=90443


Review URL: http://codereview.chromium.org/7753013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98389 0039d316-1c4b-4281-b951-d872f2087c98
parent 785565db
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "content/browser/renderer_host/gtk_window_utils.h"
#include "ui/base/keycodes/keyboard_code_conversion_gtk.h" #include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
#include "ui/base/x/x11_util.h" #include "ui/base/x/x11_util.h"
#include "ui/gfx/gtk_native_view_id_manager.h" #include "ui/gfx/gtk_native_view_id_manager.h"
...@@ -14,30 +15,6 @@ ...@@ -14,30 +15,6 @@
#include "views/widget/native_widget_gtk.h" #include "views/widget/native_widget_gtk.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h"
namespace {
// TODO(oshima): This is a copy from RenderWidgetHostViewGtk. Replace this
// with gdk-less implementation.
void GetScreenInfoFromNativeWindow(
GdkWindow* gdk_window, WebKit::WebScreenInfo* results) {
GdkScreen* screen = gdk_drawable_get_screen(gdk_window);
*results = WebKit::WebScreenInfoFactory::screenInfo(
gdk_x11_drawable_get_xdisplay(gdk_window),
gdk_x11_screen_get_screen_number(screen));
// TODO(tony): We should move this code into WebScreenInfoFactory.
int monitor_number = gdk_screen_get_monitor_at_window(screen, gdk_window);
GdkRectangle monitor_rect;
gdk_screen_get_monitor_geometry(screen, monitor_number, &monitor_rect);
results->rect = WebKit::WebRect(monitor_rect.x, monitor_rect.y,
monitor_rect.width, monitor_rect.height);
// TODO(tony): Should we query _NET_WORKAREA to get the workarea?
results->availableRect = results->rect;
}
} // namespace
void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) { void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) {
// Optimize the common case, where the cursor hasn't changed. // Optimize the common case, where the cursor hasn't changed.
...@@ -65,7 +42,8 @@ void RenderWidgetHostViewViews::DestroyPluginContainer( ...@@ -65,7 +42,8 @@ void RenderWidgetHostViewViews::DestroyPluginContainer(
void RenderWidgetHostViewViews::GetScreenInfo(WebKit::WebScreenInfo* results) { void RenderWidgetHostViewViews::GetScreenInfo(WebKit::WebScreenInfo* results) {
views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL; views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL;
if (widget) if (widget)
GetScreenInfoFromNativeWindow(widget->GetNativeView()->window, results); content::GetScreenInfoFromNativeWindow(widget->GetNativeView()->window,
results);
} }
gfx::Rect RenderWidgetHostViewViews::GetRootWindowBounds() { gfx::Rect RenderWidgetHostViewViews::GetRootWindowBounds() {
...@@ -114,13 +92,3 @@ void RenderWidgetHostViewViews::ShowCurrentCursor() { ...@@ -114,13 +92,3 @@ void RenderWidgetHostViewViews::ShowCurrentCursor() {
native_cursor_ = current_cursor_.GetNativeCursor(); native_cursor_ = current_cursor_.GetNativeCursor();
} }
#if defined(TOUCH_UI)
// static
void RenderWidgetHostView::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) {
GdkWindow* gdk_window =
gdk_display_get_default_group(gdk_display_get_default());
GetScreenInfoFromNativeWindow(gdk_window, results);
}
#endif
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/renderer_host/gtk_window_utils.h"
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h"
namespace content {
void GetScreenInfoFromNativeWindow(
GdkWindow* gdk_window, WebKit::WebScreenInfo* results) {
GdkScreen* screen = gdk_drawable_get_screen(gdk_window);
*results = WebKit::WebScreenInfoFactory::screenInfo(
gdk_x11_drawable_get_xdisplay(gdk_window),
gdk_x11_screen_get_screen_number(screen));
// TODO(tony): We should move this code into WebScreenInfoFactory.
int monitor_number = gdk_screen_get_monitor_at_window(screen, gdk_window);
GdkRectangle monitor_rect;
gdk_screen_get_monitor_geometry(screen, monitor_number, &monitor_rect);
results->rect = WebKit::WebRect(monitor_rect.x, monitor_rect.y,
monitor_rect.width, monitor_rect.height);
// TODO(tony): Should we query _NET_WORKAREA to get the workarea?
results->availableRect = results->rect;
}
} // namespace content
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_RENDERER_HOST_GTK_WINDOW_UTILS_H_
#define CONTENT_BROWSER_RENDERER_HOST_GTK_WINDOW_UTILS_H_
#pragma once
typedef struct _GdkDrawable GdkWindow;
namespace WebKit {
struct WebScreenInfo;
}
namespace content {
void GetScreenInfoFromNativeWindow(
GdkWindow* gdk_window, WebKit::WebScreenInfo* results);
} // namespace content
#endif // CONTENT_BROWSER_RENDERER_HOST_GTK_WINDOW_UTILS_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/renderer_host/render_widget_host_view.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#if defined(OS_MACOSX)
#include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFactory.h" #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFactory.h"
#endif
#if defined(TOUCH_UI)
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "content/browser/renderer_host/gtk_window_utils.h"
#endif
// TODO(jam): move this to render_widget_host_view_mac.mm when it moves to // TODO(jam): move this to render_widget_host_view_mac.mm when it moves to
// content. // content.
...@@ -17,6 +27,18 @@ void RenderWidgetHostView::GetDefaultScreenInfo( ...@@ -17,6 +27,18 @@ void RenderWidgetHostView::GetDefaultScreenInfo(
} }
#endif #endif
// TODO(erg): move this to render_widget_host_view_views_gtk.cc when if it
// moves to content.
#if defined(TOUCH_UI)
// static
void RenderWidgetHostView::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) {
GdkWindow* gdk_window =
gdk_display_get_default_group(gdk_display_get_default());
content::GetScreenInfoFromNativeWindow(gdk_window, results);
}
#endif
RenderWidgetHostView::~RenderWidgetHostView() {} RenderWidgetHostView::~RenderWidgetHostView() {}
void RenderWidgetHostView::SetBackground(const SkBitmap& background) { void RenderWidgetHostView::SetBackground(const SkBitmap& background) {
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "content/browser/renderer_host/backing_store_x.h" #include "content/browser/renderer_host/backing_store_x.h"
#include "content/browser/renderer_host/gtk_im_context_wrapper.h" #include "content/browser/renderer_host/gtk_im_context_wrapper.h"
#include "content/browser/renderer_host/gtk_window_utils.h"
#include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host.h"
...@@ -94,23 +95,6 @@ GdkCursor* GetMozSpinningCursor() { ...@@ -94,23 +95,6 @@ GdkCursor* GetMozSpinningCursor() {
return moz_spinning_cursor; return moz_spinning_cursor;
} }
void GetScreenInfoFromNativeWindow(
GdkWindow* gdk_window, WebKit::WebScreenInfo* results) {
GdkScreen* screen = gdk_drawable_get_screen(gdk_window);
*results = WebKit::WebScreenInfoFactory::screenInfo(
gdk_x11_drawable_get_xdisplay(gdk_window),
gdk_x11_screen_get_screen_number(screen));
// TODO(tony): We should move this code into WebScreenInfoFactory.
gint monitor_number = gdk_screen_get_monitor_at_window(screen, gdk_window);
GdkRectangle monitor_rect;
gdk_screen_get_monitor_geometry(screen, monitor_number, &monitor_rect);
results->rect = WebKit::WebRect(monitor_rect.x, monitor_rect.y,
monitor_rect.width, monitor_rect.height);
// TODO(tony): Should we query _NET_WORKAREA to get the workarea?
results->availableRect = results->rect;
}
} // namespace } // namespace
using WebKit::WebInputEventFactory; using WebKit::WebInputEventFactory;
...@@ -1174,7 +1158,7 @@ void RenderWidgetHostViewGtk::GetScreenInfo(WebKit::WebScreenInfo* results) { ...@@ -1174,7 +1158,7 @@ void RenderWidgetHostViewGtk::GetScreenInfo(WebKit::WebScreenInfo* results) {
} }
if (!gdk_window) if (!gdk_window)
return; return;
GetScreenInfoFromNativeWindow(gdk_window, results); content::GetScreenInfoFromNativeWindow(gdk_window, results);
} }
gfx::Rect RenderWidgetHostViewGtk::GetRootWindowBounds() { gfx::Rect RenderWidgetHostViewGtk::GetRootWindowBounds() {
...@@ -1257,5 +1241,5 @@ void RenderWidgetHostView::GetDefaultScreenInfo( ...@@ -1257,5 +1241,5 @@ void RenderWidgetHostView::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) { WebKit::WebScreenInfo* results) {
GdkWindow* gdk_window = GdkWindow* gdk_window =
gdk_display_get_default_group(gdk_display_get_default()); gdk_display_get_default_group(gdk_display_get_default());
GetScreenInfoFromNativeWindow(gdk_window, results); content::GetScreenInfoFromNativeWindow(gdk_window, results);
} }
...@@ -333,6 +333,8 @@ ...@@ -333,6 +333,8 @@
'browser/renderer_host/gtk_im_context_wrapper.h', 'browser/renderer_host/gtk_im_context_wrapper.h',
'browser/renderer_host/gtk_key_bindings_handler.cc', 'browser/renderer_host/gtk_key_bindings_handler.cc',
'browser/renderer_host/gtk_key_bindings_handler.h', 'browser/renderer_host/gtk_key_bindings_handler.h',
'browser/renderer_host/gtk_window_utils.cc',
'browser/renderer_host/gtk_window_utils.h',
'browser/renderer_host/media/audio_common.cc', 'browser/renderer_host/media/audio_common.cc',
'browser/renderer_host/media/audio_common.h', 'browser/renderer_host/media/audio_common.h',
'browser/renderer_host/media/audio_input_device_manager.cc', 'browser/renderer_host/media/audio_input_device_manager.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment