news download themes documentation links










FluxboxWindow Class Reference

Creates the window frame and handles any window event for it. More...

#include <Window.hh>

Inheritance diagram for FluxboxWindow:

FbTk::EventHandler List of all members.

accessors

typedef std::list< std::pair<
const char *, FbTk::Menu * > > 
ExtraMenus
bool isManaged () const
bool isFocused () const
bool isVisible () const
bool isIconic () const
bool isShaded () const
bool isMaximized () const
bool isIconifiable () const
bool isMaximizable () const
bool isResizable () const
bool isClosable () const
bool isStuck () const
bool hasTitlebar () const
bool isMoving () const
bool isResizing () const
bool isGroupable () const
int numClients () const
ClientList & clientList ()
const ClientList & clientList () const
WinClientwinClient ()
const WinClientwinClient () const
const BScreenscreen () const
BScreenscreen ()
const FbTk::XLayerItem & layerItem () const
FbTk::XLayerItem & layerItem ()
Window clientWindow () const
FbTk::FbWindowfbWindow ()
const FbTk::FbWindowfbWindow () const
FbTk::Menumenu ()
const FbTk::Menumenu () const
void addExtraMenu (const char *label, FbTk::Menu *menu)
void removeExtraMenu (FbTk::Menu *menu)
ExtraMenus & extraMenus ()
const ExtraMenus & extraMenus () const
const FbTk::FbWindowparent () const
FbTk::FbWindowparent ()
const std::string & title () const
const std::string & iconTitle () const
int x () const
int y () const
unsigned int width () const
unsigned int height () const
unsigned int workspaceNumber () const
int layerNum () const
void setLayerNum (int layernum)
unsigned int titlebarHeight () const
bool isLowerTab () const
int initialState () const
FbWinFrameframe ()
const FbWinFrameframe () const

Public Types

typedef FluxboxWindow::_blackbox_hints BlackboxHints
typedef FluxboxWindow::_blackbox_attributes BlackboxAttributes
typedef std::list< WinClient * > ClientList
enum  Decoration { DECOR_NONE = 0, DECOR_NORMAL, DECOR_TINY, DECOR_TOOL }
 Represents certain "preset" sets of decorations. More...

enum  { MwmHintsFunctions = (1l << 0), MwmHintsDecorations = (1l << 1) }
 Motif wm Hints. More...

enum  MwmFunc {
  MwmFuncAll = (1l << 0), MwmFuncResize = (1l << 1), MwmFuncMove = (1l << 2), MwmFuncIconify = (1l << 3),
  MwmFuncMaximize = (1l << 4), MwmFuncClose = (1l << 5)
}
 Motif wm functions. More...

enum  MwmDecor {
  MwmDecorAll = (1l << 0), MwmDecorBorder = (1l << 1), MwmDecorHandle = (1l << 2), MwmDecorTitle = (1l << 3),
  MwmDecorMenu = (1l << 4), MwmDecorIconify = (1l << 5), MwmDecorMaximize = (1l << 6)
}
 Motif wm decorations. More...

enum  Attrib {
  ATTRIB_SHADED = 0x01, ATTRIB_MAXHORIZ = 0x02, ATTRIB_MAXVERT = 0x04, ATTRIB_OMNIPRESENT = 0x08,
  ATTRIB_WORKSPACE = 0x10, ATTRIB_STACK = 0x20, ATTRIB_DECORATION = 0x40
}
 attributes for BlackboxHints

enum  MaximizeMode { MAX_NONE = 0, MAX_HORZ = 1, MAX_VERT = 2, MAX_FULL = 3 }
enum  DecorationMask {
  DECORM_TITLEBAR = (1<<0), DECORM_HANDLE = (1<<1), DECORM_BORDER = (1<<2), DECORM_ICONIFY = (1<<3),
  DECORM_MAXIMIZE = (1<<4), DECORM_CLOSE = (1<<5), DECORM_MENU = (1<<6), DECORM_STICKY = (1<<7),
  DECORM_SHADE = (1<<8), DECORM_TAB = (1<<9), DECORM_ENABLED = (1<<10), DECORM_LAST = (1<<11)
}
enum  ResizeCorner { LEFTTOP, LEFTBOTTOM, RIGHTBOTTOM, RIGHTTOP }

Public Member Functions

 FluxboxWindow (WinClient &client, FbWinFrameTheme &tm, FbTk::XLayer &layer)
 create a window from a client

void attachClient (WinClient &client)
 attach client to our client list and remove it from old window

bool detachClient (WinClient &client)
 detach client (remove it from list) and create a new window for it

void detachCurrentClient ()
 detach current working client if we have more than one

bool removeClient (WinClient &client)
 remove client from client list

bool setCurrentClient (WinClient &client, bool setinput=true)
 set new current client and raise it

WinClientfindClient (Window win)
 returns WinClient of window we're searching for

void nextClient ()
 raise and focus next client

void prevClient ()
void moveClientLeft ()
void moveClientRight ()
bool setInputFocus ()
void raiseAndFocus ()
void setFocusFlag (bool flag)
void show ()
void hide ()
void iconify ()
void deiconify (bool reassoc=true, bool do_raise=true)
void close ()
 close current client

void withdraw ()
 set the window in withdrawn state

void maximize (int type=MAX_FULL)
 toggle maximize

void maximizeHorizontal ()
 maximizes the window horizontal

void maximizeVertical ()
 maximizes the window vertical

void maximizeFull ()
 maximizes the window fully

void shade ()
 toggles shade

void stick ()
 toggles sticky

void raise ()
void lower ()
void tempRaise ()
void raiseLayer ()
void lowerLayer ()
void moveToLayer (int layernum)
void reconfigure ()
void installColormap (bool)
void restore (WinClient *client, bool remap)
void restore (bool remap)
void move (int x, int y, int gravity=ForgetGravity)
 move frame to x, y

void resize (unsigned int width, unsigned int height)
 resize frame to width, height

void moveResize (int x, int y, unsigned int width, unsigned int height, int gravity=ForgetGravity)
 move and resize frame to pox x,y and size width, height

void setWorkspace (int n)
void changeBlackboxHints (const BlackboxHints &bh)
void updateFunctions ()
void restoreAttributes ()
void showMenu (int mx, int my)
void popupMenu ()
void pauseMoving ()
void resumeMoving ()
void setDecoration (Decoration decoration)
void applyDecorations (bool initial=false)
void toggleDecoration ()
unsigned int decorationMask () const
void setDecorationMask (unsigned int mask)
const timeval & lastFocusTime () const
event handlers
void handleEvent (XEvent &event)
void buttonPressEvent (XButtonEvent &be)
void buttonReleaseEvent (XButtonEvent &be)
void motionNotifyEvent (XMotionEvent &me)
void destroyNotifyEvent (XDestroyWindowEvent &dwe)
void mapRequestEvent (XMapRequestEvent &mre)
void mapNotifyEvent (XMapEvent &mapev)
void unmapNotifyEvent (XUnmapEvent &unmapev)
void exposeEvent (XExposeEvent &ee)
void configureRequestEvent (XConfigureRequestEvent &ce)
void propertyNotifyEvent (WinClient &client, Atom a)
void enterNotifyEvent (XCrossingEvent &ev)
void leaveNotifyEvent (XCrossingEvent &ev)
signals
FbTk::Subject & stateSig ()
const FbTk::Subject & stateSig () const
FbTk::Subject & layerSig ()
const FbTk::Subject & layerSig () const
FbTk::Subject & hintSig ()
const FbTk::Subject & hintSig () const
FbTk::Subject & workspaceSig ()
const FbTk::Subject & workspaceSig () const
FbTk::Subject & dieSig ()
const FbTk::Subject & dieSig () const
FbTk::Subject & focusSig ()
FbTk::Subject & titleSig ()

Public Attributes

bool oplock
 Used to help stop transient loops occurring by locking a window during certain operations.


Friends

class WinClient

Detailed Description

Creates the window frame and handles any window event for it.

Definition at line 58 of file Window.hh.


Member Enumeration Documentation

anonymous enum
 

Motif wm Hints.

Enumeration values:
MwmHintsFunctions  use motif wm functions
MwmHintsDecorations  use motif wm decorations

Definition at line 69 of file Window.hh.

00069          {
00070         MwmHintsFunctions   = (1l << 0), 
00071         MwmHintsDecorations = (1l << 1) 
00072     };

enum FluxboxWindow::Decoration
 

Represents certain "preset" sets of decorations.

Enumeration values:
DECOR_NONE  no decor at all
DECOR_NORMAL  normal normal
DECOR_TINY  tiny decoration
DECOR_TOOL  decor tool

Definition at line 61 of file Window.hh.

00061                     {
00062         DECOR_NONE=0, 
00063         DECOR_NORMAL, 
00064         DECOR_TINY,   
00065         DECOR_TOOL    
00066     };

enum FluxboxWindow::DecorationMask
 

This enumeration represents individual decoration attributes, they can be OR-d together to get a mask. Useful for saving.

Definition at line 120 of file Window.hh.

00120                         {
00121         DECORM_TITLEBAR = (1<<0),
00122         DECORM_HANDLE   = (1<<1),
00123         DECORM_BORDER   = (1<<2),
00124         DECORM_ICONIFY  = (1<<3),
00125         DECORM_MAXIMIZE = (1<<4),
00126         DECORM_CLOSE    = (1<<5),
00127         DECORM_MENU     = (1<<6),
00128         DECORM_STICKY   = (1<<7),
00129         DECORM_SHADE    = (1<<8),
00130         DECORM_TAB      = (1<<9),
00131         DECORM_ENABLED  = (1<<10),
00132         DECORM_LAST     = (1<<11) // useful for getting "All"
00133     };

enum FluxboxWindow::MaximizeMode
 

Types of maximization

Enumeration values:
MAX_NONE  normal state
MAX_HORZ  maximize horizontal
MAX_VERT  maximize vertical
MAX_FULL  maximize full

Definition at line 109 of file Window.hh.

00109                       {
00110         MAX_NONE = 0, 
00111         MAX_HORZ = 1, 
00112         MAX_VERT = 2, 
00113         MAX_FULL = 3  
00114     };

enum FluxboxWindow::MwmDecor
 

Motif wm decorations.

Enumeration values:
MwmDecorBorder  all decorations
MwmDecorHandle  border
MwmDecorTitle  handle
MwmDecorMenu  title
MwmDecorIconify  menu
MwmDecorMaximize  iconify

Definition at line 85 of file Window.hh.

00085                   {
00086         MwmDecorAll         = (1l << 0), 
00087         MwmDecorBorder      = (1l << 1), 
00088         MwmDecorHandle      = (1l << 2), 
00089         MwmDecorTitle       = (1l << 3), 
00090         MwmDecorMenu        = (1l << 4), 
00091         MwmDecorIconify     = (1l << 5), 
00092         MwmDecorMaximize    = (1l << 6)  
00093     };

enum FluxboxWindow::MwmFunc
 

Motif wm functions.

Enumeration values:
MwmFuncAll  all motif wm functions
MwmFuncResize  resize
MwmFuncMove  move
MwmFuncIconify  iconify
MwmFuncMaximize  maximize
MwmFuncClose  close

Definition at line 75 of file Window.hh.

00075                 {
00076         MwmFuncAll          = (1l << 0), 
00077         MwmFuncResize       = (1l << 1), 
00078         MwmFuncMove         = (1l << 2), 
00079         MwmFuncIconify      = (1l << 3), 
00080         MwmFuncMaximize     = (1l << 4), 
00081         MwmFuncClose        = (1l << 5)  
00082     };


Member Function Documentation

void FluxboxWindow::attachClient WinClient client  ) 
 

attach client to our client list and remove it from old window

! TODO: check for isGroupable in client

Definition at line 590 of file Window.cc.

References FbTk::EventManager::add(), FbWinFrame::addLabelButton(), clientList(), WinClient::fbwindow(), m_client, m_clientlist, WinClient::m_win, FbTk::FbWindow::raise(), FbWinFrame::reconfigure(), WinClient::saveBlackboxAttribs(), FbWinFrame::setClientWindow(), WinClient::setGroupLeftWindow(), FbTk::TextButton::setJustify(), and WinClient::title().

Referenced by BScreen::createWindow().

00590                                                   {
00592     if (client.m_win == this)
00593         return;
00594 
00595     // reparent client win to this frame 
00596     frame().setClientWindow(client);
00597     FbTk::EventManager &evm = *FbTk::EventManager::instance();
00598 
00599     // get the current window on the end of our client list
00600     Window leftwin = None;
00601     if (!clientList().empty())
00602         leftwin = clientList().back()->window();
00603 
00604     client.setGroupLeftWindow(leftwin);
00605 
00606     if (client.fbwindow() != 0) {
00607         FluxboxWindow *old_win = client.fbwindow(); // store old window
00608 
00609         // make sure we set new window search for each client
00610         ClientList::iterator client_it = old_win->clientList().begin();
00611         ClientList::iterator client_it_end = old_win->clientList().end();
00612         for (; client_it != client_it_end; ++client_it) {
00613             // setup eventhandlers for client
00614             evm.add(*this, (*client_it)->window());
00615             
00616             // reparent window to this
00617             frame().setClientWindow(**client_it);
00618             moveResizeClient(**client_it, 
00619                              frame().clientArea().x(),
00620                              frame().clientArea().y(),
00621                              frame().clientArea().width(),
00622                              frame().clientArea().height());
00623 
00624             (*client_it)->m_win = this;
00625             // create a labelbutton for this client and 
00626             // associate it with the pointer
00627             FbTk::TextButton *btn = new FbTk::TextButton(frame().label(), 
00628                                              frame().theme().font(),
00629                                              (*client_it)->title());
00630             btn->setJustify(frame().theme().justify());
00631             m_labelbuttons[(*client_it)] = btn;
00632             frame().addLabelButton(*btn);
00633             btn->show();
00634             // we need motion notify so we mask it
00635             btn->setEventMask(ExposureMask | ButtonPressMask | 
00636                               ButtonReleaseMask | ButtonMotionMask | 
00637                               EnterWindowMask);
00638 
00639 
00640             FbTk::RefCount<FbTk::Command> 
00641                 set_client_cmd(new SetClientCmd(*(*client_it)));
00642             btn->setOnClick(set_client_cmd);
00643             evm.add(*this, btn->window()); // we take care of button events for this
00644 
00645             (*client_it)->saveBlackboxAttribs(m_blackbox_attrib);
00646         }
00647 
00648         // add client and move over all attached clients 
00649         // from the old window to this list
00650         // all the "left window"s will remain the same, except for the first.
00651         m_clientlist.splice(m_clientlist.end(), old_win->m_clientlist);           
00652         old_win->m_client = 0;
00653 
00654         delete old_win;
00655         
00656     } else { // client.fbwindow() == 0
00657         // create a labelbutton for this client and associate it with the pointer
00658         FbTk::TextButton *btn = new FbTk::TextButton(frame().label(), 
00659                                          frame().theme().font(),
00660                                          client.title());
00661         m_labelbuttons[&client] = btn;
00662         frame().addLabelButton(*btn);
00663         btn->show();
00664         FbTk::EventManager &evm = *FbTk::EventManager::instance();
00665         // we need motion notify so we mask it
00666         btn->setEventMask(ExposureMask | ButtonPressMask | 
00667                           ButtonReleaseMask | ButtonMotionMask | 
00668                           EnterWindowMask);
00669 
00670 
00671         FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(client));
00672         btn->setOnClick(set_client_cmd);
00673         evm.add(*this, btn->window()); // we take care of button events for this
00674 
00675         client.m_win = this;    
00676 
00677         client.saveBlackboxAttribs(m_blackbox_attrib);
00678         m_clientlist.push_back(&client);
00679     }
00680 
00681     // make sure that the state etc etc is updated for the new client
00682     // TODO: one day these should probably be neatened to only act on the
00683     // affected clients if possible
00684     m_statesig.notify();
00685     m_workspacesig.notify();
00686     m_layersig.notify();
00687 
00688     frame().reconfigure();
00689 
00690     // keep the current window on top
00691     m_client->raise();
00692 }

void FluxboxWindow::destroyNotifyEvent XDestroyWindowEvent &  de  ) 
 

Checks if event is for m_client->window. If it isn't, we leave it until the window is unmapped, if it is, we just hide it for now.

Definition at line 2123 of file Window.cc.

References FbWinFrame::hide(), and FbTk::FbWindow::window().

02123                                                               {
02124     if (de.window == m_client->window()) {
02125 #ifdef DEBUG
02126         cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl;
02127 #endif // DEBUG
02128         if (numClients() == 1)
02129             frame().hide();
02130     }
02131 
02132 }

void FluxboxWindow::handleEvent XEvent &  event  )  [virtual]
 

Redirect any unhandled event to our handlers

Reimplemented from FbTk::EventHandler.

Definition at line 1958 of file Window.cc.

References findClient(), Fluxbox::haveShape(), FbTk::App::instance(), Fluxbox::instance(), and Fluxbox::shapeEventbase().

01958                                              {
01959     switch (event.type) {
01960     case ConfigureRequest:
01961         configureRequestEvent(event.xconfigurerequest);
01962         break;
01963     case MapNotify:
01964         mapNotifyEvent(event.xmap);
01965         break;
01966         // This is already handled in Fluxbox::handleEvent
01967         // case MapRequest:
01968         //        mapRequestEvent(event.xmaprequest);
01969         //break;
01970     case PropertyNotify: {
01971         WinClient *client = findClient(event.xproperty.window);
01972         if (client) {
01973             propertyNotifyEvent(*client, event.xproperty.atom);
01974         }
01975     }
01976         break;
01977 
01978     default:
01979 #ifdef SHAPE
01980         if (Fluxbox::instance()->haveShape() && 
01981             event.type == Fluxbox::instance()->shapeEventbase() + ShapeNotify) {
01982             XShapeEvent *shape_event = (XShapeEvent *)&event;
01983 
01984             if (shape_event->kind != ShapeBounding)
01985                 break;
01986 
01987             if (shape_event->shaped) {
01988                 m_shaped = true;
01989                 shape();
01990             } else {
01991                 m_shaped = false;
01992                 // set no shape
01993                 XShapeCombineMask(display,
01994                                   frame().window().window(), ShapeBounding,
01995                                   0, 0,
01996                                   None, ShapeSet);
01997             }
01998 
01999             FbTk::App::instance()->sync(false);
02000             break;
02001         }
02002 #endif // SHAPE
02003 
02004         break;
02005     }
02006 }

void FluxboxWindow::iconify  ) 
 

Unmaps the window and removes it from workspace list

Definition at line 1246 of file Window.cc.

References WinClient::fbwindow(), Fluxbox::getFocusedWindow(), FbTk::FbWindow::hide(), FbWinFrame::hide(), FbTk::Menu::hide(), Fluxbox::instance(), isIconic(), Fluxbox::revertFocus(), FbTk::FbWindow::setEventMask(), WinClient::transientFor(), and WinClient::transientList().

01246                             {
01247     if (isIconic()) // no need to iconify if we're already
01248         return;
01249 
01250     menu().hide();
01251     iconic = true;
01252 
01253     setState(IconicState);
01254 
01255     frame().hide();
01256 
01257     ClientList::iterator client_it = m_clientlist.begin();
01258     const ClientList::iterator client_it_end = m_clientlist.end();
01259     for (; client_it != client_it_end; ++client_it) {
01260         WinClient &client = *(*client_it);
01261         client.setEventMask(NoEventMask);
01262         client.hide();
01263         client.setEventMask(PropertyChangeMask | StructureNotifyMask | FocusChangeMask);
01264         if (client.transientFor() &&
01265             client.transientFor()->fbwindow()) {
01266             if (!client.transientFor()->fbwindow()->isIconic()) {
01267                 client.transientFor()->fbwindow()->iconify();
01268             }
01269         }
01270 
01271         if (!client.transientList().empty()) {
01272             WinClient::TransientList::iterator it = client.transientList().begin();
01273             WinClient::TransientList::iterator it_end = client.transientList().end();
01274             for (; it != it_end; it++)
01275                 if ((*it)->fbwindow()) 
01276                     (*it)->fbwindow()->iconify();
01277         }
01278     }
01279 
01280     WinClient *focused_client = Fluxbox::instance()->getFocusedWindow();
01281     if (focused_client && focused_client->fbwindow() == this)
01282         Fluxbox::instance()->revertFocus(screen());
01283 
01284 }

void FluxboxWindow::installColormap bool  install  ) 
 

!

Definition at line 1718 of file Window.cc.

References WinClient::getAttrib(), Fluxbox::grab(), Fluxbox::instance(), Fluxbox::ungrab(), WinClient::validateClient(), and FbTk::FbWindow::window().

01718                                                 {
01719     if (m_client == 0) return;
01720 
01721     Fluxbox *fluxbox = Fluxbox::instance();
01722     fluxbox->grab();
01723     if (! m_client->validateClient())
01724         return;
01725 
01726     int i = 0, ncmap = 0;
01727     Colormap *cmaps = XListInstalledColormaps(display, m_client->window(), &ncmap);
01728     XWindowAttributes wattrib;
01729     if (cmaps) { 
01730         if (m_client->getAttrib(wattrib)) {
01731             if (install) {
01732                 // install the window's colormap
01733                 for (i = 0; i < ncmap; i++) {
01734                     if (*(cmaps + i) == wattrib.colormap) {
01735                         // this window is using an installed color map... do not install
01736                         install = false;
01737                         break; //end for-loop (we dont need to check more)
01738                     }
01739                 }
01740                 // otherwise, install the window's colormap
01741                 if (install)
01742                     XInstallColormap(display, wattrib.colormap);
01743             } else {                
01744                 for (i = 0; i < ncmap; i++) { // uninstall the window's colormap
01745                     if (*(cmaps + i) == wattrib.colormap)
01746                        XUninstallColormap(display, wattrib.colormap);
01747                 }
01748             }
01749         }
01750 
01751         XFree(cmaps);
01752     }
01753 
01754     fluxbox->ungrab();
01755 }

bool FluxboxWindow::isLowerTab  )  const
 

Determine if this is the lowest tab of them all

Definition at line 1950 of file Window.cc.

01950                                      {
01951     cerr<<__FILE__<<"("<<__FUNCTION__<<") TODO!"<<endl;
01952     return true;
01953 }

void FluxboxWindow::maximize int  type = MAX_FULL  ) 
 

toggle maximize

Maximize window both horizontal and vertical

Definition at line 1357 of file Window.cc.

References MAX_FULL, MAX_HORZ, MAX_NONE, MAX_VERT, moveResize(), and FbWinFrame::x().

Referenced by maximizeFull(), maximizeHorizontal(), and maximizeVertical().

01357                                      {
01358     if (isIconic())
01359         deiconify();
01360 
01361     int head = screen().getHead(frame().window());
01362     int new_x = frame().x(),
01363         new_y = frame().y(),
01364         new_w = frame().width(),
01365         new_h = frame().height();
01366 
01367     int orig_max = maximized;
01368 
01369     // These evaluate whether we need to TOGGLE the value for that field
01370     // Why? If maximize is only set to zero outside this, 
01371     // and we only EVER toggle them, then:
01372     // 1) We will never loose the old_ values 
01373     // 2) It shouldn't get confused
01374 
01375     // Worst case being that some action will toggle the wrong way, but 
01376     // we still won't lose the state in that case.
01377 
01378     // NOTE: There is one option to the way this works - what it does when 
01379     // fully maximised and maximise(vert, horz) is selected.
01380     // There are 2 options here - either:
01381     // 1) maximiseVertical results in a vertically (not horz) maximised window, or
01382     // 2) " toggles vertical maximisation, thus resulting in a horizontally 
01383     //      maximised window.
01384     //
01385     // The current implementation uses style 1, to change this, removed the 
01386     // item corresponding to the [[ ]] comment
01387 
01388     // toggle maximize vertically?
01389     // when _don't_ we want to toggle?
01390     // - type is horizontal maximise, [[and we aren't fully maximised]] or
01391     // - [[ type is vertical maximise and we are fully maximised ]]
01392     // - type is none and we are not vertically maximised, or
01393     // - type is full and we are not horizontally maximised, but already vertically
01394     if (!(type == MAX_HORZ && orig_max != MAX_FULL ||
01395           type == MAX_VERT && orig_max == MAX_FULL ||
01396           type == MAX_NONE && !(orig_max & MAX_VERT) ||
01397           type == MAX_FULL && orig_max == MAX_VERT)) {
01398         // already maximized in that direction?
01399         if (orig_max & MAX_VERT) {
01400             new_y = m_old_pos_y;
01401             new_h = m_old_height;
01402         } else {
01403             m_old_pos_y  = new_y;
01404             m_old_height = new_h;
01405             new_y = screen().maxTop(head);
01406             new_h = screen().maxBottom(head) - new_y - 2*frame().window().borderWidth();
01407         }
01408         maximized ^= MAX_VERT;
01409     }
01410 
01411     // maximize horizontally?
01412     if (!(type == MAX_VERT && orig_max != MAX_FULL ||
01413           type == MAX_HORZ && orig_max == MAX_FULL ||
01414           type == MAX_NONE && !(orig_max & MAX_HORZ) ||
01415           type == MAX_FULL && orig_max == MAX_HORZ)) {
01416         // already maximized in that direction?
01417         if (orig_max & MAX_HORZ) {
01418             new_x = m_old_pos_x;
01419             new_w = m_old_width;
01420         } else {
01421             // only save if we weren't already maximized
01422             m_old_pos_x = new_x;
01423             m_old_width = new_w;
01424             new_x = screen().maxLeft(head);
01425             new_w = screen().maxRight(head) - new_x - 2*frame().window().borderWidth();
01426         }
01427         maximized ^= MAX_HORZ;
01428     }
01429             
01430     moveResize(new_x, new_y, new_w, new_h);
01431 
01432 }

void FluxboxWindow::maximizeFull  ) 
 

maximizes the window fully

Maximize window fully

Definition at line 1450 of file Window.cc.

References MAX_FULL, and maximize().

01450                                  {
01451     maximize(MAX_FULL);
01452 }

void FluxboxWindow::maximizeHorizontal  ) 
 

maximizes the window horizontal

Maximize window horizontal

Definition at line 1436 of file Window.cc.

References MAX_HORZ, and maximize().

01436                                        {
01437     maximize(MAX_HORZ);
01438 }

void FluxboxWindow::maximizeVertical  ) 
 

maximizes the window vertical

Maximize window vertical

Definition at line 1443 of file Window.cc.

References MAX_VERT, and maximize().

01443                                      {
01444     maximize(MAX_VERT);
01445 }

void FluxboxWindow::popupMenu  ) 
 

Moves the menu to last button press position and shows it, if it's already visible it'll be hidden

Definition at line 1934 of file Window.cc.

References FbTk::FbWindow::height(), FbTk::Menu::hide(), FbTk::Menu::isVisible(), showMenu(), and FbWinFrame::titlebar().

01934                               {
01935     if (m_windowmenu.isVisible()) {
01936         m_windowmenu.hide(); 
01937         return;
01938     }
01939 
01940     int menu_y = frame().titlebar().height() + frame().titlebar().borderWidth();
01941     if (!decorations.titlebar) // if we don't have any titlebar
01942         menu_y = 0;
01943 
01944     showMenu(m_last_button_x, menu_y + frame().y());
01945 }

void FluxboxWindow::restoreAttributes  ) 
 

Sets the attributes to what they should be but doesn't change the actual state (so the caller can set defaults etc as well)

! TODO check value?

Definition at line 1823 of file Window.cc.

References FbAtoms::getFluxboxAttributesAtom(), MAX_FULL, MAX_HORZ, MAX_NONE, MAX_VERT, and FbTk::FbWindow::property().

01823                                       {
01824     if (!getState())
01825         m_current_state = NormalState;
01826 
01827     Atom atom_return;
01828     int foo;
01829     unsigned long ulfoo, nitems;
01830     FbAtoms *fbatoms = FbAtoms::instance();
01831     
01832     BlackboxAttributes *net;
01833     if (m_client->property(fbatoms->getFluxboxAttributesAtom(), 0l,
01834                            PropBlackboxAttributesElements, false,
01835                            fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo,
01836                            &nitems, &ulfoo, (unsigned char **) &net) &&
01837         net) {
01838         if (nitems != (unsigned)PropBlackboxAttributesElements) {
01839             XFree(net);
01840             return;
01841         }
01842         m_blackbox_attrib.flags = net->flags;
01843         m_blackbox_attrib.attrib = net->attrib;
01844         m_blackbox_attrib.workspace = net->workspace;
01845         m_blackbox_attrib.stack = net->stack;
01846         m_blackbox_attrib.premax_x = net->premax_x;
01847         m_blackbox_attrib.premax_y = net->premax_y;
01848         m_blackbox_attrib.premax_w = net->premax_w;
01849         m_blackbox_attrib.premax_h = net->premax_h;
01850 
01851         XFree(static_cast<void *>(net));
01852     } else
01853         return;
01854 
01855     if (m_blackbox_attrib.flags & ATTRIB_SHADED &&
01856         m_blackbox_attrib.attrib & ATTRIB_SHADED) {
01857         int save_state =
01858             ((m_current_state == IconicState) ? NormalState : m_current_state);
01859 
01860         shaded = true;
01861             
01862         m_current_state = save_state;
01863     }
01864 
01865     if (( m_blackbox_attrib.workspace != screen().currentWorkspaceID()) &&
01866         ( m_blackbox_attrib.workspace < screen().getCount())) {
01867         m_workspace_number = m_blackbox_attrib.workspace;
01868 
01869         if (m_current_state == NormalState) m_current_state = WithdrawnState;
01870     } else if (m_current_state == WithdrawnState)
01871         m_current_state = NormalState;
01872 
01873     if (m_blackbox_attrib.flags & ATTRIB_OMNIPRESENT &&
01874         m_blackbox_attrib.attrib & ATTRIB_OMNIPRESENT) {
01875         stuck = true;
01876 
01877         m_current_state = NormalState;
01878     }
01879 
01880     if (m_blackbox_attrib.flags & ATTRIB_STACK) {
01882         m_layernum = m_blackbox_attrib.stack;
01883     }
01884 
01885     if ((m_blackbox_attrib.flags & ATTRIB_MAXHORIZ) ||
01886         (m_blackbox_attrib.flags & ATTRIB_MAXVERT)) {
01887         int x = m_blackbox_attrib.premax_x, y = m_blackbox_attrib.premax_y;
01888         unsigned int w = m_blackbox_attrib.premax_w, h = m_blackbox_attrib.premax_h;
01889         maximized = MAX_NONE;
01890         if ((m_blackbox_attrib.flags & ATTRIB_MAXHORIZ) &&
01891             (m_blackbox_attrib.flags & ATTRIB_MAXVERT))
01892             maximized = MAX_FULL;
01893         else if (m_blackbox_attrib.flags & ATTRIB_MAXVERT)
01894             maximized = MAX_VERT;
01895         else if (m_blackbox_attrib.flags & ATTRIB_MAXHORIZ)
01896             maximized = MAX_HORZ;
01897 
01898         m_blackbox_attrib.premax_x = x;
01899         m_blackbox_attrib.premax_y = y;
01900         m_blackbox_attrib.premax_w = w;
01901         m_blackbox_attrib.premax_h = h;
01902     }
01903 
01904     setState(m_current_state);
01905 }

void FluxboxWindow::showMenu int  menu_x,
int  menu_y
 

Show the window menu at pos mx, my

Definition at line 1910 of file Window.cc.

References FbTk::Menu::fbwindow(), FbTk::Menu::height(), FbTk::Menu::move(), FbMenu::raise(), FbTk::Menu::show(), and FbTk::Menu::width().

Referenced by popupMenu().

01910                                                    {
01911     // move menu directly under titlebar
01912 
01913     int head = screen().getHead(menu_x, menu_y);
01914 
01915     // but not under screen
01916     if (menu_y + m_windowmenu.height() >= screen().maxBottom(head))
01917         menu_y = screen().maxBottom(head) - m_windowmenu.height() - 1 - m_windowmenu.fbwindow().borderWidth();
01918 
01919     if (menu_x < static_cast<signed>(screen().maxLeft(head)))
01920         menu_x = screen().maxLeft(head);
01921     else if (menu_x + static_cast<signed>(m_windowmenu.width()) >= static_cast<signed>(screen().maxRight(head)))
01922         menu_x = screen().maxRight(head) - m_windowmenu.width() - 1;
01923 
01924 
01925     m_windowmenu.move(menu_x, menu_y);
01926     m_windowmenu.show();        
01927     m_windowmenu.raise();
01928 }

void FluxboxWindow::unmapNotifyEvent XUnmapEvent &  ue  ) 
 

Unmaps frame window and client window if event.window == m_client->window Returns true if *this should die else false

Definition at line 2104 of file Window.cc.

References findClient(), WinClient::title(), and FbTk::FbWindow::window().

02104                                                     {
02105     WinClient *client = findClient(ue.window);
02106     if (client == 0)
02107         return;
02108     
02109 #ifdef DEBUG
02110     cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<client->window()<<dec<<endl;
02111     cerr<<__FILE__<<"("<<__FUNCTION__<<"): title="<<client->title()<<endl;
02112 #endif // DEBUG
02113     
02114     restore(client, false);
02115 
02116 }

void FluxboxWindow::withdraw  ) 
 

set the window in withdrawn state

Set window in withdrawn state

Definition at line 1343 of file Window.cc.

References FbTk::Menu::hide(), and FbWinFrame::hide().

01343                              {
01344     iconic = false;
01345 
01346     if (isResizing())
01347         stopResizing();
01348 
01349     frame().hide();
01350 
01351     m_windowmenu.hide();
01352 }


The documentation for this class was generated from the following files:

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA