cleaning, changed (void) to (), removed unused variable, added comments, moved MwmHints Decor and Func into class FluxboxWindow

This commit is contained in:
fluxgen 2002-05-30 00:38:22 +00:00
parent e4c8da3c33
commit b43aed4072

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Window.hh,v 1.21 2002/05/21 21:25:10 fluxgen Exp $ // $Id: Window.hh,v 1.22 2002/05/30 00:38:22 fluxgen Exp $
#ifndef WINDOW_HH #ifndef WINDOW_HH
#define WINDOW_HH #define WINDOW_HH
@ -30,8 +30,8 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef SHAPE #ifdef SHAPE
# include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#endif // SHAPE #endif // SHAPE
#include "BaseDisplay.hh" #include "BaseDisplay.hh"
@ -41,37 +41,8 @@
#include <vector> #include <vector>
#include <string> #include <string>
//#define PropMwmHintsElements 3
#define MwmHintsFunctions (1l << 0)
#define MwmHintsDecorations (1l << 1)
#define MwmFuncAll (1l << 0)
#define MwmFuncResize (1l << 1)
#define MwmFuncMove (1l << 2)
#define MwmFuncIconify (1l << 3)
#define MwmFuncMaximize (1l << 4)
#define MwmFuncClose (1l << 5)
#define MwmDecorAll (1l << 0)
#define MwmDecorBorder (1l << 1)
#define MwmDecorHandle (1l << 2)
#define MwmDecorTitle (1l << 3)
#define MwmDecorMenu (1l << 4)
#define MwmDecorIconify (1l << 5)
#define MwmDecorMaximize (1l << 6)
//names for buttons
#define NAME_STICKY "sticky"
#define NAME_MAXIMIZE "maximize"
#define NAME_MINIMIZE "minimize"
#define NAME_SHADE "shade"
#define NAME_CLOSE "close"
#define NAME_ICONIFY "iconify"
#define NAME_MENU "menu"
#define NAME_NONE "none"
#define PropMwmHintsElements 3
class Tab; class Tab;
class FluxboxWindow : public TimeoutHandler { class FluxboxWindow : public TimeoutHandler {
@ -98,15 +69,15 @@ public:
WIN_STATE_HID_WORKSPACE = (1<<6), // not on current desktop WIN_STATE_HID_WORKSPACE = (1<<6), // not on current desktop
WIN_STATE_HID_TRANSIENT = (1<<7), // owner of transient is hidden WIN_STATE_HID_TRANSIENT = (1<<7), // owner of transient is hidden
WIN_STATE_FIXED_POSITION = (1<<8), // window is fixed in position even WIN_STATE_FIXED_POSITION = (1<<8), // window is fixed in position even
WIN_STATE_ARRANGE_IGNORE = (1<<9) // ignore for auto arranging WIN_STATE_ARRANGE_IGNORE = (1<<9) // ignore for auto arranging
}; };
enum GnomeHints { enum GnomeHints {
WIN_HINTS_SKIP_FOCUS = (1<<0), // "alt-tab" skips this win WIN_HINTS_SKIP_FOCUS = (1<<0), // "alt-tab" skips this win
WIN_HINTS_SKIP_WINLIST = (1<<1), // do not show in window list WIN_HINTS_SKIP_WINLIST = (1<<1), // do not show in window list
WIN_HINTS_SKIP_TASKBAR = (1<<2), // do not show on taskbar WIN_HINTS_SKIP_TASKBAR = (1<<2), // do not show on taskbar
WIN_HINTS_GROUP_TRANSIENT = (1<<3), //Reserved - definition is unclear WIN_HINTS_GROUP_TRANSIENT = (1<<3), // Reserved - definition is unclear
WIN_HINTS_FOCUS_ON_CLICK = (1<<4) // app only accepts focus if clicked WIN_HINTS_FOCUS_ON_CLICK = (1<<4) // app only accepts focus if clicked
}; };
#endif #endif
@ -119,87 +90,112 @@ public:
enum Decoration {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL}; enum Decoration {DECOR_NONE=0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL};
//Motif wm Hints
enum {
MwmHintsFunctions = (1l << 0),
MwmHintsDecorations = (1l << 1)
};
FluxboxWindow(Window, BScreen * = 0); //Motif wm functions
virtual ~FluxboxWindow(void); enum MwmFunc{
MwmFuncAll = (1l << 0),
MwmFuncResize = (1l << 1),
MwmFuncMove = (1l << 2),
MwmFuncIconify = (1l << 3),
MwmFuncMaximize = (1l << 4),
MwmFuncClose = (1l << 5)
};
//Motif wm decorations
enum MwmDecor {
MwmDecorAll = (1l << 0),
MwmDecorBorder = (1l << 1),
MwmDecorHandle = (1l << 2),
MwmDecorTitle = (1l << 3),
MwmDecorMenu = (1l << 4),
MwmDecorIconify = (1l << 5),
MwmDecorMaximize = (1l << 6)
};
inline bool isTransient(void) const { return ((transient) ? true : false); } explicit FluxboxWindow(Window, BScreen *scr = 0);
inline bool hasTransient(void) const { return ((client.transient) ? true : false); } virtual ~FluxboxWindow();
inline bool isTransient() const { return ((transient) ? true : false); }
inline bool hasTransient() const { return ((client.transient) ? true : false); }
inline bool isManaged() const { return managed; } inline bool isManaged() const { return managed; }
inline bool isFocused(void) const { return focused; } inline bool isFocused() const { return focused; }
inline bool isVisible(void) const { return visible; } inline bool isVisible() const { return visible; }
inline bool isIconic(void) const { return iconic; } inline bool isIconic() const { return iconic; }
inline bool isShaded(void) const { return shaded; } inline bool isShaded() const { return shaded; }
inline bool isMaximized(void) const { return maximized; } inline bool isMaximized() const { return maximized; }
inline bool isIconifiable(void) const { return functions.iconify; } inline bool isIconifiable() const { return functions.iconify; }
inline bool isMaximizable(void) const { return functions.maximize; } inline bool isMaximizable() const { return functions.maximize; }
inline bool isResizable(void) const { return functions.resize; } inline bool isResizable() const { return functions.resize; }
inline bool isClosable(void) const { return functions.close; } inline bool isClosable() const { return functions.close; }
inline bool isStuck(void) const { return stuck; } inline bool isStuck() const { return stuck; }
inline bool hasTitlebar(void) const { return decorations.titlebar; } inline bool hasTitlebar() const { return decorations.titlebar; }
inline bool hasTab(void) const { return (tab!=0 ? true : false); } inline bool hasTab() const { return (tab!=0 ? true : false); }
inline bool isMoving(void) const { return moving; } inline bool isMoving() const { return moving; }
inline bool isResizing(void) const { return resizing; } inline bool isResizing() const { return resizing; }
inline BScreen *getScreen(void) const { return screen; } inline BScreen *getScreen() const { return screen; }
inline Tab *getTab(void) const { return tab; } inline Tab *getTab() const { return tab; }
inline FluxboxWindow *getTransient(void) const { return client.transient; } inline FluxboxWindow *getTransient() const { return client.transient; }
inline FluxboxWindow *getTransientFor(void) const { return client.transient_for; } inline FluxboxWindow *getTransientFor() const { return client.transient_for; }
inline const Window &getFrameWindow(void) const { return frame.window; } inline const Window &getFrameWindow() const { return frame.window; }
inline const Window &getClientWindow(void) const { return client.window; } inline const Window &getClientWindow() const { return client.window; }
inline Windowmenu *getWindowmenu(void) { return windowmenu; } inline Windowmenu *getWindowmenu() { return windowmenu; }
inline const std::string &getTitle(void) const { return client.title; } inline const std::string &getTitle() const { return client.title; }
inline const std::string &getIconTitle(void) const { return client.icon_title; } inline const std::string &getIconTitle() const { return client.icon_title; }
inline int getXFrame(void) const { return frame.x; } inline int getXFrame() const { return frame.x; }
inline int getYFrame(void) const { return frame.y; } inline int getYFrame() const { return frame.y; }
inline int getXClient(void) const { return client.x; } inline int getXClient() const { return client.x; }
inline int getYClient(void) const { return client.y; } inline int getYClient() const { return client.y; }
inline unsigned int getWorkspaceNumber(void) const { return workspace_number; } inline unsigned int getWorkspaceNumber() const { return workspace_number; }
inline int getWindowNumber(void) const { return window_number; } inline int getWindowNumber() const { return window_number; }
inline WinLayer getLayer(void) const { return m_layer; } inline WinLayer getLayer() const { return m_layer; }
inline unsigned int getWidth(void) const { return frame.width; } inline unsigned int getWidth() const { return frame.width; }
inline unsigned int getHeight(void) const { return frame.height; } inline unsigned int getHeight() const { return frame.height; }
inline unsigned int getClientHeight(void) const { return client.height; } inline unsigned int getClientHeight() const { return client.height; }
inline unsigned int getClientWidth(void) const { return client.width; } inline unsigned int getClientWidth() const { return client.width; }
inline unsigned int getTitleHeight(void) const { return frame.title_h; } inline unsigned int getTitleHeight() const { return frame.title_h; }
inline void setWindowNumber(int n) { window_number = n; } inline void setWindowNumber(int n) { window_number = n; }
inline const timeval &getLastFocusTime() const {return lastFocusTime;} inline const timeval &getLastFocusTime() const {return lastFocusTime;}
bool validateClient(void); bool validateClient();
bool setInputFocus(void); bool setInputFocus();
void setTab(bool flag); void setTab(bool flag);
void setFocusFlag(bool); void setFocusFlag(bool);
void iconify(void); void iconify();
void deiconify(bool = true, bool = true); void deiconify(bool = true, bool = true);
void close(void); void close();
void withdraw(void); void withdraw();
void maximize(unsigned int); void maximize(unsigned int);
void shade(void); void shade();
void stick(void); void stick();
void unstick(void); void unstick();
void reconfigure(void); void reconfigure();
void installColormap(bool); void installColormap(bool);
void restore(void); void restore();
void configure(int dx, int dy, unsigned int dw, unsigned int dh); void configure(int dx, int dy, unsigned int dw, unsigned int dh);
void setWorkspace(int n); void setWorkspace(int n);
void changeBlackboxHints(BaseDisplay::BlackboxHints *); void changeBlackboxHints(BaseDisplay::BlackboxHints *bh);
void restoreAttributes(void); void restoreAttributes();
bool isLowerTab(void) const; bool isLowerTab() const;
void buttonPressEvent(XButtonEvent *); void buttonPressEvent(XButtonEvent *be);
void buttonReleaseEvent(XButtonEvent *); void buttonReleaseEvent(XButtonEvent *be);
void motionNotifyEvent(XMotionEvent *); void motionNotifyEvent(XMotionEvent *me);
bool destroyNotifyEvent(XDestroyWindowEvent *); bool destroyNotifyEvent(XDestroyWindowEvent *dwe);
void mapRequestEvent(XMapRequestEvent *); void mapRequestEvent(XMapRequestEvent *mre);
void mapNotifyEvent(XMapEvent *); void mapNotifyEvent(XMapEvent *mapev);
bool unmapNotifyEvent(XUnmapEvent *); bool unmapNotifyEvent(XUnmapEvent *unmapev);
void propertyNotifyEvent(Atom); void propertyNotifyEvent(Atom a);
void exposeEvent(XExposeEvent *); void exposeEvent(XExposeEvent *ee);
void configureRequestEvent(XConfigureRequestEvent *); void configureRequestEvent(XConfigureRequestEvent *ce);
void setDecoration(Decoration decoration); void setDecoration(Decoration decoration);
void toggleDecoration(); void toggleDecoration();
@ -210,23 +206,28 @@ public:
void shapeEvent(XShapeEvent *); void shapeEvent(XShapeEvent *);
#endif // SHAPE #endif // SHAPE
virtual void timeout(void); virtual void timeout();
// this structure only contains 3 elements... the Motif 2.0 structure contains // this structure only contains 3 elements... the Motif 2.0 structure contains
// 5... we only need the first 3... so that is all we will define // 5... we only need the first 3... so that is all we will define
typedef struct MwmHints { typedef struct MwmHints {
unsigned long flags, functions, decorations; unsigned long flags; // Motif wm flags
unsigned long functions; // Motif wm functions
unsigned long decorations; // Motif wm decorations
} MwmHints; } MwmHints;
#ifdef GNOME #ifdef GNOME
void setGnomeState(int state); void setGnomeState(int state);
inline int getGnomeHints() const { return gnome_hints; } inline int getGnomeHints() const { return gnome_hints; }
#endif #endif //GNOME
private: private:
BImageControl *image_ctrl;
BImageControl *image_ctrl; //image control for rendering
//Window state
bool moving, resizing, shaded, maximized, visible, iconic, transient, bool moving, resizing, shaded, maximized, visible, iconic, transient,
focused, stuck, modal, send_focus_message, managed; focused, stuck, modal, send_focus_message, managed;
BScreen *screen; BScreen *screen;
BTimer timer; BTimer timer;
Display *display; Display *display;
@ -270,9 +271,9 @@ private:
bool resize, move, iconify, maximize, close; bool resize, move, iconify, maximize, close;
} functions; } functions;
bool usetab;
Tab *tab; Tab *tab;
friend class Tab; friend class Tab; //TODO: Don't like long distant friendship
typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool); typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool);
typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *); typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *);
@ -289,7 +290,6 @@ private:
std::vector<Button> buttonlist; std::vector<Button> buttonlist;
struct _frame { struct _frame {
//different bool because of XShapeQueryExtension
Bool shaped; Bool shaped;
unsigned long ulabel_pixel, flabel_pixel, utitle_pixel, unsigned long ulabel_pixel, flabel_pixel, utitle_pixel,
ftitle_pixel, uhandle_pixel, fhandle_pixel, ubutton_pixel, ftitle_pixel, uhandle_pixel, fhandle_pixel, ubutton_pixel,
@ -319,7 +319,7 @@ private:
void stopResizing(Window win=0); void stopResizing(Window win=0);
void updateIcon(); void updateIcon();
//create decoration functions // Decoration functions
void createTitlebar(); void createTitlebar();
void destroyTitlebar(); void destroyTitlebar();
void createHandle(); void createHandle();
@ -378,33 +378,33 @@ private:
//button base draw... background //button base draw... background
void drawButtonBase(Window, bool); void drawButtonBase(Window, bool);
bool getState(void); bool getState();
Window createToplevelWindow(int, int, unsigned int, unsigned int, Window createToplevelWindow(int, int, unsigned int, unsigned int,
unsigned int); unsigned int);
Window createChildWindow(Window, Cursor = None); Window createChildWindow(Window, Cursor = None);
void getWMName(void); void getWMName();
void getWMIconName(void); void getWMIconName();
void getWMNormalHints(void); void getWMNormalHints();
void getWMProtocols(void); void getWMProtocols();
void getWMHints(void); void getWMHints();
void getMWMHints(void); void getMWMHints();
void getBlackboxHints(void); void getBlackboxHints();
void setNetWMAttributes(void); void setNetWMAttributes();
void associateClientWindow(void); void associateClientWindow();
void decorate(void); void decorate();
void decorateLabel(void); void decorateLabel();
void positionButtons(bool redecorate_label = false); void positionButtons(bool redecorate_label = false);
void positionWindows(void); void positionWindows();
void redrawLabel(void); void redrawLabel();
void redrawAllButtons(void); void redrawAllButtons();
void restoreGravity(void); void restoreGravity();
void setGravityOffsets(void); void setGravityOffsets();
void setState(unsigned long); void setState(unsigned long);
void upsize(void); void upsize();
void downsize(void); void downsize();
void right_fixsize(int * = 0, int * = 0); void right_fixsize(int * = 0, int * = 0);
void left_fixsize(int * = 0, int * = 0); void left_fixsize(int * = 0, int * = 0);
}; };