| Ticket UUID: | 8229232472e9f94281919ab55b178286d5ad5627 | |||
| Title: | Cascade menu entry indicator wrong colour on Unix | |||
| Type: | Bug | Version: | 8.6.8 | |
| Submitter: | cjmcdonald | Created on: | 2018-09-21 16:22:25 | |
| Subsystem: | 12. Unix Menus | Assigned To: | fvogel | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2018-09-30 20:29:35 | |
| Resolution: | Fixed | Closed By: | cjmcdonald | |
| Closed on: | 2018-09-30 20:29:35 | |||
| Description: |
The cascade menu entry type contains a small arrow indicator, to indicate that a sub-menu may be invoked. On Unix the colour of the arrow indicator is always taken from the menu -activebackground colour, even if the entry is not active (i.e. not under the mouse). This is not too noticable for a default -activebackground colour which is just slightly lighter than the normal -background. But to match some Linux themes we want a different -activebackground, e.g.
option add *Menu.activeBackground #86abd9
option add *Menu.activeForeground #ffffff
then the cascade indicator is clearly the wrong colour for an non-active entry, see the "Open Previous" entry in the attached indicator-tk8.6.8.png image. The attached patch is for the tk8.6.8 version of unix/tkUnixMenu.c. If fixes the problem so that the cascade indicator is drawn in the normal -background colour (see indicator-patched.png), unless the entry is actually active under the mouse in which case it is drawn with -activebackground (see indicator-active-patched.png). | |||
| User Comments: |
cjmcdonald added on 2018-09-30 20:29:35:
Thanks François, your prompt and thorough attention to Tk tickets is an encouragement to make reports fvogel added on 2018-09-30 19:00:32: Merged to core-8-6-branch and trunk. Thanks again for the report and for the patch! fvogel added on 2018-09-23 13:52:00: Attached two snapshots - before and after the patch, made with the following test script on Linux Debian 8: package require Tk menu .m menu .m.f .m add cascade -label File -menu .m.f .m.f add command -label "Item 0" .m.f add command -label "Item 1" .m.f add cascade -label "Item 2" .m.f add cascade -label "Item 3" . configure -menu .m .m.f configure -activebackground #86abd9 -activeforeground #ffffff fvogel added on 2018-09-22 13:13:06: Analysis of the call sequence is as follows:
Given all this, it turns out that the signature of DrawMenuEntryAccelerator does not have to be changed: the arrow is not drawn by this function but in DrawMenuEntryArrow, and the bgBorder would anyway not be used. Adding bgBorder to DrawMenuEntryArrow on Windows neither does seems necessary to me since a native Windows system bitmap is drawn there (DrawWindowsSystemBitmap, with a graphics context gc adapted according to whether the menu entry is disabled or active or a normal entry). I have however changed a bit the comments about the drawArrow parameter, see [6c01b18ee4]. fvogel added on 2018-09-22 07:10:54: Thanks for the report, and even more thanks for the patch! I have committed your patch [091bec9313] in a bugfix branch. The patch changes the signature of DrawMenuEntryAccelerator() on Linux. For the sake of uniformity I was wondering whether this signature change should be propagated to Windows, even if bgBorder/activeBorder are not used in this function on Windows (and the function itself does not exists at all on Mac). Then I discovered that even before your patch the signature of DrawMenuEntryAccelerator() is not the same on Windows and on Linux, there is an additional parameter drawArrow on Linux, but with a comment in TkpDrawMenuEntry() saying that it applies only to Windows! I'll try to understand this a bit more. | |||
Attachments:
- MenuItemArrowWrongColor - after patch.png [download] added by fvogel on 2018-09-23 13:50:36. [details]
- MenuItemArrowWrongColor - before patch.png [download] added by fvogel on 2018-09-23 13:50:26. [details]
- indicator-active-patched.png [download] added by cjmcdonald on 2018-09-21 16:29:00. [details]
- indicator-patched.png [download] added by cjmcdonald on 2018-09-21 16:28:16. [details]
- indicator-tk8.6.8.png [download] added by cjmcdonald on 2018-09-21 16:27:23. [details]
- tkUnixMenu.c.patched [download] added by cjmcdonald on 2018-09-21 16:25:58. [details]
- patch.txt [download] added by cjmcdonald on 2018-09-21 16:23:48. [details]
