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

Side by Side Diff: ui/wayland/wayland_screen.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_screen.h ('k') | ui/wayland/wayland_shm_buffer.h » ('j') | 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_screen.h"
6
7 #include <wayland-client.h>
8
9 #include "ui/wayland/wayland_display.h"
10
11 namespace ui {
12
13 WaylandScreen::WaylandScreen(WaylandDisplay* display, uint32_t id)
14 : output_(NULL),
15 display_(display) {
16 static const wl_output_listener kOutputListener = {
17 WaylandScreen::OutputHandleGeometry,
18 WaylandScreen::OutputHandleMode,
19 };
20
21 output_ = static_cast<wl_output*>(
22 wl_display_bind(display_->display(), id, &wl_output_interface));
23 wl_output_add_listener(output_, &kOutputListener, this);
24 }
25
26 WaylandScreen::~WaylandScreen() {
27 if (output_)
28 wl_output_destroy(output_);
29 }
30
31 gfx::Rect WaylandScreen::GetAllocation() const {
32 gfx::Rect allocation;
33 allocation.set_origin(position_);
34
35 // Find the active mode and pass its dimensions.
36 for (Modes::const_iterator i = modes_.begin(); i != modes_.end(); ++i) {
37 if ((*i).flags & WL_OUTPUT_MODE_CURRENT) {
38 allocation.set_width((*i).width);
39 allocation.set_height((*i).height);
40 break;
41 }
42 }
43
44 return allocation;
45 }
46
47 // static
48 void WaylandScreen::OutputHandleGeometry(void* data,
49 wl_output* output,
50 int32_t x,
51 int32_t y,
52 int32_t physical_width,
53 int32_t physical_height,
54 int32_t subpixel,
55 const char* make,
56 const char* model) {
57 WaylandScreen* screen = static_cast<WaylandScreen*>(data);
58 screen->position_.SetPoint(x, y);
59 }
60
61 // static
62 void WaylandScreen::OutputHandleMode(void* data,
63 wl_output* wl_output,
64 uint32_t flags,
65 int32_t width,
66 int32_t height,
67 int32_t refresh) {
68 WaylandScreen* screen = static_cast<WaylandScreen*>(data);
69
70 Mode mode;
71 mode.width = width;
72 mode.height = height;
73 mode.refresh = refresh;
74 mode.flags = flags;
75
76 screen->modes_.push_back(mode);
77 }
78
79 } // namespace ui
OLDNEW
« no previous file with comments | « ui/wayland/wayland_screen.h ('k') | ui/wayland/wayland_shm_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698