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

Side by Side 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: Updated trunk to HEAD Created 9 years, 4 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 "ui/wayland/events/wayland_event.h"
10 #include "ui/wayland/wayland_display.h"
11 #include "ui/wayland/wayland_widget.h"
12
13 namespace ui {
14
15 WaylandWindow::WaylandWindow(WaylandWidget* widget, WaylandDisplay* display)
16 : widget_(widget),
17 display_(display),
18 parent_window_(NULL),
19 relative_position_(),
20 surface_(display->CreateSurface()),
21 fullscreen_(false) {
22 wl_surface_set_user_data(surface_, this);
23 }
24
25 WaylandWindow::WaylandWindow(
26 WaylandWidget* widget,
27 WaylandDisplay* display,
28 WaylandWindow* parent,
29 int32_t x,
30 int32_t y)
31 : widget_(widget),
32 display_(display),
33 parent_window_(parent),
34 relative_position_(x, y),
35 surface_(display->CreateSurface()),
36 fullscreen_(false) {
37 wl_surface_set_user_data(surface_, this);
38 }
39
40 WaylandWindow::~WaylandWindow() {
41 if (surface_)
42 wl_surface_destroy(surface_);
43 }
44
45 void WaylandWindow::SetVisible(bool visible) {
46 if (visible) {
47 if (fullscreen_) {
48 wl_shell_set_fullscreen(display_->shell(), surface_);
49 } else if (!parent_window_) {
50 wl_shell_set_toplevel(display_->shell(), surface_);
51 } else {
52 wl_shell_set_transient(display_->shell(),
53 surface_,
54 parent_window_->surface(),
55 relative_position_.x(),
56 relative_position_.y(),
57 0);
58 }
59 } else {
60 // TODO(dnicoara) What is the correct way of hiding a wl_surface?
61 }
62 }
63
64 bool WaylandWindow::IsVisible() const {
65 return surface_ != NULL;
66 }
67
68 void WaylandWindow::Configure(uint32_t time,
69 uint32_t edges,
70 int32_t x,
71 int32_t y,
72 int32_t width,
73 int32_t height) {
74 WaylandEvent event;
75 event.geometry_change.time = time;
76 event.geometry_change.x = x;
77 event.geometry_change.y = y;
78 event.geometry_change.width = width;
79 event.geometry_change.height = height;
80
81 widget_->OnGeometryChange(event);
82 }
83
84 } // 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