summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-03-19 00:07:00 (GMT)
committerfluxgen <fluxgen>2002-03-19 00:07:00 (GMT)
commit6c1f079fbd223946863ad445f8ffffbddf65f169 (patch)
tree98e62a850525e000abc44f1788c2c34bdfff6cd4 /src
parent3ac8394996acf85a504f05d445a52e4dcea30155 (diff)
downloadfluxbox_lack-6c1f079fbd223946863ad445f8ffffbddf65f169.zip
fluxbox_lack-6c1f079fbd223946863ad445f8ffffbddf65f169.tar.bz2
indentation and timer
Diffstat (limited to 'src')
-rw-r--r--src/Slit.cc47
-rw-r--r--src/Slit.hh189
2 files changed, 116 insertions, 120 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 19cce1a..ef16c2f 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -42,8 +42,7 @@
42#include <algorithm> 42#include <algorithm>
43 43
44 44
45Slit::Slit(BScreen *scr) { 45Slit::Slit(BScreen *scr):screen(scr), timer(this), slitmenu(this) {
46 screen = scr;
47 fluxbox = Fluxbox::instance(); 46 fluxbox = Fluxbox::instance();
48 47
49 on_top = screen->isSlitOnTop(); 48 on_top = screen->isSlitOnTop();
@@ -52,11 +51,9 @@ Slit::Slit(BScreen *scr) {
52 display = screen->getBaseDisplay()->getXDisplay(); 51 display = screen->getBaseDisplay()->getXDisplay();
53 frame.window = frame.pixmap = None; 52 frame.window = frame.pixmap = None;
54 53
55 timer = new BTimer(fluxbox, this); 54
56 timer->setTimeout(fluxbox->getAutoRaiseDelay()); 55 timer.setTimeout(fluxbox->getAutoRaiseDelay());
57 timer->fireOnce(True); 56 timer.fireOnce(True);
58
59 slitmenu = new Slitmenu(this);
60 57
61 XSetWindowAttributes attrib; 58 XSetWindowAttributes attrib;
62 unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | 59 unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel |
@@ -86,10 +83,6 @@ Slit::Slit(BScreen *scr) {
86Slit::~Slit() { 83Slit::~Slit() {
87 fluxbox->grab(); 84 fluxbox->grab();
88 85
89 delete timer;
90
91 delete slitmenu;
92
93 screen->getImageControl()->removeImage(frame.pixmap); 86 screen->getImageControl()->removeImage(frame.pixmap);
94 87
95 fluxbox->removeSlitSearch(frame.window); 88 fluxbox->removeSlitSearch(frame.window);
@@ -406,7 +399,7 @@ void Slit::reconfigure(void) {
406 break; 399 break;
407 } 400 }
408 401
409 slitmenu->reconfigure(); 402 slitmenu.reconfigure();
410} 403}
411 404
412 405
@@ -550,26 +543,26 @@ void Slit::buttonPressEvent(XButtonEvent *e) {
550 } else if (e->button == Button2 && (! on_top)) { 543 } else if (e->button == Button2 && (! on_top)) {
551 XLowerWindow(display, frame.window); 544 XLowerWindow(display, frame.window);
552 } else if (e->button == Button3) { 545 } else if (e->button == Button3) {
553 if (! slitmenu->isVisible()) { 546 if (! slitmenu.isVisible()) {
554 int x, y; 547 int x, y;
555 548
556 x = e->x_root - (slitmenu->getWidth() / 2); 549 x = e->x_root - (slitmenu.getWidth() / 2);
557 y = e->y_root - (slitmenu->getHeight() / 2); 550 y = e->y_root - (slitmenu.getHeight() / 2);
558 551
559 if (x < 0) 552 if (x < 0)
560 x = 0; 553 x = 0;
561 else if (x + slitmenu->getWidth() > screen->getWidth()) 554 else if (x + slitmenu.getWidth() > screen->getWidth())
562 x = screen->getWidth() - slitmenu->getWidth(); 555 x = screen->getWidth() - slitmenu.getWidth();
563 556
564 if (y < 0) 557 if (y < 0)
565 y = 0; 558 y = 0;
566 else if (y + slitmenu->getHeight() > screen->getHeight()) 559 else if (y + slitmenu.getHeight() > screen->getHeight())
567 y = screen->getHeight() - slitmenu->getHeight(); 560 y = screen->getHeight() - slitmenu.getHeight();
568 561
569 slitmenu->move(x, y); 562 slitmenu.move(x, y);
570 slitmenu->show(); 563 slitmenu.show();
571 } else 564 } else
572 slitmenu->hide(); 565 slitmenu.hide();
573 } 566 }
574} 567}
575 568
@@ -579,9 +572,9 @@ void Slit::enterNotifyEvent(XCrossingEvent *) {
579 return; 572 return;
580 573
581 if (hidden) { 574 if (hidden) {
582 if (! timer->isTiming()) timer->start(); 575 if (! timer.isTiming()) timer.start();
583 } else { 576 } else {
584 if (timer->isTiming()) timer->stop(); 577 if (timer.isTiming()) timer.stop();
585 } 578 }
586} 579}
587 580
@@ -591,9 +584,9 @@ void Slit::leaveNotifyEvent(XCrossingEvent *) {
591 return; 584 return;
592 585
593 if (hidden) { 586 if (hidden) {
594 if (timer->isTiming()) timer->stop(); 587 if (timer.isTiming()) timer.stop();
595 } else if (! slitmenu->isVisible()) { 588 } else if (! slitmenu.isVisible()) {
596 if (! timer->isTiming()) timer->start(); 589 if (! timer.isTiming()) timer.start();
597 } 590 }
598} 591}
599 592
diff --git a/src/Slit.hh b/src/Slit.hh
index 2c29af6..d07cfe0 100644
--- a/src/Slit.hh
+++ b/src/Slit.hh
@@ -1,3 +1,6 @@
1// Slit.hh for Fluxbox
2// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3//
1// Slit.hh for Blackbox - an X11 Window manager 4// Slit.hh for Blackbox - an X11 Window manager
2// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) 5// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
3// 6//
@@ -18,9 +21,9 @@
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// 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
20// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
21 24
22#ifndef SLIT_HH 25#ifndef SLIT_HH
23#define SLIT_HH 26#define SLIT_HH
24 27
25#include <X11/Xlib.h> 28#include <X11/Xlib.h>
26#include <X11/Xutil.h> 29#include <X11/Xutil.h>
@@ -35,126 +38,126 @@ class Slitmenu;
35 38
36class Slitmenu : public Basemenu { 39class Slitmenu : public Basemenu {
37private: 40private:
38 class Directionmenu : public Basemenu { 41 class Directionmenu : public Basemenu {
39 private: 42 private:
40 Slitmenu *slitmenu; 43 Slitmenu *slitmenu;
41 44
42 protected: 45 protected:
43 virtual void itemSelected(int, int); 46 virtual void itemSelected(int, int);
44 47
45 public: 48 public:
46 Directionmenu(Slitmenu *); 49 Directionmenu(Slitmenu *);
47 }; 50 };
48 51
49 class Placementmenu : public Basemenu { 52 class Placementmenu : public Basemenu {
50 private: 53 private:
51 Slitmenu *slitmenu; 54 Slitmenu *slitmenu;
52 55
53 protected: 56 protected:
54 virtual void itemSelected(int, int); 57 virtual void itemSelected(int, int);
55 58
56 public: 59 public:
57 Placementmenu(Slitmenu *); 60 Placementmenu(Slitmenu *);
58 }; 61 };
59 62
60 Directionmenu *directionmenu; 63 Directionmenu *directionmenu;
61 Placementmenu *placementmenu; 64 Placementmenu *placementmenu;
62 65
63 Slit *slit; 66 Slit *slit;
64 67
65 friend class Directionmenu; 68 friend class Directionmenu;
66 friend class Placementmenu; 69 friend class Placementmenu;
67 friend class Slit; 70 friend class Slit;
68 71
69 72
70protected: 73protected:
71 virtual void itemSelected(int, int); 74 virtual void itemSelected(int, int);
72 virtual void internal_hide(void); 75 virtual void internal_hide(void);
73 76
74 77
75public: 78public:
76 Slitmenu(Slit *); 79 explicit Slitmenu(Slit *);
77 virtual ~Slitmenu(void); 80 virtual ~Slitmenu(void);
78 81
79 inline Basemenu *getDirectionmenu(void) { return directionmenu; } 82 inline Basemenu *getDirectionmenu(void) { return directionmenu; }
80 inline Basemenu *getPlacementmenu(void) { return placementmenu; } 83 inline Basemenu *getPlacementmenu(void) { return placementmenu; }
81 84
82 void reconfigure(void); 85 void reconfigure(void);
83}; 86};
84 87
85 88
86class Slit : public TimeoutHandler { 89class Slit : public TimeoutHandler {
87private:
88 class SlitClient {
89 public:
90 Window window, client_window, icon_window;
91
92 int x, y;
93 unsigned int width, height;
94 };
95
96 Bool on_top, hidden, do_auto_hide;
97 Display *display;
98
99 Fluxbox *fluxbox;
100 BScreen *screen;
101 BTimer *timer;
102
103 typedef std::list<SlitClient *> SlitClients;
104
105 SlitClients clientList;
106 Slitmenu *slitmenu;
107
108 struct frame {
109 Pixmap pixmap;
110 Window window;
111
112 int x, y, x_hidden, y_hidden;
113 unsigned int width, height;
114 } frame;
115
116 friend class Slitmenu;
117 friend class Slitmenu::Directionmenu;
118 friend class Slitmenu::Placementmenu;
119
120
121public: 90public:
122 Slit(BScreen *); 91 explicit Slit(BScreen *);
123 virtual ~Slit(); 92 virtual ~Slit();
93
94 inline const bool isOnTop(void) const { return on_top; }
95 inline const bool isHidden(void) const { return hidden; }
96 inline const bool doAutoHide(void) const { return do_auto_hide; }
124 97
125 inline const Bool &isOnTop(void) const { return on_top; } 98 Slitmenu &getMenu() { return slitmenu; }
126 inline const Bool &isHidden(void) const { return hidden; }
127 inline const Bool &doAutoHide(void) const { return do_auto_hide; }
128 99
129 inline Slitmenu *getMenu() { return slitmenu; } 100 inline const Window &getWindowID() const { return frame.window; }
130 101
131 inline const Window &getWindowID() const { return frame.window; } 102 inline const int getX(void) const
103 { return ((hidden) ? frame.x_hidden : frame.x); }
104 inline const int getY(void) const
105 { return ((hidden) ? frame.y_hidden : frame.y); }
132 106
133 inline const int &getX(void) const 107 inline const unsigned int getWidth(void) const { return frame.width; }
134 { return ((hidden) ? frame.x_hidden : frame.x); } 108 inline const unsigned int getHeight(void) const { return frame.height; }
135 inline const int &getY(void) const
136 { return ((hidden) ? frame.y_hidden : frame.y); }
137 109
138 inline const unsigned int &getWidth(void) const { return frame.width; } 110 void addClient(Window);
139 inline const unsigned int &getHeight(void) const { return frame.height; } 111 void removeClient(Window, bool = true);
112 void reconfigure(void);
113 void reposition(void);
114 void shutdown(void);
140 115
141 void addClient(Window); 116 void buttonPressEvent(XButtonEvent *);
142 void removeClient(SlitClient *, bool = true); 117 void enterNotifyEvent(XCrossingEvent *);
143 void removeClient(Window, bool = true); 118 void leaveNotifyEvent(XCrossingEvent *);
144 void reconfigure(void); 119 void configureRequestEvent(XConfigureRequestEvent *);
145 void reposition(void);
146 void shutdown(void);
147 120
148 void buttonPressEvent(XButtonEvent *); 121 virtual void timeout(void);
149 void enterNotifyEvent(XCrossingEvent *);
150 void leaveNotifyEvent(XCrossingEvent *);
151 void configureRequestEvent(XConfigureRequestEvent *);
152 122
153 virtual void timeout(void); 123 enum { VERTICAL = 1, HORIZONTAL };
124 enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER,
125 TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT };
154 126
155 enum { VERTICAL = 1, HORIZONTAL }; 127private:
156 enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, 128 class SlitClient {
157 TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; 129 public:
130 Window window, client_window, icon_window;
131
132 int x, y;
133 unsigned int width, height;
134 };
135
136 void removeClient(SlitClient *, bool = true);
137
138 Bool on_top, hidden, do_auto_hide;
139 Display *display;
140
141 Fluxbox *fluxbox;
142 BScreen *screen;
143 BTimer timer;
144
145 typedef std::list<SlitClient *> SlitClients;
146
147 SlitClients clientList;
148 Slitmenu slitmenu;
149
150 struct frame {
151 Pixmap pixmap;
152 Window window;
153
154 int x, y, x_hidden, y_hidden;
155 unsigned int width, height;
156 } frame;
157
158 friend class Slitmenu;
159 friend class Slitmenu::Directionmenu;
160 friend class Slitmenu::Placementmenu;
158}; 161};
159 162
160 163