~robertcarr/mir/client-focus-notifications

« back to all changes in this revision

Viewing changes to include/server/mir/shell/default_focus_mechanism.h

MergeĀ lp:~kdub/mir/connect-display-request

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
class Surface;
31
31
class InputTargeter;
32
32
class SurfaceController;
 
33
class SessionListener;
 
34
class FocusSequence;
33
35
 
34
36
class DefaultFocusMechanism : public FocusSetter
35
37
{
36
38
public:
37
 
    explicit DefaultFocusMechanism(std::shared_ptr<InputTargeter> const& input_targeter,
38
 
                                   std::shared_ptr<SurfaceController> const& surface_controller);
 
39
    explicit DefaultFocusMechanism(std::shared_ptr<FocusSequence> const& sequence,
 
40
                                   std::shared_ptr<InputTargeter> const& input_targeter,
 
41
                                   std::shared_ptr<SurfaceController> const& surface_controller,
 
42
                                   std::shared_ptr<SessionListener> const& session_listener);
39
43
    virtual ~DefaultFocusMechanism() = default;
40
44
 
41
 
    void set_focus_to(std::shared_ptr<shell::Session> const& new_focus);
 
45
    void surface_created_for(std::shared_ptr<Session> const& session);
 
46
    void session_opened(std::shared_ptr<Session> const& session);
 
47
    void session_closed(std::shared_ptr<Session> const& session);
 
48
    std::weak_ptr<Session> focused_session() const;
 
49
 
 
50
    //TODO: this is only used in example code
 
51
    void focus_next();
42
52
 
43
53
protected:
 
54
    void focus_next_locked();
 
55
 
44
56
    DefaultFocusMechanism(const DefaultFocusMechanism&) = delete;
45
57
    DefaultFocusMechanism& operator=(const DefaultFocusMechanism&) = delete;
46
58
 
47
59
private:
 
60
    void set_focus(std::shared_ptr<Session> const& session);
 
61
 
 
62
    std::shared_ptr<FocusSequence> const sequence;
 
63
    std::shared_ptr<SessionListener> const session_listener;
48
64
    std::shared_ptr<InputTargeter> const input_targeter;
49
65
    std::shared_ptr<SurfaceController> const surface_controller;
50
66
 
51
 
    // TODO: Protect with mutex
 
67
    std::mutex mutable mutex;
 
68
    std::shared_ptr<Session> focus_session;
 
69
    // TODO: Protected wiht mutex?
52
70
    std::weak_ptr<Surface> currently_focused_surface;
53
71
};
54
72