2
* Copyright (C) 2013 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Robert Carr <robert.carr@canonical.com>
19
#include "window_properties_mirclient_priv.h"
21
namespace uamc = ubuntu::application::mir::client;
23
uamc::WindowProperties::WindowProperties()
25
type(mir_surface_type_normal),
28
_event_cb_ctx(nullptr)
30
parameters.name = nullptr;
32
parameters.height = 0;
33
parameters.buffer_usage = mir_buffer_usage_hardware;
34
parameters.output_id = mir_display_output_id_invalid;
37
UAUiWindowProperties* uamc::WindowProperties::as_u_window_properties()
39
return static_cast<UAUiWindowProperties*>(this);
41
uamc::WindowProperties* uamc::WindowProperties::from_u_window_properties(UAUiWindowProperties* u_properties)
43
return static_cast<uamc::WindowProperties*>(u_properties);
46
void uamc::WindowProperties::set_title(char const* window_title, size_t length)
48
title = std::string(window_title, length);
49
parameters.name = title.c_str();
52
void uamc::WindowProperties::set_input_cb_and_ctx(UAUiWindowInputEventCb callback, void* ctx)
58
void uamc::WindowProperties::set_event_cb_and_ctx(UAUiWindowEventCb callback, void* ctx)
64
void uamc::WindowProperties::set_dimensions(uint32_t width, uint32_t height)
66
parameters.width = width;
67
parameters.height = height;
70
void uamc::WindowProperties::set_role(UAUiWindowRole role)
72
if (role == U_ON_SCREEN_KEYBOARD_ROLE) {
73
type = mir_surface_type_inputmethod;
75
//TODO implement other surface roles
78
MirSurfaceParameters const& uamc::WindowProperties::surface_parameters() const
83
MirSurfaceType uamc::WindowProperties::surface_type() const
88
UAUiWindowInputEventCb uamc::WindowProperties::input_cb() const
93
UAUiWindowEventCb uamc::WindowProperties::event_cb() const
98
void* uamc::WindowProperties::event_cb_context() const
100
return _event_cb_ctx;