From 5fd232652b6c10314c67eaea9df74821513f0f8a Mon Sep 17 00:00:00 2001 From: Morgan Aldridge Date: Wed, 24 Mar 2021 07:34:35 -0400 Subject: [PATCH] More accurate rendering & positioning of close & min/max title bar buttons, esp. for default System7 theme. Issue #16 --- mlvwm/add_window.c | 4 ++-- mlvwm/borders.c | 12 ++++++------ mlvwm/mlvwm.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mlvwm/add_window.c b/mlvwm/add_window.c index ae07219..3e475a2 100644 --- a/mlvwm/add_window.c +++ b/mlvwm/add_window.c @@ -204,7 +204,7 @@ void create_titlebar( MlvwmWindow *tmp_win ) if( tmp_win->flags&CLOSER ){ attributes.cursor = Scr.MlvwmCursors[DESTROY]; tmp_win->close_b = XCreateWindow( dpy, tmp_win->title_w, - Scr.flags&SYSTEM8?2:BOXSIZE+1, + Scr.flags&SYSTEM8?2:BOXSIZE-3, (TITLE_HEIGHT-BOXSIZE)/2, BOXSIZE, BOXSIZE, 0, CopyFromParent, InputOutput, @@ -215,7 +215,7 @@ void create_titlebar( MlvwmWindow *tmp_win ) if( tmp_win->flags&MINMAXR ){ attributes.cursor = Scr.MlvwmCursors[SELECT]; tmp_win->minmax_b = XCreateWindow( dpy, tmp_win->title_w, - tmp_win->frame_w-BOXSIZE*2-1, + tmp_win->frame_w-(BOXSIZE*2-3), (TITLE_HEIGHT-BOXSIZE)/2, BOXSIZE, BOXSIZE, 0, CopyFromParent, InputOutput, diff --git a/mlvwm/borders.c b/mlvwm/borders.c index e2e0fd8..7121f00 100644 --- a/mlvwm/borders.c +++ b/mlvwm/borders.c @@ -133,7 +133,7 @@ void SetUpFrame( MlvwmWindow *t, int x, int y, int w, int h, Bool sendEvent ) (TITLE_HEIGHT-BOXSIZE)/2); else XMoveWindow(dpy, t->minmax_b, - w-BOXSIZE*2-1, + w-(BOXSIZE*2-2), (TITLE_HEIGHT-BOXSIZE)/2); } if( t->flags&SHADER ) @@ -339,8 +339,8 @@ void DrawCloseBox( MlvwmWindow *t, Bool on ) } else{ XFillRectangle( dpy, t->title_w, Scr.Gray4GC, - BOXSIZE-1, (TITLE_HEIGHT-BOXSIZE)/2-1, - BOXSIZE+4, BOXSIZE+1 ); + BOXSIZE-4, (TITLE_HEIGHT-BOXSIZE)/2-1, + BOXSIZE+2, BOXSIZE+1 ); DrawShadowBox( 0, 0, BOXSIZE, BOXSIZE, t->close_b, 1, Scr.BlackGC, Scr.WhiteGC, SHADOW_ALL ); DrawShadowBox( 1, 1, BOXSIZE-2, BOXSIZE-2, t->close_b, 1, @@ -386,13 +386,13 @@ void DrawMinMax( MlvwmWindow *t, Bool on ) } else{ XFillRectangle( dpy, t->title_w, Scr.Gray4GC, - t->frame_w-BOXSIZE*2-3,(TITLE_HEIGHT-BOXSIZE)/2-1, - BOXSIZE+4, BOXSIZE+1 ); + t->frame_w-(BOXSIZE*2-1),(TITLE_HEIGHT-BOXSIZE)/2-1, + BOXSIZE+2, BOXSIZE+1 ); DrawShadowBox( 0, 0, BOXSIZE, BOXSIZE, t->minmax_b, 1, Scr.BlackGC, Scr.WhiteGC, SHADOW_ALL ); DrawShadowBox( 1, 1, BOXSIZE-2, BOXSIZE-2, t->minmax_b, 1, Scr.WhiteGC, Scr.BlackGC, SHADOW_ALL ); - DrawShadowBox( 1, 1, BOXSIZE-6, BOXSIZE-6, t->minmax_b, 1, + DrawShadowBox( 1, 1, BOXSIZE-5, BOXSIZE-5, t->minmax_b, 1, Scr.WhiteGC, Scr.BlackGC, SHADOW_ALL ); } } diff --git a/mlvwm/mlvwm.h b/mlvwm/mlvwm.h index 5bb3a16..63baaed 100644 --- a/mlvwm/mlvwm.h +++ b/mlvwm/mlvwm.h @@ -58,7 +58,7 @@ #endif #define TITLE_HEIGHT 20 -#define BOXSIZE 13 +#define BOXSIZE (Scr.flags&SYSTEM8?13:11) #define SBAR_WH Scr.bar_width extern Display *dpy;