Page 1 of 1
GUI Window movement
Posted: Sun Nov 21, 2021 12:45 pm
by Kamal123
Hi,
I use compositing window manager, so for now, when I move an window the server sends messages to clients to redraw itself in new position then clients redraw every widgets in new position which becomes slower when many widgets are present and sometimes the entire system crashes!! Is my method is correct?.. what method do you apply for window movement in compositor?...
What happens actually, when window is moved in compositing window manager?
Thanks in advance!!
Re: GUI Window movement
Posted: Sun Nov 21, 2021 1:13 pm
by vhaudiquet
the server sends messages to clients to redraw itself in new position then clients redraw every widgets in new position
Why would you need to redraw every widget ?
From my understanding there isn't a widget update needed, and as the display server must know the framebuffer, moving a window is just moving an array of pixels.
You don't need to update anything when moving a window (if you are not changing it's size)
You can just memcpy the pixel array of that window and clear/redraw background on the old position.
You don't even have to know which widgets/library is used by the client.
Re: GUI Window movement
Posted: Sun Nov 21, 2021 5:13 pm
by thewrongchristian
Kamal123 wrote:Hi,
I use compositing window manager, so for now, when I move an window the server sends messages to clients to redraw itself in new position then clients redraw every widgets in new position which becomes slower when many widgets are present and sometimes the entire system crashes!! Is my method is correct?.. what method do you apply for window movement in compositor?...
What happens actually, when window is moved in compositing window manager?
Thanks in advance!!
A compositing window manager should provide each top level window with its own pixmap buffer, into which the application renders its widgets. The compositing window manager then blits that buffer to its final position on the screen. So moving a window on the screen should just be a blit of an already rendered buffer, no client redrawing necessary.
Expose events are a throwback to when the screen framebuffer was the only place widgets were rendered, and made sense when video cards had 256KB RAM and machines didn't have enough main memory space or bandwidth to maintain an off screen pixmap for each top level window.
Re: GUI Window movement
Posted: Mon Nov 22, 2021 6:06 am
by Kamal123
Thanks, now my confusions are cleared. I fixed it...I have another question, I have pop-up menus, so if a popup menu is visible and after any menu item is clicked the popup menu disappears. If the popup menu disappears, how do I restore the contents behind it?..I am totally new to graphical widgets programing. I want to know the methods implemented in pop-up menus!!
Thanks in advance
Re: GUI Window movement
Posted: Mon Nov 22, 2021 10:05 pm
by nullplan
Kamal123 wrote:Thanks, now my confusions are cleared. I fixed it...I have another question, I have pop-up menus, so if a popup menu is visible and after any menu item is clicked the popup menu disappears. If the popup menu disappears, how do I restore the contents behind it?..I am totally new to graphical widgets programing. I want to know the methods implemented in pop-up menus!!
In most windowing environments, a pop-up menu is just another window (only without decoration), so it obscuring parts of other windows is just business as usual. When it goes away, either you saved the content of the obscured window and can restore it, or you send a message to the now visible window saying to redraw the damaged parts. In Windows, this is a WM_PAINT message, in X11 it is an XExposeEvent. The former method is not easy to do right, so a simple implementation probably just ought to go with the latter one.
Re: GUI Window movement
Posted: Thu Nov 25, 2021 9:46 am
by Kamal123
nullplan wrote:Kamal123 wrote:Thanks, now my confusions are cleared. I fixed it...I have another question, I have pop-up menus, so if a popup menu is visible and after any menu item is clicked the popup menu disappears. If the popup menu disappears, how do I restore the contents behind it?..I am totally new to graphical widgets programing. I want to know the methods implemented in pop-up menus!!
In most windowing environments, a pop-up menu is just another window (only without decoration), so it obscuring parts of other windows is just business as usual. When it goes away, either you saved the content of the obscured window and can restore it, or you send a message to the now visible window saying to redraw the damaged parts. In Windows, this is a WM_PAINT message, in X11 it is an XExposeEvent. The former method is not easy to do right, so a simple implementation probably just ought to go with the latter one.
Thank you so much, for your reply. I'll try to implement.