FLTK logo

Re: [fltk.general] Re: FLTK 1.4 Menu Bar Style

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 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Re: FLTK 1.4 Menu Bar Style "'Albrecht Schlosser' via fltk.general" 16:59 May 06  
  On 5/6/24 12:15 Manolo wrote:
Adding
    app_menu_bar->selection_color(FL_DARK_BLUE);
to whatever menu of your app will restore the blue background.

Well, this might be a workaround, but setting a specific selection color (other than the default selection color of the system or theme) would IMHO be a bad choice in general. We should find a better solution.

Imagine a user selecting a dark theme and the code sets FL_DARK_BLUE as the selection color, or the system uses a "green" or "tan" theme (as Greg posted recently). In such a case setting a dark blue selection color on menus (only) would certainly be a bad choice, at the very least very inconsistent.

@Albrecht: the call to fl_contrast() at line 288 of file sc/Fl_Menu.cxx
gives a different result under Windows than under X11 and macOS.
That's the cause of the changed menu behavior. Is it wanted?

No, that isn't intended but it's much more complicated than just that "simple" question. This code has not been changed for a long time, and if `fl_contrast()` yields a different result than in 1.3 than this is most likely intended. In this case FLTK 1.3 allowed a color combination with too little contrast whereas 1.4 notices that the contrast is too low.

Honestly, I don't really understand the code around line 288 in that file. The mentioned line:
```
if (fl_contrast(r, color) != r) { // back compatibility boxtypes
```

seems to be the wrong way around, and I don't understand what that comment means.
<rant>What is it good for, if you don't understand it?</rant>
Sorry, no offense intended, whoever is responsible for this comment - it's late here!!!.

I would say the code should query whether the foreground color (i.e. 'color') is the same if fl_contrast() is applied, like this:
```
  if (fl_contrast(color, r) != color) { // ?? text color 'color' has not enough contrast... ??
```

... and then do whatever is required...

(disclaimer: unless I misunderstood what the code is intended to do).

The following lines seem to replace the background color which is IMHO NOT what we want (see my comment to issue #969:
https://github.com/fltk/fltk/issues/969#issuecomment-2097056656

```
if (selected == 2) { // menu title
r = color;
b = m ? m->box() : FL_UP_BOX;
} else {
r = (Fl_Color)(FL_COLOR_CUBE-1); // white // This makes the background white **BAD**
l.color = fl_contrast((Fl_Color)labelcolor_, r); // This selects a contrasting text color **OK?**
}

    ```

So, yes, I agree that this is the culprit, but since I don't know what it is intended to do (and why) I have no idea how to fix it.

Maybe Matt who is more familiar with menu code can shed some light on this issue?

That said, whoever takes this: **please** change at least some of these single-letter variable names (r, b, and maybe m and l) to something a reader can understand! Sorry for the rant, again!

Good night.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/ee944da7-25db-4470-943c-5c43e4db2ea2%40aljus.de.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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'.