X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fframe.hh;h=7fa7a513fdd7c8194101df19e71e04a1e0799a3b;hb=cce970813f088952e05e20f13d77d6f4766863e3;hp=c5d68de98a08362fe039410352650300e084b973;hpb=74cfb1b4c115cdb4e05aa823b09d2b5ea9d0d690;p=chaz%2Fopenbox diff --git a/src/frame.hh b/src/frame.hh index c5d68de9..7fa7a513 100644 --- a/src/frame.hh +++ b/src/frame.hh @@ -9,6 +9,7 @@ extern "C" { #include } +#include "client.hh" #include "python.hh" #include "otk/strut.hh" #include "otk/rect.hh" @@ -18,11 +19,10 @@ extern "C" { #include "otk/eventhandler.hh" #include +#include namespace ob { -class Client; - //! Varius geometry settings in the frame decorations struct FrameGeometry { int width; // title and handle @@ -31,6 +31,12 @@ struct FrameGeometry { int label_width; int label_height() { return font_height; } int handle_height; // static, from the style + int icon_x; // x-position of the window icon button + int title_x; // x-position of the window title + int iconify_x; // x-position of the window iconify button + int desktop_x; // x-position of the window all-desktops button + int max_x; // x-position of the window maximize button + int close_x; // x-position of the window close button int handle_y; int button_size; // static, from the style int grip_width() { return button_size * 2; } @@ -64,6 +70,9 @@ private: otk::Rect _area; bool _visible; + + //! The decorations that are being displayed in the frame. + Client::DecorationFlags _decorations; // decoration windows Window _frame; // sits under everything @@ -73,11 +82,11 @@ private: Window _handle; // bottom bar Window _lgrip; // lefthand resize grab on the handle Window _rgrip; // righthand resize grab on the handle - Window *_buttons; // all of the titlebar buttons - int _numbuttons; // number of buttons, size of _buttons array - int *_titleorder; // order of the buttons and the label (always - // holds '_numbuttons + 1' elements (for the - // label, which is coded as '-1') + Window _max; // maximize button + Window _desk; // all-desktops button + Window _iconify; // iconify button + Window _icon; // window icon button + Window _close; // close button // surfaces for each otk::Surface *_frame_sur; @@ -85,13 +94,31 @@ private: otk::Surface *_label_sur; otk::Surface *_handle_sur; otk::Surface *_grip_sur; - otk::Surface **_buttons_sur; + otk::Surface *_max_sur; + otk::Surface *_desk_sur; + otk::Surface *_iconify_sur; + otk::Surface *_icon_sur; + otk::Surface *_close_sur; + + otk::ustring _layout; // layout of the titlebar + + bool _max_press; + bool _desk_press; + bool _iconify_press; + bool _icon_press; + bool _close_press; + unsigned int _press_button; // mouse button that started the press FrameGeometry geom; void applyStyle(const otk::RenderStyle &style); void layoutTitle(); void renderLabel(); + void renderMax(); + void renderDesk(); + void renderIconify(); + void renderClose(); + void renderIcon(); public: //! Constructs an Frame object for a client @@ -124,6 +151,7 @@ public: void adjustState(); void adjustFocus(); void adjustTitle(); + void adjustIcon(); //! Applies gravity to the client's position to find where the frame should //! be positioned. @@ -150,6 +178,9 @@ public: //! Hides the frame void hide(); + void buttonPressHandler(const XButtonEvent &e); + void buttonReleaseHandler(const XButtonEvent &e); + //! Returns the MouseContext for the given window id /*! Returns '-1' if no valid mouse context exists in the frame for the given