~vanvugt/mir/log-level

« back to all changes in this revision

Viewing changes to src/server/shell/default_shell.h

  • Committer: Daniel van Vugt
  • Date: 2015-01-23 03:08:41 UTC
  • mfrom: (2201.2.50 development-branch)
  • Revision ID: daniel.van.vugt@canonical.com-20150123030841-zn39cao9um2o9x0p
Merge latest trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2015 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3,
 
6
 * as 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: Alan Griffiths <alan@octopull.co.uk>
 
17
 */
 
18
 
 
19
#ifndef MIR_SHELL_DEFAULT_SHELL_H_
 
20
#define MIR_SHELL_DEFAULT_SHELL_H_
 
21
 
 
22
#include "mir/frontend/shell.h"
 
23
#include "mir/shell/focus_controller.h"
 
24
 
 
25
#include <mutex>
 
26
 
 
27
namespace mir
 
28
{
 
29
namespace scene { class SessionCoordinator; }
 
30
 
 
31
namespace shell
 
32
{
 
33
class FocusSetter;
 
34
 
 
35
class DefaultShell : public frontend::Shell, public FocusController
 
36
{
 
37
public:
 
38
    DefaultShell(
 
39
        std::shared_ptr<FocusSetter> const& focus_setter,
 
40
        std::shared_ptr<scene::SessionCoordinator> const& session_coordinator);
 
41
 
 
42
    void focus_next() override;
 
43
 
 
44
    std::weak_ptr<scene::Session> focussed_application() const override;
 
45
 
 
46
    void set_focus_to(std::shared_ptr<scene::Session> const& focus) override;
 
47
 
 
48
    virtual std::shared_ptr<frontend::Session> open_session(
 
49
        pid_t client_pid,
 
50
        std::string const& name,
 
51
        std::shared_ptr<frontend::EventSink> const& sink) override;
 
52
 
 
53
    virtual void close_session(std::shared_ptr<frontend::Session> const& session) override;
 
54
 
 
55
    void handle_surface_created(std::shared_ptr<frontend::Session> const& session) override;
 
56
 
 
57
    std::shared_ptr<frontend::PromptSession> start_prompt_session_for(
 
58
        std::shared_ptr<frontend::Session> const& session,
 
59
        scene::PromptSessionCreationParameters const& params) override;
 
60
 
 
61
    void add_prompt_provider_for(
 
62
        std::shared_ptr<frontend::PromptSession> const& prompt_session,
 
63
        std::shared_ptr<frontend::Session> const& session) override;
 
64
 
 
65
    void stop_prompt_session(std::shared_ptr<frontend::PromptSession> const& prompt_session) override;
 
66
 
 
67
    frontend::SurfaceId create_surface(std::shared_ptr<frontend::Session> const& session, scene::SurfaceCreationParameters const& params) override;
 
68
 
 
69
    void destroy_surface(std::shared_ptr<frontend::Session> const& session, frontend::SurfaceId surface) override;
 
70
 
 
71
    int set_surface_attribute(
 
72
        std::shared_ptr<frontend::Session> const& session,
 
73
        frontend::SurfaceId surface_id,
 
74
        MirSurfaceAttrib attrib,
 
75
        int value) override;
 
76
 
 
77
    int get_surface_attribute(
 
78
        std::shared_ptr<frontend::Session> const& session,
 
79
        frontend::SurfaceId surface_id,
 
80
        MirSurfaceAttrib attrib) override;
 
81
 
 
82
private:
 
83
    std::shared_ptr<FocusSetter> const focus_setter;
 
84
    std::shared_ptr<scene::SessionCoordinator> const session_coordinator;
 
85
 
 
86
    std::mutex mutex;
 
87
    std::weak_ptr<scene::Session> focus_application;
 
88
 
 
89
    void set_focus_to_locked(std::unique_lock<std::mutex> const& lock, std::shared_ptr<scene::Session> const& next_focus);
 
90
};
 
91
}
 
92
}
 
93
 
 
94
#endif /* MIR_SHELL_DEFAULT_SHELL_H_ */