Correctly select FILLPEN or FOREGROUNDPEN for scroller knob colour

svn path=/trunk/netsurf/; revision=12569
This commit is contained in:
Chris Young 2011-07-03 18:20:18 +00:00
parent d253daa020
commit b1e425a967
2 changed files with 22 additions and 12 deletions

View File

@ -153,9 +153,6 @@ ULONG applibsig = 0;
const char tree_directory_icon_name[] = "def_drawer.info";
const char tree_content_icon_name[] = "def_project.info";
extern colour scrollbar_widget_fg_colour;
extern colour scrollbar_widget_bg_colour;
extern colour scrollbar_widget_arrow_colour;
static struct DrawInfo *dri;
@ -494,11 +491,6 @@ void gui_init(int argc, char** argv)
ami_font_setdevicedpi(0); /* for early font requests, eg treeview init */
/* Some defaults, these are overridden later in gui_system_colour_init */
scrollbar_widget_fg_colour = 0x00aaaaaa;
scrollbar_widget_bg_colour = 0x00833c3c;
scrollbar_widget_arrow_colour = 0x00d6d6d6;
ami_amiupdate(); /* set env-vars for AmiUpdate */
ami_init_fonts();

View File

@ -30,8 +30,11 @@
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/Picasso96API.h>
#include <intuition/gui.h>
#include <intuition/screens.h>
#define AMINS_SCROLLERPEN NUMDRIPENS
struct gui_system_colour_ctx {
const char *name;
int length;
@ -180,7 +183,7 @@ static struct gui_system_colour_ctx colour_list[] = {
SLEN("Scrollbar"),
0xffaaaaaa,
&option_sys_colour_Scrollbar,
FOREGROUNDPEN, /* or FILLPEN, see GetGUIAttrs() */
AMINS_SCROLLERPEN,
NULL
}, {
"ThreeDDarkShadow",
@ -253,13 +256,26 @@ extern colour scrollbar_widget_arrow_colour;
css_color ami_css_colour_from_pen(struct Screen *screen, UWORD pen);
UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo)
{
LONG scrollerfillpen = FALSE;
GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE);
if(scrollerfillpen) return FILLPEN;
else return FOREGROUNDPEN;
}
void ami_system_colour_scrollbar_widget(void)
{
if(scrn == NULL) return;
scrollbar_widget_fg_colour = p96EncodeColor(RGBFB_A8B8G8R8, ami_css_colour_from_pen(scrn, FOREGROUNDPEN)); /* or FILLPEN */
scrollbar_widget_bg_colour = p96EncodeColor(RGBFB_A8B8G8R8, ami_css_colour_from_pen(scrn, FILLSHADOWPEN));
scrollbar_widget_arrow_colour = p96EncodeColor(RGBFB_A8B8G8R8, ami_css_colour_from_pen(scrn, SHINEPEN));
scrollbar_widget_fg_colour = p96EncodeColor(RGBFB_A8B8G8R8,
ami_css_colour_from_pen(scrn, AMINS_SCROLLERPEN));
scrollbar_widget_bg_colour = p96EncodeColor(RGBFB_A8B8G8R8,
ami_css_colour_from_pen(scrn, FILLSHADOWPEN));
scrollbar_widget_arrow_colour = p96EncodeColor(RGBFB_A8B8G8R8,
ami_css_colour_from_pen(scrn, SHINEPEN));
}
bool gui_system_colour_init(void)
@ -348,6 +364,8 @@ css_color ami_css_colour_from_pen(struct Screen *screen, UWORD pen)
if(drinfo == NULL) return 0x00000000;
if(pen == AMINS_SCROLLERPEN) pen = ami_system_colour_scrollbar_fgpen(drinfo);
/* Get the colour of the pen being used for "pen" */
GetRGB32(screen->ViewPort.ColorMap, drinfo->dri_Pens[pen], 1, (ULONG *)&colour);