2002-03-19 00:07:00 +00:00
|
|
|
// Slit.hh for Fluxbox
|
2003-01-05 23:42:27 +00:00
|
|
|
// Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
|
2002-03-19 00:07:00 +00:00
|
|
|
//
|
2001-12-11 20:47:02 +00:00
|
|
|
// Slit.hh for Blackbox - an X11 Window manager
|
2003-01-05 23:42:27 +00:00
|
|
|
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)
|
2001-12-11 20:47:02 +00:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
// 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.
|
2002-03-19 00:07:00 +00:00
|
|
|
|
2003-01-12 17:56:15 +00:00
|
|
|
/// $Id: Slit.hh,v 1.18 2003/01/12 17:53:10 fluxgen Exp $
|
2003-01-05 23:42:27 +00:00
|
|
|
|
2002-03-19 00:07:00 +00:00
|
|
|
#ifndef SLIT_HH
|
|
|
|
#define SLIT_HH
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2003-01-12 17:56:15 +00:00
|
|
|
#include "Menu.hh"
|
|
|
|
#include "FbWindow.hh"
|
|
|
|
#include "Timer.hh"
|
2002-11-14 00:15:10 +00:00
|
|
|
|
2001-12-11 20:47:02 +00:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
|
2002-02-04 22:33:09 +00:00
|
|
|
#include <list>
|
2002-05-29 06:21:59 +00:00
|
|
|
#include <string>
|
2002-11-14 00:15:10 +00:00
|
|
|
#include <memory>
|
2003-01-12 17:56:15 +00:00
|
|
|
class BScreen;
|
|
|
|
class SlitClient;
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2003-01-05 23:42:27 +00:00
|
|
|
/// Handles dock apps
|
2003-01-12 17:56:15 +00:00
|
|
|
class Slit : public FbTk::TimeoutHandler, public FbTk::EventHandler {
|
2001-12-11 20:47:02 +00:00
|
|
|
public:
|
2003-01-12 17:56:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Client alignment
|
|
|
|
*/
|
|
|
|
enum Direction { VERTICAL = 1, HORIZONTAL };
|
|
|
|
/**
|
|
|
|
Screen placement
|
|
|
|
*/
|
|
|
|
enum Placement { TOPLEFT = 1, CENTERLEFT, BOTTOMLEFT, TOPCENTER, BOTTOMCENTER,
|
|
|
|
TOPRIGHT, CENTERRIGHT, BOTTOMRIGHT };
|
|
|
|
|
|
|
|
explicit Slit(BScreen &screen, const char *filename = 0);
|
2002-12-01 13:42:15 +00:00
|
|
|
virtual ~Slit();
|
|
|
|
|
|
|
|
inline bool isOnTop() const { return on_top; }
|
|
|
|
inline bool isHidden() const { return hidden; }
|
|
|
|
inline bool doAutoHide() const { return do_auto_hide; }
|
2003-01-12 17:56:15 +00:00
|
|
|
inline Direction direction() const { return m_direction; }
|
|
|
|
inline Placement placement() const { return m_placement; }
|
|
|
|
FbTk::Menu &menu() { return slitmenu; }
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2003-01-12 17:56:15 +00:00
|
|
|
inline Window getWindowID() const { return frame.window.window(); }
|
2002-12-01 13:42:15 +00:00
|
|
|
|
|
|
|
inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); }
|
|
|
|
inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); }
|
|
|
|
|
|
|
|
inline unsigned int width() const { return frame.width; }
|
|
|
|
inline unsigned int height() const { return frame.height; }
|
2003-01-12 17:56:15 +00:00
|
|
|
|
|
|
|
void setDirection(Direction dir);
|
|
|
|
void setPlacement(Placement place);
|
2002-12-01 13:42:15 +00:00
|
|
|
void setOnTop(bool val);
|
|
|
|
void setAutoHide(bool val);
|
|
|
|
void addClient(Window clientwin);
|
|
|
|
void removeClient(Window clientwin, bool = true);
|
|
|
|
void reconfigure();
|
|
|
|
void reposition();
|
|
|
|
void shutdown();
|
2003-01-12 17:56:15 +00:00
|
|
|
/// save clients name in a file
|
2002-12-01 13:42:15 +00:00
|
|
|
void saveClientList();
|
2003-01-12 17:56:15 +00:00
|
|
|
/// cycle slit clients up one step
|
|
|
|
void cycleClientsUp();
|
|
|
|
/// cycle slit clients down one step
|
|
|
|
void cycleClientsDown();
|
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
BScreen *screen() { return m_screen; }
|
|
|
|
const BScreen *screen() const { return m_screen; }
|
|
|
|
/**
|
|
|
|
@name eventhandlers
|
|
|
|
*/
|
|
|
|
//@{
|
2003-01-12 17:56:15 +00:00
|
|
|
void handleEvent(XEvent &event);
|
|
|
|
void buttonPressEvent(XButtonEvent &event);
|
|
|
|
void enterNotifyEvent(XCrossingEvent &event);
|
|
|
|
void leaveNotifyEvent(XCrossingEvent &event);
|
|
|
|
void configureRequestEvent(XConfigureRequestEvent &event);
|
2002-12-01 13:42:15 +00:00
|
|
|
//@}
|
2002-08-04 15:55:13 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
virtual void timeout();
|
|
|
|
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-03-19 00:07:00 +00:00
|
|
|
private:
|
2003-01-12 17:56:15 +00:00
|
|
|
void setupMenu();
|
2002-03-19 00:07:00 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
void removeClient(SlitClient *client, bool remap, bool destroy);
|
2003-01-12 17:56:15 +00:00
|
|
|
void loadClientList(const char *filename);
|
|
|
|
void updateClientmenu();
|
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
bool on_top, hidden, do_auto_hide;
|
2003-01-12 17:56:15 +00:00
|
|
|
Direction m_direction;
|
|
|
|
Placement m_placement;
|
2002-08-04 15:55:13 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
BScreen *m_screen;
|
2003-01-09 22:06:49 +00:00
|
|
|
FbTk::Timer timer;
|
2002-03-19 00:07:00 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
typedef std::list<SlitClient *> SlitClients;
|
2002-03-19 00:07:00 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
SlitClients clientList;
|
2003-01-12 17:56:15 +00:00
|
|
|
FbTk::Menu slitmenu, placement_menu, clientlist_menu;
|
2002-12-01 13:42:15 +00:00
|
|
|
std::string clientListPath;
|
2003-01-12 17:56:15 +00:00
|
|
|
std::string m_filename;
|
2002-03-19 00:07:00 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
struct frame {
|
|
|
|
Pixmap pixmap;
|
2003-01-12 17:56:15 +00:00
|
|
|
FbTk::FbWindow window;
|
2002-03-19 00:07:00 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
int x, y, x_hidden, y_hidden;
|
|
|
|
unsigned int width, height;
|
|
|
|
} frame;
|
2003-01-12 17:56:15 +00:00
|
|
|
// for KDE
|
|
|
|
Atom kwm1_dockwindow, kwm2_dockwindow;
|
2001-12-11 20:47:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-08-04 15:55:13 +00:00
|
|
|
#endif // SLIT_HH
|