From df5c18315ff13e215f661eacd2d81e3c0a758e57 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 8 May 2019 17:29:14 +0100 Subject: Pass ptr to clicktab var instead of func calls --- frontends/amiga/ctxmenu.c | 8 ++++---- frontends/amiga/ctxmenu.h | 5 +++-- frontends/amiga/gui.c | 2 +- frontends/amiga/gui.h | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'frontends') diff --git a/frontends/amiga/ctxmenu.c b/frontends/amiga/ctxmenu.c index e9ab0e6b4..92f399fe6 100644 --- a/frontends/amiga/ctxmenu.c +++ b/frontends/amiga/ctxmenu.c @@ -586,13 +586,13 @@ struct Menu *ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin **************************/ /** Exported interface documented in ctxmenu.h **/ -struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin) +struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin, Object **clicktab_obj) { Object *root_menu; Object *clicktab; - if(ami_gui2_get_ctxmenu_clicktab(gwin) != NULL) { - return (struct Menu *)ami_gui2_get_ctxmenu_clicktab(gwin); + if(*clicktab_obj != NULL) { + return (struct Menu *)*clicktab_obj; } clicktab = MStrip, @@ -604,7 +604,7 @@ struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin) MEnd, MEnd; - ami_gui2_set_ctxmenu_clicktab(gwin, clicktab); + *clicktab_obj = clicktab; ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_TABNEW, gwin); ami_ctxmenu_add_item(root_menu, AMI_CTX_ID_TABCLOSE_OTHER, gwin); diff --git a/frontends/amiga/ctxmenu.h b/frontends/amiga/ctxmenu.h index 08a5fe582..39a838702 100644 --- a/frontends/amiga/ctxmenu.h +++ b/frontends/amiga/ctxmenu.h @@ -75,10 +75,11 @@ struct Menu *ami_ctxmenu_history_create(int direction, struct gui_window_2 *gwin * Create ClickTab context menu * * \param gwin struct gui_window_2 * - * \returns pointer to menu (for convenience, is also stored in gwin structure) + * \param clicktab_obj ptr to memory to hold clicktab menu object + * \returns pointer to menu (for convenience) * The returned pointer MUST be disposed of with DisposeObject before program exit. */ -struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin); +struct Menu *ami_ctxmenu_clicktab_create(struct gui_window_2 *gwin, Object **clicktab_obj); #else //__amigaos4__ inline void ami_ctxmenu_init(void) {} diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 9832b1d26..1671e9db5 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -3660,7 +3660,7 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show) GA_ID, GID_TABS, GA_RelVerify, TRUE, GA_Underscore, 13, // disable kb shortcuts - GA_ContextMenu, ami_ctxmenu_clicktab_create(gwin), + GA_ContextMenu, ami_ctxmenu_clicktab_create(gwin, &gwin->clicktab_ctxmenu), CLICKTAB_Labels, &gwin->tab_list, CLICKTAB_LabelTruncate, TRUE, CLICKTAB_CloseImage, gwin->objects[GID_CLOSETAB_BM], diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h index f45d22e22..e3f0f4330 100644 --- a/frontends/amiga/gui.h +++ b/frontends/amiga/gui.h @@ -152,7 +152,7 @@ struct gui_window_2 { struct Hook throbber_hook; struct Hook *ctxmenu_hook; Object *restrict history_ctxmenu[2]; - Object *restrict clicktab_ctxmenu; + Object *clicktab_ctxmenu; gui_drag_type drag_op; struct IBox *ptr_lock; struct AppWindow *appwin; -- cgit v1.2.3