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

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: 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 unified diff | Download patch | Annotate | Revision Log
« ui/wayland/wayland_buffer.h ('K') | « 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 "wayland_window.h"
6
7 #include "wayland_display.h"
8 #include "wayland_widget.h"
9 #include "events/wayland_event.h"
10
11 #include <wayland-egl.h>
12
13 WaylandWindow::WaylandWindow(WaylandWidget* widget, WaylandDisplay* display)
14 : widget_(widget),
15 display_(display),
16 surface_(display->CreateSurface()),
17 fullscreen_(false),
18 parent_window_(NULL),
19 relative_position_() {
20 wl_surface_set_user_data(surface_, this);
21 }
22
23 WaylandWindow::WaylandWindow(WaylandWidget* widget, WaylandDisplay* display,
24 WaylandWindow* parent, int32_t x, int32_t y)
25 : widget_(widget),
26 display_(display),
27 surface_(display->CreateSurface()),
28 fullscreen_(false),
29 parent_window_(parent),
30 relative_position_(x, y) {
31 wl_surface_set_user_data(surface_, this);
32 }
33
34 WaylandWindow::~WaylandWindow() {
35 if (surface_) {
36 wl_surface_destroy(surface_);
37 }
38 }
39
40 void WaylandWindow::SetVisible(bool visible) {
41 if (visible) {
42 if (fullscreen_) {
43 wl_shell_set_fullscreen(display_->GetShell(), surface_);
44 } else if (!parent_window_) {
45 wl_shell_set_toplevel(display_->GetShell(), surface_);
46 } else {
47 wl_shell_set_transient(display_->GetShell(),
48 surface_,
49 parent_window_->GetSurface(),
50 relative_position_.x,
51 relative_position_.y,
52 0);
53 }
54 } else {
55 // What is the correct way of hiding a wl_surface?
56 }
57 }
58
59 bool WaylandWindow::IsVisible() const {
60 return surface_ != NULL;
61 }
62
63 void WaylandWindow::SetFullscreen(bool fullscreen) {
64 fullscreen_ = fullscreen;
65 }
66
67 bool WaylandWindow::IsFullscreen() const {
68 return fullscreen_;
69 }
70
71 WaylandWindow* WaylandWindow::GetParentWindow() const {
72 return parent_window_;
73 }
74
75 WaylandWidget* WaylandWindow::GetWidget() const {
76 return widget_;
77 }
78
79 wl_surface* WaylandWindow::GetSurface() const {
80 return surface_;
81 }
82
83 void WaylandWindow::Configure(uint32_t time, uint32_t edges,
84 int32_t x, int32_t y,
85 int32_t width, int32_t height) {
86 WaylandEvent event;
87 event.geometry_change.time = time;
88 event.geometry_change.x = x;
89 event.geometry_change.y = y;
90 event.geometry_change.width = width;
91 event.geometry_change.height = height;
92
93 widget_->OnGeometryChange(event);
94 }
OLDNEW
« ui/wayland/wayland_buffer.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