FLTK logo

STR #255

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.1 | SVN ⇄ GIT ]

STR #255

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:Fl::background2() causes invalid FL_FOREGROUND_COLOR in get_system_colors()
Version:1.1.4
Created By:pgriddev.yahoo
Assigned To:mike
Fix Version:1.1.5rc1
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files


Trouble Report Comments:


Name/Time/Date Text  
 
#1 pgriddev.yahoo
07:29 Jan 18, 2004
DESCRIPTION:
============

In the current release, 'Fl::background2()' sets 'fl_fg_set'. Because 'get_system_colors()' calls 'Fl::background2()' before it would call 'Fl::foreground()', the latter is never called :

void get_system_colors() {
  if (!fl_bg2_set) getsyscolor(COLOR_WINDOW, fl_bg2,Fl::background2);
  if (!fl_fg_set) getsyscolor(COLOR_WINDOWTEXT, fl_fg, Fl::foreground);
  if (!fl_bg_set) getsyscolor(COLOR_BTNFACE, fl_bg, Fl::background);
  getsyscolor(COLOR_HIGHLIGHT, 0,     set_selection_color);
}

(above the windows version, but others are the same)


SUGGESTED SOLUTIONS
===================

(1) Either change the sequence in which 'get_system_colors()' loads system colors
(2) or don't set 'fl_fg_set' in 'Fl::background2'
(3) have additional flags or flag values to indicate when a color is : not set / derived / set by user

Solution (2) seems preferable over (1) : why should setting the backgroud color imply that the foreground color is set ? And over (3) for simplicity's sake. It was successfully tested, below is the corresponding modified function :

void Fl::background2(uchar r, uchar g, uchar b) {
//  fl_fg_set  = 1;
  fl_bg2_set = 1;

  Fl::set_color(FL_BACKGROUND2_COLOR,r,g,b);
  Fl::set_color(FL_FOREGROUND_COLOR,
                get_color(fl_contrast(FL_FOREGROUND_COLOR,FL_BACKGROUND2_COLOR)));
}

 
 
#2 mike
14:47 Feb 29, 2004
Fixed in CVS - the anonymous CVS repository will be updated at midnight PST.  
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.