Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translucent Menus #760

Merged
merged 1 commit into from
Nov 15, 2022
Merged

Translucent Menus #760

merged 1 commit into from
Nov 15, 2022

Conversation

somiaj
Copy link
Collaborator

@somiaj somiaj commented Nov 11, 2022

Update the Translucent colorset for menus patch to work with fvwm3.

Address #578

Tested and the patch works, and has been used as an unofficial patch from various downstream versions for many years.

I did notice one issue in my testing, a menu with lots of submenus, when going down through the menu the new menu popups faster than the previous goes away, so the image grabbed to create the translucent effect will have artifacts of the previous submenu underneath that. This should probably be fixed before being merged.

I'm also unsure if this introduces any memory leaks, should be tested for that as well.

@ThomasAdam ThomasAdam added the type:new-feature Brand new feature not yet present in fvwm3 label Nov 11, 2022
@ThomasAdam ThomasAdam added this to the 1.0.6 milestone Nov 11, 2022
@somiaj
Copy link
Collaborator Author

somiaj commented Nov 11, 2022

I have a few thoughts on this feature.

First, I don't think the Translucent option should take a color and a percent. It should just take a percent, and use the background color of the colorset. It doesn't make sense to also set the background color with this option.

Second, is this something we wish to extend to other places that use colorsets. Such as decor and modules. If we wish to extend it, it should remain a colorset option. If this is only going to be an option for menus, it should be a MenuStyle option, such as MenuStyle * Translucent 75. (even if we make it a MenuStyle option, it could still be extended to other places such as window decor or modules by adding a Translucent option to the appropriate place). So unless there is a strong desire to support Translucent colorsets everywhere colorsets are used, I don't think it makes sense to be a Colorset option.

@ThomasAdam
Copy link
Member

Second, is this something we wish to extend to other places that use colorsets. Such as decor and modules. If we wish to extend it, it should remain a colorset option.

Yes, this. As in, this should be a property of the Colorset. I thought though, this was already the case, but if not, I think making it so means this will benefit other areas, as you say...

@somiaj
Copy link
Collaborator Author

somiaj commented Nov 11, 2022

I thought though, this was already the case

Yes, this is currently the case. My comment was if this only applies to menus and not to other places that use colorsets, it might not make sense to be a colorset property.

@ThomasAdam
Copy link
Member

Yes, this is currently the case. My comment was if this only applies to menus and not to other places that use colorsets, it might not make sense to be a colorset property.

Right, yes. I agree. Perhaps it shouldn't be a colorset property then.

@somiaj
Copy link
Collaborator Author

somiaj commented Nov 11, 2022

I have updated the feature to be a MenuStyle option. For example to test it out just use, MenuStyle * Translucent 75.

The way it was implemented as a colorset was just incorrect, it shouldn't have defined its own tint to use, instead of used the already defined tints (or alphas) in the colorset. Plus now that this is a MenuStyle option, there is no expectation that this will work for modules, decor, etc. It might be possible to extend this effect to other aspects of fvwm3, but I am unsure on how to do that (and its use will be are more limited with RootTrasparent effect already supported. For cases like Panels, Pager, Iconman, they aren't often over other windows anyways). And of course if someone wants real transparency they should use a compositor.

@somiaj
Copy link
Collaborator Author

somiaj commented Nov 12, 2022

I tried to make the active menu item, and title translucent, but I am unable to figure out what variables hold the correct location of the active menu item, so my attempt is slightly off, and causes a strange shadow/offset. I have put this in the code around a #if 0 block to disable in case someone wants to take off where I left off.

If you want the active item and/or title to be translucent, you have to disable the hilight, so something like, MenuStyle * Translucent 60, !HilightBack, !HilightTitleBack, ActiveFore with the default-config.

@sebaro
Copy link

sebaro commented Nov 13, 2022

Without a background color the menu doesn't have a good visibility on darker pars of the screen/wallpaper.
Isn't it possible to add bgcolor too, "Translucent % bgcolor"?

translucent

@somiaj
Copy link
Collaborator Author

somiaj commented Nov 13, 2022

@sebaro it uses the background color of the menu colorset, if you want to change the translucent color for the tint, change the background color of the colorset for the menu. I see no reason to also allow you to set this with the translucent option, it should just use the already defined background color of the menu.

@sebaro
Copy link

sebaro commented Nov 13, 2022

@sebaro it uses the background color of the menu colorset, if you want to change the translucent color for the tint, change the background color of the colorset for the menu. I see no reason to also allow you to set this with the translucent option, it should just use the already defined background color of the menu.

Thanks.

@somiaj
Copy link
Collaborator Author

somiaj commented Nov 14, 2022

The more I think about making it so the title and active back highlights are also translucent, the more I realize the this really isn't possible the way I'm going about it (and most likely why it was never included in the original patch). The issue is it will be grabbing a new screenshot, which includes the menu, so this will get in the way the translucent effect, since the menu is going to already have some tinting, on top of new tinting. When I get home, I am going to revert my attempt at this, and make this ready to go into the main branch (unless @ThomasAdam notices something about the code / method I'm taking that needs to be worked on).

In the future, a way to make the title and active back translucent would be to modify the translucent function to grab and store an original screenshot of the area it is using for the background of the main window. Then crop that image to the correct location for the title/menu item, and add a tint to that. This could work, but currently the original screenshot the window uses is not saved. I am not going to attempt this with this patch, and just add the feature as people are used to it work (outside of turning it into a MenuStyle). But if some future work is ever done, this idea might help them.

  Adds new MenuStyle option 'Translucent', which can set the
  Translucent percent of menus using the associated style.
  This option takes one additional value that is a number
  between 0 (fully translucent) to 100 (not translucent).
  Supplying no value (or an invalid value), or using
  '!Translucent' turns translucency off.
@somiaj somiaj marked this pull request as ready for review November 15, 2022 05:16
@somiaj
Copy link
Collaborator Author

somiaj commented Nov 15, 2022

@ThomasAdam this should be ready to go, unless you notice something off about the patch that needs addressed.

@ThomasAdam
Copy link
Member

I don't see anything glaringly obvious which could hold this patch up. Everything looks good to me. :)

@ThomasAdam ThomasAdam merged commit ad8e4a0 into master Nov 15, 2022
@ThomasAdam ThomasAdam deleted the js/translucent-menu branch November 15, 2022 19:09
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Feb 15, 2023
# Changelog

## [1.0.6a](https://github.com/fvwmorg/fvwm3/tree/1.0.6a) (2023-01-16)

## What's Changed
### Other Changes
* dist: doc: include all doc sources by @ThomasAdam in fvwmorg/fvwm3#806


**Full Changelog**: fvwmorg/fvwm3@1.0.6...1.0.6a
## [1.0.6](https://github.com/fvwmorg/fvwm3/tree/1.0.6) (2023-01-14)

## What's Changed
### Breaking Changes
* remove fvwm-config by @ThomasAdam in fvwmorg/fvwm3#731
* ta/alloca by @ThomasAdam in fvwmorg/fvwm3#722
* deprecate color commands by @ThomasAdam in fvwmorg/fvwm3#738
* Ensure a default colorset is always configured. by @somiaj in fvwmorg/fvwm3#740
* commands: remove DefaultColors & DefaultColorset by @ThomasAdam in fvwmorg/fvwm3#749
* MenuStyle: Remove Depreciated options and non colorset  by @somiaj in fvwmorg/fvwm3#757
### Enhancements
* decor: allow window borders separate colours by @ThomasAdam in fvwmorg/fvwm3#730
* Update Move shuffle logic to jump to next monitor by @somiaj in fvwmorg/fvwm3#742
* conditional: screen: simplify logic by @ThomasAdam in fvwmorg/fvwm3#746
* Allow SidePic in default-config. by @somiaj in fvwmorg/fvwm3#762
* Move shuffle, ensure window inside working area. by @somiaj in fvwmorg/fvwm3#767
* Translucent Menus by @somiaj in fvwmorg/fvwm3#760
* Updates to FvwmPager scaling math to improve visual aspects due to rounding errors. by @somiaj in fvwmorg/fvwm3#790
### Other Changes
* doc: don't install fvwm3_manpage_source by @ThomasAdam in fvwmorg/fvwm3#712
* Rename .stalonetrayrc to stalonetrayrc by @wfp5p in fvwmorg/fvwm3#713
* Fix background resetting in default-config by @somiaj in fvwmorg/fvwm3#714
* desk_add: fix window counting by @ThomasAdam in fvwmorg/fvwm3#716
* remove unused variable by @omar-polo in fvwmorg/fvwm3#718
* two clock_t and time_t casts for portability by @omar-polo in fvwmorg/fvwm3#719
* changing sprintf -> snprintf & co by @omar-polo in fvwmorg/fvwm3#720
* DesktopConfiguration: send status_send() by @ThomasAdam in fvwmorg/fvwm3#724
* FvwmScript.c: fix wrong size of TabCom array by @slazav in fvwmorg/fvwm3#725
* gotodesk: simplify logic for shared/global by @ThomasAdam in fvwmorg/fvwm3#727
* Add a multicolor border example to default-config by @somiaj in fvwmorg/fvwm3#732
* Some pedantic clean up of whitespace and add missing translation strings. by @somiaj in fvwmorg/fvwm3#733
* Tweak HilightBorderColorset by @lgsobalvarro in fvwmorg/fvwm3#737
* docs: remove obsolete GNOME references by @ThomasAdam in fvwmorg/fvwm3#739
* MWMBorder: fix calculation by @ThomasAdam in fvwmorg/fvwm3#743
* Don't set border colorsets by default. by @somiaj in fvwmorg/fvwm3#747
* style: silence warning for unconsumed string by @ThomasAdam in fvwmorg/fvwm3#745
* Add split manpages to default-config. by @somiaj in fvwmorg/fvwm3#750
* FvwnIconMan use font as fallback for tips font. by @somiaj in fvwmorg/fvwm3#751
* FvwmIconMan: Don't chop window display string by @somiaj in fvwmorg/fvwm3#752
* fvwm-config: remove .in file by @ThomasAdam in fvwmorg/fvwm3#758
* FvwmPager make mini windows always round down. by @somiaj in fvwmorg/fvwm3#756
* Clean up some build warnings by @somiaj in fvwmorg/fvwm3#759
* Move shuffle modifications. by @somiaj in fvwmorg/fvwm3#764
* borders: treat 0 pixels as 1 pixel border by @ThomasAdam in fvwmorg/fvwm3#765
* AddWindow: don't crash reparenting by @ThomasAdam in fvwmorg/fvwm3#786
* ModuleSynchronous: don't segfault on free() by @ThomasAdam in fvwmorg/fvwm3#787
* FvwmIconMan: fix segfault in initialisation by @ThomasAdam in fvwmorg/fvwm3#800
* randr: quit when no screens found & not active by @ThomasAdam in fvwmorg/fvwm3#801

## New Contributors
* @wfp5p made their first contribution in fvwmorg/fvwm3#713

**Full Changelog**: fvwmorg/fvwm3@1.0.5...1.0.6
## [1.0.5](https://github.com/fvwmorg/fvwm3/tree/1.0.5) (2022-09-28)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:new-feature Brand new feature not yet present in fvwm3
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants