 Hello and welcome to yet another episode of Nicholas, Pence, Howard's and Howard's trying to fix the smallest bug ever that basically nobody would have ever noticed, but I did. I mean, I fixed it. And the funny thing is that it's not even there out of the box. It is only noticeable if you use certain plasma themes, not breeze, but third party plasma themes, who have, sorry, super big rounded corners. And you can only notice it when you're using a floating panel with a very small size. So yeah, but I fixed it nonetheless, because I care about, let's see what the bug is. So right now you can see that I have a floating panel. I'm using breeze. Everything is fine. Let's switch to a third party plasma style, which in this case is going to be Whitesur, which is one of the themes where you can actually notice the bug. Now, if we just do that, nothing's wrong because we also have to make the panel small as I said. So let's go into edit mode and let's make the panel small and smaller and smaller and smaller and smaller and smaller and smaller. And now you can start noticing it. So you can see that there is this ugly black line in the panel. I mean, it's pretty noticeable. And you could say, oh, there's a black line in the panel. But I think that the smarter between you already get what the issue is, because it's super simple. And it is even more easy to notice if I zoom into the corners. Yeah, the rounded corners are bigger, like the radius of the corners are bigger compared to the height of the panel. And so the bottom corner is drawn on top of the top corner. Like, I think it's 18 pixels, they use like that's a lot. But okay, fair. There is 18 pixels of corner radius. So we have 18 pixels of bottom corners, 18 of top corner. And when the panel is smaller than 36, then the bottom part of the panel will be drawn on top of the top one. So you could say firstly and rightfully who cares? Yeah, especially if you consider that it's kind of a fault of the theme for using such a big corner radius without, you know, actually putting margins inside of them that would counterbalance that. And it is only noticeable if you make the panel very small. And I think that everybody with some common sense would see this and get the panel bigger to avoid that bang. Like you see that you can't go smaller than that and you just don't. However, I thought, I mean, but why? But why don't we fix it? So the easiest way to fix this is to make sure that the panel cannot be set to a thickness that is lower compared to the sum of the size of the elements on the top and on the bottom. In this case, 18 plus 18, that's 36. And just by doing that, we avoid all of the bugs. Like instead of expecting the users to notice the bug and not make the panel too small, we just take off the option to make the panel that small because it has bugs, obviously. So I was like this close to just close the bug report saying blame the plasma theme, but I didn't. And it took hours and hours to actually address this thing. It seemed much easier than it was. So how did I do that? Well, first of all, let's give a look to how the theme is like themes are in dot local plasma. No, sorry, sure. Plasma desktop theme. And we're white to sort dark. And inside of widgets, we have panel background this one. And if we open it, we can see these are the corners. They are very big. These are the top and bottom elements. So what we want to do is read the height of these two elements, summit and say, okay, the height of these two elements summed is the minimum available height that the panel can have. And that is a task for the frame SVG item and the frame SVG, which is the element that actually draws these things on screen. They take the SVG, they analyze the SVG, and then they draw it on screen. So let's actually see the patches because they're very simple overall. They are actually three patches. I had to divide it into three patches. This is the first one. So what we do, so we say, okay, this is the frame SVG, the minimum drawing height of this frame SVG is the top height, like the height of the element on the top, plus the one in the bottom. That's it. That was easy. Now we actually need to use this value, which is why we have two other merge requests. So what we do is we go into the Plasma workspace. No, sorry, actually desktop, Plasma desktop. In Plasma desktop, we actually draw the panel. The element is called panel dot QML in views. And you can see that we actually have inside of here, the SVG is here to draw the panel, Plasma core dot frame SVG item. Now we know that the frame SVG item has the property I just showed you. So what we do, we just take that value and we just save it somewhat. So the minimum panel hate will be the translucent item, which is the frame SVG item that we just saw. And we take the property minimum drawing height, which is top element plus bottom element. So actually the panel dot QML code is not a place where we set the thickness. And we want to make sure that these values are like the minimum thickness that we can set the panel. And the logic of the panel is in workspace. So we need to also make a patch to the workspace. The first one was in frameworks. So what do we do? We say where is this? Okay, take the root object, which is that panel dot QML that we just saw, and take the property called minimum panel height. And then we save it pretty easy. Now that we do have this property, let's add a new property to the panel called a minimum thickness, which is the minimum drawing width. If you're on horizontal panel, vertical panel, sorry, and it is the minimum drawing height, if it's horizontal panel. And then what do we use this minimum thickness for? When we try to set the thickness to a value, if the value is smaller than the minimum thickness, then the value is the minimum thickness. That's it. That's almost a few changes, but that is the point. And that is mostly the patch. Now to actually make this work, I spent a lot of time, especially because it looks easy to say, oh, yes, this component talks to this component that talks to this component, and it all just works at the end. Yeah, I can say it after I've done it, but before starting actually finding the correct way to make all of the components talk to each other, it's not that easy, especially because the frame SVG is actually a different thing from the frame SVG item. So the frame SVG tells the minimum with the frame SVG item that has the minimum with to the panel.qml that has the minimum with to the panel C++, which then exposes it as a property to the COM box when you're into edit mode, trying to edit the thickness of the panel. So there is this information that just travels through classes and to make everything work was quite a challenge, but now it does. And also in a very dumb way, I spent some hours debugging why this wasn't working, because it wasn't. And then I discovered that I was trying to read the minimum height of the opaque panel instead of the transparent one. Now here's the thing, not the opaque one, the thick panel, like because the panel has a normal panel. And then there's also a thick panel, which is the same panel, but with bigger margins, you can see that these things have a smaller margins compared to these ones in theory. Now here's the thing, white sore theme doesn't have a thick panel, it's just the normal panel. So I was trying to read the minimum drawing height of an element that didn't exist and turns out it's zero, because it doesn't exist. So I just kept having this zero value and I was like, sorry what? But then I noticed that I was trying to read something that didn't exist. Actually, I didn't notice. I asked another developer and he made me notice. But yeah, I noticed that I was trying to read an element that didn't exist. So I fixed that and now it works. So nice. Now if you have a floating panel with a very small size and you're using a third party plasma theme that has very small, very big, sorry, corners, you don't have this back anymore. Don't think. Anyway, before I go, this month is actually doing great in terms of donation and I will probably not reach my 700 years goal, but we can try to aim for that. I think that's a nice thing. And for now, I'm working at 15 years a hour, but again, that's gonna get significantly lower at times passes because most of the donations I receive are beginning of the month. So if you have any change to spare, if you want to donate me a pizza, pizzas here are expensive. So feel free to make a donation. As you can see, I'm trying to do my best even about the smaller, more insignificant stuff of cat plasma. Thanks everybody for following and see you tomorrow with a new video. Bye.