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  254c00ba6f95362487369a2453b8bc88fc6bd117 (commit)
       via  a5eb4910e45d54140c41ee752943da48390e900b (commit)
      from  b6ced4fa5d291b94eb10170860fd8e22dc29c157 (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/254c00ba6f95362487369a2453b8bc88fc6bd117

commit 254c00ba6f95362487369a2453b8bc88fc6bd117
Author: Carlos R. Mafra <[email protected]>
Date:   Sat Jun 23 17:32:42 2012 +0100

    Address 'may be used uninitialized' warnings
    
    Making all in src
      CC     actions.o
    actions.c: In function ‘wMaximizeWindow’:
    actions.c:421:14: warning: ‘maximus_height’ may be used uninitialized 
in this function [-Wuninitialized]
    actions.c:440:29: warning: ‘maximus_width’ may be used uninitialized in 
this function [-Wuninitialized]
    actions.c:442:35: warning: ‘maximus_y’ may be used uninitialized in 
this function [-Wuninitialized]
    actions.c:454:18: warning: ‘maximus_x’ may be used uninitialized in 
this function [-Wuninitialized]
      CCLD   wmaker
    
    These warnings were harmless because they were at a point where
    find_Maximus_geometry() had already been called. So let's simply initialize
    them to zero to silence gcc.

diff --git a/src/actions.c b/src/actions.c
index fed1c1e..9617fb5 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -317,8 +317,10 @@ void wMaximizeWindow(WWindow *wwin, int directions)
 {
        int new_x, new_y;
        unsigned int new_width, new_height, half_scr_width;
-       int maximus_x, maximus_y;
-       unsigned int maximus_width, maximus_height;
+       int maximus_x = 0;
+       int maximus_y = 0;
+       unsigned int maximus_width = 0;
+       unsigned int maximus_height = 0;
        WArea usableArea, totalArea;
        Bool has_border = 1;
        int save_directions = 0;

http://repo.or.cz/w/wmaker-crm.git/commit/a5eb4910e45d54140c41ee752943da48390e900b

commit a5eb4910e45d54140c41ee752943da48390e900b
Author: Rodolfo García Peñas (kix) <[email protected]>
Date:   Sat Jun 23 13:05:30 2012 +0200

    Remove code duplication in winmenu.c
    
    There are some code duplication in winmenu.c. Two new functions,
    
    - open_window_menu_core
    - prepare_menu_position
    
    Join the common code and then the duplicated code can be removed.

diff --git a/src/winmenu.c b/src/winmenu.c
index ef97126..c967164 100644
--- a/src/winmenu.c
+++ b/src/winmenu.c
@@ -576,11 +576,10 @@ static void updateMenuForWindow(WMenu * menu, WWindow * 
wwin)
        wMenuRealize(menu);
 }
 
-void OpenWindowMenu(WWindow * wwin, int x, int y, int keyboard)
+static WMenu *open_window_menu_core(WWindow *wwin, int x, int y)
 {
-       WMenu *menu;
        WScreen *scr = wwin->screen_ptr;
-       WMRect rect;
+       WMenu *menu;
 
        wwin->flags.menu_open_for_me = 1;
 
@@ -598,18 +597,18 @@ void OpenWindowMenu(WWindow * wwin, int x, int y, int 
keyboard)
        menu = scr->window_menu;
        if (menu->flags.mapped) {
                wMenuUnmap(menu);
-               if (menu->entries[0]->clientdata == wwin) {
-                       return;
-               }
+               if (menu->entries[0]->clientdata == wwin)
+                       return NULL;
        }
 
        updateMenuForWindow(menu, wwin);
 
-       x -= menu->frame->core->width / 2;
-       if (x + menu->frame->core->width > wwin->frame_x + 
wwin->frame->core->width)
-               x = wwin->frame_x + wwin->frame->core->width - 
menu->frame->core->width;
-       if (x < wwin->frame_x)
-               x = wwin->frame_x;
+       return menu;
+}
+
+static void prepare_menu_position(WMenu *menu, int x, int y)
+{
+       WMRect rect;
 
        rect = wGetRectForHead(menu->frame->screen_ptr,
                               
wGetHeadForPointerLocation(menu->frame->screen_ptr));
@@ -617,6 +616,25 @@ void OpenWindowMenu(WWindow * wwin, int x, int y, int 
keyboard)
                x = rect.pos.x - menu->frame->core->width / 2;
        if (y < rect.pos.y)
                y = rect.pos.y;
+}
+
+void OpenWindowMenu(WWindow *wwin, int x, int y, int keyboard)
+{
+       WMenu *menu;
+
+       menu = open_window_menu_core(wwin, x, y);
+       if (!menu)
+               return;
+
+       /* Specific menu position */
+       x -= menu->frame->core->width / 2;
+       if (x + menu->frame->core->width > wwin->frame_x + 
wwin->frame->core->width)
+               x = wwin->frame_x + wwin->frame->core->width - 
menu->frame->core->width;
+       if (x < wwin->frame_x)
+               x = wwin->frame_x;
+
+       /* Common menu position */
+       prepare_menu_position(menu, x, y);
 
        if (!wwin->flags.internal_window)
                wMenuMapAt(menu, x, y, keyboard);
@@ -627,31 +645,12 @@ void OpenWindowMenu2(WWindow *wwin, int x, int y, int 
keyboard)
        int i;
        WMenu *menu;
        WScreen *scr = wwin->screen_ptr;
-       WMRect rect;
-
-       wwin->flags.menu_open_for_me = 1;
 
-       if (!scr->window_menu) {
-               scr->window_menu = createWindowMenu(scr);
-
-               /* hack to save some memory allocation/deallocation */
-               wfree(scr->window_menu->entries[MC_MINIATURIZE]->text);
-               wfree(scr->window_menu->entries[MC_MAXIMIZE]->text);
-               wfree(scr->window_menu->entries[MC_SHADE]->text);
-       } else {
-               updateWorkspaceMenu(scr->workspace_submenu);
-       }
-
-       menu = scr->window_menu;
-       if (menu->flags.mapped) {
-               wMenuUnmap(menu);
-               if (menu->entries[0]->clientdata == wwin) {
-                       return;
-               }
-       }
-
-       updateMenuForWindow(menu, wwin);
+       menu = open_window_menu_core(wwin, x, y);
+       if (!menu)
+               return;
 
+       /* Specific menu position */
        for (i = 0; i < scr->workspace_submenu->entry_no; i++) {
                scr->workspace_submenu->entries[i]->clientdata = wwin;
                wMenuSetEnabled(scr->workspace_submenu, i, True);
@@ -659,12 +658,8 @@ void OpenWindowMenu2(WWindow *wwin, int x, int y, int 
keyboard)
 
        x -= menu->frame->core->width / 2;
 
-       rect = wGetRectForHead(menu->frame->screen_ptr,
-                              
wGetHeadForPointerLocation(menu->frame->screen_ptr));
-       if (x < rect.pos.x - menu->frame->core->width / 2)
-               x = rect.pos.x - menu->frame->core->width / 2;
-       if (y < rect.pos.y)
-               y = rect.pos.y;
+       /* Common menu position */
+       prepare_menu_position(menu, x, y);
 
        if (!wwin->flags.internal_window)
                wMenuMapAt(menu, x, y, keyboard);
@@ -673,30 +668,10 @@ void OpenWindowMenu2(WWindow *wwin, int x, int y, int 
keyboard)
 void OpenMiniwindowMenu(WWindow * wwin, int x, int y)
 {
        WMenu *menu;
-       WScreen *scr = wwin->screen_ptr;
-
-       wwin->flags.menu_open_for_me = 1;
 
-       if (!scr->window_menu) {
-               scr->window_menu = createWindowMenu(scr);
-
-               /* hack to save some memory allocation/deallocation */
-               wfree(scr->window_menu->entries[MC_MINIATURIZE]->text);
-               wfree(scr->window_menu->entries[MC_MAXIMIZE]->text);
-               wfree(scr->window_menu->entries[MC_SHADE]->text);
-       } else {
-               updateWorkspaceMenu(scr->workspace_submenu);
-       }
-
-       menu = scr->window_menu;
-       if (menu->flags.mapped) {
-               wMenuUnmap(menu);
-               if (menu->entries[0]->clientdata == wwin) {
-                       return;
-               }
-       }
-
-       updateMenuForWindow(menu, wwin);
+       menu = open_window_menu_core(wwin, x, y);
+       if (!menu)
+               return;
 
        x -= menu->frame->core->width / 2;
 

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

Summary of changes:
 src/actions.c |    6 ++-
 src/winmenu.c |  101 +++++++++++++++++++++-----------------------------------
 2 files changed, 42 insertions(+), 65 deletions(-)


repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


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

Reply via email to