 Hi, today we are actually not trying to fix any bug in particular, but I still want to do a devlog because I want to understand better the code we currently have regarding a behavior that I think doesn't work well enough for the user. That is changing the size, sorry, the screen inside of the panels. Look at here, if I try to change this like very many times in a row, it just fails. And there are many bugs related to this. As an example, sometimes it doesn't actually return back to the normal length, but it gets shorter and I wasn't able to reproduce it. I think it might be something regarding maybe the panel not being full width from the beginning and when you actually like go around doing this terrible stuff, it just breaks. But for me right now it's working, but in general it seems to be much, much slower than it should be. So let's try to dive in and see just how does it work. Because sometimes there are some things that are slow and you can't do anything about them. But who knows, first of all we need to give a look into it, so KDE source and KDE workspace and it's probably either Plasma desktop or workspace. I think desktop is the right one here. So package contents views panel, this is the small, let's say small file about the panel. It is rather small. So I don't think it's the one that actually interested us, although it's part of the panel. If you're confused about this, I think I did a video about views and contentments and there I talked about why we have two different, actually three different files for the panel. But let's actually go pick up the next one, which I don't remember contentments panel. This one contains UI, main UI, this one, okay. So let's see what's in this file. And as you can see I'm using the CSD looking thingy hack that I've shown in my last video. I don't think I'm going to keep it, but I did it so I should also suffer from it. So first of all you can see that there's a property ball, here's horizontal, which is plasmoid form factor, isn't vertical, makes sense. In this case my guess is that the C++ code is changing form factor depending on the side of the screen. But to actually see how it's changing the screen side, we need to go to the component that actually does it, which is of course the thingy that you drag around. And it is not in main Qmall, it is in config overlay. What is config overlay? If I remember correctly it should be this thingy above the panel with this screen edge button. So let's see if I indeed recall correctly, we should have screen, and what was it? Screen edge. Okay, so we do not have that very nice screen edge, as you can see it's not here, it's red, but we can still search through the files to see. Well, also let me see if I don't know, is remove button, sorry, remove panel here, because it's also move panel, okay so it's not, although we do get this which I think is remove configural alternatives, it should be the hover thingy you get, like this one. Remove configural alternatives, yes. What else? Here we have code to handle dragging panels, sorry, widgets around, and we don't have anything about the edit view, so maybe it's in main Qmall, let's see here, remove panel, of course it's not. Everything is ever in the place you would expect, let's do a search for that string that we're looking for which is screen edge, and any name or location but we want containing text screen edge, no file contains that, okay, so that's very nice, we take a step back and search more widely, still nothing, okay, so let's search in the entire Plasma desktop repository, it has to be there, it will probably take a while, but it has to be there. So we do get edge handle, looking good, it looks like an edge angle, so maybe it makes sense, and also look at here, the sub folder is desktop package contents configuration panel configuration, so it looks like we found it, so let's go into that folder, I could have just click on it, but it's prettier to just open it up to remember where it is, the sub page contents configuration, panel configuration, it's full of stuff in here. Where do we have a folder and, okay. So edge handle, which is exactly what we were looking for, so we got a button with this text, with this icon, blah blah blah, a tool tip which is click and drag the button to a screen edge to move the panel there, thank you, makes sense, and then there is this mouse event listener, which sounds like what we were looking for. So what does this do, last X, last Y, start mouse X, start mouse Y, we're probably looking for drugs, on pressed we record the, okay what's the difference between mouse screen X and mouse X, maybe one is relative to the screen and one to the panel, I don't know, I could Google it, but it's not very important right now, so I leave the mystery, is this recording, hey yeah, you're recording, everything is recording, okay, mouse screen X, blah blah blah, blah blah blah, blah blah blah, blah blah blah, is if the mouse is in internal rectangle do nothing, so if it's like here, you don't see my here, but if it's in the middle, don't do anything, makes sense, I do expect an else, or maybe this is, okay so I guess this is if it's in a border rectangle, that's what the if is saying, it does nothing if it ignores the thing, so we check where it is and we set this variable new location to other top edge, right edge, left edge, bottom edge, okay, and then switch new location, if it's on the top, then var Y equals math max mouse screen Y minus map to item dialog root zero start, what, okay so I'm not sure, so it's taking the Y, okay so it's replacing the coordinate of the config dialog, okay, makes sense, and then what does this do, that's it, new location and that's it, that's all it does, that doesn't sound enough, it should probably set this new location variable to, ah here, panel dot location equals new location, so what is panel, panel is one thing I hate about QML is that it doesn't allow you to understand where a variable is from, like what is panel, where, what is it's type, come on, it should be a panel, but is this like this panel or is it another one, it's probably the C++ panel view thingy, I guess, let's see if location, do we have our location in here, it's probably the containment, so property in here the only location seems to be this one, this one, okay, so in here is only reading the location of the containment, so it's probably referring to the location of the containment, and the containment is handled through, I don't remember, I probably should review, with Plasma 6 I will review the status quo of the Plasma API, but we're doing some, we're going forward with our investigation, we should now check where is the containment, this one is the view, right, this is the view, and this one is the containment, but it's probably referring to the C++, if we check for location here, there's nothing, and it was called location here, right, yes, so it's probably C++ stuff, so let's go fetch them, it's in Plasma workspace, here, shell, panel view, panel, there's also panel config view, interesting, but I was only looking for panel view C++, panel view H, and why not panel view config view C++, so that we have all of the interesting files, where is my sidebar with with all the files, where is my sidebar, views, tools, views, show, documents, yes this one, thank you, okay, so let's look into here, so here we've got I think two objects, no just one, which is panel view, which is a containment view, and let's see if location, there's nothing about location here, so and nothing here, there's also, there's something here, interesting, what is panel config view, panel config view is a config view, thank you, now we've got to fetch those classes to understand a bit better what's going on, so let's see, this looks looks like a rather short file, so let's give a look, blah blah blah, this looks very ugly, a valid script, okay, sync geometry, sync location, okay let's see sync location, if it doesn't have a containment return, okay, we know blah blah blah, this is not interesting, see it's just using the location of the containment, I think that's what we're interested in, yeah this sync location doesn't interest us at all, so we're only interested in finding out about the containment containment view, where is the containment view file, I don't know, it's in Plasma Quick, is this a Plasma framework thing, let's find out, Plasma, I mean it's probably containment, no it's totally frameworks, so Plasma framework, and we search for kfind, kfind is like one of the most useful things ever, containment view is not here, seriously, oh come on, containment view, had I case sensitive, no we didn't, why didn't you find containment view, so let's open these two up, I said let's open these two up, let's start with the h file and we should have location here, we do, very interesting, so there's location and basically nothing particularly word going on, we just have a function to read the location, a function to set the location, a signal, if you don't know what signals our site suggests, looking into QT, QT, QT documentation, a signal when the location is changed, and that's it, so code wise it shouldn't be surprising at all, but let's give it a look anyway, we switch from the .h file to the .c++ file, because the .h file is the header file which only contains the declarations of stuff, it's sort of, how do you say this, a summary of the code and then there's the c++ which contains the, let's say actual stuff, so we have here, if the location is different from the new one, then emit that the location has changed, normal stuff, blah blah blah blah blah, that's it, okay so that's pretty nice actually, that's pretty clean, so we only have a way to read the location which means and write it, which means that we have edge handle which sets the panel location and then this goes into the containment view c++, it changes the location and it throws off a signal which changes everything that's based upon panel.location in QML, because I don't think there's any c++ code handling rotation, not rotation, edge screen changing at this point, so it's QML and QML only, so as an example here we've got location, switch containment location and this thing, is this the only use of location, I know I've just searched but on containment changed, containment, okay so look at here, containment, location change, connect, adjust prefix, what does this mean, well in this adjust prefix thingy we've got a switch that acts upon containment's location and in order for this to be actually code every time the location is changed, here which is run every time there's a new containment, so at boot as well, it says when the location changed, connect the function adjust prefix, so each time location changes adjust prefix is called, what does this function do then, well it checks which edge we're in and does this absolutely uninteresting thing of setting the prefix to that and which means that stuff like oxygen can look different depending on the side it's in, absolutely uninteresting, like this shouldn't be any performance issue thing, so I mean we can take it completely off to show you that it will change nothing, let's actually try this out and this is plasma desktop isn't it, I've lost my file, where's my file, this is plasma desktop as you can see here, so let's go into plasma desktop thank you, plasma desktop to build it, so build, KDE workspace, plasma desktop and then make install, okay it's compiled, so we source the prefix and we start the plasma show, in this way we can see that doesn't matter that changing the prefix is actually a completely useless feature as far as breeze goes but of course third-party things need that so it's not like we can actually just remove it all together, so we've got our panel thank you and you can see that still works, still works and still incredibly slow at changing the screen's side, so pretty to look at, so we actually managed to break it, look at here, it's floating, it's accidentally floating, yay, let's I don't know drag it to the bottom and then bottom again, now it's fixed, this code does seem really fragile, so this function is useless, what we're really interested in is the contentment and particularly everything that depends on location, there's not a single location in here, so how does this know if it's vertical or not, why are we using plasmoid form factor instead of location, I have no clue, plasmoid, what's plasmoid in this context, why can't QML, okay so far enough, I guess it tells me the package but still pretty useless, so route is horizontal, okay, it's actually fairly easy, I mean it's what you would expect, this is just having the widgets inside of the panel, so what it does is you have a row which becomes a column when you change the size and gets back to being arrow after that and nothing weird and of course I mean I cannot debug the fact that it's slow because most of it is probably from the widgets themselves which need to repeat them as horizontal vertical depending on the screen side, so I do understand the code better now, there is probably plasmoid form factor depending on the panel's location somehow, I don't know in this case how it's done, I don't remember at all how this works, so there's probably more to it, I'm not particularly expert of these things but I'm happy that I managed to see a bit more of how it works under the hood, is there anything else that my interests us, let me see, we could give a look to, because I mean the panel view, this has to do something, the C++ code to resize, like know what if I search for location here, so something does happen here, so when panel view location changed it starts a timer called the position panel timer which is set to 150 milliseconds, now quick question, what? but does this do, let's try to find out, so restore might have been called directly at which point we don't still need the timer, we also start when adapt to screen and that's it, sorry I missed this, when the panel hard the timer times out call restore, okay so that's interesting, let's search what this whoops restore function is, okay let's zoom in, okay so all the defaults are based on whatever the current values, so it won't be worthy reset after screen resolution change, alignment is not resolution dependent, but if it fails to read it from the resolution dependent one as the place for this config key, it's change to plasma 5.9, do not use read config value with fallback, this very much sounds like a poem in some dark forgotten language, but it fails read it from the resolution dependent one as the place for this config key is change in plasma, what? I'm a bit tired, so it's probably my brain functioning correctly, so here is something interesting going on, set alignment, so this is setting the alignment which is more in line with what we see here which is called form factor which is completely different from alignment, never mind that, so there's alignment, okay then all the other values are read from screen independent values, but fallback on the screen independent section as is the only place is safe to directly write during plasmaster tap, as there can be resolution changes, another good sounding poem, I'm offset read config value with fallback offset, okay makes sense, it's reading the offset compared to the center I guess, or whatever it's aligned, set thickness, okay so basically every time you change this seems unnecessary, every time you change the screen edge it reads all of the saved values again, but why? I mean there's a timer to do this 150 milliseconds after you actually change the screen size, I am confused, screen size blah blah blah, fix me an invalid size doesn't work with q windows, okay const inside blah blah blah, we do have form factor here, const and max size equal sized minus offset, then we've got max length and the min length, these are all values that you can customize in the panel config thing, panel visibility is not resolution dependent, but if it falls things to read it from the resolution, the dependent one as the place for this config key is changed in plasma 5.1, 5.9, do not use read config value with fallback, okay so we set the visibility mode, which is you know how to hide, do not how to hide those things, the opacity mode, normal stuff, we announced that we finished the init, we finally resized the panel, so 150 milliseconds after moving it, I can see why it's slow, I mean 150 milliseconds of delay is not optimal and then position panel, then you emit that everything has changed and use top timer, interesting, so I've got a bunch of questions here, the first of which what happens if I lower this interval, it doesn't sound like it's a good idea because honestly I don't think that's the issue, but I wonder what happens, it's just out of curiosity, let me try, so this is Plasma Frameworks, so we need to build that one, so dolphin, new tab, Talbot workspace, make install minus j6, okay we're done, so again we searched the prefix and I am getting annoyed that my timer has been reset, I was counting time with that timer, I'm mildly annoyed, what was it, it's five o'clock, so let's restart Plasma Shell while I try to remember, it was 70 before I replaced Plasma Shell around that, which was I don't know 10 minutes ago, I don't remember, okay let's say I started off five o'clock which is probably true, let's rotate this, oh here's the back I was talking about, it's broken, it's probably related to the fact that I took off that, I made the timers lower because when you think about it, it also changed size, when you think about it, that code that we've seen saves the length of the panel and the offset as part of it, which means that if you manage to screw up somehow with changing the side of the panel and then maybe doing it again and changing it exactly when it was saving the length, but then it saves the wrong alignment, I mean screen side, that might be a problem, not necessarily the problem, it's incredible how fast it is to do this and just how slow to do this, it must be the updates inside of it, no, it must be, also this back, what is, is this the actual look of the config window when you're on the side, see it's much smaller, so there's also that back as well, so go down, okay, so let's set the timer back to what it was, my second question is, so I reckon that this restore function is used in many places and not just to change the screen edge, but what if just for the sake of trying right now, we took off anything but resizing and changing the panel position, like this it won't even save the new position, so if you like restart Plasma Shell it won't save the fact that you changed it, but I'm wondering, does it change anything, please note that at this point I'm just doing random stuff just to see what, I'm not expecting to fix anything like this, it's just changing random values, taking off parts and see what's the difference that it actually makes to better understand how the code works, okay let's try to restore Plasma Shell and let's see what happens, probably nothing, but nothing is the most important, most interesting result that we can get, so no hurry, okay so maybe, okay so interesting, we actually broke it, I did of course it broke, I just removed any way for it to actually read the values from your configuration file of the panel when it's actually starting up for the first time, so yeah of course it won't work, makes sense, but okay but I mean it's something we learned and that's useful, with this site, okay it makes sense, and containment from factor fail is not changed in here I think, so it's the one that follows the location that we've seen in the other file, the containment view, okay so one last thing, first of all I need to recompile the working panel because I you know actually need panels and it really seems like it's all about the QML widgets that are slow to resize from one orientation to another and you know also the actual background SVG of the panel seems to be pretty slow at updating, but it's very weird that the actual speed at which that is done is so inconsistent, like sometimes it changes from bottom to right in a reasonable time, sometimes it's just so slow, I have no idea, if there were an easy fix it would have been fixed already, so I wasn't actually expecting to fix anything, but there was this bug report here screen edge, button lose, grab while moving panel and then also panel sometimes gets shortened or remains floating in space while blah blah blah blah and I was wondering why is this so broken, what's going on, so now I know a bit better of the code, I should go on and keep investing getting stuff because there's clearly a need to however it's late, I don't have my panel anymore and this video is probably too long already, so how about we all go like you go sleep or something and I go studying because that's what I'm tired but I have to study, so for one last time before I finish up this video, beautiful, beautiful