summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-07-03 16:55:00 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2016-07-03 16:55:00 +0100
commit65bf58e4a1999fca0de1279e143f714acc19fe8d (patch)
tree38a043b326bc531a8b8cecc0774a3c7e835eac71
parent313c48b8a15b6ebe683ceb8a995c62e2e0e97616 (diff)
downloadnetsurf-65bf58e4a1999fca0de1279e143f714acc19fe8d.tar.gz
netsurf-65bf58e4a1999fca0de1279e143f714acc19fe8d.tar.bz2
Remove ami_menu_toggle_checked global
-rw-r--r--frontends/amiga/gui.c3
-rwxr-xr-xfrontends/amiga/gui_options.c3
-rw-r--r--frontends/amiga/menu.c20
-rwxr-xr-xfrontends/amiga/menu.h14
4 files changed, 31 insertions, 9 deletions
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 4cfb39874..3806601ca 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -2556,9 +2556,8 @@ static void ami_handle_msg(void)
ami_menu_window_close = NULL;
}
- if(ami_menu_check_toggled) {
+ if(ami_menu_get_check_toggled() == true) {
ami_gui_menu_update_all();
- ami_menu_check_toggled = false;
}
}
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index 344d82309..21067fb40 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -2061,8 +2061,7 @@ static void ami_gui_opts_use(bool save)
ami_font_savescanner(); /* just in case it has changed and been used only */
}
- ami_menu_check_toggled = true;
-
+ ami_menu_set_check_toggled();
ami_update_pointer(gow->win, GUI_POINTER_DEFAULT);
}
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 58ea27e1e..e7b4c6d18 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -88,8 +88,8 @@ enum {
};
struct gui_window_2 *ami_menu_window_close = NULL;
-bool ami_menu_check_toggled = false;
+static bool ami_menu_check_toggled = false;
static BOOL menualreadyinit;
static Object *menu_glyph[NSA_GLYPH_MAX];
static int menu_glyph_width[NSA_GLYPH_MAX];
@@ -101,6 +101,18 @@ const char * const verdate;
static nserror ami_menu_scan(struct tree *tree, struct gui_window_2 *gwin);
void ami_menu_arexx_scan(struct gui_window_2 *gwin);
+void ami_menu_set_check_toggled(void)
+{
+ ami_menu_check_toggled = true;
+}
+
+bool ami_menu_get_check_toggled(void)
+{
+ bool check_toggled = ami_menu_check_toggled;
+ ami_menu_check_toggled = false;
+ return check_toggled;
+}
+
/*
* The below functions are called automatically by window.class when menu items are selected.
*/
@@ -354,7 +366,7 @@ HOOKF(void, ami_menu_item_browser_foreimg, APTR, window, struct IntuiMessage *)
if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
nsoption_set_bool(foreground_images, checked);
- ami_menu_check_toggled = true;
+ ami_menu_set_check_toggled();
}
HOOKF(void, ami_menu_item_browser_backimg, APTR, window, struct IntuiMessage *)
@@ -366,7 +378,7 @@ HOOKF(void, ami_menu_item_browser_backimg, APTR, window, struct IntuiMessage *)
if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
nsoption_set_bool(background_images, checked);
- ami_menu_check_toggled = true;
+ ami_menu_set_check_toggled();
}
HOOKF(void, ami_menu_item_browser_enablejs, APTR, window, struct IntuiMessage *)
@@ -378,7 +390,7 @@ HOOKF(void, ami_menu_item_browser_enablejs, APTR, window, struct IntuiMessage *)
if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
nsoption_set_bool(enable_javascript, checked);
- ami_menu_check_toggled = true;
+ ami_menu_set_check_toggled();
}
HOOKF(void, ami_menu_item_browser_scale_decrease, APTR, window, struct IntuiMessage *)
diff --git a/frontends/amiga/menu.h b/frontends/amiga/menu.h
index 22e998439..91077b662 100755
--- a/frontends/amiga/menu.h
+++ b/frontends/amiga/menu.h
@@ -136,7 +136,6 @@ struct gui_window;
struct gui_window_2;
extern struct gui_window_2 *ami_menu_window_close;
-extern bool ami_menu_check_toggled;
void ami_free_menulabs(struct gui_window_2 *gwin);
struct Menu *ami_menu_create(struct gui_window_2 *gwin);
@@ -146,5 +145,18 @@ void ami_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c);
void ami_menu_free_glyphs(void);
void ami_menu_free(struct gui_window_2 *gwin);
+/**
+ * Sets that an item linked to a toggle menu item has been changed.
+ */
+void ami_menu_set_check_toggled(void);
+
+/**
+ * Gets if the menu needs updating because an item linked
+ * to a toggle menu item has been changed.
+ * NB: This also *clears* the state
+ *
+ * \return true if the menus need refreshing
+ */
+bool ami_menu_get_check_toggled(void);
#endif