indentation and timer
fluxgen fluxgen
2 files changed,
109 insertions(+),
113 deletions(-)
M
src/Slit.cc
→
src/Slit.cc
@@ -42,8 +42,7 @@
#include <algorithm> -Slit::Slit(BScreen *scr) { - screen = scr; +Slit::Slit(BScreen *scr):screen(scr), timer(this), slitmenu(this) { fluxbox = Fluxbox::instance(); on_top = screen->isSlitOnTop();@@ -52,11 +51,9 @@
display = screen->getBaseDisplay()->getXDisplay(); frame.window = frame.pixmap = None; - timer = new BTimer(fluxbox, this); - timer->setTimeout(fluxbox->getAutoRaiseDelay()); - timer->fireOnce(True); - - slitmenu = new Slitmenu(this); + + timer.setTimeout(fluxbox->getAutoRaiseDelay()); + timer.fireOnce(True); XSetWindowAttributes attrib; unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel |@@ -85,10 +82,6 @@
Slit::~Slit() { fluxbox->grab(); - - delete timer; - - delete slitmenu; screen->getImageControl()->removeImage(frame.pixmap);@@ -406,7 +399,7 @@
break; } - slitmenu->reconfigure(); + slitmenu.reconfigure(); }@@ -550,26 +543,26 @@ screen->raiseWindows(w, 1);
} else if (e->button == Button2 && (! on_top)) { XLowerWindow(display, frame.window); } else if (e->button == Button3) { - if (! slitmenu->isVisible()) { + if (! slitmenu.isVisible()) { int x, y; - x = e->x_root - (slitmenu->getWidth() / 2); - y = e->y_root - (slitmenu->getHeight() / 2); + x = e->x_root - (slitmenu.getWidth() / 2); + y = e->y_root - (slitmenu.getHeight() / 2); if (x < 0) x = 0; - else if (x + slitmenu->getWidth() > screen->getWidth()) - x = screen->getWidth() - slitmenu->getWidth(); + else if (x + slitmenu.getWidth() > screen->getWidth()) + x = screen->getWidth() - slitmenu.getWidth(); if (y < 0) y = 0; - else if (y + slitmenu->getHeight() > screen->getHeight()) - y = screen->getHeight() - slitmenu->getHeight(); + else if (y + slitmenu.getHeight() > screen->getHeight()) + y = screen->getHeight() - slitmenu.getHeight(); - slitmenu->move(x, y); - slitmenu->show(); + slitmenu.move(x, y); + slitmenu.show(); } else - slitmenu->hide(); + slitmenu.hide(); } }@@ -579,9 +572,9 @@ if (! do_auto_hide)
return; if (hidden) { - if (! timer->isTiming()) timer->start(); + if (! timer.isTiming()) timer.start(); } else { - if (timer->isTiming()) timer->stop(); + if (timer.isTiming()) timer.stop(); } }@@ -591,9 +584,9 @@ if (! do_auto_hide)
return; if (hidden) { - if (timer->isTiming()) timer->stop(); - } else if (! slitmenu->isVisible()) { - if (! timer->isTiming()) timer->start(); + if (timer.isTiming()) timer.stop(); + } else if (! slitmenu.isVisible()) { + if (! timer.isTiming()) timer.start(); } }
M
src/Slit.hh
→
src/Slit.hh
@@ -1,3 +1,6 @@
+// Slit.hh for Fluxbox +// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) +// // Slit.hh for Blackbox - an X11 Window manager // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) //@@ -18,9 +21,9 @@ // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. - -#ifndef SLIT_HH -#define SLIT_HH + +#ifndef SLIT_HH +#define SLIT_HH #include <X11/Xlib.h> #include <X11/Xutil.h>@@ -35,126 +38,126 @@ #include <list>
class Slitmenu : public Basemenu { private: - class Directionmenu : public Basemenu { - private: - Slitmenu *slitmenu; + class Directionmenu : public Basemenu { + private: + Slitmenu *slitmenu; - protected: - virtual void itemSelected(int, int); + protected: + virtual void itemSelected(int, int); - public: - Directionmenu(Slitmenu *); - }; + public: + Directionmenu(Slitmenu *); + }; - class Placementmenu : public Basemenu { - private: - Slitmenu *slitmenu; + class Placementmenu : public Basemenu { + private: + Slitmenu *slitmenu; - protected: - virtual void itemSelected(int, int); + protected: + virtual void itemSelected(int, int); - public: - Placementmenu(Slitmenu *); - }; + public: + Placementmenu(Slitmenu *); + }; - Directionmenu *directionmenu; - Placementmenu *placementmenu; + Directionmenu *directionmenu; + Placementmenu *placementmenu; - Slit *slit; + Slit *slit; - friend class Directionmenu; - friend class Placementmenu; - friend class Slit; + friend class Directionmenu; + friend class Placementmenu; + friend class Slit; protected: - virtual void itemSelected(int, int); - virtual void internal_hide(void); + virtual void itemSelected(int, int); + virtual void internal_hide(void); public: - Slitmenu(Slit *); - virtual ~Slitmenu(void); + explicit Slitmenu(Slit *); + virtual ~Slitmenu(void); - inline Basemenu *getDirectionmenu(void) { return directionmenu; } - inline Basemenu *getPlacementmenu(void) { return placementmenu; } + inline Basemenu *getDirectionmenu(void) { return directionmenu; } + inline Basemenu *getPlacementmenu(void) { return placementmenu; } - void reconfigure(void); + void reconfigure(void); }; class Slit : public TimeoutHandler { -private: - class SlitClient { - public: - Window window, client_window, icon_window; +public: + explicit Slit(BScreen *); + virtual ~Slit(); - int x, y; - unsigned int width, height; - }; + inline const bool isOnTop(void) const { return on_top; } + inline const bool isHidden(void) const { return hidden; } + inline const bool doAutoHide(void) const { return do_auto_hide; } - Bool on_top, hidden, do_auto_hide; - Display *display; + Slitmenu &getMenu() { return slitmenu; } - Fluxbox *fluxbox; - BScreen *screen; - BTimer *timer; + inline const Window &getWindowID() const { return frame.window; } - typedef std::list<SlitClient *> SlitClients; + inline const int getX(void) const + { return ((hidden) ? frame.x_hidden : frame.x); } + inline const int getY(void) const + { return ((hidden) ? frame.y_hidden : frame.y); } - SlitClients clientList; - Slitmenu *slitmenu; + inline const unsigned int getWidth(void) const { return frame.width; } + inline const unsigned int getHeight(void) const { return frame.height; } - struct frame { - Pixmap pixmap; - Window window; + void addClient(Window); + void removeClient(Window, bool = true); + void reconfigure(void); + void reposition(void); + void shutdown(void); - int x, y, x_hidden, y_hidden; - unsigned int width, height; - } frame; + void buttonPressEvent(XButtonEvent *); + void enterNotifyEvent(XCrossingEvent *); + void leaveNotifyEvent(XCrossingEvent *); + void configureRequestEvent(XConfigureRequestEvent *); - friend class Slitmenu; - friend class Slitmenu::Directionmenu; - friend class Slitmenu::Placementmenu; + virtual void timeout(void); + enum { VERTICAL = 1, HORIZONTAL }; + enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, + TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; -public: - Slit(BScreen *); - virtual ~Slit(); +private: + class SlitClient { + public: + Window window, client_window, icon_window; - inline const Bool &isOnTop(void) const { return on_top; } - inline const Bool &isHidden(void) const { return hidden; } - inline const Bool &doAutoHide(void) const { return do_auto_hide; } + int x, y; + unsigned int width, height; + }; + + void removeClient(SlitClient *, bool = true); + + Bool on_top, hidden, do_auto_hide; + Display *display; - inline Slitmenu *getMenu() { return slitmenu; } + Fluxbox *fluxbox; + BScreen *screen; + BTimer timer; - inline const Window &getWindowID() const { return frame.window; } + typedef std::list<SlitClient *> SlitClients; - inline const int &getX(void) const - { return ((hidden) ? frame.x_hidden : frame.x); } - inline const int &getY(void) const - { return ((hidden) ? frame.y_hidden : frame.y); } + SlitClients clientList; + Slitmenu slitmenu; - inline const unsigned int &getWidth(void) const { return frame.width; } - inline const unsigned int &getHeight(void) const { return frame.height; } + struct frame { + Pixmap pixmap; + Window window; - void addClient(Window); - void removeClient(SlitClient *, bool = true); - void removeClient(Window, bool = true); - void reconfigure(void); - void reposition(void); - void shutdown(void); + int x, y, x_hidden, y_hidden; + unsigned int width, height; + } frame; - void buttonPressEvent(XButtonEvent *); - void enterNotifyEvent(XCrossingEvent *); - void leaveNotifyEvent(XCrossingEvent *); - void configureRequestEvent(XConfigureRequestEvent *); - - virtual void timeout(void); - - enum { VERTICAL = 1, HORIZONTAL }; - enum { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER, - TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT }; + friend class Slitmenu; + friend class Slitmenu::Directionmenu; + friend class Slitmenu::Placementmenu; };