fixed indentation

This commit is contained in:
fluxgen 2002-01-18 01:33:58 +00:00
parent 1817ff7579
commit a742d228c7

View file

@ -16,22 +16,22 @@
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // 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 // 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.4 2002/01/11 10:40:59 fluxgen Exp $ // $Id: Window.hh,v 1.5 2002/01/18 01:33:58 fluxgen Exp $
#ifndef _WINDOW_HH_ #ifndef _WINDOW_HH_
#define _WINDOW_HH_ #define _WINDOW_HH_
#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
// forward declaration // forward declaration
@ -52,154 +52,156 @@ class Tab;
#include "Windowmenu.hh" #include "Windowmenu.hh"
#endif #endif
#define MwmHintsFunctions (1l << 0) #define MwmHintsFunctions (1l << 0)
#define MwmHintsDecorations (1l << 1) #define MwmHintsDecorations (1l << 1)
#define MwmFuncAll (1l << 0) #define MwmFuncAll (1l << 0)
#define MwmFuncResize (1l << 1) #define MwmFuncResize (1l << 1)
#define MwmFuncMove (1l << 2) #define MwmFuncMove (1l << 2)
#define MwmFuncIconify (1l << 3) #define MwmFuncIconify (1l << 3)
#define MwmFuncMaximize (1l << 4) #define MwmFuncMaximize (1l << 4)
#define MwmFuncClose (1l << 5) #define MwmFuncClose (1l << 5)
#define MwmDecorAll (1l << 0) #define MwmDecorAll (1l << 0)
#define MwmDecorBorder (1l << 1) #define MwmDecorBorder (1l << 1)
#define MwmDecorHandle (1l << 2) #define MwmDecorHandle (1l << 2)
#define MwmDecorTitle (1l << 3) #define MwmDecorTitle (1l << 3)
#define MwmDecorMenu (1l << 4) #define MwmDecorMenu (1l << 4)
#define MwmDecorIconify (1l << 5) #define MwmDecorIconify (1l << 5)
#define MwmDecorMaximize (1l << 6) #define MwmDecorMaximize (1l << 6)
//names for buttons //names for buttons
#define NAME_STICKY "sticky" #define NAME_STICKY "sticky"
#define NAME_MAXIMIZE "maximize" #define NAME_MAXIMIZE "maximize"
#define NAME_MINIMIZE "minimize" #define NAME_MINIMIZE "minimize"
#define NAME_SHADE "shade" #define NAME_SHADE "shade"
#define NAME_CLOSE "close" #define NAME_CLOSE "close"
#define NAME_ICONIFY "iconify" #define NAME_ICONIFY "iconify"
#define NAME_MENU "menu" #define NAME_MENU "menu"
#define NAME_NONE "none" #define NAME_NONE "none"
#define PropMwmHintsElements 3 #define PropMwmHintsElements 3
class FluxboxWindow : public TimeoutHandler { class FluxboxWindow : public TimeoutHandler {
public: public:
FluxboxWindow(Window, BScreen * = (BScreen *) 0); enum Error{NOERROR=0, XGETWINDOWATTRIB, CANTFINDSCREEN};
virtual ~FluxboxWindow(void);
inline const bool isTransient(void) const
{ return ((transient) ? true : false); }
inline const bool hasTransient(void) const
{ return ((client.transient) ? true : false); }
inline const bool &isFocused(void) const { return focused; }
inline const bool &isVisible(void) const { return visible; }
inline const bool &isIconic(void) const { return iconic; }
inline const bool &isShaded(void) const { return shaded; }
inline const bool &isMaximized(void) const { return maximized; }
inline const bool &isIconifiable(void) const { return functions.iconify; }
inline const bool &isMaximizable(void) const { return functions.maximize; }
inline const bool &isResizable(void) const { return functions.resize; }
inline const bool &isClosable(void) const { return functions.close; }
inline const bool &isStuck(void) const { return stuck; }
inline const bool &hasTitlebar(void) const { return decorations.titlebar; }
inline const bool hasTab(void) const { return (tab!=0 ? true : false); }
inline BScreen *getScreen(void) { return screen; } FluxboxWindow(Window, BScreen * = (BScreen *) 0);
virtual ~FluxboxWindow(void);
inline const bool isTransient(void) const
{ return ((transient) ? true : false); }
inline const bool hasTransient(void) const
{ return ((client.transient) ? true : false); }
inline const bool &isFocused(void) const { return focused; }
inline const bool &isVisible(void) const { return visible; }
inline const bool &isIconic(void) const { return iconic; }
inline const bool &isShaded(void) const { return shaded; }
inline const bool &isMaximized(void) const { return maximized; }
inline const bool &isIconifiable(void) const { return functions.iconify; }
inline const bool &isMaximizable(void) const { return functions.maximize; }
inline const bool &isResizable(void) const { return functions.resize; }
inline const bool &isClosable(void) const { return functions.close; }
inline const bool &isStuck(void) const { return stuck; }
inline const bool &hasTitlebar(void) const { return decorations.titlebar; }
inline const bool hasTab(void) const { return (tab!=0 ? true : false); }
static void showError(FluxboxWindow::Error error);
inline BScreen *getScreen(void) { return screen; }
inline Tab *getTab(void) { return tab; } inline Tab *getTab(void) { return tab; }
inline FluxboxWindow *getTransient(void) { return client.transient; } inline FluxboxWindow *getTransient(void) { return client.transient; }
inline FluxboxWindow *getTransientFor(void) { return client.transient_for; } inline FluxboxWindow *getTransientFor(void) { return client.transient_for; }
inline const Window &getFrameWindow(void) const { return frame.window; } inline const Window &getFrameWindow(void) const { return frame.window; }
inline const Window &getClientWindow(void) const { return client.window; } inline const Window &getClientWindow(void) const { return client.window; }
inline Windowmenu *getWindowmenu(void) { return windowmenu; } inline Windowmenu *getWindowmenu(void) { return windowmenu; }
inline char **getTitle(void) { return &client.title; } inline char **getTitle(void) { return &client.title; }
inline char **getIconTitle(void) { return &client.icon_title; } inline char **getIconTitle(void) { return &client.icon_title; }
inline const int &getXFrame(void) const { return frame.x; } inline const int &getXFrame(void) const { return frame.x; }
inline const int &getYFrame(void) const { return frame.y; } inline const int &getYFrame(void) const { return frame.y; }
inline const int &getXClient(void) const { return client.x; } inline const int &getXClient(void) const { return client.x; }
inline const int &getYClient(void) const { return client.y; } inline const int &getYClient(void) const { return client.y; }
inline const int &getWorkspaceNumber(void) const { return workspace_number; } inline const int &getWorkspaceNumber(void) const { return workspace_number; }
inline const int &getWindowNumber(void) const { return window_number; } inline const int &getWindowNumber(void) const { return window_number; }
inline const unsigned int &getWidth(void) const { return frame.width; } inline const unsigned int &getWidth(void) const { return frame.width; }
inline const unsigned int &getHeight(void) const { return frame.height; } inline const unsigned int &getHeight(void) const { return frame.height; }
inline const unsigned int &getClientHeight(void) const inline const unsigned int &getClientHeight(void) const
{ return client.height; } { return client.height; }
inline const unsigned int &getClientWidth(void) const inline const unsigned int &getClientWidth(void) const
{ return client.width; } { return client.width; }
inline const unsigned int &getTitleHeight(void) const inline const unsigned int &getTitleHeight(void) const
{ return frame.title_h; } { return frame.title_h; }
inline void setWindowNumber(int n) { window_number = n; } inline void setWindowNumber(int n) { window_number = n; }
bool validateClient(void); bool validateClient(void);
bool setInputFocus(void); bool setInputFocus(void);
void setTab(bool flag); void setTab(bool flag);
void setFocusFlag(bool); void setFocusFlag(bool);
void iconify(void); void iconify(void);
void deiconify(bool = true, bool = true); void deiconify(bool = true, bool = true);
void close(void); void close(void);
void withdraw(void); void withdraw(void);
void maximize(unsigned int); void maximize(unsigned int);
void shade(void); void shade(void);
void stick(void); void stick(void);
void unstick(void); void unstick(void);
void reconfigure(void); void reconfigure(void);
void installColormap(bool); void installColormap(bool);
void restore(void); void restore(void);
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 *);
void restoreAttributes(void); void restoreAttributes(void);
void buttonPressEvent(XButtonEvent *); void buttonPressEvent(XButtonEvent *);
void buttonReleaseEvent(XButtonEvent *); void buttonReleaseEvent(XButtonEvent *);
void motionNotifyEvent(XMotionEvent *); void motionNotifyEvent(XMotionEvent *);
void destroyNotifyEvent(XDestroyWindowEvent *); void destroyNotifyEvent(XDestroyWindowEvent *);
void mapRequestEvent(XMapRequestEvent *); void mapRequestEvent(XMapRequestEvent *);
void mapNotifyEvent(XMapEvent *); void mapNotifyEvent(XMapEvent *);
void unmapNotifyEvent(XUnmapEvent *); void unmapNotifyEvent(XUnmapEvent *);
void propertyNotifyEvent(Atom); void propertyNotifyEvent(Atom);
void exposeEvent(XExposeEvent *); void exposeEvent(XExposeEvent *);
void configureRequestEvent(XConfigureRequestEvent *); void configureRequestEvent(XConfigureRequestEvent *);
#ifdef SHAPE #ifdef SHAPE
void shapeEvent(XShapeEvent *); void shapeEvent(XShapeEvent *);
#endif // SHAPE #endif // SHAPE
virtual void timeout(void); virtual void timeout(void);
// 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, functions, decorations;
} MwmHints; } MwmHints;
private: private:
BImageControl *image_ctrl; BImageControl *image_ctrl;
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;
BaseDisplay::BlackboxAttributes blackbox_attrib; BaseDisplay::BlackboxAttributes blackbox_attrib;
Time lastButtonPressTime; Time lastButtonPressTime;
Windowmenu *windowmenu; Windowmenu *windowmenu;
int focus_mode, window_number, workspace_number; int focus_mode, window_number, workspace_number;
unsigned long current_state; unsigned long current_state;
struct _client { struct _client {
FluxboxWindow *transient_for, // which window are we a transient for? FluxboxWindow *transient_for, // which window are we a transient for?
*transient; // which window is our transient? *transient; // which window is our transient?
Window window, window_group; Window window, window_group;
char *title, *icon_title; char *title, *icon_title;
int x, y, old_bw, title_len; int x, y, old_bw, title_len;
unsigned int width, height, title_text_w, unsigned int width, height, title_text_w,
min_width, min_height, max_width, max_height, width_inc, height_inc, min_width, min_height, max_width, max_height, width_inc, height_inc,
min_aspect_x, min_aspect_y, max_aspect_x, max_aspect_y, min_aspect_x, min_aspect_y, max_aspect_x, max_aspect_y,
@ -218,7 +220,7 @@ private:
struct _functions { struct _functions {
bool resize, move, iconify, maximize, close; bool resize, move, iconify, maximize, close;
} functions; } functions;
bool usetab; bool usetab;
Tab *tab; Tab *tab;
friend class Tab; friend class Tab;
@ -226,92 +228,92 @@ private:
typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool); typedef void (*ButtonDrawProc)(FluxboxWindow *, Window, bool);
typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *); typedef void (*ButtonEventProc)(FluxboxWindow *, XButtonEvent *);
struct Button { struct Button {
int type; int type;
Window win; Window win;
bool used; bool used;
ButtonEventProc pressed; ButtonEventProc pressed;
ButtonEventProc released; ButtonEventProc released;
ButtonDrawProc draw; ButtonDrawProc draw;
}; };
std::vector<Button> buttonlist; std::vector<Button> buttonlist;
struct _frame { struct _frame {
//different bool because of XShapeQueryExtension //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,
fbutton_pixel, pbutton_pixel, uborder_pixel, fborder_pixel, fbutton_pixel, pbutton_pixel, uborder_pixel, fborder_pixel,
ugrip_pixel, fgrip_pixel; ugrip_pixel, fgrip_pixel;
Pixmap ulabel, flabel, utitle, ftitle, uhandle, fhandle, Pixmap ulabel, flabel, utitle, ftitle, uhandle, fhandle,
ubutton, fbutton, pbutton, ugrip, fgrip; ubutton, fbutton, pbutton, ugrip, fgrip;
Window window, plate, title, label, handle, Window window, plate, title, label, handle,
right_grip, left_grip; right_grip, left_grip;
int x, y, resize_x, resize_y, move_x, move_y, grab_x, grab_y, int x, y, resize_x, resize_y, move_x, move_y, grab_x, grab_y,
y_border, y_handle; y_border, y_handle;
unsigned int width, height, title_h, label_w, label_h, handle_h, unsigned int width, height, title_h, label_w, label_h, handle_h,
button_w, button_h, grip_w, grip_h, mwm_border_w, border_h, button_w, button_h, grip_w, grip_h, mwm_border_w, border_h,
bevel_w, resize_w, resize_h, snap_w, snap_h; bevel_w, resize_w, resize_h, snap_w, snap_h;
} frame; } frame;
enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE }; enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };
void createButton(int type, ButtonEventProc, ButtonEventProc, ButtonDrawProc); void createButton(int type, ButtonEventProc, ButtonEventProc, ButtonDrawProc);
Window findTitleButton(int type); Window findTitleButton(int type);
protected: protected:
//event callbacks //event callbacks
static void stickyButton_cb(FluxboxWindow *, XButtonEvent *); static void stickyButton_cb(FluxboxWindow *, XButtonEvent *);
static void stickyPressed_cb(FluxboxWindow *, XButtonEvent *); static void stickyPressed_cb(FluxboxWindow *, XButtonEvent *);
static void iconifyButton_cb(FluxboxWindow *, XButtonEvent *); static void iconifyButton_cb(FluxboxWindow *, XButtonEvent *);
static void iconifyPressed_cb(FluxboxWindow *, XButtonEvent *); static void iconifyPressed_cb(FluxboxWindow *, XButtonEvent *);
static void maximizeButton_cb(FluxboxWindow *, XButtonEvent *); static void maximizeButton_cb(FluxboxWindow *, XButtonEvent *);
static void maximizePressed_cb(FluxboxWindow *, XButtonEvent *); static void maximizePressed_cb(FluxboxWindow *, XButtonEvent *);
static void closeButton_cb(FluxboxWindow *, XButtonEvent *); static void closeButton_cb(FluxboxWindow *, XButtonEvent *);
static void closePressed_cb(FluxboxWindow *, XButtonEvent *); static void closePressed_cb(FluxboxWindow *, XButtonEvent *);
static void shadeButton_cb(FluxboxWindow *, XButtonEvent *); static void shadeButton_cb(FluxboxWindow *, XButtonEvent *);
//draw callbacks //draw callbacks
static void stickyDraw_cb(FluxboxWindow *, Window, bool); static void stickyDraw_cb(FluxboxWindow *, Window, bool);
static void iconifyDraw_cb(FluxboxWindow *, Window, bool); static void iconifyDraw_cb(FluxboxWindow *, Window, bool);
static void maximizeDraw_cb(FluxboxWindow *, Window, bool); static void maximizeDraw_cb(FluxboxWindow *, Window, bool);
static void closeDraw_cb(FluxboxWindow *, Window, bool); static void closeDraw_cb(FluxboxWindow *, Window, bool);
static void shadeDraw_cb(FluxboxWindow *, Window, bool); static void shadeDraw_cb(FluxboxWindow *, Window, bool);
static void grabButton(Display *display, unsigned int button, Window window, Cursor cursor); static void grabButton(Display *display, unsigned int button, Window window, Cursor cursor);
//button base draw... background //button base draw... background
void drawButtonBase(Window, bool); void drawButtonBase(Window, bool);
bool getState(void); bool getState(void);
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);
void getWMIconName(void); void getWMIconName(void);
void getWMNormalHints(void); void getWMNormalHints(void);
void getWMProtocols(void); void getWMProtocols(void);
void getWMHints(void); void getWMHints(void);
void getMWMHints(void); void getMWMHints(void);
void getBlackboxHints(void); void getBlackboxHints(void);
void setNetWMAttributes(void); void setNetWMAttributes(void);
void associateClientWindow(void); void associateClientWindow(void);
void decorate(void); void decorate(void);
void decorateLabel(void); void decorateLabel(void);
void positionButtons(bool redecorate_label = false); void positionButtons(bool redecorate_label = false);
void positionWindows(void); void positionWindows(void);
void redrawLabel(void); void redrawLabel(void);
void redrawAllButtons(void); void redrawAllButtons(void);
void restoreGravity(void); void restoreGravity(void);
void setGravityOffsets(void); void setGravityOffsets(void);
void setState(unsigned long); void setState(unsigned long);
void upsize(void); void upsize(void);
void downsize(void); void downsize(void);
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);
}; };