diff options
author | fluxgen <fluxgen> | 2002-01-20 02:09:40 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-01-20 02:09:40 (GMT) |
commit | fdb6b3f41b0fc45ffc2b31454807b32dd5b5bbf6 (patch) | |
tree | abcb6d1a1a3cfca11d3afa7c4c17fcd0033616c5 | |
parent | 6c10acb3cb57a6038202e8967ecd64ac234d0075 (diff) | |
download | fluxbox-fdb6b3f41b0fc45ffc2b31454807b32dd5b5bbf6.zip fluxbox-fdb6b3f41b0fc45ffc2b31454807b32dd5b5bbf6.tar.bz2 |
Added GrabGuard class
-rw-r--r-- | src/BaseDisplay.hh | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/BaseDisplay.hh b/src/BaseDisplay.hh index 8513699..3165aae 100644 --- a/src/BaseDisplay.hh +++ b/src/BaseDisplay.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: BaseDisplay.hh,v 1.6 2002/01/10 12:52:51 fluxgen Exp $ | 25 | // $Id: BaseDisplay.hh,v 1.7 2002/01/20 02:09:40 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef _BASEDISPLAY_HH_ | 27 | #ifndef _BASEDISPLAY_HH_ |
28 | #define _BASEDISPLAY_HH_ | 28 | #define _BASEDISPLAY_HH_ |
@@ -31,11 +31,11 @@ | |||
31 | #include <X11/Xatom.h> | 31 | #include <X11/Xatom.h> |
32 | 32 | ||
33 | // forward declaration | 33 | // forward declaration |
34 | class BaseDisplay; | ||
35 | class ScreenInfo; | 34 | class ScreenInfo; |
36 | 35 | ||
37 | #include "LinkedList.hh" | 36 | #include "LinkedList.hh" |
38 | #include "Timer.hh" | 37 | #include "Timer.hh" |
38 | #include "NotCopyable.hh" | ||
39 | 39 | ||
40 | 40 | ||
41 | #define PropBlackboxHintsElements (5) | 41 | #define PropBlackboxHintsElements (5) |
@@ -45,6 +45,7 @@ class ScreenInfo; | |||
45 | void bexec(const char *, char *); | 45 | void bexec(const char *, char *); |
46 | #endif // !__EMX__ | 46 | #endif // !__EMX__ |
47 | 47 | ||
48 | |||
48 | template <typename Z> inline Z min(Z a, Z b) { return ((a < b) ? a : b); } | 49 | template <typename Z> inline Z min(Z a, Z b) { return ((a < b) ? a : b); } |
49 | template <typename Z> inline Z max(Z a, Z b) { return ((a > b) ? a : b); } | 50 | template <typename Z> inline Z max(Z a, Z b) { return ((a > b) ? a : b); } |
50 | 51 | ||
@@ -256,7 +257,18 @@ public: | |||
256 | // another pure virtual... this is used to handle signals that BaseDisplay | 257 | // another pure virtual... this is used to handle signals that BaseDisplay |
257 | // doesn't understand itself | 258 | // doesn't understand itself |
258 | virtual Bool handleSignal(int) = 0; | 259 | virtual Bool handleSignal(int) = 0; |
259 | 260 | ||
261 | class GrabGuard:private NotCopyable | ||
262 | { | ||
263 | public: | ||
264 | GrabGuard(BaseDisplay &bd):m_bd(bd) { } | ||
265 | ~GrabGuard() { m_bd.ungrab(); } | ||
266 | inline void grab() { m_bd.grab(); } | ||
267 | inline void ungrab() { m_bd.ungrab(); } | ||
268 | private: | ||
269 | BaseDisplay &m_bd; | ||
270 | }; | ||
271 | |||
260 | private: | 272 | private: |
261 | struct cursor { | 273 | struct cursor { |
262 | Cursor session, move, ll_angle, lr_angle; | 274 | Cursor session, move, ll_angle, lr_angle; |