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

Unified Diff: ui/wayland/wayland_window.cc

Issue 7457023: Adding a Wayland basic toolkit (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed argument layout Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« ui/wayland/wayland_window.h ('K') | « ui/wayland/wayland_window.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wayland/wayland_window.cc
diff --git a/ui/wayland/wayland_window.cc b/ui/wayland/wayland_window.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3767f8e3142ff275c02781afe0d24f7eb87c1fff
--- /dev/null
+++ b/ui/wayland/wayland_window.cc
@@ -0,0 +1,105 @@
+// 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 "ui/wayland/wayland_window.h"
+
+#include <wayland-egl.h>
+
+#include "ui/wayland/events/wayland_event.h"
+#include "ui/wayland/wayland_display.h"
+#include "ui/wayland/wayland_widget.h"
+
+namespace ui {
+
+WaylandWindow::WaylandWindow(WaylandWidget* widget, WaylandDisplay* display)
+ : widget_(widget),
+ display_(display),
+ surface_(display->CreateSurface()),
+ fullscreen_(false),
+ parent_window_(NULL),
+ relative_position_() {
+ wl_surface_set_user_data(surface_, this);
+}
+
+WaylandWindow::WaylandWindow(
+ WaylandWidget* widget,
+ WaylandDisplay* display,
+ WaylandWindow* parent,
+ int32_t x,
+ int32_t y)
+ : widget_(widget),
+ display_(display),
+ surface_(display->CreateSurface()),
+ fullscreen_(false),
+ parent_window_(parent),
+ relative_position_(x, y) {
+ wl_surface_set_user_data(surface_, this);
+}
+
+WaylandWindow::~WaylandWindow() {
+ if (surface_)
+ wl_surface_destroy(surface_);
+}
+
+void WaylandWindow::SetVisible(bool visible) {
+ if (visible) {
+ if (fullscreen_) {
+ wl_shell_set_fullscreen(display_->GetShell(), surface_);
+ } else if (!parent_window_) {
+ wl_shell_set_toplevel(display_->GetShell(), surface_);
+ } else {
+ wl_shell_set_transient(display_->GetShell(),
+ surface_,
+ parent_window_->GetSurface(),
+ relative_position_.x(),
+ relative_position_.y(),
+ 0);
+ }
+ } else {
+ // TODO(dnicoara) What is the correct way of hiding a wl_surface?
+ }
+}
+
+bool WaylandWindow::IsVisible() const {
+ return surface_ != NULL;
+}
+
+void WaylandWindow::SetFullscreen(bool fullscreen) {
+ fullscreen_ = fullscreen;
+}
+
+bool WaylandWindow::IsFullscreen() const {
+ return fullscreen_;
+}
+
+WaylandWindow* WaylandWindow::GetParentWindow() const {
+ return parent_window_;
+}
+
+WaylandWidget* WaylandWindow::GetWidget() const {
+ return widget_;
+}
+
+wl_surface* WaylandWindow::GetSurface() const {
+ return surface_;
+}
+
+void WaylandWindow::Configure(
+ uint32_t time,
tfarina 2011/07/25 18:34:27 You can write this as: void WaylandWindow::Config
+ uint32_t edges,
+ int32_t x,
+ int32_t y,
+ int32_t width,
+ int32_t height) {
+ WaylandEvent event;
+ event.geometry_change.time = time;
+ event.geometry_change.x = x;
+ event.geometry_change.y = y;
+ event.geometry_change.width = width;
+ event.geometry_change.height = height;
+
+ widget_->OnGeometryChange(event);
+}
+
+} // namespace ui
« ui/wayland/wayland_window.h ('K') | « ui/wayland/wayland_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698