all repos — openbox @ 72a2e98738d87b89620bafd15141690aa4be8fab

openbox fork - make it a bit more like ryudo

merged with 2_1-merged-to-HEAD-2002-09-30
Scott Moynes smoynes@nexus.carleton.ca
commit

72a2e98738d87b89620bafd15141690aa4be8fab

parent

783fac59c994930139c1ee8162b9150e41dc8307

M AUTHORSAUTHORS

@@ -64,7 +64,9 @@ SATO Satoru <ssato@adachi.ne.jp>

- Japanese (ja_JP) Hyun Suk Noh <tzesti@users.sourceforge.net> - Korean (ko_KR) - Wilbert Berendsen <wbsoft@xs4all.nl> + Artis Trops <hornet@navigator.lv> + - Latvian (lv_LV) + Wilbert Berendsen <wbsoft@xs4all.nl> - Dutch (nl_NL) Øyvind Stegard <oyvind.stegard@bluezone.no> - Norwegian (no_NO)
M CHANGELOGCHANGELOG

@@ -2,11 +2,17 @@ Changelog for Openbox:

2.2.0 * Bitmap buttons (Scott Moynes) +2.1.1: + * A build fix for xftlsfonts. (Scott Moynes) + + * Add a configuration menu for changing Xft font (Ben Jansens) + options, when Xft is compiled in. + 2.1.0: - * make alt-right-click resizing work on bottom window (Ben Jansens) + * Make alt-right-click resizing work on bottom window (Ben Jansens) handles. - * drop shadows for fonts, optional. (dropShadowFonts (Ben Jansens) + * Drop shadows for fonts, optional. (dropShadowFonts (Ben Jansens) in the rc file). * GNOME 2 Support. (Fixed problems with Gnome 2 (Ben Jansens)
M CHANGELOG.BlackboxCHANGELOG.Blackbox

@@ -1,9 +1,9 @@

ChangeLog from Blackbox (this code's previous project): Changes from 0.62.1 to 0.65.0: - - added Taiwan Chinese (zh_TW), Hungarian (hu_HU), Korean (ko_KR), - Norwegian (no_NO), Polish (pl_PL), Romanian (ro_RO) and Ukrainian (uk_UA) - nls files and updated most of the others. + - added Taiwan Chinese (zh_TW), Hungarian (hu_HU), Latvian (lv_LV), + Korean (ko_KR), Norwegian (no_NO), Polish (pl_PL), Romanian (ro_RO) and + Ukrainian (uk_UA) nls files and updated most of the others. - added French man pages - remove slit and netwm as compile time options - strip much of BaseDisplay's original functionality and move it to the
M configure.inconfigure.in

@@ -35,7 +35,7 @@ dnl Check for X headers and libraries

AC_PATH_X AC_PATH_XTRA -test x$no_x = "xyes" && AC_MSG_ERROR([Openbox requires the X Window System libraries and headers.]) +test "$no_x" = "yes" && AC_MSG_ERROR([Openbox requires the X Window System libraries and headers.]) test x$x_includes = "x" && x_includes="/usr/include" test x$x_libraries = "x" && x_libraries="/usr/lib"

@@ -46,7 +46,7 @@ LIBS="$LIBS $X_LIBS"

LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS" AC_MSG_CHECKING(for GCC) -if test x$GCC = "xyes"; then +if test "$GCC" = "yes"; then AC_MSG_RESULT([yes]) CXXFLAGS="${CXXFLAGS} -Wall -W" else

@@ -83,7 +83,7 @@ AC_ARG_ENABLE(

shape, [ --enable-shape enable support of the XShape extension [default=yes]]) : ${enableval="yes"} -if test x$enableval = "xyes"; then +if test "$enableval" = "yes"; then AC_MSG_RESULT([yes]) AC_CHECK_LIB(Xext, XShapeCombineShape, AC_MSG_CHECKING([for X11/extensions/shape.h])

@@ -100,7 +100,7 @@ )

else AC_MSG_RESULT([no]) fi -if test x$SHAPE = "xyes"; then +if test "$SHAPE" = "yes"; then LIBS="$LIBS -lXext" AC_DEFINE(SHAPE,1,Enable support of the XShape extension) fi

@@ -110,7 +110,7 @@ XINERAMA=""

AC_MSG_CHECKING([whether to build support for the Xinerama extension]) AC_ARG_ENABLE( xinerama, [ --enable-xinerama enable support of the Xinerama extension [default=no]], - if test x$enableval = "xyes"; then + if test "$enableval" = "yes"; then AC_MSG_RESULT([yes]) AC_CHECK_LIB(Xinerama, XineramaQueryExtension,

@@ -131,17 +131,18 @@ AC_MSG_RESULT([no])

fi, AC_MSG_RESULT([no]) ) -if test x$XINERAMA = "xyes"; then +if test "$XINERAMA" = "yes"; then AC_DEFINE(XINERAMA,1,Enable support of the Xinerama extension) fi dnl Check for Xft extension support and proper library files. XFT="" +XFT_UTF8="" AC_MSG_CHECKING([whether to build support for the Xft extension]) AC_ARG_ENABLE( xft, [ --enable-xft enable support of the Xft extension [default=yes]]) : ${enableval="yes"} -if test x$enableval = "xyes"; then +if test "$enableval" = "yes"; then AC_MSG_RESULT([yes]) AC_CHECK_LIB(Xft, XftFontOpenXlfd,

@@ -152,7 +153,13 @@ #include <X11/Xft/Xft.h>

, XftFont foo, AC_MSG_RESULT([yes]) XFT="yes" - LIBS="$LIBS -lXft", + LIBS="$LIBS -lXft" + + dnl Check for utf8 support in the Xft library + AC_CHECK_LIB(Xft, XftDrawStringUtf8, + XFT_UTF8="yes", + ), + AC_MSG_RESULT([no]) ) )

@@ -160,8 +167,11 @@

else AC_MSG_RESULT([no]) fi -if test x$XFT = "xyes"; then - AC_DEFINE(XFT,1,Enable support of the Xft extension) +if test "$XFT" = "yes"; then + AC_DEFINE(XFT,1,[Enable support of the Xft extension]) + if test "$XFT_UTF8" = "yes"; then + AC_DEFINE(XFT_UTF8,1,[Support for Utf8 text in the Xft extension]) + fi fi dnl Check for ordered 8bpp dithering

@@ -170,7 +180,7 @@ AC_MSG_CHECKING([whether to include Pseudocolor ordered dithering code])

AC_ARG_ENABLE(ordered-pseudo, [ --enable-ordered-pseudo include code for ordered pseudocolor (8bpp) dithering [default=no]], - if test x$enableval = "xyes"; then + if test "$enableval" = "yes"; then AC_MSG_RESULT([yes]) ORDEREDPSEUDO="yes" else

@@ -178,7 +188,7 @@ AC_MSG_RESULT([no])

fi, AC_MSG_RESULT([no]) ) -if test x$ORDEREDPSEUDO = "xyes"; then +if test "$ORDEREDPSEUDO" = "yes"; then AC_DEFINE(ORDEREDPSEUDO,1,Enable pseudocolor ordered dithering) fi

@@ -187,9 +197,9 @@ DEBUG=""

AC_MSG_CHECKING([whether to include verbose debugging code]) AC_ARG_ENABLE(debug, [ --enable-debug include verbose debugging code [default=no]], - if test x$enableval = "xyes"; then + if test "$enableval" = "yes"; then AC_MSG_RESULT([yes]) - if test x$GCC = "xyes"; then + if test "$GCC" = "yes"; then DEBUG="-DDEBUG -fno-inline -g" else DEBUG="-DDEBUG"

@@ -208,7 +218,7 @@ NLS=""

AC_MSG_CHECKING([whether to include NLS support]) AC_ARG_ENABLE(nls, [ --enable-nls include natural language support [default=yes]], - if test x$enableval = "xyes"; then + if test "$enableval" = "yes"; then AC_MSG_RESULT([yes]) NLS="yes" else

@@ -225,7 +235,7 @@ if test x$gencat_cmd = "x"; then

NLS="" fi -if test x$NLS = "xyes"; then +if test "$NLS" = "yes"; then AC_DEFINE(NLS,1,Include natural language support) AC_SUBST(NLS) fi

@@ -236,7 +246,7 @@ AC_MSG_CHECKING([whether to use the timed pixmap cache])

AC_ARG_ENABLE( timed-cache, [ --enable-timed-cache use timed pixmap cache [default=yes]], - if test x$enableval = "xyes"; then + if test "$enableval" = "yes"; then AC_MSG_RESULT([yes]) TIMEDCACHE="yes" else

@@ -245,7 +255,7 @@ fi,

AC_MSG_RESULT([yes]) TIMEDCACHE="yes" ) -if test x$TIMEDCACHE = "xyes"; then +if test "$TIMEDCACHE" = "yes"; then AC_DEFINE(TIMEDCACHE,1,Use timed pixmap cache) fi

@@ -305,6 +315,7 @@ nls/hu_HU/Makefile

nls/it_IT/Makefile nls/ja_JP/Makefile nls/ko_KR/Makefile +nls/lv_LV/Makefile nls/no_NO/Makefile nls/pl_PL/Makefile nls/nl_NL/Makefile
M nls/C/Configmenu.mnls/C/Configmenu.m

@@ -72,3 +72,9 @@ $ #XineramaMaximizing

# Window Maximizing $ #XineramaSnapping # Window Snapping +$ #XftOptions +# Xft Font Options +$ #XftAA +# Anti-Alias Text +$ #XftShadow +# Drop Shadows Under Text
M nls/Makefile.amnls/Makefile.am

@@ -1,8 +1,8 @@

# nls/Makefile.am for Blackbox - an X11 Window Manager NLSTEST = @NLS@ -SUBDIRS = C da_DK de_DE es_AR es_ES et_EE fr_FR hu_HU it_IT ja_JP ko_KR nl_NL \ - no_NO pl_PL pt_BR ro_RO ru_RU sk_SK sl_SI sv_SE tr_TR uk_UA \ +SUBDIRS = C da_DK de_DE es_AR es_ES et_EE fr_FR hu_HU it_IT ja_JP ko_KR lv_LV \ + nl_NL no_NO pl_PL pt_BR ro_RO ru_RU sk_SK sl_SI sv_SE tr_TR uk_UA \ zh_CN zh_TW MAINTAINERCLEANFILES = Makefile.in blackbox-nls.hh DISTCLEANFILES = blackbox-nls.hh
M src/Configmenu.ccsrc/Configmenu.cc

@@ -33,7 +33,7 @@ #include "Window.hh"

#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 @@ edgesnapmenu = new WindowToEdgeSnapmenu(this);

#ifdef XINERAMA xineramamenu = new Xineramamenu(this); #endif // XINERAMA +#ifdef XFT + xftmenu = new Xftmenu(this); +#endif // XFT insert(i18n(ConfigmenuSet, ConfigmenuFocusModel, "Focus Model"), focusmenu);

@@ -55,6 +58,10 @@ "Window-To-Edge Snapping"), edgesnapmenu);

#ifdef XINERAMA 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);

@@ -82,6 +89,9 @@ int index = 4;

#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 @@ delete edgesnapmenu;

#ifdef XINERAMA delete xineramamenu; #endif // XINERAMA +#ifdef XFT + delete xftmenu; +#endif // XFT }

@@ -167,6 +180,9 @@ edgesnapmenu->reconfigure();

#ifdef XINERAMA xineramamenu->reconfigure(); #endif // XINERAMA +#ifdef XFT + xftmenu->reconfigure(); +#endif // XFT Basemenu::reconfigure(); }

@@ -546,3 +562,54 @@ break;

} } #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
M src/Configmenu.hhsrc/Configmenu.hh

@@ -105,6 +105,22 @@ virtual void reconfigure(void);

}; #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 @@ WindowToEdgeSnapmenu *edgesnapmenu;

#ifdef XINERAMA Xineramamenu *xineramamenu; #endif // XINERAMA +#ifdef XFT + Xftmenu *xftmenu; +#endif // XFT // friend class Focusmenu; // friend class Placementmenu;

@@ -134,6 +153,9 @@ inline Basemenu *getEdgeSnapmenu(void) { return edgesnapmenu; }

#ifdef XINERAMA inline Basemenu *getXineramamenu(void) { return xineramamenu; } #endif // XINERAMA +#ifdef XFT + inline Basemenu *getXftmenu(void) { return xftmenu; } +#endif // XFT virtual void reconfigure(void); };
M src/Font.ccsrc/Font.cc

@@ -270,9 +270,13 @@ c.color.blue = 0;

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 @@ c.color.blue = color.blue() | color.blue() << 8;

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 @@

#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
M src/Screen.ccsrc/Screen.cc

@@ -429,15 +429,15 @@

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,11 +709,12 @@

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 &&

@@ -1753,6 +1754,9 @@ int bbwins = 15;

#ifdef XINERAMA ++bbwins; #endif // XINERAMA +#ifdef XFT + ++bbwins; +#endif // XFT Window *session_stack = new Window[(num + workspacesList.size() + rootmenuList.size() +

@@ -1776,6 +1780,9 @@ *(session_stack + i++) = configmenu->getEdgeSnapmenu()->getWindowID();

#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::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 @@ // 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) { + // 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 @@ updateWorkArea();

} -Workspace* BScreen::getWorkspace(unsigned int index) { +Workspace* BScreen::getWorkspace(unsigned int index) const { assert(index < workspacesList.size()); return workspacesList[index]; }
M src/Screen.hhsrc/Screen.hh

@@ -272,7 +272,7 @@

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 @@ void lowerWindows(Window *workspace_stack, unsigned int num);

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);
M src/Workspace.ccsrc/Workspace.cc

@@ -636,11 +636,24 @@ screen->getBlackbox()->doXineramaPlacement()) {

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(),
M util/xftlsfonts.ccutil/xftlsfonts.cc

@@ -128,12 +128,14 @@ case XftTypeBool:

cout << val.u.b; break; +#ifdef XFT_UTF8 case XftTypeMatrix: cout << "xx(" << val.u.m->xx << ") "; cout << "xy(" << val.u.m->xy << ") "; cout << "yx(" << val.u.m->yx << ") "; cout << "yy(" << val.u.m->yy << ")"; break; +#endif } } while ((vallist = vallist->next)); cout << endl;