- int ibw = s->display.x->internal_border_width;
- Window parent;
- XColor fore_color, back_color;
- Pixmap up_arrow_pixmap, down_arrow_pixmap, slider_pixmap;
- int pix_x, pix_y, width, height, border;
-
- height = s->display.x->pixel_height - ibw - 2;
- width = VSCROLL_WIDTH - 2;
- pix_x = s->display.x->pixel_width - ibw/2;
- pix_y = ibw / 2;
- border = 1;
-
-#ifdef HAVE_X11
- up_arrow_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, s->display.x->window_desc,
- up_arrow_bits, 16, 16,
- s->display.x->foreground_pixel,
- s->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- down_arrow_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, s->display.x->window_desc,
- down_arrow_bits, 16, 16,
- s->display.x->foreground_pixel,
- s->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- slider_pixmap =
- XCreatePixmapFromBitmapData (x_current_display, s->display.x->window_desc,
- gray_bits, 16, 16,
- s->display.x->foreground_pixel,
- s->display.x->background_pixel,
- DefaultDepth (x_current_display,
- XDefaultScreen (x_current_display)));
-
- /* These cursor shapes will be installed when the mouse enters
- the appropriate window. */
-
- up_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_up_arrow);
- down_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_down_arrow);
- v_double_arrow_cursor = XCreateFontCursor (x_current_display, XC_sb_v_double_arrow);
-
- s->display.x->v_scrollbar =
- XCreateSimpleWindow (x_current_display, s->display.x->window_desc,
- pix_x, pix_y, width, height, border,
- s->display.x->foreground_pixel,
- s->display.x->background_pixel);
- XFlush (x_current_display);
- XDefineCursor (x_current_display, s->display.x->v_scrollbar,
- v_double_arrow_cursor);
-
- /* Create slider window */
- s->display.x->v_slider =
- XCreateSimpleWindow (x_current_display, s->display.x->v_scrollbar,
- 0, VSCROLL_WIDTH - 2,
- VSCROLL_WIDTH - 4, VSCROLL_WIDTH - 4,
- 1, s->display.x->border_pixel,
- s->display.x->foreground_pixel);
- XFlush (x_current_display);
- XDefineCursor (x_current_display, s->display.x->v_slider,
- v_double_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, s->display.x->v_slider,
- slider_pixmap);
-
- s->display.x->v_thumbup =
- XCreateSimpleWindow (x_current_display, s->display.x->v_scrollbar,
- 0, 0,
- VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2,
- 0, s->display.x->foreground_pixel,
- s->display.x-> background_pixel);
- XFlush (x_current_display);
- XDefineCursor (x_current_display, s->display.x->v_thumbup,
- up_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, s->display.x->v_thumbup,
- up_arrow_pixmap);
-
- s->display.x->v_thumbdown =
- XCreateSimpleWindow (x_current_display, s->display.x->v_scrollbar,
- 0, height - VSCROLL_WIDTH + 2,
- VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2,
- 0, s->display.x->foreground_pixel,
- s->display.x->background_pixel);
- XFlush (x_current_display);
- XDefineCursor (x_current_display, s->display.x->v_thumbdown,
- down_arrow_cursor);
- XSetWindowBackgroundPixmap (x_current_display, s->display.x->v_thumbdown,
- down_arrow_pixmap);
-
- fore_color.pixel = s->display.x->mouse_pixel;
- back_color.pixel = s->display.x->background_pixel;
- XQueryColor (x_current_display,
- DefaultColormap (x_current_display,
- DefaultScreen (x_current_display)),
- &fore_color);
- XQueryColor (x_current_display,
- DefaultColormap (x_current_display,
- DefaultScreen (x_current_display)),
- &back_color);
- XRecolorCursor (x_current_display, up_arrow_cursor,
- &fore_color, &back_color);
- XRecolorCursor (x_current_display, down_arrow_cursor,
- &fore_color, &back_color);
- XRecolorCursor (x_current_display, v_double_arrow_cursor,
- &fore_color, &back_color);
-
- XFreePixmap (x_current_display, slider_pixmap);
- XFreePixmap (x_current_display, up_arrow_pixmap);
- XFreePixmap (x_current_display, down_arrow_pixmap);
- XFlush (x_current_display);
-
- XSelectInput (x_current_display, s->display.x->v_scrollbar,
- ButtonPressMask | ButtonReleaseMask
- | PointerMotionMask | PointerMotionHintMask
- | EnterWindowMask);
- XSelectInput (x_current_display, s->display.x->v_slider,
- ButtonPressMask | ButtonReleaseMask);
- XSelectInput (x_current_display, s->display.x->v_thumbdown,
- ButtonPressMask | ButtonReleaseMask);
- XSelectInput (x_current_display, s->display.x->v_thumbup,
- ButtonPressMask | ButtonReleaseMask);
- XFlush (x_current_display);
-
- /* This should be done at the same time as the main window. */
- XMapWindow (x_current_display, s->display.x->v_scrollbar);
- XMapSubwindows (x_current_display, s->display.x->v_scrollbar);
- XFlush (x_current_display);
-#else /* not HAVE_X11 */
- Bitmap b;
- Pixmap fore_tile, back_tile, bord_tile;
- static short up_arrow_bits[] = {
- 0x0000, 0x0180, 0x03c0, 0x07e0,
- 0x0ff0, 0x1ff8, 0x3ffc, 0x7ffe,
- 0x0180, 0x0180, 0x0180, 0x0180,
- 0x0180, 0x0180, 0x0180, 0xffff};
- static short down_arrow_bits[] = {
- 0xffff, 0x0180, 0x0180, 0x0180,
- 0x0180, 0x0180, 0x0180, 0x0180,
- 0x7ffe, 0x3ffc, 0x1ff8, 0x0ff0,
- 0x07e0, 0x03c0, 0x0180, 0x0000};
-
- fore_tile = XMakeTile (s->display.x->foreground_pixel);
- back_tile = XMakeTile (s->display.x->background_pixel);
- bord_tile = XMakeTile (s->display.x->border_pixel);
-
- b = XStoreBitmap (VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2, up_arrow_bits);
- up_arrow_pixmap = XMakePixmap (b,
- s->display.x->foreground_pixel,
- s->display.x->background_pixel);
- XFreeBitmap (b);
-
- b = XStoreBitmap (VSCROLL_WIDTH - 2, VSCROLL_WIDTH - 2, down_arrow_bits);
- down_arrow_pixmap = XMakePixmap (b,
- s->display.x->foreground_pixel,
- s->display.x->background_pixel);
- XFreeBitmap (b);
-
- ibw = s->display.x->internal_border_width;
-
- s->display.x->v_scrollbar = XCreateWindow (s->display.x->window_desc,
- width - VSCROLL_WIDTH - ibw/2,
- ibw/2,
- VSCROLL_WIDTH - 2,
- height - ibw - 2,
- 1, bord_tile, back_tile);
-
- s->display.x->v_scrollbar_width = VSCROLL_WIDTH;
-
- s->display.x->v_thumbup = XCreateWindow (s->display.x->v_scrollbar,
- 0, 0,
- VSCROLL_WIDTH - 2,
- VSCROLL_WIDTH - 2,
- 0, 0, up_arrow_pixmap);
- XTileAbsolute (s->display.x->v_thumbup);
-
- s->display.x->v_thumbdown = XCreateWindow (s->display.x->v_scrollbar,
- 0,
- height - ibw - VSCROLL_WIDTH,
- VSCROLL_WIDTH - 2,
- VSCROLL_WIDTH - 2,
- 0, 0, down_arrow_pixmap);
- XTileAbsolute (s->display.x->v_thumbdown);
-
- s->display.x->v_slider = XCreateWindow (s->display.x->v_scrollbar,
- 0, VSCROLL_WIDTH - 2,
- VSCROLL_WIDTH - 4,
- VSCROLL_WIDTH - 4,
- 1, back_tile, fore_tile);
-
- XSelectInput (s->display.x->v_scrollbar,
- (ButtonPressed | ButtonReleased | KeyPressed));
- XSelectInput (s->display.x->v_thumbup,
- (ButtonPressed | ButtonReleased | KeyPressed));
-
- XSelectInput (s->display.x->v_thumbdown,
- (ButtonPressed | ButtonReleased | KeyPressed));
-
- XMapWindow (s->display.x->v_thumbup);
- XMapWindow (s->display.x->v_thumbdown);
- XMapWindow (s->display.x->v_slider);
- XMapWindow (s->display.x->v_scrollbar);
-
- XFreePixmap (fore_tile);
- XFreePixmap (back_tile);
- XFreePixmap (up_arrow_pixmap);
- XFreePixmap (down_arrow_pixmap);
-#endif /* not HAVE_X11 */
-}