diff options
author | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 18:14:45 +0000 |
---|---|---|
committer | backer@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-26 18:14:45 +0000 |
commit | a4f857f0cafb41c3d7c3fd50c6b39c99e629b48a (patch) | |
tree | 521a058f131d900136105ce2ce3c368991de5ad1 /ui | |
parent | 3a1381d637b14d103c581990451f92877107893e (diff) | |
download | chromium_src-a4f857f0cafb41c3d7c3fd50c6b39c99e629b48a.zip chromium_src-a4f857f0cafb41c3d7c3fd50c6b39c99e629b48a.tar.gz chromium_src-a4f857f0cafb41c3d7c3fd50c6b39c99e629b48a.tar.bz2 |
Wayland support for views. views_desktop on Wayland.
This CL depends on:
* http://codereview.chromium.org/7457023
* http://codereview.chromium.org/7467007
* http://codereview.chromium.org/7473010
Wayland requires newer libraries than Ubuntu currently provides. I've created a
list of required dependencies:
https://sites.google.com/a/google.com/chrome_on_wayland/home/wayland-build-dependencies
BUG=
TEST=Built Chrome to verify that Wayland dependencies and changes don't interfere with
the usual build.
Review URL: http://codereview.chromium.org/7464027
Patch from Daniel Nicoara <dnicoara@chromium.org>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98453 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gfx/rect.cc | 32 | ||||
-rw-r--r-- | ui/gfx/rect.h | 13 |
2 files changed, 41 insertions, 4 deletions
diff --git a/ui/gfx/rect.cc b/ui/gfx/rect.cc index 5413711..96a8b0d 100644 --- a/ui/gfx/rect.cc +++ b/ui/gfx/rect.cc @@ -1,4 +1,4 @@ -// 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 // found in the LICENSE file. @@ -8,9 +8,12 @@ #include <windows.h> #elif defined(OS_MACOSX) #include <CoreGraphics/CGGeometry.h> -#elif defined(OS_POSIX) +#elif defined(USE_X11) #include <gdk/gdk.h> #endif +#if defined(USE_WAYLAND) +#include <cairo.h> +#endif #include <ostream> @@ -77,7 +80,7 @@ Rect& Rect::operator=(const CGRect& r) { set_height(r.size.height); return *this; } -#elif defined(OS_POSIX) +#elif defined(USE_X11) Rect::Rect(const GdkRectangle& r) : origin_(r.x, r.y) { set_width(r.width); @@ -91,6 +94,21 @@ Rect& Rect::operator=(const GdkRectangle& r) { return *this; } #endif +#if defined(USE_WAYLAND) +Rect::Rect(const cairo_rectangle_int_t& r) + : origin_(r.x, r.y) { + set_width(r.width); + set_height(r.height); +} + +Rect& Rect::operator=(const cairo_rectangle_int_t& r) { + origin_.SetPoint(r.x, r.y); + set_width(r.width); + set_height(r.height); + return *this; +} +#endif + void Rect::SetRect(int x, int y, int width, int height) { origin_.SetPoint(x, y); @@ -141,12 +159,18 @@ RECT Rect::ToRECT() const { CGRect Rect::ToCGRect() const { return CGRectMake(x(), y(), width(), height()); } -#elif defined(OS_POSIX) +#elif defined(USE_X11) GdkRectangle Rect::ToGdkRectangle() const { GdkRectangle r = {x(), y(), width(), height()}; return r; } #endif +#if defined(USE_WAYLAND) +cairo_rectangle_int_t Rect::ToCairoRectangle() const { + cairo_rectangle_int_t r = {x(), y(), width(), height()}; + return r; +} +#endif bool Rect::Contains(int point_x, int point_y) const { return (point_x >= x()) && (point_x < right()) && diff --git a/ui/gfx/rect.h b/ui/gfx/rect.h index fdb3088..f47456f 100644 --- a/ui/gfx/rect.h +++ b/ui/gfx/rect.h @@ -24,6 +24,10 @@ typedef struct tagRECT RECT; typedef struct _GdkRectangle GdkRectangle; #endif +#if defined(USE_WAYLAND) +typedef struct _cairo_rectangle_int cairo_rectangle_int_t; +#endif + namespace gfx { class Insets; @@ -40,6 +44,9 @@ class UI_EXPORT Rect { #elif defined(USE_X11) explicit Rect(const GdkRectangle& r); #endif +#if defined(USE_WAYLAND) + explicit Rect(const cairo_rectangle_int_t& r); +#endif explicit Rect(const gfx::Size& size); Rect(const gfx::Point& origin, const gfx::Size& size); @@ -52,6 +59,9 @@ class UI_EXPORT Rect { #elif defined(USE_X11) Rect& operator=(const GdkRectangle& r); #endif +#if defined(USE_WAYLAND) + Rect& operator=(const cairo_rectangle_int_t& r); +#endif int x() const { return origin_.x(); } void set_x(int x) { origin_.set_x(x); } @@ -119,6 +129,9 @@ class UI_EXPORT Rect { // Construct an equivalent CoreGraphics object. CGRect ToCGRect() const; #endif +#if defined(USE_WAYLAND) + cairo_rectangle_int_t ToCairoRectangle() const; +#endif // Returns true if the point identified by point_x and point_y falls inside // this rectangle. The point (x, y) is inside the rectangle, but the |