From 1d99100814c6a10a921243f2139be4432f1a0893 Mon Sep 17 00:00:00 2001 From: Morgan Aldridge Date: Sun, 21 Mar 2021 16:28:17 -0400 Subject: [PATCH] Added System6 configuration setting and first pass at forcing monochrome styling. Issue #18 --- mlvwm/borders.c | 8 ++++---- mlvwm/config.c | 13 +++++++++++++ mlvwm/menus.c | 10 +++++----- mlvwm/mlvwm.c | 18 +++++++++--------- mlvwm/screen.h | 1 + 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/mlvwm/borders.c b/mlvwm/borders.c index e2e0fd8..0852c30 100644 --- a/mlvwm/borders.c +++ b/mlvwm/borders.c @@ -489,7 +489,7 @@ void SetTitleBar( MlvwmWindow *t, Bool on_off ) if( on_off ){ for( lp=4; lp<16; lp+=2 ){ - if( Scr.d_depth>1 ){ + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ){ if( Scr.flags&SYSTEM8 ) DrawShadowBox( 4, lp-1, t->frame_w-14, 2, t->title_w, 1, Scr.WhiteGC, Scr.Gray1GC, SHADOW_ALL ); @@ -515,7 +515,7 @@ void SetTitleBar( MlvwmWindow *t, Bool on_off ) dispgc = Scr.BlackGC; } else{ - if( Scr.d_depth>1 ) dispgc = Scr.Gray3GC; + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) dispgc = Scr.Gray3GC; else dispgc = Scr.BlackGC; } if( t->flags&CLOSER ) DrawCloseBox( t, on_off ); @@ -524,7 +524,7 @@ void SetTitleBar( MlvwmWindow *t, Bool on_off ) XDRAWSTRING( dpy, t->title_w, WINDOWFONT, dispgc, (t->frame_w-w)/2, TITLE_HEIGHT/2-offset, t->name, titlelength ); - if( Scr.d_depth<2 && !on_off ){ + if( (Scr.d_depth<2 || Scr.flags&SYSTEM6) && !on_off ){ xgcv.function = GXor; mask = GCFunction; XChangeGC( dpy, Scr.BlackGC, mask, &xgcv ); @@ -761,7 +761,7 @@ void DrawSbarBar( MlvwmWindow *t, int context, Bool on_off ) if( on_off ){ if( t->flags&SCROLL && size<0 ){ - if( Scr.flags&SYSTEM8 ){ + if( Scr.flags&SYSTEM8 && !(Scr.flags&SYSTEM6) ){ Pixmap bgpix; bgpix = XCreatePixmap( dpy, Scr.Root, width_f, height_f, Scr.d_depth ); diff --git a/mlvwm/config.c b/mlvwm/config.c index 64792f4..f9806bd 100644 --- a/mlvwm/config.c +++ b/mlvwm/config.c @@ -478,6 +478,16 @@ void SetMenuFlush( char *line, FILE *fp ) Scr.flush_time *= 1000; } +void SetSystem6( char *line, FILE *fp ) +{ + if( Scr.d_depth<2) + DrawErrMsgOnMenu( "Option is assumed ", "System6" ); + else if( Scr.flags&SYSTEM8 ) + DrawErrMsgOnMenu( "Option cannot be used with System8 ", "System6" ); + else + Scr.flags |= SYSTEM6; +} + void SetSystem8( char *line, FILE *fp ) { XGCValues gcv; @@ -486,6 +496,8 @@ void SetSystem8( char *line, FILE *fp ) if( Scr.d_depth<2 ) DrawErrMsgOnMenu( "Can't use option ", "System8" ); + else if( Scr.flags&SYSTEM6 ) + DrawErrMsgOnMenu( "Option cannot be used with System6 ", "System8" ); else{ Scr.flags |= SYSTEM8; gcm = GCForeground; @@ -748,6 +760,7 @@ config_func main_config[]={ { "StickyHide", SetStickyHide }, { "Style", SetStyles }, { "Swallow", SetSwallow }, + { "System6", SetSystem6 }, { "System8", SetSystem8 }, { "OpaqueMove", SetOpaqueMove }, { "OpaqueResize", SetOpaqueResize }, diff --git a/mlvwm/menus.c b/mlvwm/menus.c index f7e52f6..74e6fc3 100644 --- a/mlvwm/menus.c +++ b/mlvwm/menus.c @@ -68,7 +68,7 @@ void RedrawMenu( MenuLabel *m, Bool onoroff ) tmp_f_GC = Scr.BlackGC; tmp_b_GC = Scr.WhiteGC; } - if( !(m->flags&ACTIVE) && Scr.d_depth>1 ) + if( !(m->flags&ACTIVE) && Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) tmp_f_GC = Scr.Gray3GC; if( !m->xpm ){ if( m->LabelStr ){ @@ -77,7 +77,7 @@ void RedrawMenu( MenuLabel *m, Bool onoroff ) (MENUB_H-2)/2-offset, m->LabelStr, strlen(m->LabelStr) ); /* Mask String for Mono Display */ - if( !(m->flags&ACTIVE) && Scr.d_depth<2 ){ + if( !(m->flags&ACTIVE) && (Scr.d_depth<2 || Scr.flags&SYSTEM6) ){ if( onoroff ) gcv.function = GXand; else gcv.function = GXor; gcm = GCFunction; @@ -225,7 +225,7 @@ MenuLabel *DrawMenuItem( MenuLabel *ml, int sel, Bool on ) s_tmpGC = Scr.BlackGC; } - if( mi->mode&STRGRAY && Scr.d_depth>2 ) + if( mi->mode&STRGRAY && Scr.d_depth>2 && !(Scr.flags&SYSTEM6) ) s_tmpGC = Scr.Gray3GC; XFillRectangle( dpy, ml->PullWin, r_tmpGC, 0+(Scr.flags&SYSTEM8?1:0), top_y, @@ -283,7 +283,7 @@ MenuLabel *DrawMenuItem( MenuLabel *ml, int sel, Bool on ) top_y+ml->ItemHeight/2-offset, mi->label, strlen(mi->label) ); /* Mask String for Mono Display */ - if( mi->mode&STRGRAY && Scr.d_depth<2 ){ + if( mi->mode&STRGRAY && (Scr.d_depth<2 || Scr.flags&SYSTEM6) ){ if( on ) gcv.function = GXand; else gcv.function = GXor; gcm = GCFunction; @@ -297,7 +297,7 @@ MenuLabel *DrawMenuItem( MenuLabel *ml, int sel, Bool on ) } } if( mi->label && mi->label[0]=='\0' ){ - if( Scr.d_depth>1 ){ + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ){ if( Scr.flags&SYSTEM8 ){ XDrawLine( dpy, ml->PullWin, Scr.Gray2GC, 2, top_y+ml->ItemHeight/2, diff --git a/mlvwm/mlvwm.c b/mlvwm/mlvwm.c index b39be9f..af0c76d 100644 --- a/mlvwm/mlvwm.c +++ b/mlvwm/mlvwm.c @@ -213,7 +213,7 @@ void InitGCs( void ) gcv.subwindow_mode = IncludeInferiors; gcv.line_width = 1; - if( Scr.d_depth>1 ) + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#777777" ); else gcv.foreground = WhitePixel( dpy, Scr.screen ); @@ -236,32 +236,32 @@ void InitGCs( void ) gcv.background = BlackPixel( dpy, Scr.screen ); Scr.WhiteGC = XCreateGC( dpy, Scr.Root, gcm, &gcv ); - if( Scr.d_depth>1 ) gcv.foreground = GetColor( "#444444" ); + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#444444" ); gcv.background = WhitePixel( dpy, Scr.screen ); Scr.Gray1GC = XCreateGC( dpy, Scr.Root, gcm, &gcv ); - if( Scr.d_depth>1 ) gcv.foreground = GetColor( "#777777" ); + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#777777" ); gcv.background = WhitePixel( dpy, Scr.screen ); Scr.Gray2GC = XCreateGC( dpy, Scr.Root, gcm, &gcv ); - if( Scr.d_depth>1 ) gcv.foreground = GetColor( "#bbbbbb" ); - if( Scr.d_depth>1 ) gcv.foreground = GetColor( "#aaaaaa" ); + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#bbbbbb" ); + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#aaaaaa" ); gcv.background = WhitePixel( dpy, Scr.screen ); Scr.Gray3GC = XCreateGC( dpy, Scr.Root, gcm, &gcv ); - if( Scr.d_depth>1 ) gcv.foreground = GetColor( "#e0e0e0" ); + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#e0e0e0" ); gcv.background = WhitePixel( dpy, Scr.screen ); Scr.Gray4GC = XCreateGC( dpy, Scr.Root, gcm, &gcv ); - if( Scr.d_depth>1 ) gcv.foreground = GetColor( "#3333ff" ); + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#3333ff" ); gcv.background = WhitePixel( dpy, Scr.screen ); Scr.MenuSelectBlueGC = XCreateGC( dpy, Scr.Root, gcm, &gcv ); - if( Scr.d_depth>1 ) gcv.foreground = GetColor( "#dddddd" ); + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#dddddd" ); gcv.background = WhitePixel( dpy, Scr.screen ); Scr.MenuBlueGC = XCreateGC( dpy, Scr.Root, gcm, &gcv ); - if( Scr.d_depth>1 ) gcv.foreground = GetColor( "#ccccff" ); + if( Scr.d_depth>1 && !(Scr.flags&SYSTEM6) ) gcv.foreground = GetColor( "#ccccff" ); gcv.background = WhitePixel( dpy, Scr.screen ); Scr.ScrollBlueGC = XCreateGC( dpy, Scr.Root, gcm, &gcv ); } diff --git a/mlvwm/screen.h b/mlvwm/screen.h index 4aafe92..120000c 100644 --- a/mlvwm/screen.h +++ b/mlvwm/screen.h @@ -142,6 +142,7 @@ typedef struct ScreenInfo #define ONECLICKMENU 0x00010000 #define DEBUGOUT 0x00020000 #define ROUNDEDCORNERS 0x00040000 +#define SYSTEM6 0x00080000 #ifdef USE_LOCALE #define MENUBARFONT Scr.MenuBarFs