diff options
| author | Scott Moynes <smoynes@nexus.carleton.ca> | 2002-10-01 01:59:09 +0000 |
|---|---|---|
| committer | Scott Moynes <smoynes@nexus.carleton.ca> | 2002-10-01 01:59:09 +0000 |
| commit | 72a2e98738d87b89620bafd15141690aa4be8fab (patch) | |
| tree | 840e499622440035f074c0ab80ea00f3fb8a1327 /src | |
| parent | 783fac59c994930139c1ee8162b9150e41dc8307 (diff) | |
merged with 2_1-merged-to-HEAD-2002-09-30
Diffstat (limited to 'src')
| -rw-r--r-- | src/Configmenu.cc | 69 | ||||
| -rw-r--r-- | src/Configmenu.hh | 22 | ||||
| -rw-r--r-- | src/Font.cc | 30 | ||||
| -rw-r--r-- | src/Screen.cc | 69 | ||||
| -rw-r--r-- | src/Screen.hh | 8 | ||||
| -rw-r--r-- | src/Workspace.cc | 17 |
6 files changed, 165 insertions, 50 deletions
diff --git a/src/Configmenu.cc b/src/Configmenu.cc index 54c047ed..fbb2c66a 100644 --- a/src/Configmenu.cc +++ b/src/Configmenu.cc @@ -33,7 +33,7 @@ #include "Screen.hh" Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) { - setLabel(i18n(ConfigmenuSet, ConfigmenuConfigOptions, "Config options")); + setLabel(i18n(ConfigmenuSet, ConfigmenuConfigOptions, "Config Options")); setInternalMenu(); focusmenu = new Focusmenu(this); @@ -43,6 +43,9 @@ Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) { #ifdef XINERAMA xineramamenu = new Xineramamenu(this); #endif // XINERAMA +#ifdef XFT + xftmenu = new Xftmenu(this); +#endif // XFT insert(i18n(ConfigmenuSet, ConfigmenuFocusModel, "Focus Model"), focusmenu); @@ -56,6 +59,10 @@ Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) { insert(i18n(ConfigmenuSet, ConfigmenuXineramaSupport, "XineramaSupport"), xineramamenu); #endif // XINERAMA +#ifdef XFT + insert(i18n(ConfigmenuSet, ConfigmenuXftOptions, + "Xft Font Options"), xftmenu); +#endif // XINERAMA insert(i18n(ConfigmenuSet, ConfigmenuImageDithering, "Image Dithering"), 1); insert(i18n(ConfigmenuSet, ConfigmenuOpaqueMove, @@ -82,6 +89,9 @@ void Configmenu::setValues(void) { #ifdef XINERAMA ++index; #endif // XINERAMA +#ifdef XFT + ++index; +#endif // XFT setItemSelected(index++, getScreen()->doImageDither()); setItemSelected(index++, getScreen()->doOpaqueMove()); setItemSelected(index++, getScreen()->doWorkspaceWarping()); @@ -101,6 +111,9 @@ Configmenu::~Configmenu(void) { #ifdef XINERAMA delete xineramamenu; #endif // XINERAMA +#ifdef XFT + delete xftmenu; +#endif // XFT } @@ -167,6 +180,9 @@ void Configmenu::reconfigure(void) { #ifdef XINERAMA xineramamenu->reconfigure(); #endif // XINERAMA +#ifdef XFT + xftmenu->reconfigure(); +#endif // XFT Basemenu::reconfigure(); } @@ -546,3 +562,54 @@ void Configmenu::Xineramamenu::itemSelected(int button, unsigned int index) { } } #endif // XINERAMA + +#ifdef XFT +Configmenu::Xftmenu::Xftmenu(Configmenu *cm): + Basemenu(cm->getScreen()) { + setLabel(i18n(ConfigmenuSet, ConfigmenuXftOptions, "Xft Font Options")); + setInternalMenu(); + + insert(i18n(ConfigmenuSet, ConfigmenuXftAA, "Anti-Alias Text"), 1); + insert(i18n(ConfigmenuSet, ConfigmenuXftShadow, "Drop Shadows Under Text"), + 2); + + update(); + setValues(); +} + + +void Configmenu::Xftmenu::setValues(void) { + setItemSelected(0, getScreen()->doAAFonts()); + setItemEnabled(1, getScreen()->doAAFonts()); + setItemSelected(1, getScreen()->doShadowFonts()); +} + + +void Configmenu::Xftmenu::reconfigure(void) { + setValues(); + Basemenu::reconfigure(); +} + + +void Configmenu::Xftmenu::itemSelected(int button, unsigned int index) { + if (button != 1) + return; + + BasemenuItem *item = find(index); + + if (! item->function()) + return; + + switch (item->function()) { + case 1: // anti-alias text + getScreen()->saveAAFonts(! getScreen()->doAAFonts()); + break; + + case 2: // drop shadows + getScreen()->saveShadowFonts(! getScreen()->doShadowFonts()); + break; + } + + setValues(); +} +#endif // XFT diff --git a/src/Configmenu.hh b/src/Configmenu.hh index 6a80ab4e..081e397f 100644 --- a/src/Configmenu.hh +++ b/src/Configmenu.hh @@ -105,6 +105,22 @@ private: }; #endif // XINERAMA +#ifdef XFT + class Xftmenu : public Basemenu { + private: + Xftmenu(const Xftmenu&); + Xftmenu& operator=(const Xftmenu&); + + protected: + virtual void itemSelected(int button, unsigned int index); + virtual void setValues(void); + + public: + Xftmenu(Configmenu *cm); + virtual void reconfigure(void); + }; +#endif // XFT + Focusmenu *focusmenu; Placementmenu *placementmenu; WindowToWindowSnapmenu *windowsnapmenu; @@ -112,6 +128,9 @@ private: #ifdef XINERAMA Xineramamenu *xineramamenu; #endif // XINERAMA +#ifdef XFT + Xftmenu *xftmenu; +#endif // XFT // friend class Focusmenu; // friend class Placementmenu; @@ -134,6 +153,9 @@ public: #ifdef XINERAMA inline Basemenu *getXineramamenu(void) { return xineramamenu; } #endif // XINERAMA +#ifdef XFT + inline Basemenu *getXftmenu(void) { return xftmenu; } +#endif // XFT virtual void reconfigure(void); }; diff --git a/src/Font.cc b/src/Font.cc index 68114a98..fd7a0fbe 100644 --- a/src/Font.cc +++ b/src/Font.cc @@ -270,9 +270,13 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color, c.color.alpha = 0x40 | 0x40 << 8; // transparent shadow c.pixel = BlackPixel(_display, _screen->getScreenNumber()); - - XftDrawStringUtf8(draw, &c, _xftfont, x + 1, _xftfont->ascent + y + 1, - (XftChar8 *) string.c_str(), string.size()); +#ifdef XFT_UTF8 + XftDrawStringUtf8( +#else + XftDrawString8( +#endif + draw, &c, _xftfont, x + 1, _xftfont->ascent + y + 1, + (XftChar8 *) string.c_str(), string.size()); } XftColor c; @@ -282,8 +286,13 @@ void BFont::drawString(Drawable d, int x, int y, const BColor &color, c.pixel = color.pixel(); c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet - XftDrawStringUtf8(draw, &c, _xftfont, x, _xftfont->ascent + y, - (XftChar8 *) string.c_str(), string.size()); +#ifdef XFT_UTF8 + XftDrawStringUtf8( +#else + XftDrawString8( +#endif + draw, &c, _xftfont, x, _xftfont->ascent + y, + (XftChar8 *) string.c_str(), string.size()); XftDrawDestroy(draw); return; @@ -309,8 +318,15 @@ unsigned int BFont::measureString(const string &string) const { #ifdef XFT if (_xftfont) { XGlyphInfo info; - XftTextExtentsUtf8(_display, _xftfont, (XftChar8 *) string.c_str(), - string.size(), &info); + +#ifdef XFT_UTF8 + XftTextExtentsUtf8( +#else + XftTextExtents8( +#endif + _display, _xftfont, (XftChar8 *) string.c_str(), + string.size(), &info); + return info.xOff + (_shadow ? 1 : 0); } #endif // XFT diff --git a/src/Screen.cc b/src/Screen.cc index 987f923b..7e7ce5a4 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -429,15 +429,15 @@ void BScreen::saveFocusLast(bool f) { void BScreen::saveAAFonts(bool f) { resource.aa_fonts = f; - reconfigure(); config->setValue(screenstr + "antialiasFonts", resource.aa_fonts); + reconfigure(); } void BScreen::saveShadowFonts(bool f) { resource.shadow_fonts = f; - reconfigure(); config->setValue(screenstr + "dropShadowFonts", resource.shadow_fonts); + reconfigure(); } @@ -709,12 +709,13 @@ void BScreen::load_rc(void) { if (! config->getValue(screenstr + "opaqueMove", resource.opaque_move)) resource.opaque_move = false; - if (! config->getValue(screenstr + "dropShadowFonts", resource.shadow_fonts)) - resource.shadow_fonts = false; - if (! config->getValue(screenstr + "antialiasFonts", resource.aa_fonts)) resource.aa_fonts = true; + if (! resource.aa_fonts || + ! config->getValue(screenstr + "dropShadowFonts", resource.shadow_fonts)) + resource.shadow_fonts = false; + if (! config->getValue(screenstr + "resizeZones", resource.resize_zones) || (resource.resize_zones != 1 && resource.resize_zones != 2 && resource.resize_zones != 4)) @@ -1753,6 +1754,9 @@ void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) { #ifdef XINERAMA ++bbwins; #endif // XINERAMA +#ifdef XFT + ++bbwins; +#endif // XFT Window *session_stack = new Window[(num + workspacesList.size() + rootmenuList.size() + @@ -1776,6 +1780,9 @@ void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) { #ifdef XINERAMA *(session_stack + i++) = configmenu->getXineramamenu()->getWindowID(); #endif // XINERAMA +#ifdef XFT + *(session_stack + i++) = configmenu->getXftmenu()->getWindowID(); +#endif // XFT *(session_stack + i++) = configmenu->getWindowID(); *(session_stack + i++) = slit->getMenu()->getDirectionmenu()->getWindowID(); @@ -1867,8 +1874,7 @@ void BScreen::propagateWindowName(const BlackboxWindow *bw) { if (bw->isIconic()) { iconmenu->changeItemLabel(bw->getWindowNumber(), bw->getIconTitle()); iconmenu->update(); - } - else { + } else { Clientmenu *clientmenu = getWorkspace(bw->getWorkspaceNumber())->getMenu(); clientmenu->changeItemLabel(bw->getWindowNumber(), bw->getTitle()); clientmenu->update(); @@ -1879,36 +1885,28 @@ void BScreen::propagateWindowName(const BlackboxWindow *bw) { } -void BScreen::nextFocus(void) { +void BScreen::nextFocus(void) const { BlackboxWindow *focused = blackbox->getFocusedWindow(), *next = focused; - if (focused) { - // if window is not on this screen, ignore it - if (focused->getScreen()->getScreenNumber() != getScreenNumber()) - focused = (BlackboxWindow*) 0; - } - - if (focused && current_workspace->getCount() > 1) { - // next is the next window to recieve focus, current is a place holder - BlackboxWindow *current; + if (focused && + focused->getScreen()->getScreenNumber() == getScreenNumber() && + current_workspace->getCount() > 1) { do { - current = next; - next = current_workspace->getNextWindowInList(current); - } while(! next->setInputFocus() && next != focused); + next = current_workspace->getNextWindowInList(next); + } while (next != focused && ! next->setInputFocus()); if (next != focused) current_workspace->raiseWindow(next); - } else if (current_workspace->getCount() >= 1) { + } else if (current_workspace->getCount() > 0) { next = current_workspace->getTopWindowOnStack(); - - current_workspace->raiseWindow(next); next->setInputFocus(); + current_workspace->raiseWindow(next); } } -void BScreen::prevFocus(void) { +void BScreen::prevFocus(void) const { BlackboxWindow *focused = blackbox->getFocusedWindow(), *next = focused; @@ -1917,27 +1915,26 @@ void BScreen::prevFocus(void) { if (focused->getScreen()->getScreenNumber() != getScreenNumber()) focused = (BlackboxWindow*) 0; } - - if (focused && current_workspace->getCount() > 1) { - // next is the next window to recieve focus, current is a place holder - BlackboxWindow *current; + + if (focused && + focused->getScreen()->getScreenNumber() == getScreenNumber() && + current_workspace->getCount() > 1) { + // next is the next window to receive focus, current is a place holder do { - current = next; - next = current_workspace->getPrevWindowInList(current); - } while(! next->setInputFocus() && next != focused); + next = current_workspace->getPrevWindowInList(next); + } while (next != focused && ! next->setInputFocus()); if (next != focused) current_workspace->raiseWindow(next); - } else if (current_workspace->getCount() >= 1) { + } else if (current_workspace->getCount() > 0) { next = current_workspace->getTopWindowOnStack(); - - current_workspace->raiseWindow(next); next->setInputFocus(); + current_workspace->raiseWindow(next); } } -void BScreen::raiseFocus(void) { +void BScreen::raiseFocus(void) const { BlackboxWindow *focused = blackbox->getFocusedWindow(); if (! focused) return; @@ -2525,7 +2522,7 @@ void BScreen::updateAvailableArea(void) { } -Workspace* BScreen::getWorkspace(unsigned int index) { +Workspace* BScreen::getWorkspace(unsigned int index) const { assert(index < workspacesList.size()); return workspacesList[index]; } diff --git a/src/Screen.hh b/src/Screen.hh index 32440d7b..c96c973e 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -272,7 +272,7 @@ public: inline Slit *getSlit(void) { return slit; } inline Toolbar *getToolbar(void) { return toolbar; } - Workspace *getWorkspace(unsigned int index); + Workspace *getWorkspace(unsigned int index) const; inline Workspace *getCurrentWorkspace(void) { return current_workspace; } @@ -397,9 +397,9 @@ public: void reassociateWindow(BlackboxWindow *w, unsigned int wkspc_id, bool ignore_sticky); void propagateWindowName(const BlackboxWindow *bw); - void prevFocus(void); - void nextFocus(void); - void raiseFocus(void); + void prevFocus(void) const; + void nextFocus(void) const; + void raiseFocus(void) const; void load_rc(void); void save_rc(void); void reconfigure(void); diff --git a/src/Workspace.cc b/src/Workspace.cc index 4a76bc8a..67e19110 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -636,11 +636,24 @@ bool Workspace::smartPlacement(Rect& win) { RectList availableAreas = screen->allAvailableAreas(); RectList::iterator it, end = availableAreas.end(); - for (it = availableAreas.begin(); it != end; ++it) + for (it = availableAreas.begin(); it != end; ++it) { + Rect r = *it; + r.setRect(r.x() + screen->getSnapOffset(), + r.y() + screen->getSnapOffset(), + r.width() - screen->getSnapOffset(), + r.height() - screen->getSnapOffset()); spaces.push_back(*it); + } } else #endif // XINERAMA - spaces.push_back(screen->availableArea()); + { + Rect r = screen->availableArea(); + r.setRect(r.x() + screen->getSnapOffset(), + r.y() + screen->getSnapOffset(), + r.width() - screen->getSnapOffset(), + r.height() - screen->getSnapOffset()); + spaces.push_back(r); + } //Find Free Spaces BlackboxWindowList::const_iterator wit = windowList.begin(), |
