diff options
author | QC <qball@gmpclient.org> | 2015-09-19 12:21:30 +0200 |
---|---|---|
committer | QC <qball@gmpclient.org> | 2015-09-19 12:21:30 +0200 |
commit | 442e235c24fa33a499e51b4a2f7ff95fb4ab43ad (patch) | |
tree | c74a3fea5b7286e9d4e60f3fc656805b3a0fad07 /source/scrollbar.c | |
parent | 4c970fe4da46b2b463a59acdb4ec807cf83c61c4 (diff) |
Some cleanups, tweak uncrustify.
Diffstat (limited to 'source/scrollbar.c')
-rw-r--r-- | source/scrollbar.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source/scrollbar.c b/source/scrollbar.c index 3396af72..b327fd39 100644 --- a/source/scrollbar.c +++ b/source/scrollbar.c @@ -56,8 +56,11 @@ scrollbar *scrollbar_create ( Window parent, XVisualInfo *vinfo, Colormap map, attr.colormap = map; attr.border_pixel = color_border ( display ); attr.background_pixel = color_background ( display ); - sb->window = XCreateWindow ( display, sb->parent, sb->x, sb->y, sb->w, sb->h, 0, vinfo->depth, - InputOutput, vinfo->visual, CWColormap | CWBorderPixel | CWBackPixel, &attr ); + sb->window = + XCreateWindow ( display, sb->parent, sb->x, sb->y, sb->w, sb->h, 0, vinfo->depth, + InputOutput, vinfo->visual, CWColormap | + CWBorderPixel | CWBackPixel, + &attr ); XSelectInput ( display, sb->window, ExposureMask | ButtonPressMask | Button1MotionMask ); sb->gc = XCreateGC ( display, sb->window, 0, 0 ); @@ -128,21 +131,31 @@ void scrollbar_draw ( scrollbar *sb ) // Redraw base window XClearWindow ( display, sb->window ); // Paint the handle. - XFillRectangle ( display, sb->window, sb->gc, config.line_margin, y, sb->w - config.line_margin, height ); + XFillRectangle ( display, sb->window, sb->gc, config.line_margin, y, sb->w - + config.line_margin, + height ); } } void scrollbar_resize ( scrollbar *sb, int w, int h ) { if ( sb != NULL ) { - if(h > 0 ) { + if ( h > 0 ) { sb->h = h; } - if(w > 0 ) { + if ( w > 0 ) { sb->w = w; } XResizeWindow ( display, sb->window, sb->w, sb->h ); } } +void scrollbar_move ( scrollbar *sb, int x, int y ) +{ + if ( sb != NULL ) { + sb->x = x; + sb->y = y; + XMoveWindow ( display, sb->window, x, y ); + } +} unsigned int scrollbar_clicked ( scrollbar *sb, int y ) { |