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

Side by Side Diff: ui/wayland/wayland_window.cc

Issue 10009024: Remove WAYLAND port (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/wayland/wayland_window.h ('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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/wayland/wayland_window.h"
6
7 #include <wayland-egl.h>
8
9 #include "base/wayland/wayland_event.h"
10 #include "ui/wayland/wayland_display.h"
11 #include "ui/wayland/wayland_widget.h"
12
13 using base::wayland::WaylandEvent;
14
15 namespace ui {
16
17 WaylandWindow::WaylandWindow(WaylandWidget* widget, WaylandDisplay* display)
18 : widget_(widget),
19 display_(display),
20 parent_window_(NULL),
21 relative_position_(),
22 surface_(display->CreateSurface()),
23 fullscreen_(false) {
24 wl_surface_set_user_data(surface_, this);
25 }
26
27 WaylandWindow::WaylandWindow(
28 WaylandWidget* widget,
29 WaylandDisplay* display,
30 WaylandWindow* parent,
31 int32_t x,
32 int32_t y)
33 : widget_(widget),
34 display_(display),
35 parent_window_(parent),
36 relative_position_(x, y),
37 surface_(display->CreateSurface()),
38 fullscreen_(false) {
39 wl_surface_set_user_data(surface_, this);
40 }
41
42 WaylandWindow::~WaylandWindow() {
43 if (surface_)
44 wl_surface_destroy(surface_);
45 }
46
47 void WaylandWindow::SetVisible(bool visible) {
48 if (visible) {
49 if (fullscreen_) {
50 wl_shell_set_fullscreen(display_->shell(), surface_);
51 } else if (!parent_window_) {
52 wl_shell_set_toplevel(display_->shell(), surface_);
53 } else {
54 wl_shell_set_transient(display_->shell(),
55 surface_,
56 parent_window_->surface(),
57 relative_position_.x(),
58 relative_position_.y(),
59 0);
60 }
61 } else {
62 // TODO(dnicoara) What is the correct way of hiding a wl_surface?
63 }
64 }
65
66 bool WaylandWindow::IsVisible() const {
67 return surface_ != NULL;
68 }
69
70 void WaylandWindow::Configure(uint32_t time,
71 uint32_t edges,
72 int32_t x,
73 int32_t y,
74 int32_t width,
75 int32_t height) {
76 WaylandEvent event;
77 event.geometry_change.time = time;
78 event.geometry_change.x = x;
79 event.geometry_change.y = y;
80 event.geometry_change.width = width;
81 event.geometry_change.height = height;
82
83 widget_->OnGeometryChange(event);
84 }
85
86 } // namespace ui
OLDNEW
« no previous file with comments | « ui/wayland/wayland_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698