On 2012-10-30 16:42, Carlos R. Mafra wrote:
First of all: thanks for doing this, Iain!

On Tue, 30 Oct 2012 at  5:29:46 +0000, Iain Patterson wrote:

Subject: [PATCH 1/3] AppIcon helper functions.

Create wAppIconFor() and wAppIconTouchesHead() to match wWindowFor()
and wWindowTouchesHead(). These functions will allow us to locate the
window and head associated with a particular app icon or dock icon.

+WAppIcon *wAppIconFor(Window window)
+{
+       WObjDescriptor *desc;
+
+       if (window == None)
+               return NULL;
+
+ if (XFindContext(dpy, window, wWinContext, (XPointer *) & desc) == XCNOENT)
+               return NULL;
+
+ if (desc->parent_type == WCLASS_APPICON || desc->parent_type == WCLASS_DOCK_ICON)
+               return desc->parent;
+
+       return NULL;
+}

Perhaps it's just me, but I can't really get what the function does
from just reading its name: wAppIconFor(). I'm no native speaker, but
the "For" suffix confuses me. I wonder if wAppIconOf() would be more
"correct" -- ignoring the CamelCase issue :-)

This is used in other functions. I don't have wmaker source here, but the prototype is something like:

wAppIconFor(WWindow *wwin)

then you can read it as:

AppIcon for wwindow :-)

I don't like these function names!

I am changing the camel case too, we can see the code modified :-)

CamelCase: "Original" code
no_camel_case: New code :-P

I think there is a better name which clearly states its purpose.
I'm bad in choosing names, though.

I have a lot of monkeys typing here ;-)

I guess that justifies having some comment on top of the function
to state its purpose? I know it's a small function, but I find it
nicer to have an overview of what the function is supposed to do
before reading it.

Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to