~hikiko/unity/unity.tmp-alpha-shadows

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
* Copyright (C) 2013 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
*/

#ifndef UNITY_LOCKSCREEN_SHIELD_H
#define UNITY_LOCKSCREEN_SHIELD_H

#include <UnityCore/ConnectionManager.h>
#include <UnityCore/GLibSource.h>
#include "LockScreenAbstractShield.h"

namespace unity
{
namespace lockscreen
{

class BackgroundSettings;
class UserAuthenticator;
class UserPromptView;
class Panel;
class CofView;

class Shield : public AbstractShield
{
public:
  Shield(session::Manager::Ptr const&,
         indicator::Indicators::Ptr const&,
         Accelerators::Ptr const&,
         nux::ObjectPtr<UserPromptView> const&,
         int monitor, bool is_primary);

  bool HasGrab() const override;
  bool IsIndicatorOpen() const override;
  void ActivatePanel() override;

protected:
  bool AcceptKeyNavFocus() override;
  nux::Area* FindKeyFocusArea(unsigned int, unsigned long, unsigned long) override;
  nux::Area* FindAreaUnderMouse(nux::Point const&, nux::NuxEventType) override;

private:
  void UpdateBackgroundTexture();
  void GrabScreen(bool cancel_on_failure);
  void ShowPrimaryView();
  void ShowSecondaryView();
  void UpdateScale();
  Panel* CreatePanel();

  std::shared_ptr<BackgroundSettings> bg_settings_;
  std::unique_ptr<nux::AbstractPaintLayer> background_layer_;
  nux::ObjectPtr<nux::Layout> primary_layout_;
  nux::ObjectPtr<nux::Layout> prompt_layout_;
  nux::ObjectPtr<nux::Layout> cof_layout_;
  connection::Wrapper panel_active_conn_;
  connection::Wrapper regrab_conn_;
  glib::Source::UniquePtr regrab_timeout_;
  Panel* panel_view_;
  CofView* cof_view_;
};

}
}

#endif