aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-01-12 17:56:15 (GMT)
committerfluxgen <fluxgen>2003-01-12 17:56:15 (GMT)
commitfcf431100c1729c8301aa48a884c3b0feef495cb (patch)
treeb6415038b5896a05128ecc50acabdbb876e30bed /src/Slit.hh
parentd3f98a9ca47ca0099da8415565dba00915cab588 (diff)
downloadfluxbox-fcf431100c1729c8301aa48a884c3b0feef495cb.zip
fluxbox-fcf431100c1729c8301aa48a884c3b0feef495cb.tar.bz2
major update, moved SlitClient to Slit.cc, changed frame.window to FbWindow type, changed menus to FbTk Menu type, fixed clientlist menu with cycle up/down functions, changed Slit to an EventHandler
Diffstat (limited to 'src/Slit.hh')
-rw-r--r--src/Slit.hh162
1 files changed, 48 insertions, 114 deletions
diff --git a/src/Slit.hh b/src/Slit.hh
index e2542f7..3a7c437 100644
--- a/src/Slit.hh
+++ b/src/Slit.hh
@@ -22,12 +22,14 @@
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: Slit.hh,v 1.17 2003/01/09 22:06:49 fluxgen Exp $ 25/// $Id: Slit.hh,v 1.18 2003/01/12 17:53:10 fluxgen Exp $
26 26
27#ifndef SLIT_HH 27#ifndef SLIT_HH
28#define SLIT_HH 28#define SLIT_HH
29 29
30#include "Basemenu.hh" 30#include "Menu.hh"
31#include "FbWindow.hh"
32#include "Timer.hh"
31 33
32#include <X11/Xlib.h> 34#include <X11/Xlib.h>
33#include <X11/Xutil.h> 35#include <X11/Xutil.h>
@@ -35,95 +37,43 @@
35#include <list> 37#include <list>
36#include <string> 38#include <string>
37#include <memory> 39#include <memory>
38 40class BScreen;
39// forward declaration 41class SlitClient;
40class Slit;
41
42/// menu in slit
43class Slitmenu : public Basemenu {
44public:
45 explicit Slitmenu(Slit &theslist);
46 virtual ~Slitmenu();
47
48 const Basemenu &getDirectionmenu() const { return m_directionmenu; }
49 const Basemenu &getPlacementmenu() const { return m_placementmenu; }
50
51#ifdef XINERAMA
52 const Basemenu *getHeadmenu() const { return m_headmenu.get(); }
53#endif // XINERAMA
54
55 void reconfigure();
56
57protected:
58 virtual void itemSelected(int button, unsigned int index);
59 virtual void internal_hide();
60
61private:
62 class Directionmenu : public Basemenu {
63 public:
64 Directionmenu(Slitmenu &sm);
65
66 protected:
67 virtual void itemSelected(int button, unsigned int index);
68
69 private:
70 Slitmenu &slitmenu;
71 };
72
73 class Placementmenu : public Basemenu {
74 public:
75 Placementmenu(Slitmenu &sm);
76
77 protected:
78 virtual void itemSelected(int button, unsigned int index);
79
80 private:
81 Slitmenu &slitmenu;
82 };
83
84 Slit &slit;
85
86#ifdef XINERAMA
87 class Headmenu : public Basemenu {
88 public:
89 Headmenu(Slitmenu &sm);
90 protected:
91 virtual void itemSelected(int button, unsigned int index);
92 private:
93 Slitmenu &slitmenu;
94 };
95 friend class Headmenu;
96 std::auto_ptr<Headmenu> m_headmenu;
97#endif // XINERAMA
98
99 Placementmenu m_placementmenu;
100 Directionmenu m_directionmenu;
101
102
103
104 friend class Directionmenu;
105 friend class Placementmenu;
106};
107 42
108/// Handles dock apps 43/// Handles dock apps
109class Slit : public FbTk::TimeoutHandler { 44class Slit : public FbTk::TimeoutHandler, public FbTk::EventHandler {
110public: 45public:
111 explicit Slit(BScreen *screen); 46
47 /**
48 Client alignment
49 */
50 enum Direction { VERTICAL = 1, HORIZONTAL };
51 /**
52 Screen placement
53 */
54 enum Placement { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER,
55 TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT };
56
57 explicit Slit(BScreen &screen, const char *filename = 0);
112 virtual ~Slit(); 58 virtual ~Slit();
113 59
114 inline bool isOnTop() const { return on_top; } 60 inline bool isOnTop() const { return on_top; }
115 inline bool isHidden() const { return hidden; } 61 inline bool isHidden() const { return hidden; }
116 inline bool doAutoHide() const { return do_auto_hide; } 62 inline bool doAutoHide() const { return do_auto_hide; }
63 inline Direction direction() const { return m_direction; }
64 inline Placement placement() const { return m_placement; }
65 FbTk::Menu &menu() { return slitmenu; }
117 66
118 Slitmenu &menu() { return slitmenu; } 67 inline Window getWindowID() const { return frame.window.window(); }
119
120 inline const Window &getWindowID() const { return frame.window; }
121 68
122 inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); } 69 inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); }
123 inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); } 70 inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); }
124 71
125 inline unsigned int width() const { return frame.width; } 72 inline unsigned int width() const { return frame.width; }
126 inline unsigned int height() const { return frame.height; } 73 inline unsigned int height() const { return frame.height; }
74
75 void setDirection(Direction dir);
76 void setPlacement(Placement place);
127 void setOnTop(bool val); 77 void setOnTop(bool val);
128 void setAutoHide(bool val); 78 void setAutoHide(bool val);
129 void addClient(Window clientwin); 79 void addClient(Window clientwin);
@@ -131,57 +81,39 @@ public:
131 void reconfigure(); 81 void reconfigure();
132 void reposition(); 82 void reposition();
133 void shutdown(); 83 void shutdown();
84 /// save clients name in a file
134 void saveClientList(); 85 void saveClientList();
86 /// cycle slit clients up one step
87 void cycleClientsUp();
88 /// cycle slit clients down one step
89 void cycleClientsDown();
90
135 BScreen *screen() { return m_screen; } 91 BScreen *screen() { return m_screen; }
136 const BScreen *screen() const { return m_screen; } 92 const BScreen *screen() const { return m_screen; }
137 /** 93 /**
138 @name eventhandlers 94 @name eventhandlers
139 */ 95 */
140 //@{ 96 //@{
141 void buttonPressEvent(XButtonEvent *bp); 97 void handleEvent(XEvent &event);
142 void enterNotifyEvent(XCrossingEvent *en); 98 void buttonPressEvent(XButtonEvent &event);
143 void leaveNotifyEvent(XCrossingEvent *ln); 99 void enterNotifyEvent(XCrossingEvent &event);
144 void configureRequestEvent(XConfigureRequestEvent *cr); 100 void leaveNotifyEvent(XCrossingEvent &event);
101 void configureRequestEvent(XConfigureRequestEvent &event);
145 //@} 102 //@}
146 103
147 virtual void timeout(); 104 virtual void timeout();
148 105
149 /**
150 Client alignment
151 */
152 enum { VERTICAL = 1, HORIZONTAL };
153 /**
154 Screen placement
155 */
156 enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER,
157 TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT };
158 106
159private: 107private:
160 class SlitClient { 108 void setupMenu();
161 public:
162 SlitClient(BScreen *screen, Window client_window); // For adding an actual window
163 SlitClient(const char *name); // For adding a placeholder
164
165 // Now we pre-initialize a list of slit clients with names for
166 // comparison with incoming client windows. This allows the slit
167 // to maintain a sorted order based on a saved window name list.
168 // Incoming windows not found in the list are appended. Matching
169 // duplicates are inserted after the last found instance of the
170 // matching name.
171 std::string match_name;
172
173 Window window, client_window, icon_window;
174
175 int x, y;
176 unsigned int width, height;
177
178 void initialize(BScreen *screen = 0, Window client_window= None);
179 };
180 109
181 void removeClient(SlitClient *client, bool remap, bool destroy); 110 void removeClient(SlitClient *client, bool remap, bool destroy);
182 void loadClientList(); 111 void loadClientList(const char *filename);
183 112 void updateClientmenu();
113
184 bool on_top, hidden, do_auto_hide; 114 bool on_top, hidden, do_auto_hide;
115 Direction m_direction;
116 Placement m_placement;
185 117
186 BScreen *m_screen; 118 BScreen *m_screen;
187 FbTk::Timer timer; 119 FbTk::Timer timer;
@@ -189,17 +121,19 @@ private:
189 typedef std::list<SlitClient *> SlitClients; 121 typedef std::list<SlitClient *> SlitClients;
190 122
191 SlitClients clientList; 123 SlitClients clientList;
192 Slitmenu slitmenu; 124 FbTk::Menu slitmenu, placement_menu, clientlist_menu;
193 std::string clientListPath; 125 std::string clientListPath;
126 std::string m_filename;
194 127
195 struct frame { 128 struct frame {
196 Pixmap pixmap; 129 Pixmap pixmap;
197 Window window; 130 FbTk::FbWindow window;
198 131
199 int x, y, x_hidden, y_hidden; 132 int x, y, x_hidden, y_hidden;
200 unsigned int width, height; 133 unsigned int width, height;
201 } frame; 134 } frame;
202 135 // for KDE
136 Atom kwm1_dockwindow, kwm2_dockwindow;
203}; 137};
204 138
205 139