"Fossies" - the Fresh Open Source Software Archive 
Member "bbkeys-0.9.1/src/ScreenHandler.h" (6 Dec 2007, 4978 Bytes) of package /linux/privat/old/bbkeys-0.9.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "ScreenHandler.h" see the
Fossies "Dox" file reference documentation.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // -- ScreenHandler.h --
3 // Copyright (c) 2001 - 2003 Jason 'vanRijn' Kasper <vR at movingparts dot net>
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 // DEALINGS IN THE SOFTWARE.
22
23 // E_O_H_VR
24
25 #ifndef SCREENHANDLER_HH
26 #define SCREENHANDLER_HH
27
28 extern "C" {
29 #include <X11/Xlib.h>
30 }
31
32 #include <list>
33 #include <iostream>
34 #include <string>
35
36 #include "KeyClient.h"
37 #include "WindowlistMenu.h"
38 #include "KeyGrabber.h"
39 #include "Config.h"
40 #include "keytree.hh"
41 #include "Netclient.h"
42 #include "window.hh"
43
44 // the blackbox library
45 #include <Display.hh>
46 #include <EventHandler.hh>
47 #include <EWMH.hh>
48
49 class KeyClient;
50 class WindowlistMenu;
51 class keytree;
52
53 class ScreenHandler : public bt::EventHandler
54 {
55
56 public:
57 ScreenHandler (KeyClient * _k, unsigned int number);
58 ~ScreenHandler () ;
59 inline unsigned int getScreenNumber() const { return _screenNumber; }
60 inline unsigned int getDesktopNumber() const { return _active_desktop; }
61 void focusWindow(const XWindow * win);
62 bt::ustring getDesktopName(unsigned int desktopNbr) const;
63 inline Window getRootWindow() const { return _screenInfo.rootWindow(); }
64 inline KeyClient & getKeyClient() const { return * _keyClient; }
65 inline bool isManaged() const { return _managed; }
66 inline const bt::ScreenInfo & getScreenInfo() { return _screenInfo; }
67
68 void initialize();
69 bool grabKey(const KeyCode keyCode, const int modifierMask) const;
70 bool ungrabKey(const KeyCode keyCode, const int modifierMask) const;
71
72 const XWindow *lastActiveWindow() const;
73
74 private:
75 friend class WindowlistMenu;
76 bool _managed;
77 bool _debug;
78 bool _grabbed; // used for keygrab toggle function
79 bool _cycling; // used for window cycling
80 bool _raise_while_cycling;
81 bool _show_cycle_menu;
82 bool _honor_modifiers;
83 bool _follow_window_on_send;
84 bool _include_iconified_windows_in_cycle;
85 std::string _menu_text_justify;
86 unsigned int _workspace_columns;
87 unsigned int _workspace_rows;
88
89 unsigned int _screenNumber;
90 KeyClient * _keyClient;
91 bt::EWMH * _ewmh;
92 Netclient * _netclient;
93 Config * _config;
94 Display * _display;
95 Window _root;
96 KeyGrabber * _keyGrabber;
97 keytree * _keybindings;
98 int _numlockMask;
99 int _scrolllockMask;
100 std::string _wm_name;
101 WindowlistMenu * _windowmenu;
102
103
104 unsigned int _num_desktops;
105 unsigned int _active_desktop;
106 std::vector<bt::ustring> _desktop_names;
107
108
109 const bt::ScreenInfo & _screenInfo;
110
111 bool careAboutWindow(Window window) const ;
112 XWindow * findWindow(Window window) const ;
113 void p(void);
114
115 void keyPressEvent (const XKeyEvent * const e) ;
116 void keyReleaseEvent (const XKeyEvent * const e) ;
117 void propertyNotifyEvent(const XPropertyEvent * const e);
118 void updateNumDesktops();
119 void updateDesktopNames();
120 void updateActiveDesktop();
121 void updateActiveWindow();
122 void updateClientList();
123 void updateClientListStacking();
124
125 WindowList & _clients;
126 WindowList::iterator & _active;
127 WindowList::iterator _last_active;
128
129 bool nothingIsPressed(void) const;
130 bool findSupportingWM();
131
132 void cycleWindow(unsigned int state, const bool forward, const int increment,
133 const bool allscreens = false,
134 const bool alldesktops = false,
135 const bool sameclass = false,
136 const std::string &classname = "");
137 WindowList getCycleWindowList(unsigned int state, const bool forward, const int increment,
138 const bool allscreens = false,
139 const bool alldesktops = false,
140 const bool sameclass = false,
141 const std::string &classname = "");
142 void cycleWorkspace(const bool forward, const int increment,
143 const bool loop = true) const;
144 void changeWorkspace(const int num) const;
145 void changeWorkspaceVert(const int num) const;
146 void changeWorkspaceHorz(const int num) const;
147
148 void execCommand(const std::string &cmd) const;
149
150 };
151 #endif