~mir-team/mir/in-process-egl+input-conglomeration

« back to all changes in this revision

Viewing changes to examples/demo-inprocess-surface-client/demo_inprocess_surface_client.cpp

Merged trunk and fixed issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2013 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify
5
 
 * it under the terms of the GNU General Public License version 3 as
6
 
 * published by the Free Software Foundation.
7
 
 *
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 General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Authored by: Robert Carr <robert.carr@canonical.com>
17
 
 */
18
 
 
19
 
#include "inprocess_egl_client.h"
20
 
 
21
 
#include "mir/run_mir.h"
22
 
#include "mir/default_server_configuration.h"
23
 
 
24
 
#include "mir/report_exception.h"
25
 
#include <iostream>
26
 
 
27
 
namespace me = mir::examples;
28
 
 
29
 
///\page demo_inprocess_egl demo_inprocess_egl.cpp: A simple use of egl in process
30
 
///\section main main
31
 
/// The main() function uses a default configuration for Mir and sets up an InprocessEGLClient
32
 
/// that accesses the graphics platform and surface factory.
33
 
/// \snippet demo_inprocess_egl.cpp main_tag
34
 
/// This InprocessEGLClient sets up a single surface
35
 
/// \snippet inprocess_egl_client.cpp setup_tag
36
 
/// And loops updating the surface
37
 
/// \snippet inprocess_egl_client.cpp loop_tag
38
 
 
39
 
int main(int argc, char const* argv[])
40
 
try
41
 
{
42
 
    ///\internal [main_tag]
43
 
    mir::DefaultServerConfiguration config(argc, argv);
44
 
 
45
 
    std::shared_ptr<me::InprocessEGLClient> client;
46
 
    mir::run_mir(config, [&config, &client](mir::DisplayServer&)
47
 
    {
48
 
        client = std::make_shared<me::InprocessEGLClient>(
49
 
              config.the_graphics_platform(),
50
 
              config.the_session_manager());
51
 
    });
52
 
    ///\internal [main_tag]
53
 
 
54
 
    return 0;
55
 
}
56
 
catch (...)
57
 
{
58
 
    mir::report_exception(std::cerr);
59
 
    return 1;
60
 
}