Closed fbosio closed 4 years ago
@fbosio, thank you for the detailed report! I have a couple of questions:
View | Default Layout
?I think that something is going on with the SettingsRestoreView() function, called in main, but I don't know exactly what.
If you can reproduce the issue, can you add a couple of ide:Print
commands around 442 in src/editor/settings.lua to show besth
value, as there is already a workaround for a similar (the same?) problem, but it's not hardcoded to any particular height. I'm curious as to why it may not be catching your case. Thank you.
@fbosio, thank you for the detailed report!
You're welcome! I really like this project, specially for game development with Löve2D :) (Regarding that, thank you for accepting my pull request).
1. How did it get into this situation? Is it reproducible?
I just cloned the repository and ran the shell script, and the toolbar showed up like that. This graphic issue is persistent, if you close ZeroBrane Studio and open it again, the toolbar will look equally thin.
Here's something more, one may
View > Tool Bar
View > Tool Bar
and it will look just fine. But that doesn't fix the thing, because the toolbar will be shown the wrong way again if you close and open the IDE once more. Actually, that's why I made the workaround in the first place.
2. Is the issue fixed if you use
View | Default Layout
?
Yes, but temporarily. The issue appears again when I close and open the IDE, like above.
If you can reproduce the issue, can you add a couple of
ide:Print
commands around 442 in src/editor/settings.lua to showbesth
value, as there is already a workaround for a similar (the same?) problem, but it's not hardcoded to any particular height. I'm curious as to why it may not be catching your case. Thank you.
Glad to read that! And sure, I removed my workaround, added an ide:Print(besth)
in src/editor/settings.lua/
, line 443, and here's the output when I run zbstudio.sh
The API file must be located in a subdirectory of the API directory.
26
It seems that the layout engine detects the besth
value correctly.
However, when I run
ide:GetUIManager():GetPane("toolbar").best_size:GetHeight()
in the Local console, I get
10
I found that the uimgrlayout
settings override this value on line 445,
because I added an
ide:Print(string.match(layout, "toolbar.-(besth=.-);")) -- edited
in line 433 and got
besth=10;
but I can't find exactly where that's happening right now. Does this help?
I repeated my original test in several virtual machines with differente Ubuntu-based distributions, they all look fine, except Lubuntu. So the issue is clearly caused by something going on with LXQt.
So I made a few prints and found that, whatever is causing this issue, is doing it after the onAppLoad
event. I looked a bit deeper for event callbacks and found the line 27 of src/editor/gui.lua
.
toolbar:BestSize(event:GetSize():GetWidth(), ide:GetToolBar():GetClientSize():GetHeight())
I added an ide:Print(ide:GetToolBar():GetClientSize():GetHeight())
and got this
26
26
1
1
10
Hence, the wxSizeEvent
gets here, at some point, a window 'client height' of 1
. I added the same print command in Ubuntu, whose desktop environment is GNOME, and the 'client height' is always 26
. My hypothesis is that the desktop environment, LXQt, is giving the wrong value to wxWidgets. So maybe this issue belongs to them!
Anyway, thank you, @pkulchenko for your attention!
@fbosio, thank for you the detailed analysis! It does look like the issue is with LXQt, as I couldn't reproduce it on my Ubuntu image.
It may be possible to add a workaround though. What if you replace that line 27 with something like this:
if ide:GetToolBar():GetClientSize():GetHeight() > 1 then
toolbar:BestSize(event:GetSize():GetWidth(), ide:GetToolBar():GetClientSize():GetHeight())
Does it work better? In fact, it should probably be >= 16, which is the minimal icon size anyway.
Nice hack, works like a charm!
Bug
Information
How to reproduce this issue
Just run
zbstudio.sh
.The toolbar height is too small, in such a way that the icons cannot be seen completely.
Workaround
Run the following in a shell
Then, close and open the IDE again. The toolbar should look well from now on.
Note
I had a look at the ZeroBrain Studio source code, and I think that something is going on with the
SettingsRestoreView()
function, called inmain
, but I don't know exactly what.