mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Introduce a mechanism by which calls to midend_supersede_game_desc()
can trigger a call to a front end notification function. Use this to update the game ID permalink when Mines supersedes its game ID. [originally from svn r9793]
This commit is contained in:
11
midend.c
11
midend.c
@ -81,6 +81,9 @@ struct midend {
|
||||
int pressed_mouse_button;
|
||||
|
||||
int preferred_tilesize, tilesize, winwidth, winheight;
|
||||
|
||||
void (*game_desc_change_notify_function)(void *);
|
||||
void *game_desc_change_notify_ctx;
|
||||
};
|
||||
|
||||
#define ensure(me) do { \
|
||||
@ -1079,12 +1082,20 @@ int midend_wants_statusbar(midend *me)
|
||||
return me->ourgame->wants_statusbar;
|
||||
}
|
||||
|
||||
void midend_request_desc_changes(midend *me, void (*notify)(void *), void *ctx)
|
||||
{
|
||||
me->game_desc_change_notify_function = notify;
|
||||
me->game_desc_change_notify_ctx = ctx;
|
||||
}
|
||||
|
||||
void midend_supersede_game_desc(midend *me, char *desc, char *privdesc)
|
||||
{
|
||||
sfree(me->desc);
|
||||
sfree(me->privdesc);
|
||||
me->desc = dupstr(desc);
|
||||
me->privdesc = privdesc ? dupstr(privdesc) : NULL;
|
||||
if (me->game_desc_change_notify_function)
|
||||
me->game_desc_change_notify_function(me->game_desc_change_notify_ctx);
|
||||
}
|
||||
|
||||
config_item *midend_get_config(midend *me, int which, char **wintitle)
|
||||
|
Reference in New Issue
Block a user