This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  238b8ed3ca301ee027e11fe5b7dbd3627d61f265 (commit)
      from  adebdf41c6ff33648fd884599e35b20a448500cc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/238b8ed3ca301ee027e11fe5b7dbd3627d61f265

commit 238b8ed3ca301ee027e11fe5b7dbd3627d61f265
Author: David Maciejak <david.macie...@gmail.com>
Date:   Sun Aug 24 08:55:59 2014 +0800

    WINGs: merge duplicate code from wtext
    
    This patch is saving about 30 duplicate code lines from
    WMPrependTextBlock and WMAppendTextBlock to create
    a static fct called prepareTextBlock.

diff --git a/WINGs/wtext.c b/WINGs/wtext.c
index 734dc8bc..5981de38 100644
--- a/WINGs/wtext.c
+++ b/WINGs/wtext.c
@@ -3322,13 +3322,8 @@ WMGetTextBlockProperties(WMText * tPtr, void *vtb, 
unsigned int *first,
                *margins = tPtr->margins[tb->marginN];
 }
 
-void WMPrependTextBlock(WMText * tPtr, void *vtb)
+static int prepareTextBlock(WMText *tPtr, TextBlock *tb)
 {
-       TextBlock *tb = (TextBlock *) vtb;
-
-       if (!tb)
-               return;
-
        if (tb->graphic) {
                if (tb->object) {
                        WMWidget *w = tb->d.widget;
@@ -3348,13 +3343,24 @@ void WMPrependTextBlock(WMText * tPtr, void *vtb)
                tb->next = tb->prior = NULL;
                tb->first = True;
                tPtr->lastTextBlock = tPtr->firstTextBlock = 
tPtr->currentTextBlock = tb;
-               return;
+               return 0;
        }
 
        if (!tb->first) {
                tb->marginN = tPtr->currentTextBlock->marginN;
        }
 
+       return 1;
+}
+
+
+void WMPrependTextBlock(WMText *tPtr, void *vtb)
+{
+       TextBlock *tb = (TextBlock *) vtb;
+
+       if (!tb || !prepareTextBlock(tPtr, tb))
+               return;
+
        tb->next = tPtr->currentTextBlock;
        tb->prior = tPtr->currentTextBlock->prior;
        if (tPtr->currentTextBlock->prior)
@@ -3367,39 +3373,13 @@ void WMPrependTextBlock(WMText * tPtr, void *vtb)
        tPtr->currentTextBlock = tb;
 }
 
-void WMAppendTextBlock(WMText * tPtr, void *vtb)
+void WMAppendTextBlock(WMText *tPtr, void *vtb)
 {
        TextBlock *tb = (TextBlock *) vtb;
 
-       if (!tb)
+       if (!tb || !prepareTextBlock(tPtr, tb))
                return;
 
-       if (tb->graphic) {
-               if (tb->object) {
-                       WMWidget *w = tb->d.widget;
-                       if (W_CLASS(w) != WC_TextField && W_CLASS(w) != 
WC_Text) {
-                               (W_VIEW(w))->attribs.cursor = 
tPtr->view->screen->defaultCursor;
-                               (W_VIEW(w))->attribFlags |= CWOverrideRedirect 
| CWCursor;
-                       }
-               }
-               WMAddToArray(tPtr->gfxItems, (void *)tb);
-               tPtr->tpos = 1;
-
-       } else {
-               tPtr->tpos = tb->used;
-       }
-
-       if (!tPtr->lastTextBlock || !tPtr->firstTextBlock) {
-               tb->next = tb->prior = NULL;
-               tb->first = True;
-               tPtr->lastTextBlock = tPtr->firstTextBlock = 
tPtr->currentTextBlock = tb;
-               return;
-       }
-
-       if (!tb->first) {
-               tb->marginN = tPtr->currentTextBlock->marginN;
-       }
-
        tb->next = tPtr->currentTextBlock->next;
        tb->prior = tPtr->currentTextBlock;
        if (tPtr->currentTextBlock->next)

-----------------------------------------------------------------------

Summary of changes:
 WINGs/wtext.c |   50 +++++++++++++++-----------------------------------
 1 files changed, 15 insertions(+), 35 deletions(-)


repo.or.cz automatic notification. Contact project admin crma...@gmail.com
if you want to unsubscribe, or site admin ad...@repo.or.cz if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


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

Reply via email to