1 /*
2  * synergy -- mouse and keyboard sharing utility
3  * Copyright (C) 2012-2016 Symless Ltd.
4  * Copyright (C) 2002 Chris Schoeneman
5  *
6  * This package is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * found in the file LICENSE that should have accompanied this file.
9  *
10  * This package is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #include "base/XBase.h"
22 
23 //! Generic screen exception
24 XBASE_SUBCLASS(XScreen, XBase);
25 
26 //! Cannot open screen exception
27 /*!
28 Thrown when a screen cannot be opened or initialized.
29 */
30 XBASE_SUBCLASS_WHAT(XScreenOpenFailure, XScreen);
31 
32 //! XInput exception
33 /*!
34 Thrown when an XInput error occurs
35 */
36 XBASE_SUBCLASS_WHAT(XScreenXInputFailure, XScreen);
37 
38 //! Screen unavailable exception
39 /*!
40 Thrown when a screen cannot be opened or initialized but retrying later
41 may be successful.
42 */
43 class XScreenUnavailable : public XScreenOpenFailure {
44 public:
45     /*!
46     \c timeUntilRetry is the suggested time the caller should wait until
47     trying to open the screen again.
48     */
49     XScreenUnavailable(double timeUntilRetry);
50     virtual ~XScreenUnavailable() _NOEXCEPT;
51 
52     //! @name manipulators
53     //@{
54 
55     //! Get retry time
56     /*!
57     Returns the suggested time to wait until retrying to open the screen.
58     */
59     double                getRetryTime() const;
60 
61     //@}
62 
63 protected:
64     virtual String        getWhat() const throw();
65 
66 private:
67     double                m_timeUntilRetry;
68 };
69