El 12.06.2012 00:57, Carlos R. Mafra escribió:
On Mon, 11 Jun 2012 at 23:28:01 +0200, Rodolfo kix Garcia wrote:

I did this experimental patch. I sent it compressed because I want
to explain it (using my poor english).

It's not a good idea to send compressed patches. Less people will see
it.

Yes, I know it. Sorry, but I don't want the developers spent a lot of time with the first patch. I want the developers understand the idea.

The idea of this patch is break the current icon creation. Now, when
a new aplication is launched, the function wApplicationCreate is
called, then it search an icon (extractIcon function), then check if
the application needs an icon (no_appicon set) and then create the
application icon, save it (again??) and paint it.

IMO this is an error. The application should create the icon
allways, then save it (if was not previously created), and then
check if the application needs appicon (no_appicon set) then paint
or not it.

I agree with you.

To do it, I created two patches. The first patch breaks the
dependency between create+paint an icon. Now, if we create an icon,
we call "wIconCreate". If we needs paint it, then calls
"paint_icon".

Your patch does not seem to quite match your description, you removed the
paint_icon() call from wIconUpdate() and added it right after
all 11 calls to wIconUpdate(). So it looks like this is related to
"update" and not "create".

Yes. This is because wIconUpdate is used in two cases:

1. When the icon is created (wIconCreate), we call wIconUpdate to finish the icon creation. Really is like wIconCreate is splitted in wIconCreate and wIconUpdate. 2. When the icon changes in X11. When the icon changes, then we call wIconUpdate. We don't need call wIconCreate, because the struct is created and only the icon could be modified.

But... really we need paint the icon? For example, we need paint the icon when is updated and no_appicon is set? IMO No. This is the reason because I did this change, probably we need tweak it a little the different cases and check if we need call always paint_icon.

But regardless of that, I think we should leave the paint_icon() call
inside wIconUpdate(). There is no downside and we avoid the repetition
(11 times!) of those lines right after wIconUpdate().

The second patch do the main work. The application is created, calls
to wApplicationCreate, create the icon, save it, check if no_appicon
is needed, then calls paint_appicon.

Now, the icon in the switchpanel shows the icon, always, and the
icon in the appicon is the the same icon.

The second patch is really nice! Especially the removal of extractIcon()
and the extra wAppIconSave().

But I did not understand why you still want to create the appicon
even if no_appicon is set. Isn't that a waste of energy? What am I
missing?

Yes. Reasons:

1. We remove extracIcon, but we need save the icon in CachedPixmaps because the icon can be used when we dock the application. Then we must create the icon, and then save it. 2. The appicon is used in three different parts of the code. As "appicon" (the app icon), as "miniwindow" (the icon when the application is minimized) and the icon in the switchpanel (alt + tab). The icon in the docks is icon saved in CachedPixmaps previously, but is the same icon than the other three cases. Now, with this code, the icon is created always. Is a waste of energy, no; because for example, if we create an application without appicon, we will still use the icon when we minimize the window, or if we make alt+tab. Why create the icon in that cases and then remove it. For example if I do "alt+tab" three times, the icon is created, updated, painted and removed three times!

This is the idea of these patches:

1. Create the icon ONE time in the code.
2. Update it when needed: When is created and if the icon changes in X11
3. Use the SAME icon in all parts of the code
4. Delete the icon only ONE time in the code.

We can remove more code with this idea, because wApplication->AppIcon always exists, for example the function addIconForWindow() in the switchpanel.c always will find the icon in wapp->appicon->icon, then it don't needs finds (and creates if not found) the image.

Best Regards,
kix

PS. Carlos, you get the Yast2 icon?
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to [email protected].

Reply via email to