More accurate rendering of scroll bars. Issue #16

This commit is contained in:
Morgan Aldridge 2021-03-14 11:40:42 -04:00
parent da10f2cf46
commit 6822305905
3 changed files with 14 additions and 11 deletions

View File

@ -535,7 +535,7 @@ void SetTitleBar( MlvwmWindow *t, Bool on_off )
}
}
void DrawArrow( Window w, int direction, GC color )
void DrawArrow( Window w, int direction, GC fill, GC outline )
{
XPoint arrow_p[] = {
{7,3},{2,8},{5,8},{5,12},{9,12},{9,8},{12,8},{7,3}, {0,0}},
@ -564,8 +564,8 @@ void DrawArrow( Window w, int direction, GC color )
if( direction==C_SBAR_DOWN )
for( lp=0; lp<point; lp++ ) use_p[lp].y = SBAR_WH-use_p[lp].y-1;
XFillPolygon( dpy, w, color, use_p, point, Nonconvex, CoordModeOrigin );
XDrawLines( dpy, w, Scr.BlackGC, use_p, point, CoordModeOrigin );
XFillPolygon( dpy, w, fill, use_p, point, Nonconvex, CoordModeOrigin );
XDrawLines( dpy, w, outline, use_p, point, CoordModeOrigin );
}
void DrawSbarAnk( MlvwmWindow *t, int context, Bool on_off )
@ -689,11 +689,14 @@ void DrawSbarArrow( MlvwmWindow *t, int context, Bool on_off )
XChangeWindowAttributes( dpy, win, valuemask, &attributes );
XClearWindow( dpy, win );
if( t->flags&SCROLL && size<0 )
if( t->flags&SCROLL && size<0 ) {
DrawShadowBox( 0, 0, SBAR_WH, SBAR_WH, win, 1,
Scr.WhiteGC, Scr.Gray2GC, SHADOW_ALL );
DrawArrow( win, context, Scr.Gray3GC );
DrawArrow( win, context, Scr.Gray3GC, Scr.BlackGC);
}
else{
DrawArrow( win, context, Scr.Gray4GC, Scr.Gray2GC);
}
}
else{
mask = GCForeground;

View File

@ -17,7 +17,7 @@
extern void SetShape( MlvwmWindow *, int );
extern void SetUpFrame( MlvwmWindow *, int, int, int, int, Bool );
extern void SetTitleBar( MlvwmWindow *, Bool );
extern void DrawArrow( Window, int, GC );
extern void DrawArrow( Window, int, GC, GC );
extern void DrawSbarAnk( MlvwmWindow *, int, Bool );
extern void DrawSbarArrow( MlvwmWindow *, int, Bool );
extern void DrawSbarBar( MlvwmWindow *, int, Bool );

View File

@ -1248,7 +1248,7 @@ void PressSbar( Bool isHbar, Window pressedwin, MlvwmWindow *tmp_win )
anker = tmp_win->scroll_v[3];
}
if( pushd!=0 ){
DrawArrow( pressedwin, direction, Scr.BlackGC );
DrawArrow( pressedwin, direction, Scr.BlackGC, Scr.BlackGC );
XSync( dpy, 0 );
}
@ -1290,14 +1290,14 @@ void PressSbar( Bool isHbar, Window pressedwin, MlvwmWindow *tmp_win )
case EnterNotify:
if( ev.xcrossing.window==pressedwin ){
if( !isSelect )
DrawArrow( pressedwin, direction, Scr.BlackGC );
DrawArrow( pressedwin, direction, Scr.BlackGC, Scr.BlackGC );
isSelect = True;
}
break;
case LeaveNotify:
if( ev.xcrossing.window==pressedwin ){
if( isSelect )
DrawArrow( pressedwin, direction, Scr.Gray3GC );
DrawArrow( pressedwin, direction, Scr.Gray3GC, Scr.BlackGC );
isSelect = False;
}
break;
@ -1330,7 +1330,7 @@ void PressSbar( Bool isHbar, Window pressedwin, MlvwmWindow *tmp_win )
while( !isEnd );
if( pushd!=0 )
DrawArrow( pressedwin, direction, Scr.Gray3GC );
DrawArrow( pressedwin, direction, Scr.Gray3GC, Scr.BlackGC );
XSync( dpy, 0 );
}