gnustep / libs-gui

The GNUstep gui library is a library of graphical user interface classes written completely in the Objective-C language; the classes are based upon Apple's Cocoa framework (which came from the OpenStep specification). *** Larger patches require copyright assignment to FSF. please file bugs here. ***
http://www.gnustep.org
GNU General Public License v3.0
276 stars 100 forks source link

NSBox: (re-)implement isOpaque; decode NSBorderColor2 and NSFillColor2 #254

Closed qmfrederik closed 5 months ago

qmfrederik commented 5 months ago

This (re-)implements logic where a box is marked as opaque if it is a custom box which is not transparent and adds the decoding of the NSBorderColor2 and NSFillColor2 attributes.

This fixes the rendering of custom boxes with a custom fill color; the current implementation would mark them as non-opaque and hence the fill color would not be rendered.

fredkiefer commented 5 months ago

The decoding of the missing values is fine. What I am worried about is the opaque method. The code here really cannot know what the theme is going to do with the box. There all the set colours could get ignored. A proper solution would be to move your code (which is the old code) into the theme and have themes that behave differently override that method.

qmfrederik commented 5 months ago

A proper solution would be to move your code (which is the old code) into the theme and have themes that behave differently override that method.

I don't know much about themes in GNUstep, so where would that code go? In GSThemeDrawing drawBoxInClipRect or somewhere else?

fredkiefer commented 5 months ago

What would be needed is a new method isBoxOpaque: close to the other one you mentioned. The code being just like the one you tried to put here. And the method in NSBox would call the theme method with itself as an argument. Annoying and complicated, but the only way the behaviour matches.

qmfrederik commented 5 months ago

Thanks, @fredkiefer . I've updated the PR, let me know if this what you had in mind.