BALATON Zoltan <[email protected]> escribió:
On Fri, 23 Aug 2013, Rodolfo García Peñas wrote:
- RLoadImage(file): Load the image, and render it if the RContext
is not needed.
- RDrawImage(RContext, RImage): Draw the image on the WScreen. This
function depends on the WScreen.
With this change, we can create items (Menu, Dock, Clip,...) that
are screen independent. Then, we can draw them on the WScreen when
needed. If the WScreen change (for example, with XRandR), we only
need repaint them (using RDrawImage).
What is the advantage of this change? Would this move some
operations that are now done when the image is loaded only once to
drawing the image which can be done frequently? Does this lead to
less efficient operation (by eliminating images that are now cached
for each screen)? (You could argue that current systems are fast
enough but doing unnecessary work is still unnecessary, so shuold
not be done if not needed.) Is the reason for this change purely
esthetic (i.e. some code would look better)? If so, is there another
way to make code look better (like using macros or new functions to
hide ugly parts)?
These are just some questions without knowing anything about your
proposed changes, so maybe I'm completely misunderstood this...
Hi!
We are talking about different things. A little example:
- Think about a wmaker screen, only with the Dock icon. The Dock icon
uses a xpm icon.
When you run wmaker, it creates:
1st: The WScreen (the screen) interacting with X11 server.
2nd: Call to create the Dock Icon. To create the Dock icon, the
dock-create function calls RLoadImage to create the XPM image. The
image is created, using the WScreen variable.
In this example, the XPM image depends on the WScreen. This is the
current behaviour.
What's happend if the user changes the Display/Screen? wmaker must
restart, reload files again, and re-do all again.
With the new code:
1st: We create the Dock icon. To create the Dock icon, we use
RLoadImage to read the XPM from disk. The image is not yet created
(fully, only the screen independent work). We don't need the WScreen
variable. The Dock struct is created in memory, not painted!
2nd: We create the workspace and the WScreen. Then, we need paint the
Dock. Then, we call RDrawImage.
If we add, remove or change the display/screen, no problem. We only
need do the 2nd part of the code. We don't need re-read the images
from disk.
kix.
Rodolfo García Peñas (kix)
http://www.kix.es/
--
To unsubscribe, send mail to [email protected].