+}
+
+
+void BScreen::showRootMenu(int x, int y) {
+ int mx = x - (rootmenu->getWidth() / 2);
+ int my = y - (rootmenu->getTitleHeight() / 2);
+
+ if (mx < 0) mx = 0;
+ if (my < 0) my = 0;
+
+ if (mx + rootmenu->getWidth() > getWidth())
+ mx = getWidth() - rootmenu->getWidth() - getBorderWidth();
+
+ if (my + rootmenu->getHeight() > getHeight())
+ my = getHeight() - rootmenu->getHeight() - getBorderWidth();
+
+ rootmenu->move(mx, my);
+
+ if (! rootmenu->isVisible()) {
+ blackbox->checkMenu();
+ rootmenu->show();
+ }
+}
+
+
+void BScreen::propertyNotifyEvent(const XPropertyEvent *pe) {
+ if (pe->atom == xatom->getAtom(XAtom::net_desktop_names)) {
+ // _NET_WM_DESKTOP_NAMES
+ WorkspaceList::iterator it = workspacesList.begin();
+ const WorkspaceList::iterator end = workspacesList.end();
+ for (; it != end; ++it) {
+ (*it)->readName(); // re-read its name from the window property
+ workspacemenu->changeWorkspaceLabel((*it)->getID(), (*it)->getName());
+ }
+ workspacemenu->update();
+ toolbar->reconfigure();
+ saveWorkspaceNames();
+ }
+}
+
+
+void BScreen::toggleFocusModel(FocusModel model) {
+ std::for_each(windowList.begin(), windowList.end(),
+ std::mem_fun(&BlackboxWindow::ungrabButtons));
+
+ if (model == SloppyFocus) {
+ saveSloppyFocus(True);
+ } else {
+ // we're cheating here to save writing the config file 3 times
+ resource.auto_raise = False;
+ resource.click_raise = False;
+ saveSloppyFocus(False);
+ }
+
+ std::for_each(windowList.begin(), windowList.end(),
+ std::mem_fun(&BlackboxWindow::grabButtons));
+}
+
+#ifdef BITMAPBUTTONS
+void BScreen::readDatabaseMask(const string &rname, PixmapMask &pixmapMask,
+ const Configuration &style) {
+ string s;
+ int hx, hy; //ignored
+ int ret = BitmapOpenFailed; //default to failure.
+
+ if (style.getValue(rname, s))
+ {
+ if (s[0] != '/' && s[0] != '~')
+ {
+ std::string xbmFile = std::string("~/.openbox/buttons/") + s;
+ ret = XReadBitmapFile(blackbox->getXDisplay(), getRootWindow(),
+ expandTilde(xbmFile).c_str(), &pixmapMask.w,
+ &pixmapMask.h, &pixmapMask.mask, &hx, &hy);
+ } else
+ ret = XReadBitmapFile(blackbox->getXDisplay(), getRootWindow(),
+ expandTilde(s).c_str(), &pixmapMask.w,
+ &pixmapMask.h, &pixmapMask.mask, &hx, &hy);
+
+ if (ret == BitmapSuccess)
+ return;
+ }
+
+ pixmapMask.mask = None;
+ pixmapMask.w = pixmapMask.h = 0;
+}
+#endif // BITMAPSUCCESS
+
+BTexture BScreen::readDatabaseTexture(const string &rname,
+ const string &default_color,
+ const Configuration &style,
+ bool allowNoTexture) {
+ BTexture texture;
+ string s;
+
+ if (style.getValue(rname, s))
+ texture = BTexture(s);
+ else if (allowNoTexture) //no default
+ texture.setTexture(BTexture::NoTexture);
+ else
+ texture.setTexture(BTexture::Solid | BTexture::Flat);
+
+ // associate this texture with this screen
+ texture.setDisplay(getBaseDisplay(), getScreenNumber());
+ texture.setImageControl(image_control);
+
+ if (texture.texture() != BTexture::NoTexture) {
+ texture.setColor(readDatabaseColor(rname + ".color", default_color,
+ style));
+ texture.setColorTo(readDatabaseColor(rname + ".colorTo", default_color,
+ style));
+ texture.setBorderColor(readDatabaseColor(rname + ".borderColor",
+ default_color, style));
+ }
+
+ return texture;
+}
+
+
+BColor BScreen::readDatabaseColor(const string &rname,
+ const string &default_color,
+ const Configuration &style) {
+ BColor color;
+ string s;
+ if (style.getValue(rname, s))
+ color = BColor(s, getBaseDisplay(), getScreenNumber());
+ else
+ color = BColor(default_color, getBaseDisplay(), getScreenNumber());
+ return color;
+}
+
+
+BFont *BScreen::readDatabaseFont(const string &rbasename,
+ const Configuration &style) {
+ string fontname;
+
+ string s;
+
+#ifdef XFT
+ int i;
+ if (style.getValue(rbasename + "xft.font", s) &&
+ style.getValue(rbasename + "xft.size", i)) {
+ string family = s;
+ bool bold = False;
+ bool italic = False;
+ bool dropShadow = False;
+ if (style.getValue(rbasename + "xft.flags", s)) {
+ if (s.find("bold") != string::npos)
+ bold = True;
+ if (s.find("italic") != string::npos)
+ italic = True;
+ if (s.find("shadow") != string::npos)
+ dropShadow = True;
+ }
+
+ BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold,
+ italic, dropShadow, resource.aa_fonts);
+ if (b->valid())
+ return b;
+ else
+ delete b; // fall back to the normal X font stuff
+ }
+#endif // XFT
+
+ style.getValue(rbasename + "font", s);
+ // if this fails, a blank string will be used, which will cause the fallback
+ // font to load.