aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-02-18 15:11:12 (GMT)
committerrathnor <rathnor>2003-02-18 15:11:12 (GMT)
commitb4ffe4fe21699c7123728aeeb99576a540b3694e (patch)
treef8a133be750f844f3c48f5a631fb8bf088544549 /src/Slit.cc
parentaa602770fbbd4e84154028d3181d275b81ea914d (diff)
downloadfluxbox-b4ffe4fe21699c7123728aeeb99576a540b3694e.zip
fluxbox-b4ffe4fe21699c7123728aeeb99576a540b3694e.tar.bz2
Added layer menus for windows, toolbar, and slit, plus associated
resources. Cleaned up some cruft from the previous layering setup.
Diffstat (limited to 'src/Slit.cc')
-rw-r--r--src/Slit.cc47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index c565867..65e1b63 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -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: Slit.cc,v 1.34 2003/02/17 12:53:21 fluxgen Exp $ 25// $Id: Slit.cc,v 1.35 2003/02/18 15:11:08 rathnor Exp $
26 26
27#include "Slit.hh" 27#include "Slit.hh"
28 28
@@ -43,6 +43,9 @@
43#include "BoolMenuItem.hh" 43#include "BoolMenuItem.hh"
44#include "EventManager.hh" 44#include "EventManager.hh"
45#include "MacroCommand.hh" 45#include "MacroCommand.hh"
46#include "LayerMenu.hh"
47#include "fluxbox.hh"
48#include "XLayer.hh"
46 49
47#include <algorithm> 50#include <algorithm>
48#include <iostream> 51#include <iostream>
@@ -104,6 +107,7 @@ void getWMName(BScreen *screen, Window window, std::string& name) {
104} 107}
105 108
106}; 109};
110
107/// holds slit client info 111/// holds slit client info
108class SlitClient { 112class SlitClient {
109public: 113public:
@@ -226,8 +230,8 @@ private:
226 230
227}; // End anonymous namespace 231}; // End anonymous namespace
228 232
229Slit::Slit(BScreen &scr, const char *filename): 233Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
230 m_screen(&scr), timer(this), 234 : m_screen(&scr), timer(this),
231 slitmenu(*scr.menuTheme(), 235 slitmenu(*scr.menuTheme(),
232 scr.getScreenNumber(), 236 scr.getScreenNumber(),
233 *scr.getImageControl()), 237 *scr.getImageControl()),
@@ -236,12 +240,20 @@ Slit::Slit(BScreen &scr, const char *filename):
236 *scr.getImageControl()), 240 *scr.getImageControl()),
237 clientlist_menu(*scr.menuTheme(), 241 clientlist_menu(*scr.menuTheme(),
238 scr.getScreenNumber(), 242 scr.getScreenNumber(),
239 *scr.getImageControl()) { 243 *scr.getImageControl()),
244 slit_layermenu(0),
245 m_layeritem(0)
246{
247
248 slit_layermenu = new LayerMenu<Slit>(*scr.menuTheme(),
249 scr.getScreenNumber(),
250 *scr.getImageControl(),
251 *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()),
252 this);
240 253
241 // default placement and direction 254 // default placement and direction
242 m_direction = HORIZONTAL; 255 m_direction = HORIZONTAL;
243 m_placement = TOPLEFT; 256 m_placement = TOPLEFT;
244 on_top = false;
245 hidden = do_auto_hide = false; 257 hidden = do_auto_hide = false;
246 258
247 frame.pixmap = None; 259 frame.pixmap = None;
@@ -270,6 +282,7 @@ Slit::Slit(BScreen &scr, const char *filename):
270 create_mask, &attrib); 282 create_mask, &attrib);
271 283
272 FbTk::EventManager::instance()->add(*this, frame.window); 284 FbTk::EventManager::instance()->add(*this, frame.window);
285 m_layeritem = new FbTk::XLayerItem(frame.window, layer);
273 286
274 //For KDE dock applets 287 //For KDE dock applets
275 kwm1_dockwindow = XInternAtom(disp, "KWM_DOCKWINDOW", False); //KDE v1.x 288 kwm1_dockwindow = XInternAtom(disp, "KWM_DOCKWINDOW", False); //KDE v1.x
@@ -287,6 +300,8 @@ Slit::Slit(BScreen &scr, const char *filename):
287Slit::~Slit() { 300Slit::~Slit() {
288 if (frame.pixmap != 0) 301 if (frame.pixmap != 0)
289 screen()->getImageControl()->removeImage(frame.pixmap); 302 screen()->getImageControl()->removeImage(frame.pixmap);
303 if (m_layeritem) delete m_layeritem;
304 if (slit_layermenu) delete slit_layermenu;
290} 305}
291 306
292 307
@@ -904,13 +919,7 @@ void Slit::buttonPressEvent(XButtonEvent &e) {
904 if (e.window != frame.window.window()) 919 if (e.window != frame.window.window())
905 return; 920 return;
906 921
907 if (e.button == Button1 && (! on_top)) { 922 if (e.button == Button3) {
908 Workspace::Stack st;
909 st.push_back(frame.window.window());
910 screen()->raiseWindows(st);
911 } else if (e.button == Button2 && (! on_top)) {
912 frame.window.lower();
913 } else if (e.button == Button3) {
914 if (! slitmenu.isVisible()) { 923 if (! slitmenu.isVisible()) {
915 int x = e.x_root - (slitmenu.width() / 2), 924 int x = e.x_root - (slitmenu.width() / 2),
916 y = e.y_root - (slitmenu.height() / 2); 925 y = e.y_root - (slitmenu.height() / 2);
@@ -1068,13 +1077,6 @@ void Slit::saveClientList() {
1068 } 1077 }
1069} 1078}
1070 1079
1071void Slit::setOnTop(bool val) {
1072 if (isOnTop())
1073 screen()->raiseWindows(Workspace::Stack());
1074
1075}
1076
1077
1078void Slit::setAutoHide(bool val) { 1080void Slit::setAutoHide(bool val) {
1079 do_auto_hide = val; 1081 do_auto_hide = val;
1080} 1082}
@@ -1091,11 +1093,8 @@ void Slit::setupMenu() {
1091 CommonSet, CommonPlacementTitle, 1093 CommonSet, CommonPlacementTitle,
1092 "Placement"), 1094 "Placement"),
1093 &placement_menu); 1095 &placement_menu);
1094 slitmenu.insert(new BoolMenuItem(i18n->getMessage( 1096
1095 CommonSet, CommonAlwaysOnTop, 1097 slitmenu.insert("Layer...", slit_layermenu);
1096 "Always on top"),
1097 on_top,
1098 menu_cmd));
1099 1098
1100 slitmenu.insert(new BoolMenuItem(i18n->getMessage( 1099 slitmenu.insert(new BoolMenuItem(i18n->getMessage(
1101 CommonSet, CommonAutoHide, 1100 CommonSet, CommonAutoHide,