X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2FWindow.hh;h=74a562a014da317b517bde260b0ab7779a88505b;hb=f763814b338f9418e705309ddc87f68140d7888a;hp=9bed2798f859aba0fd0d9054d8b9c07113f7e8ba;hpb=8794d357e67abddf9fda9db77b235e294d0ec590;p=chaz%2Fopenbox diff --git a/src/Window.hh b/src/Window.hh index 9bed2798..74a562a0 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -98,7 +98,7 @@ public: Func_Iconify = (1l << 2), Func_Maximize = (1l << 3), Func_Close = (1l << 4) }; - typedef unsigned int FunctionFlags; + typedef unsigned char FunctionFlags; enum Decoration { Decor_Titlebar = (1l << 0), Decor_Handle = (1l << 1), @@ -106,11 +106,26 @@ public: Decor_Iconify = (1l << 3), Decor_Maximize = (1l << 4), Decor_Close = (1l << 5) }; - typedef unsigned int DecorationFlags; + typedef unsigned char DecorationFlags; + + enum WindowType { Type_Desktop, + Type_Dock, + Type_Toolbar, + Type_Menu, + Type_Utility, + Type_Splash, + Type_Dialog, + Type_Normal }; + + enum Corner { TopLeft, + TopRight, + BottomLeft, + BottomRight }; private: Blackbox *blackbox; BScreen *screen; + XAtom *xatom; BTimer *timer; BlackboxAttributes blackbox_attrib; @@ -119,6 +134,7 @@ private: unsigned int window_number; unsigned long current_state; + unsigned int mod_mask; // the mod mask used to grab buttons enum FocusMode { F_NoInput = 0, F_Passive, F_LocallyActive, F_GloballyActive }; @@ -131,8 +147,11 @@ private: visible, // is visible? iconic, // is iconified? focused, // has focus? - stuck, // is omnipresent + stuck, // is omnipresent? modal, // is modal? (must be dismissed to continue) + skip_taskbar, // skipped by taskbars? + skip_pager, // skipped by pagers? + fullscreen, // a fullscreen window? send_focus_message, // should we send focus messages to our client? shaped; // does the frame use the shape extension? unsigned int maximized; // maximize is special, the number corresponds @@ -150,6 +169,7 @@ private: std::string title, icon_title; Rect rect; + Strut strut; int old_bw; // client's borderwidth @@ -157,21 +177,25 @@ private: min_width, min_height, // can not be resized smaller max_width, max_height, // can not be resized larger width_inc, height_inc, // increment step +#if 0 // not supported at the moment min_aspect_x, min_aspect_y, // minimum aspect ratio max_aspect_x, max_aspect_y, // maximum aspect ratio +#endif base_width, base_height, win_gravity; - unsigned long initial_state, normal_hint_flags, wm_hint_flags; + unsigned long initial_state, normal_hint_flags; } client; FunctionFlags functions; /* * what decorations do we have? * this is based on the type of the client window as well as user input - * the menu is not really decor, but it goes hand in hand with the decor */ DecorationFlags decorations; + DecorationFlags mwm_decorations; + Corner resize_dir; + WindowType window_type; /* * client window = the application's window @@ -231,13 +255,17 @@ private: bool getState(void); Window createToplevelWindow(); - Window createChildWindow(Window parent, Cursor = None); + Window createChildWindow(Window parent, unsigned long event_mask, + Cursor = None); + bool getWindowType(void); + void updateStrut(void); void getWMName(void); void getWMIconName(void); void getWMNormalHints(void); void getWMProtocols(void); void getWMHints(void); + void getNetWMHints(void); void getMWMHints(void); bool getBlackboxHints(void); void getTransientInfo(void); @@ -257,18 +285,25 @@ private: void destroyIconifyButton(void); void createMaximizeButton(void); void destroyMaximizeButton(void); - void redrawLabel(void); - void redrawAllButtons(void); - void redrawCloseButton(bool pressed); - void redrawIconifyButton(bool pressed); - void redrawMaximizeButton(bool pressed); - void restoreGravity(void); - void setGravityOffsets(void); + void redrawWindowFrame(void) const; + void redrawLabel(void) const; + void redrawAllButtons(void) const; + void redrawCloseButton(bool pressed) const; + void redrawIconifyButton(bool pressed) const; + void redrawMaximizeButton(bool pressed) const; + void applyGravity(Rect &r); + void restoreGravity(Rect &r); + void setAllowedActions(void); void setState(unsigned long new_state); void upsize(void); + void doMove(int x_root, int y_root); + void doWorkspaceWarping(int x_root, int y_root, int &dx); + void doWindowSnapping(int &dx, int &dy); + void endMove(void); + void doResize(int x_root, int y_root); + void endResize(void); - enum Corner { TopLeft, TopRight }; - void constrain(Corner anchor, int *pw = 0, int *ph = 0); + void constrain(Corner anchor, unsigned int *pw = 0, unsigned int *ph = 0); public: BlackboxWindow(Blackbox *b, Window w, BScreen *s); @@ -280,25 +315,37 @@ public: inline bool isIconic(void) const { return flags.iconic; } inline bool isShaded(void) const { return flags.shaded; } inline bool isMaximized(void) const { return flags.maximized; } + inline bool isMaximizedHoriz(void) const { return flags.maximized == 3; } + inline bool isMaximizedVert(void) const { return flags.maximized == 2; } + inline bool isMaximizedFull(void) const { return flags.maximized == 1; } inline bool isStuck(void) const { return flags.stuck; } + inline bool isModal(void) const { return flags.modal; } inline bool isIconifiable(void) const { return functions & Func_Iconify; } inline bool isMaximizable(void) const { return functions & Func_Maximize; } inline bool isResizable(void) const { return functions & Func_Resize; } inline bool isClosable(void) const { return functions & Func_Close; } + // is a 'normal' window? meaning, a standard client application + inline bool isNormal(void) const + { return window_type == Type_Dialog || window_type == Type_Normal || + window_type == Type_Toolbar || window_type == Type_Utility; } + inline bool isTopmost(void) const + { return window_type == Type_Toolbar || window_type == Type_Utility; } + inline bool isDesktop(void) const { return window_type == Type_Desktop; } + inline bool hasTitlebar(void) const { return decorations & Decor_Titlebar; } inline const BlackboxWindowList &getTransients(void) const { return client.transientList; } BlackboxWindow *getTransientFor(void) const; - inline BScreen *getScreen(void) { return screen; } + inline BScreen *getScreen(void) const { return screen; } inline Window getFrameWindow(void) const { return frame.window; } inline Window getClientWindow(void) const { return client.window; } inline Window getGroupWindow(void) const { return client.window_group; } - inline Windowmenu * getWindowmenu(void) { return windowmenu; } + inline Windowmenu * getWindowmenu(void) const { return windowmenu; } inline const char *getTitle(void) const { return client.title.c_str(); } @@ -317,9 +364,24 @@ public: inline void setWindowNumber(int n) { window_number = n; } - bool validateClient(void); + bool validateClient(void) const; bool setInputFocus(void); + // none of these are used by the window manager, they are here to persist + // them properly in the window's netwm state property. + inline bool skipTaskbar(void) const { return flags.skip_taskbar; } + inline void setSkipTaskbar(const bool s) { flags.skip_taskbar = s; } + inline bool skipPager(void) const { return flags.skip_pager; } + inline void setSkipPager(const bool s) { flags.skip_pager = s; } + inline bool isFullscreen(void) const { return flags.fullscreen; } + inline void setFullscreen(const bool f) { flags.fullscreen = f; } + + inline void setModal(const bool m) { flags.modal = m; } + + void beginMove(int x_root, int y_root); + void beginResize(int x_root, int y_root, Corner dir); + void enableDecor(bool enable); + void setupDecor(); void setFocusFlag(bool focus); void iconify(void); void deiconify(bool reassoc = True, bool raise = True); @@ -330,26 +392,28 @@ public: void remaximize(void); void shade(void); void stick(void); - void unstick(void); void reconfigure(void); - void updateFocusModel(void); + void grabButtons(void); + void ungrabButtons(void); void installColormap(bool install); void restore(bool remap); void configure(int dx, int dy, unsigned int dw, unsigned int dh); void setWorkspace(unsigned int n); - void changeBlackboxHints(BlackboxHints *net); + void changeBlackboxHints(const BlackboxHints *net); void restoreAttributes(void); - void buttonPressEvent(XButtonEvent *be); - void buttonReleaseEvent(XButtonEvent *re); - void motionNotifyEvent(XMotionEvent *me); - void destroyNotifyEvent(XDestroyWindowEvent */*unused*/); - void mapRequestEvent(XMapRequestEvent *mre); - void unmapNotifyEvent(XUnmapEvent */*unused*/); - void reparentNotifyEvent(XReparentEvent */*unused*/); - void propertyNotifyEvent(Atom atom); - void exposeEvent(XExposeEvent *ee); - void configureRequestEvent(XConfigureRequestEvent *cr); + void buttonPressEvent(const XButtonEvent *be); + void buttonReleaseEvent(const XButtonEvent *re); + void motionNotifyEvent(const XMotionEvent *me); + void destroyNotifyEvent(const XDestroyWindowEvent* /*unused*/); + void mapRequestEvent(const XMapRequestEvent *mre); + void unmapNotifyEvent(const XUnmapEvent* /*unused*/); + void reparentNotifyEvent(const XReparentEvent* /*unused*/); + void propertyNotifyEvent(const XPropertyEvent *pe); + void exposeEvent(const XExposeEvent *ee); + void configureRequestEvent(const XConfigureRequestEvent *cr); + void enterNotifyEvent(const XCrossingEvent *ce); + void leaveNotifyEvent(const XCrossingEvent* /*unused*/); #ifdef SHAPE void configureShape(void);