BScreen Class ReferenceHandles screen connection, screen clients and workspaces.
More...
#include <Screen.hh>
Inheritance diagram for BScreen:
List of all members.
|
Public Types |
|
typedef std::vector< FluxboxWindow * > | Icons |
|
typedef std::list< WinClient * > | FocusedWindows |
|
typedef std::vector< Workspace * > | Workspaces |
|
typedef std::vector< std::string > | WorkspaceNames |
| enum | FocusModel { SLOPPYFOCUS = 0,
SEMISLOPPYFOCUS,
CLICKTOFOCUS
} |
| enum | FocusDir { FOCUSUP,
FOCUSDOWN,
FOCUSLEFT,
FOCUSRIGHT
} |
| enum | PlacementPolicy { ROWSMARTPLACEMENT,
COLSMARTPLACEMENT,
CASCADEPLACEMENT,
UNDERMOUSEPLACEMENT
} |
| enum | RowDirection { LEFTRIGHT,
RIGHTLEFT
} |
| enum | ColumnDirection { TOPBOTTOM,
BOTTOMTOP
} |
| enum | {
CYCLEGROUPS = 0x01,
CYCLESKIPSTUCK = 0x02,
CYCLESKIPSHADED = 0x04,
CYCLELINEAR = 0x08,
CYCLEDEFAULT = 0x00
} |
Public Member Functions |
| | BScreen (FbTk::ResourceManager &rm, const std::string &screenname, const std::string &altscreenname, int scrn, int number_of_layers) |
|
bool | isSloppyFocus () const |
|
bool | isSemiSloppyFocus () const |
|
bool | isRootColormapInstalled () const |
|
bool | isScreenManaged () const |
|
bool | isSloppyWindowGrouping () const |
|
bool | isWorkspaceWarping () const |
|
bool | isDesktopWheeling () const |
|
bool | doAutoRaise () const |
|
bool | clickRaises () const |
|
bool | doOpaqueMove () const |
|
bool | doFullMax () const |
|
bool | doFocusNew () const |
|
bool | doFocusLast () const |
|
bool | doShowWindowPos () const |
|
bool | antialias () const |
|
FbTk::ImageControl & | imageControl () |
|
const FbTk::Menu & | getRootmenu () const |
|
FbTk::Menu & | getRootmenu () |
|
const std::string & | getRootCommand () const |
|
const std::string & | getResizeMode () const |
|
FocusModel | getFocusModel () const |
|
Slit * | slit () |
|
const Slit * | slit () const |
|
Workspace * | getWorkspace (unsigned int w) |
|
Workspace * | currentWorkspace () |
|
const Workspace * | currentWorkspace () const |
|
const FbTk::Menu & | getWorkspacemenu () const |
|
FbTk::Menu & | getWorkspacemenu () |
|
unsigned int | currentWorkspaceID () const |
|
Pixmap | rootPixmap () const |
|
unsigned int | maxLeft (int head) const |
|
unsigned int | maxRight (int head) const |
|
unsigned int | maxTop (int head) const |
|
unsigned int | maxBottom (int head) const |
|
unsigned int | width () const |
|
unsigned int | height () const |
|
unsigned int | screenNumber () const |
|
unsigned int | getCount () const |
| | number of workspaces
|
|
unsigned int | getIconCount () const |
| | number of icons
|
|
const Icons & | getIconList () const |
|
Icons & | getIconList () |
|
const FocusedWindows & | getFocusedList () const |
|
FocusedWindows & | getFocusedList () |
| WinClient * | getLastFocusedWindow (int workspace=-1) |
|
const Workspaces & | getWorkspacesList () const |
|
Workspaces & | getWorkspacesList () |
|
const WorkspaceNames & | getWorkspaceNames () const |
|
void | update (FbTk::Subject *subj) |
|
FbTk::Menu * | createMenu (const std::string &label) |
|
void | hideMenus () |
|
int | getNumberOfWorkspaces () const |
| | the resource value of number of workspace
|
|
PlacementPolicy | getPlacementPolicy () const |
|
int | getEdgeSnapThreshold () const |
|
RowDirection | getRowPlacementDirection () const |
|
ColumnDirection | getColPlacementDirection () const |
|
void | setRootColormapInstalled (bool r) |
|
void | saveRootCommand (std::string rootcmd) |
|
void | saveFocusModel (FocusModel model) |
|
void | saveWorkspaces (int w) |
|
void | setAntialias (bool value) |
|
FbWinFrameTheme & | winFrameTheme () |
|
const FbWinFrameTheme & | winFrameTheme () const |
|
MenuTheme & | menuTheme () |
|
const MenuTheme & | menuTheme () const |
|
const RootTheme & | rootTheme () const |
|
WinButtonTheme & | winButtonTheme () |
|
const WinButtonTheme & | winButtonTheme () const |
|
FbRootWindow & | rootWindow () |
|
const FbRootWindow & | rootWindow () const |
|
FbTk::MultLayers & | layerManager () |
|
const FbTk::MultLayers & | layerManager () const |
|
FbTk::ResourceManager & | resourceManager () |
|
const FbTk::ResourceManager & | resourceManager () const |
|
const std::string & | name () const |
|
const std::string & | altName () const |
|
bool | isShuttingdown () const |
|
int | addWorkspace () |
| int | removeLastWorkspace () |
|
void | nextWorkspace () |
|
void | prevWorkspace () |
| void | nextWorkspace (int delta) |
| void | prevWorkspace (int delta) |
| void | rightWorkspace (int delta) |
| void | leftWorkspace (int delta) |
|
void | removeWorkspaceNames () |
|
void | updateWorkspaceNamesAtom () |
|
void | addWorkspaceName (const char *name) |
|
void | addNetizen (Window win) |
|
void | removeNetizen (Window win) |
|
void | addIcon (FluxboxWindow *win) |
|
void | removeIcon (FluxboxWindow *win) |
|
void | removeWindow (FluxboxWindow *win) |
|
void | removeClient (WinClient &client) |
|
std::string | getNameOfWorkspace (unsigned int workspace) const |
|
void | changeWorkspaceID (unsigned int) |
|
void | sendToWorkspace (unsigned int workspace, FluxboxWindow *win=0, bool changeworkspace=true) |
|
void | reassociateWindow (FluxboxWindow *window, unsigned int workspace_id, bool ignore_sticky) |
|
void | prevFocus () |
|
void | nextFocus () |
|
void | prevFocus (int options) |
|
void | nextFocus (int options) |
|
void | raiseFocus () |
|
void | setFocusedWindow (WinClient &winclient) |
|
void | dirFocus (FluxboxWindow &win, FocusDir dir) |
|
void | reconfigure () |
|
void | rereadMenu () |
|
void | shutdown () |
|
void | showPosition (int x, int y) |
| | show position window centered on the screen with "X x Y" text
|
| void | showGeometry (unsigned int width, unsigned int height) |
| | show geomentry with "width x height"-text, not size of window
|
|
void | hideGeometry () |
| void | notifyReleasedKeys (XKeyEvent &ke) |
|
void | setLayer (FbTk::XLayerItem &item, int layernum) |
| void | updateSize () |
|
bool | hasXinerama () const |
|
int | numHeads () const |
|
void | initXinerama () |
|
int | getHead (int x, int y) const |
|
int | getHead (FbTk::FbWindow &win) const |
|
int | getCurrHead () const |
|
int | getHeadX (int head) const |
|
int | getHeadY (int head) const |
|
int | getHeadWidth (int head) const |
|
int | getHeadHeight (int head) const |
|
template<typename OnHeadObject> int | getOnHead (OnHeadObject &obj) |
|
template<typename OnHeadObject> void | setOnHead (OnHeadObject &obj, int head) |
| FluxboxWindow * | findGroupLeft (WinClient &winclient) |
|
FluxboxWindow * | findGroupRight (WinClient &winclient) |
|
void | updateNetizenCurrentWorkspace () |
|
void | updateNetizenWorkspaceCount () |
|
void | updateNetizenWindowFocus () |
|
void | updateNetizenWindowAdd (Window, unsigned long) |
|
void | updateNetizenWindowDel (Window) |
|
void | updateNetizenConfigNotify (XEvent &ev) |
|
void | updateNetizenWindowRaise (Window) |
|
void | updateNetizenWindowLower (Window) |
|
FluxboxWindow * | createWindow (Window clientwin) |
| | create window frame for client window and attach it
|
|
FluxboxWindow * | createWindow (WinClient &client) |
|
void | setupWindowActions (FluxboxWindow &win) |
|
Strut * | requestStrut (int left, int right, int top, int bottom) |
| | request workspace space, i.e "don't maximize over this area"
|
|
void | clearStrut (Strut *strut) |
| | remove requested space and destroy strut
|
|
void | updateAvailableWorkspaceArea () |
| | updates max avaible area for the workspace
|
|
void | addConfigMenu (const char *label, FbTk::Menu &menu) |
|
void | removeConfigMenu (FbTk::Menu &menu) |
|
|
FbTk::Subject & | clientListSig () |
| | client list signal
|
|
FbTk::Subject & | iconListSig () |
| | icon list sig
|
|
FbTk::Subject & | workspaceCountSig () |
| | workspace count signal
|
|
FbTk::Subject & | workspaceNamesSig () |
| | workspace names signal
|
|
FbTk::Subject & | currentWorkspaceSig () |
| | current workspace signal
|
|
FbTk::Subject & | reconfigureSig () |
| | reconfigure signal
|
|
FbTk::Subject & | resizeSig () |
Detailed Description
Handles screen connection, screen clients and workspaces.
Create workspaces, handles switching between workspaces and windows
Definition at line 73 of file Screen.hh.
Constructor & Destructor Documentation
| BScreen::BScreen |
( |
FbTk::ResourceManager & |
rm, |
|
|
const std::string & |
screenname, |
|
|
const std::string & |
altscreenname, |
|
|
int |
scrn, |
|
|
int |
num_layers |
|
) |
|
|
|
|
! TODO: NLS
! TODO: NLS
! TODO: we shouldn't do this more than once, but since slit handles their
! TODO: For some strange reason we must load everything,
Definition at line 382 of file Screen.cc.
References Fluxbox::colorsPerChannel(), createWindow(), Fluxbox::getCacheLife(), Fluxbox::getCacheMax(), FbTk::ImageControl::installRootColormap(), Fluxbox::instance(), FbTk::App::instance(), Fluxbox::load_rc(), FluxboxWindow::mapRequestEvent(), FbTk::ImageControl::setDither(), and Fluxbox::validateWindow().
00384 :
00385 m_clientlist_sig(*this),
00386 m_iconlist_sig(*this),
00387 m_workspacecount_sig(*this),
00388 m_workspacenames_sig(*this),
00389 m_currentworkspace_sig(*this),
00390 m_reconfigure_sig(*this),
00391 m_resize_sig(*this),
00392 m_layermanager(num_layers),
00393 cycling_focus(false),
00394 cycling_last(0),
00395 m_windowtheme(new FbWinFrameTheme(scrn)),
00396
00397
00398
00399 m_winbutton_theme(new WinButtonTheme(scrn, *m_windowtheme)),
00400 m_menutheme(new MenuTheme(scrn)),
00401 m_root_theme(new
00402 RootTheme(scrn,
00403 *resource.rootcommand)),
00404 m_root_window(scrn),
00405 resource(rm, screenname, altscreenname),
00406 m_name(screenname),
00407 m_altname(altscreenname),
00408 m_resource_manager(rm),
00409 m_available_workspace_area(new Strut(0, 0, 0, 0)),
00410 m_xinerama_headinfo(0),
00411 m_shutdown(false) {
00412
00413
00414 Display *disp = FbTk::App::instance()->display();
00415
00416 initXinerama();
00417
00418
00419 XErrorHandler old = XSetErrorHandler((XErrorHandler) anotherWMRunning);
00420
00421 rootWindow().setEventMask(ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
00422 SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
00423 ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask);
00424
00425 FbTk::App::instance()->sync(false);
00426
00427 XSetErrorHandler((XErrorHandler) old);
00428
00429 managed = running;
00430 if (! managed)
00431 return;
00432
00433 I18n *i18n = I18n::instance();
00434
00435 fprintf(stderr, i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenManagingScreen,
00436 "BScreen::BScreen: managing screen %d "
00437 "using visual 0x%lx, depth %d\n"),
00438 screenNumber(), XVisualIDFromVisual(rootWindow().visual()),
00439 rootWindow().depth());
00440
00441 cycling_window = focused_list.end();
00442
00443 rootWindow().setCursor(XCreateFontCursor(disp, XC_left_ptr));
00444
00445 Fluxbox *fluxbox = Fluxbox::instance();
00446
00447 fluxbox->load_rc(*this);
00448
00449
00450 m_image_control.reset(new FbTk::ImageControl(scrn, true, fluxbox->colorsPerChannel(),
00451 fluxbox->getCacheLife(), fluxbox->getCacheMax()));
00452 imageControl().installRootColormap();
00453 root_colormap_installed = true;
00454
00455
00456
00457 m_menutheme->setAlpha(*resource.menu_alpha);
00458 m_menutheme->setMenuMode(*resource.menu_mode);
00459
00460 if (*resource.menu_delay > 5000)
00461 *resource.menu_delay = 5000;
00462 if (*resource.menu_delay < 0)
00463 *resource.menu_delay = 0;
00464
00465 if (*resource.menu_delay_close > 5000)
00466 *resource.menu_delay_close = 5000;
00467 if (*resource.menu_delay_close < 0)
00468 *resource.menu_delay_close = 0;
00469
00470 m_menutheme->setDelayOpen(*resource.menu_delay);
00471 m_menutheme->setDelayClose(*resource.menu_delay_close);
00472
00473 imageControl().setDither(*resource.image_dither);
00474
00475
00476
00477
00478 winFrameTheme().font().setAntialias(*resource.antialias);
00479 menuTheme().titleFont().setAntialias(*resource.antialias);
00480 menuTheme().frameFont().setAntialias(*resource.antialias);
00481
00482
00483
00484
00485 int geom_h = 10;
00486 int geom_w = 100;
00487
00488 XSetWindowAttributes attrib;
00489 unsigned long mask = CWBorderPixel | CWColormap | CWSaveUnder;
00490 attrib.border_pixel = winFrameTheme().border().color().pixel();
00491 attrib.colormap = rootWindow().colormap();
00492 attrib.save_under = true;
00493
00494 winFrameTheme().reconfigSig().attach(this);
00495
00496 m_geom_window =
00497 XCreateWindow(disp, rootWindow().window(),
00498 0, 0, geom_w, geom_h, winFrameTheme().border().width(), rootWindow().depth(),
00499 InputOutput, rootWindow().visual(), mask, &attrib);
00500 geom_visible = false;
00501 geom_pixmap = 0;
00502
00503 renderGeomWindow();
00504
00505
00506
00507 workspacemenu.reset(createMenu(""));
00508 workspacemenu->setInternalMenu();
00510 m_iconmenu.reset(createMenu("Icons"));
00511 m_iconmenu->setInternalMenu();
00512
00513 if (*resource.workspaces != 0) {
00514 for (int i = 0; i < *resource.workspaces; ++i) {
00515 Workspace *wkspc = new Workspace(*this, m_layermanager,
00516 getNameOfWorkspace(m_workspaces_list.size()),
00517 m_workspaces_list.size());
00518 m_workspaces_list.push_back(wkspc);
00519 }
00520 } else {
00521 Workspace *wkspc = new Workspace(*this, m_layermanager,
00522 getNameOfWorkspace(m_workspaces_list.size()),
00523 m_workspaces_list.size());
00524 m_workspaces_list.push_back(wkspc);
00525 }
00526
00527 setupWorkspacemenu(*this, *workspacemenu);
00529 workspacemenu->insert("Icons", m_iconmenu.get());
00530 workspacemenu->update();
00531
00532 m_current_workspace = m_workspaces_list.front();
00533
00534 #ifdef SLIT
00535 m_slit.reset(new Slit(*this, *layerManager().getLayer(Fluxbox::instance()->getDesktopLayer()),
00536 Fluxbox::instance()->getSlitlistFilename().c_str()));
00537 #endif // SLIT
00538
00540
00541 fluxbox->load_rc(*this);
00542
00543
00544 m_configmenu.reset(createMenu("Configuration"));
00545 setupConfigmenu(*m_configmenu.get());
00546 m_configmenu->setInternalMenu();
00547
00548 workspacemenu->setItemSelected(2, true);
00549
00550 rereadMenu();
00551
00552 m_configmenu->update();
00553
00554
00555 changeWorkspaceID(0);
00556 updateNetizenWorkspaceCount();
00557
00558
00559
00560
00561
00563
00564
00565
00566 m_root_theme->lock(true);
00567 FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename());
00568 m_root_theme->lock(false);
00569
00570 int i;
00571 unsigned int nchild;
00572 Window r, p, *children;
00573 XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild);
00574
00575
00576 for (i = 0; i < (int) nchild; i++) {
00577
00578 if (children[i] == None) continue;
00579
00580 XWMHints *wmhints = XGetWMHints(FbTk::App::instance()->display(),
00581 children[i]);
00582
00583 if (wmhints) {
00584 if ((wmhints->flags & IconWindowHint) &&
00585 (wmhints->icon_window != children[i]))
00586 for (int j = 0; j < (int) nchild; j++) {
00587 if (children[j] == wmhints->icon_window) {
00588 children[j] = None;
00589 break;
00590 }
00591 }
00592 XFree(wmhints);
00593 }
00594 }
00595
00596
00597 for (i = 0; i < (int) nchild; ++i) {
00598 if (children[i] == None || (! fluxbox->validateWindow(children[i])))
00599 continue;
00600
00601 XWindowAttributes attrib;
00602 if (XGetWindowAttributes(disp, children[i],
00603 &attrib)) {
00604 if (attrib.override_redirect)
00605 continue;
00606
00607 if (attrib.map_state != IsUnmapped) {
00608 FluxboxWindow *win = createWindow(children[i]);
00609
00610 if (win) {
00611 XMapRequestEvent mre;
00612 mre.window = children[i];
00613 win->mapRequestEvent(mre);
00614 }
00615 }
00616 }
00617 }
00618
00619 rm.unlock();
00620
00621 XFree(children);
00622
00623 XFlush(disp);
00624 }
|
Member Function Documentation
| WinClient * BScreen::getLastFocusedWindow |
( |
int |
workspace = -1 |
) |
|
|
|
|
Used to find out which window was last focused on the given workspace If workspace is outside the ID range, then the absolute last focused window is given.
Definition at line 2438 of file Screen.cc.
References getCount().
Referenced by Fluxbox::revertFocus().
02438 {
02439 if (focused_list.empty()) return 0;
02440 if (workspace < 0 || workspace >= (int) getCount())
02441 return focused_list.front();
02442
02443 FocusedWindows::iterator it = focused_list.begin();
02444 FocusedWindows::iterator it_end = focused_list.end();
02445 for (; it != it_end; ++it) {
02446 if ((*it)->fbwindow() &&
02447 (((int)(*it)->fbwindow()->workspaceNumber()) == workspace
02448 && !(*it)->fbwindow()->isIconic()
02449 && (!(*it)->fbwindow()->isStuck() || (*it)->fbwindow()->isFocused())))
02450
02451
02452 return *it;
02453 }
02454 return 0;
02455 }
|
| void BScreen::leftWorkspace |
( |
int |
delta |
) |
|
|
|
|
Goes to the workspace "left" of the current
Definition at line 2352 of file Screen.cc.
02352 {
02353 if (currentWorkspaceID() >= static_cast<unsigned int>(delta))
02354 changeWorkspaceID(currentWorkspaceID()-delta);
02355 }
|
| void BScreen::nextWorkspace |
( |
int |
delta |
) |
|
|
|
|
Goes to the workspace "right" of the current
Definition at line 2330 of file Screen.cc.
References getCount().
02330 {
02331 changeWorkspaceID( (currentWorkspaceID() + delta) % getCount());
02332 }
|
| void BScreen::notifyReleasedKeys |
( |
XKeyEvent & |
ke |
) |
|
|
| void BScreen::prevWorkspace |
( |
int |
delta |
) |
|
|
|
|
Goes to the workspace "left" of the current
Definition at line 2337 of file Screen.cc.
References getCount().
02337 {
02338 changeWorkspaceID( (currentWorkspaceID() - delta + getCount()) % getCount());
02339 }
|
| int BScreen::removeLastWorkspace |
( |
|
) |
|
|
|
|
removes last workspace - Returns:
- number of desktops left
Definition at line 996 of file Screen.cc.
References Workspace::removeAll(), and Workspace::workspaceID().
00996 {
00997 if (m_workspaces_list.size() <= 1)
00998 return 0;
00999 Workspace *wkspc = m_workspaces_list.back();
01000
01001 if (m_current_workspace->workspaceID() == wkspc->workspaceID())
01002 changeWorkspaceID(m_current_workspace->workspaceID() - 1);
01003
01004 wkspc->removeAll();
01005
01006 workspacemenu->remove(wkspc->workspaceID()+2);
01007 workspacemenu->update();
01008
01009
01010 m_workspaces_list.pop_back();
01011 delete wkspc;
01012
01013
01014 updateNetizenWorkspaceCount();
01015 saveWorkspaces(m_workspaces_list.size());
01016
01017 return m_workspaces_list.size();
01018 }
|
| void BScreen::rightWorkspace |
( |
int |
delta |
) |
|
|
|
|
Goes to the workspace "right" of the current
Definition at line 2344 of file Screen.cc.
References getCount().
02344 {
02345 if (currentWorkspaceID()+delta < getCount())
02346 changeWorkspaceID(currentWorkspaceID()+delta);
02347 }
|
| void BScreen::showGeometry |
( |
unsigned int |
gx, |
|
|
unsigned int |
gy |
|
) |
|
|
|
|
show geomentry with "width x height"-text, not size of window
! TODO: geom window again?! repeated
Definition at line 2276 of file Screen.cc.
References FbTk::FbWindow::clear(), FbTk::FbWindow::height(), FbTk::FbWindow::move(), FbTk::FbWindow::raise(), FbTk::FbWindow::show(), FbTk::FbWindow::width(), and FbTk::FbWindow::window().
02276 {
02277 if (!doShowWindowPos())
02278 return;
02279
02280 if (! geom_visible) {
02281 if (hasXinerama()) {
02282 unsigned int head = getCurrHead();
02283
02284 m_geom_window.move(getHeadX(head) + (getHeadWidth(head) - m_geom_window.width()) / 2,
02285 getHeadY(head) + (getHeadHeight(head) - m_geom_window.height()) / 2);
02286 } else {
02287 m_geom_window.move((width() - m_geom_window.width()) / 2, (height() - m_geom_window.height()) / 2);
02288
02289 }
02290 m_geom_window.show();
02291 m_geom_window.raise();
02292
02293 geom_visible = true;
02294 }
02295
02296 char label[256];
02297
02298 sprintf(label,
02299 I18n::instance()->getMessage(FBNLS::ScreenSet, FBNLS::ScreenGeometryFormat,
02300 "W: %4d x H: %4d"), gx, gy);
02301
02302 m_geom_window.clear();
02303
02305 winFrameTheme().font().drawText(m_geom_window.window(),
02306 screenNumber(),
02307 winFrameTheme().labelTextFocusGC(),
02308 label, strlen(label),
02309 winFrameTheme().bevelWidth(),
02310 winFrameTheme().bevelWidth() +
02311 winFrameTheme().font().ascent());
02312 }
|
| void BScreen::updateSize |
( |
|
) |
|
|
|
|
updates root window size and resizes/reconfigures screen clients that depends on screen size (slit) (and maximized windows?)
Definition at line 2457 of file Screen.cc.
02457 {
02458 cerr<<"update Size"<<endl;
02459
02460 rootWindow().updateGeometry();
02461
02462
02463 m_root_theme->reconfigTheme();
02464
02465
02466 m_resize_sig.notify();
02467 }
|
The documentation for this class was generated from the following files:
Fluxbox CVS-Jan-2003
|
|
|