So I have been idly poking at the "built-in" Cairo based libdecor decorator plugin - not changing anything serious, jus a little bit of "window dressing" as it were...
Now, I'm not sure how representative my testing is, since the box I'm using to test this is actually a Win11 test with WSL2/WSLg enabled and Ubutunu-22.04 since that's the only "Linux" box I have with Wayland installed.
(And my main Linux dev box already has GTK3 installed, which would get in the way of the Cairo-decorator testing, potentially, since the Cairo decorator is the "last resort" if GTK3 is not present...)
Situation: With the Cairo decorator, I'm seeing a weird effect when I go full screen. In the attached screenshots, see the Win11 desktop running my Linux instances of the "demo" and "browser" code, note the position of the "browser" window.
When I go full screen on the "browser" (second screenshot) it draws the browse OK, but then *draws the decorator drop-shadows anyway* at the position that the (non-maximized) window would have been.
This is very ugly, and I'm not quite sure why it happens... I suspect the WSLg compositor is sending misleading requests to the decorator (and hence triggering the border and drop-shadow to be drawn) but I'd like to know what folks running Wayland on a real Linux host are seeing... If this is indeed a widespread issue I can work around it, but it may just be the WSL2/WSLg setup that causes the issue, rather than the decorator plugin itself...
(For those following along at home, the Linux windows in these shots are using our built-in Cairo decorator, but with the title-bar font size corrected *was the bug I suspected, I think) and the colours changed as I was fiddling to see what did what...
On my Gnome/Wayland desktop on Linux Mint 20 (based on Ubuntu 20.04 LTS) it's fine, no such drop shadows.
There are two points to this:
1. I remember that there were issues with fullscreen windows, maybe in libdecor, but I don't remember exactly. These issues have been fixed weeks (months?) ago and I don't know what exactly the issues were. Manolo may know more.
2. According to this image WSLg is running a Weston compositor which
(a) is the reference compositor of Wayland but
(b) has some known issues.
Maybe this is one of these issues.
https://github.com/microsoft/wslg/raw/main/docs/WSLg_ArchitectureOverview.png
On 12/3/22 17:15 Albrecht Schlosser wrote:
> On 12/3/22 13:53 imm wrote:
>> Regards a patch, it might be easiest if I post the modified file so
>> far - I couldn't get on with the style of the base code so might
>> "accidentally" have run it through astyle to make it more readable. A
>> patch will show *a lot* of change where really there's very little...
>>
>> There's a "one liner" change to libdecor/build/fl_libdecor-plugins.c
>> (attached) and a "new" file libdecor-cairo-modified.c (in zip)
>
> Thanks, I copied your file and applied the patch. After disabling the
> GTK plugin it uses the modified plugin as can be seen in the
> screenshot (modified colours).
FWIW, for other users: I made a patch of the "original" Cairo plugin
(attached). It is enough to apply this patch and recompile.
Some notes:
1) changed titlebar color, comment: /* FLTK (TEST only); are there
"better" colors? */
2) changed 'libdecor_cairo_proxy_tag', comment /* FLTK - optional */
3) patched "case SHADOW" as given by Ian:
looks useful *NOT* to draw drop shadows if the window is maximized,
comment: /* FLTK - Fix (?) */
4) patched 'pango_font_description_set_absolute_size', comment: /* FLTK
- Fix ! */
5) patched "priority" as given by Ian, comment: /* FLTK - optional */
Regarding (3): would likely be useful upstream.
Regarding (4): *should* be patched upstream.
Regarding (1, 2, 5): probably not useful upstream.
The only mandatory part of the patch would IMHO be point (4) above which
fixes the annoying titlebar font size and should be proposed to libdecor
maintainers (MR).
Looking forward to others' test result and Manolo's comments. TIA.
On Sat, 3 Dec 2022, 21:33 Albrecht Schlosser wrote:
FWIW, for other users: I made a patch of the "original" Cairo plugin
(attached). It is enough to apply this patch and recompile.
Some notes:
1) changed titlebar color, comment: /* FLTK (TEST only); are there
"better" colors? */
TBH I changed this mainly so I could tell if it was my version that was running...I'd like to be able to load the system colours, but don't know how to do that.I like my titlebar colour better than stock...
2) changed 'libdecor_cairo_proxy_tag', comment /* FLTK - optional */
We probably want this in our built-in, but no one else needs this.
3) patched "case SHADOW" as given by Ian:
looks useful *NOT* to draw drop shadows if the window is maximized,
comment: /* FLTK - Fix (?) */
I'm cautious about this; a feature of the plugin is that it uses the logic that computes the shadow region to also detect the grabbable borders, e.g. for resizing the window.So if we always suppress the shadow, it then means we can't resize the window by grabbing an edge...
That said, maximized or tiled windows should not have drop shadows (and can't be resized by dragging) but under WSLg they do get shadows. I'm pretty sure that's a bug in WSLg though... Maybe...
- if (frame_cairo->decoration_type != DECORATION_TYPE_TILED) + if (frame_cairo->decoration_type != DECORATION_TYPE_TILED && + frame_cairo->decoration_type != DECORATION_TYPE_MAXIMIZED) /* FLTK - Fix (?) */i.e. the condition '!= DECORATION_TYPE_MAXIMIZED' which could make sense since, as you wrote above, "maximized or tiled windows should not have drop shadows".
I need to do a lot more tests on a real Linux to see what's happening here, but I think the plugin may be "OK" as it was.
4) patched 'pango_font_description_set_absolute_size', comment: /* FLTK
- Fix ! */
I think this is the only definitely useful change I've made
5) patched "priority" as given by Ian, comment: /* FLTK - optional */
This is useful for our built-in decorator, just so it takes priority over a stock Cairo decorator. Probably not useful for upstream though.
Regarding (3): would likely be useful upstream.
Not sure; this shouldn't be happening anyway...
Regarding (4): *should* be patched upstream.
OK
Regarding (1, 2, 5): probably not useful upstream.
OK
In later testing I've been seeing some other odd behaviours, with the plugin getting "unexpected" window states sent from the WSLg system. I need to test elsewhere, but I suspect it's not the plugin that's faulty here.
In particular, weird effects where the titlebar has disappeared, and where the main,max, close buttons are not getting set to the correct colour, or are changing colour at the wrong time.
Also inactive windows aren't being drawn in the inactive colours at all (or maybe very rarely) which again looks like a WSLg bug.
Ian, would you like to create a GitLab "MR" for libdecor yourself?
If not: Manolo, since you already succeeded in pushing MR's, could you
do it again?
Any volunteers to create a GitLab MR for libdecor/Cairo-plugin?
...
Whatever we do, I propose to use this one-line patch in our bundled
Cairo plugin until it's hopefully fixed upstream. This would make the
Cairo plugin look much better (kinda "normal") and users wouldn't need
to install gtk development files.
See attached patch 'cairo-plugin-fontsize.patch'.
+1 for the patch
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/a20182b1-6a48-4d0f-be37-21b41f93afc2n%40googlegroups.com.
On Monday, 5 December 2022 at 13:08:55 UTC Albrecht Schlosser wrote:
Ian, would you like to create a GitLab "MR" for libdecor yourself?I'll take a look, but I don't think I've an account for GitLab and I've certainly never used their tools, so it might take me a while!
I think FLTK should only include the patched fallback cairo version. Somebody should confirm that if a desktop has installed it's own plugin the fltk programs use that one instead of the fallback.
So, just to summarize (for my own benefit, really!):We are thinking that for the built-in decorator, we should use a (possibly slightly modified) version of the Cairo decorator. The gtk3 decorator {can | should | must} be dropped because it may cause a hard dependency on GTK3, which we do not want in our fall-back code. (This is a simple change to our file "fl_libdecor-plugins.c" to drop the GTK3 option and affects no other code.)IF the system provides a decorator, we expect that this will be used at runtime in preference to our built-in.We expect that, at that point, IF the system offers the GTK3 decorator as an option, it may be used (since it sets a higher selection priority than the stock Cairo decorator plugin.) Also, Manolo reports that most systems that offer a decorator plugin at all, seem to only have the Cairo decorator at present.For our built-in decorator, we derive from the Cairo decorator, but (at least in the short term) we apply the title bar font size correction (until we get the fix upstreamed...)
I'm utterly against the proposal of removing the GTK libdecor plugin from the FLTK source code for the following reasons- It does not introduce a hard dependency on GTK because this plugin is used only optionally, the default being not touse it when package libgtk-3-dev is not present on the build system. Any developer reluctant to install package libgtk-3-devcan build FLTK apps with the cairo plugin. Any developer willing not to use libgtk even if package libgtk-3-dev is presenton the build system can do so with "cmake -DOPTION_ALLOW_GTK_PLUGIN:Off".- Supposing an FLTK app was built with the gtk-based plugin option set to on, the app is dynamically linked to libgtk.sowhich is present in all systems recent enough to support Wayland. Package libgtk-3-dev is necessary at build time,but not at run time.
On Tuesday, 6 December 2022 at 13:27:25 UTC Manolo wrote:
I'm utterly against the proposal of removing the GTK libdecor plugin from the FLTK source code for the following reasons
- It does not introduce a hard dependency on GTK because this plugin is used only optionally, the default being not to
use it when package libgtk-3-dev is not present on the build system. Any developer reluctant to install package libgtk-3-devcan build FLTK apps with the cairo plugin. Any developer willing not to use libgtk even if package libgtk-3-dev is present
on the build system can do so with "cmake -DOPTION_ALLOW_GTK_PLUGIN:Off".
- Supposing an FLTK app was built with the gtk-based plugin option set to on, the app is dynamically linked to libgtk.sowhich is present in all systems recent enough to support Wayland. Package libgtk-3-dev is necessary at build time,
but not at run time.
OK - but: If FLTK is built on a system that has the gtk3-dev files available (as most of mine do) this then means that fltk ONLY has the gtk plugin built-in, the Cairo decorator will not be included (our build selects one or other to build in at compile time, it is not selected at run time.)
If code built against that FLTK is then deployed on a system that does not have gtk3 at all (which is still very possible) and is run on a system that provides no other decorator (still very likely just now) then it will not work as intended and a fallback to X11 must be used. Which is OK, but not ideal.
If we *only* build in the Cairo decorator, it will work "everywhere" that fltk can work (since the default build of fltk now needs Cairo).Any system that provides gtk3 and also provides a client-side decorator will use that anyway, rather than our built-in, and I assume that at some point (hopefully fairly soon) that will be the default and our built-in decorator will become rarely used. Our built-in decorator is only intended as a last-resort, not at the "best option".So on that basis I do not think we should strive to make it too gnome-compatible; any desktop distro that strives for gnome compatibility will presumably provide a gtk-client-side decorator and that is what will be used at runtime, rather than our built-in. (Or they might even switch to server-side decoration like KDE and save us all the hassle!)
I think that our built-in is very much the "decorator of last resort", and on that basis we should make it have as few other dependencies as possible.
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/4d9cc55d-ef6d-d5bf-5e68-6e186a136e4e%40online.de.
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/380138f7-abd3-4453-8164-8a008b01e006n%40googlegroups.com.
On 12/6/22 11:31, Bill Spitzak wrote:
The problem is that if you compile on a system with GTK the result won't work on a system that does not have GTK.
Perhaps Manolo's using runtime dynamic loads for gtk.
The problem is that if you compile on a system with GTK the result won't work on a system that does not have GTK.Cairo of course has the same problem, but since the program won't work anyway this is much less of a concern.I'm also wondering if the "fallback" can actually be in the fltk library, rather than a separate file. This is a real pita for statically-linked applications because the extra file is needed for them to work. What would happen is libdecor fails to load a plugin then it would be set to call the already included code. May require the code to be changed to avoid a name collision with symbols in the plugins.
My angle of view is to put FLTK 1.4 in the best possible situation for acceptance of its new Wayland/X11 hybrid platform by current and prospective users. Therefore, why not arranging for it to appear as it will do when the next release of libdecor will have made its way into a linux package? Why present it as an alien app relatively to the gnome desktop when we know how to do better ?
I know I keep banging on about this, and I really don't want to come across as being an arse about it, but I still do not get it:Yes, making fltk look consistent is important, but if the user has a system that is making heavy use of Wayland windows, then they presumably already have a system-provided decorator? (Either server or client side.)In that case, fltk will be using that decorator anyway and there is no problem?
If they do not already have a system provided decorator, then it seems likely that their windows will have inconsistent decorations, and so fltk looks "no worse" than anything else?
So my concept of this is that we provide a fallback decorator that is "good enough" and which is likely to work "everywhere" , but in the expectation that (in the very near future, if not now) it will never be needed on most systems anyway.