On Thu, 04 Apr 2013, Daniel Déchelotte escribió: > > From: "Rodolfo García Peñas (kix)" <[email protected]> > > > > This patch creates the middle button menu when the Dock is created. > > Then, dock and clip have a similar behavior. Now the middle button > > is only used by the Clip. > > Sorry, I simply don't see the benefit for now.
:-) Then I did something wrong. The idea is that when you call create(clip) or create(dock), paint(clip), paint(dock), update(clip) or update(dock)... you can use the same functions. If one function do some things for one type, and others for other type, then we will have different functions. > -- Daniel > > > This patch change the function name for the main menu (right button) > > to have consistent names between functions. > > > > Signed-off-by: Rodolfo García Peñas (kix) <[email protected]> > > --- > > src/dock.c | 30 +++++++++++++++++++++++++----- > > src/dock.h | 3 ++- > > 2 files changed, 27 insertions(+), 6 deletions(-) > > > > diff --git a/src/dock.c b/src/dock.c > > index d4d25ce..09d2804 100644 > > --- a/src/dock.c > > +++ b/src/dock.c > > @@ -1040,7 +1040,7 @@ static WMenu *create_clip_main_menu(WScreen > > *scr) > > return menu; > > } > > > > -static WMenu *dockMenuCreate(WScreen *scr, int type) > > +static WMenu *create_main_menu(WScreen *scr, int type) > > { > > WMenu *menu = NULL; > > > > @@ -1062,6 +1062,28 @@ static WMenu *dockMenuCreate(WScreen *scr, int > > type) > > return menu; > > } > > > > +static WMenu *create_alt_menu(WScreen *scr, int type) > > +{ > > + WMenu *menu = NULL; > > + > > + switch (type) { > > + case WM_DOCK: > > + menu = NULL; > > + break; > > + case WM_CLIP: > > + if (scr->clip_ws_menu) { > > + /* If the common menu for Clips exists, use it */ > > + menu = scr->clip_ws_menu; > > + } else { > > + /* Else, create and save for other Clips */ > > + menu = wWorkspaceMenuMake(scr, False); > > + scr->clip_ws_menu = menu; > > + } > > + } > > + > > + return menu; > > +} > > + > > WDock *wDockCreate(WScreen *scr, int type) > > { > > WDock *dock; > > @@ -1098,7 +1120,8 @@ WDock *wDockCreate(WScreen *scr, int type) > > XMoveWindow(dpy, btn->icon->core->window, btn->x_pos, btn->y_pos); > > > > /* create dock menu */ > > - dock->menu = dockMenuCreate(scr, type); > > + dock->menu = create_main_menu(scr, type); > > + dock->alt_menu = create_alt_menu(scr, type); > > > > return dock; > > } > > @@ -3774,9 +3797,6 @@ static void iconMouseDown(WObjDescriptor *desc, > > XEvent *event) > > iconDblClick(desc, event); > > } > > } else if (event->xbutton.button == Button2 && dock->type == > > WM_CLIP && aicon == scr->clip_icon) { > > - if (!scr->clip_ws_menu) { > > - scr->clip_ws_menu = wWorkspaceMenuMake(scr, False); > > - } > > if (scr->clip_ws_menu) { > > WMenu *wsMenu = scr->clip_ws_menu; > > int xpos; > > diff --git a/src/dock.h b/src/dock.h > > index 47d963d..9ff0a98 100644 > > --- a/src/dock.h > > +++ b/src/dock.h > > @@ -57,7 +57,8 @@ typedef struct WDock { > > unsigned int lclip_button_pushed:1; > > unsigned int rclip_button_pushed:1; > > > > - struct WMenu *menu; > > + struct WMenu *menu; /* Main menu, right click */ > > + struct WMenu *alt_menu; /* Alt menu, middle click */ > > > > struct WDDomain *defaults; > > } WDock; > > -- > > 1.7.10.4 > > > > > > -- > > To unsubscribe, send mail to > > [email protected]. > > > > > -- > To unsubscribe, send mail to [email protected]. -- ||// //\\// Rodolfo "kix" Garcia ||\\// //\\ http://www.kix.es/ -- To unsubscribe, send mail to [email protected].
