~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-10-10 14:01:26 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20141010140126-n1czko8na1kuz4ll
Tags: upstream-0.8.0+14.10.20141010
Import upstream version 0.8.0+14.10.20141010

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 "server_configuration.h"
 
23
 
 
24
#include "mir/report_exception.h"
 
25
 
 
26
#include <iostream>
 
27
 
 
28
namespace me = mir::examples;
 
29
 
 
30
///\page demo_inprocess_egl demo_inprocess_egl.cpp: A simple use of egl in process
 
31
///\section main main
 
32
/// The main() function uses a default configuration for Mir and sets up an InprocessEGLClient
 
33
/// that accesses the graphics platform and surface factory.
 
34
/// \snippet demo_inprocess_egl.cpp main_tag
 
35
/// This InprocessEGLClient sets up a single surface
 
36
/// \snippet inprocess_egl_client.cpp setup_tag
 
37
/// And loops updating the surface
 
38
/// \snippet inprocess_egl_client.cpp loop_tag
 
39
 
 
40
int main(int argc, char const* argv[])
 
41
try
 
42
{
 
43
    ///\internal [main_tag]
 
44
    me::ServerConfiguration config(argc, argv);
 
45
 
 
46
    std::shared_ptr<me::InprocessEGLClient> client;
 
47
 
 
48
    mir::run_mir(config, [&config, &client](mir::DisplayServer&)
 
49
    {
 
50
        client = std::make_shared<me::InprocessEGLClient>(
 
51
              config.the_graphics_platform(),
 
52
              config.the_frontend_shell(),
 
53
              config.the_focus_controller());
 
54
    });
 
55
    ///\internal [main_tag]
 
56
 
 
57
    return 0;
 
58
}
 
59
catch (...)
 
60
{
 
61
    mir::report_exception(std::cerr);
 
62
    return 1;
 
63
}