Index: src/RootTheme.cc =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/RootTheme.cc,v retrieving revision 1.7 diff -a -b -B -p -u -r1.7 RootTheme.cc --- src/RootTheme.cc 2 Jan 2004 13:28:38 -0000 1.7 +++ src/RootTheme.cc 19 Mar 2004 15:15:03 -0000 @@ -37,6 +37,7 @@ RootTheme::RootTheme(int screen_num, std m_opgc.setForeground(WhitePixel(disp, screen_num)^BlackPixel(disp, screen_num)); m_opgc.setFunction(GXxor); m_opgc.setSubwindowMode(IncludeInferiors); + m_opgc.setLineAttributes(1, LineSolid, CapNotLast, JoinMiter); } RootTheme::~RootTheme() { Index: src/RootTheme.hh =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/RootTheme.hh,v retrieving revision 1.6 diff -a -b -B -p -u -r1.6 RootTheme.hh --- src/RootTheme.hh 2 Jan 2004 13:28:38 -0000 1.6 +++ src/RootTheme.hh 19 Mar 2004 15:15:04 -0000 @@ -44,6 +44,14 @@ public: void reconfigTheme(); GC opGC() const { return m_opgc.gc(); } + + void setLineAttributes(unsigned int width, + int line_style, + int cap_style, + int join_style) { + m_opgc.setLineAttributes(width, line_style, cap_style, join_style); + } + //!! TODO we should need this later void lock(bool value) { m_lock = value; } private: Index: src/Screen.cc =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/Screen.cc,v retrieving revision 1.269 diff -a -b -B -p -u -r1.269 Screen.cc --- src/Screen.cc 18 Mar 2004 14:45:56 -0000 1.269 +++ src/Screen.cc 19 Mar 2004 15:15:07 -0000 @@ -306,6 +306,113 @@ setFromString(char const *strval) { setDefaultValue(); } +template<> +void FbTk::Resource::setDefaultValue() { + *(*this) = FbTk::GContext::LINESOLID; +} + +template<> +std::string FbTk::Resource::getString() { + switch(m_value) { + case FbTk::GContext::LINESOLID: + return "LineSolid"; + break; + case FbTk::GContext::LINEONOFFDASH: + return "LineOnOffDash"; + break; + case FbTk::GContext::LINEDOUBLEDASH: + return "LineDoubleDash"; + break; + }; +} + +template<> +void FbTk::Resource +::setFromString(char const *strval) { + + if (strcasecmp(strval, "LineSolid") == 0 ) + m_value = FbTk::GContext::LINESOLID; + else if (strcasecmp(strval, "LineOnOffDash") == 0 ) + m_value = FbTk::GContext::LINEONOFFDASH; + else if (strcasecmp(strval, "LineDoubleDash") == 0) + m_value = FbTk::GContext::LINEDOUBLEDASH; + else + setDefaultValue(); +} + +template<> +void FbTk::Resource::setDefaultValue() { + *(*this) = FbTk::GContext::JOINMITER; +} + +template<> +std::string FbTk::Resource::getString() { + switch(m_value) { + case FbTk::GContext::JOINMITER: + return "JoinMiter"; + break; + case FbTk::GContext::JOINBEVEL: + return "JoinBevel"; + break; + case FbTk::GContext::JOINROUND: + return "JoinRound"; + break; + }; +} + +template<> +void FbTk::Resource +::setFromString(char const *strval) { + + if (strcasecmp(strval, "JoinRound") == 0 ) + m_value = FbTk::GContext::JOINROUND; + else if (strcasecmp(strval, "JoinMiter") == 0 ) + m_value = FbTk::GContext::JOINMITER; + else if (strcasecmp(strval, "JoinBevel") == 0) + m_value = FbTk::GContext::JOINBEVEL; + else + setDefaultValue(); +} + +template<> +void FbTk::Resource::setDefaultValue() { + *(*this) = FbTk::GContext::CAPNOTLAST; +} + +template<> +std::string FbTk::Resource::getString() { + switch(m_value) { + case FbTk::GContext::CAPNOTLAST: + return "CapNotLast"; + break; + case FbTk::GContext::CAPBUTT: + return "CapButt"; + break; + case FbTk::GContext::CAPROUND: + return "CapRound"; + break; + case FbTk::GContext::CAPPROJECTING: + return "CapProjecting"; + break; + }; +} + +template<> +void FbTk::Resource +::setFromString(char const *strval) { + + if (strcasecmp(strval, "CapNotLast") == 0 ) + m_value = FbTk::GContext::CAPNOTLAST; + else if (strcasecmp(strval, "CapProjecting") == 0 ) + m_value = FbTk::GContext::CAPPROJECTING; + else if (strcasecmp(strval, "CapRound") == 0) + m_value = FbTk::GContext::CAPROUND; + else if (strcasecmp(strval, "CapButt" ) == 0) + m_value = FbTk::GContext::CAPBUTT; + else + setDefaultValue(); +} + namespace { class StyleMenuItem: public FbTk::MenuItem { @@ -378,7 +485,20 @@ BScreen::ScreenResource::ScreenResource( menu_mode(rm, FbTk::MenuTheme::DELAY_OPEN, scrname+".menuMode", altscrname+".MenuMode"), placement_policy(rm, ROWSMARTPLACEMENT, scrname+".windowPlacement", altscrname+".WindowPlacement"), row_direction(rm, LEFTRIGHT, scrname+".rowPlacementDirection", altscrname+".RowPlacementDirection"), - col_direction(rm, TOPBOTTOM, scrname+".colPlacementDirection", altscrname+".ColPlacementDirection") { + col_direction(rm, TOPBOTTOM, scrname+".colPlacementDirection", altscrname+".ColPlacementDirection"), + gc_line_width(rm, 1, scrname+".overlay.lineWidth", altscrname+".Overlay.LineWidth"), + gc_line_style(rm, + FbTk::GContext::LINESOLID, + scrname+".overlay.lineStyle", + altscrname+".Overlay.LineStyle"), + gc_join_style(rm, + FbTk::GContext::JOINMITER, + scrname+".overlay.joinStyle", + altscrname+".Overlay.JoinStyle"), + gc_cap_style(rm, + FbTk::GContext::CAPNOTLAST, + scrname+".overlay.capStyle", + altscrname+".overlay.CapStyle") { } @@ -584,6 +704,10 @@ BScreen::BScreen(FbTk::ResourceManager & m_root_theme->lock(true); FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename()); m_root_theme->lock(false); + m_root_theme->setLineAttributes(*resource.gc_line_width, + *resource.gc_line_style, + *resource.gc_cap_style, + *resource.gc_join_style); int i; unsigned int nchild; Index: src/Screen.hh =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/Screen.hh,v retrieving revision 1.134 diff -a -b -B -p -u -r1.134 Screen.hh --- src/Screen.hh 19 Jan 2004 18:28:58 -0000 1.134 +++ src/Screen.hh 19 Mar 2004 15:15:07 -0000 @@ -430,6 +425,10 @@ private: FbTk::Resource placement_policy; FbTk::Resource row_direction; FbTk::Resource col_direction; + FbTk::Resource gc_line_width; + FbTk::Resource gc_line_style; + FbTk::Resource gc_join_style; + FbTk::Resource gc_cap_style; } resource; Index: src/FbTk/GContext.hh =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/FbTk/GContext.hh,v retrieving revision 1.8 diff -a -b -B -p -u -r1.8 GContext.hh --- src/FbTk/GContext.hh 11 Jan 2004 12:53:46 -0000 1.8 +++ src/FbTk/GContext.hh 19 Mar 2004 15:15:07 -0000 @@ -37,6 +37,11 @@ class Font; /// wrapper for X GC class GContext { public: + + typedef enum JoinStyle { JOINMITER= JoinMiter, JOINROUND= JoinRound, JOINBEVEL= JoinBevel }; + typedef enum LineStyle { LINESOLID= LineSolid, LINEONOFFDASH= LineOnOffDash, LINEDOUBLEDASH= LineDoubleDash }; + typedef enum CapStyle { CAPNOTLAST= CapNotLast, CAPBUTT= CapButt, CAPROUND= CapRound, CAPPROJECTING= CapProjecting }; + /// for FbTk drawable explicit GContext(const FbTk::FbDrawable &drawable); /// for X drawable @@ -94,6 +99,15 @@ public: inline void setFillRule(int rule) { XSetFillRule(m_display, m_gc, rule); } + + inline void setLineAttributes(unsigned int width, + int line_style, + int cap_style, + int join_style) { + + XSetLineAttributes(m_display, m_gc, width, line_style, cap_style, join_style); + } + void copy(GC gc); void copy(const GContext &gc);