OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:58 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: GUI Window movement
PostPosted: Sun Nov 21, 2021 12:45 pm 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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!!


Top
 Profile  
 
 Post subject: Re: GUI Window movement
PostPosted: Sun Nov 21, 2021 1:13 pm 
Offline
Member
Member

Joined: Sun Aug 20, 2017 10:59 am
Posts: 43
Quote:
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.


Top
 Profile  
 
 Post subject: Re: GUI Window movement
PostPosted: Sun Nov 21, 2021 5:13 pm 
Offline
Member
Member

Joined: Tue Apr 03, 2018 2:44 am
Posts: 401
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.


Top
 Profile  
 
 Post subject: Re: GUI Window movement
PostPosted: Mon Nov 22, 2021 6:06 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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


Top
 Profile  
 
 Post subject: Re: GUI Window movement
PostPosted: Mon Nov 22, 2021 10:05 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1593
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.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: GUI Window movement
PostPosted: Thu Nov 25, 2021 9:46 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 59 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group