mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[client] overlay/msg: provide a method to close messages from code
This commit is contained in:
parent
ced952a4c6
commit
6fc0c69b2e
@ -134,7 +134,9 @@ void app_clipboardRequest(const LG_ClipboardReplyFn replyFn, void * opaque);
|
||||
*/
|
||||
void app_alert(LG_MsgAlert type, const char * fmt, ...);
|
||||
|
||||
void app_msgBox(const char * caption, const char * fmt, ...);
|
||||
typedef void * MsgBoxHandle;
|
||||
MsgBoxHandle app_msgBox(const char * caption, const char * fmt, ...);
|
||||
void app_msgBoxClose(MsgBoxHandle * handle);
|
||||
|
||||
typedef struct KeybindHandle * KeybindHandle;
|
||||
typedef void (*KeybindFn)(int sc, void * opaque);
|
||||
|
@ -637,14 +637,25 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void app_msgBox(const char * caption, const char * fmt, ...)
|
||||
MsgBoxHandle app_msgBox(const char * caption, const char * fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
overlayMsg_show(caption, fmt, args);
|
||||
MsgBoxHandle handle =
|
||||
overlayMsg_show(caption, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
core_updateOverlayState();
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
void app_msgBoxClose(MsgBoxHandle * handle)
|
||||
{
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
overlayMsg_close(handle);
|
||||
}
|
||||
|
||||
KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, const char * description)
|
||||
|
@ -18,6 +18,7 @@
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "msg.h"
|
||||
#include "interface/overlay.h"
|
||||
#include "cimgui.h"
|
||||
#include "overlay_utils.h"
|
||||
@ -148,7 +149,8 @@ bool overlayMsg_modal(void)
|
||||
return ll_count(l_msg.messages) > 0;
|
||||
}
|
||||
|
||||
void overlayMsg_show(const char * caption, const char * fmt, va_list args)
|
||||
MsgBoxHandle overlayMsg_show(
|
||||
const char * caption, const char * fmt, va_list args)
|
||||
{
|
||||
struct Msg * msg = malloc(sizeof(*msg));
|
||||
msg->caption = strdup(caption);
|
||||
@ -174,4 +176,12 @@ void overlayMsg_show(const char * caption, const char * fmt, va_list args)
|
||||
|
||||
ll_push(l_msg.messages, msg);
|
||||
app_invalidateOverlay(false);
|
||||
|
||||
return (MsgBoxHandle)msg;
|
||||
}
|
||||
|
||||
void overlayMsg_close(MsgBoxHandle * handle)
|
||||
{
|
||||
if (ll_removeData(l_msg.messages, handle))
|
||||
freeMsg((struct Msg *)handle);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#define _H_OVERLAYS_H
|
||||
|
||||
#include "interface/overlay.h"
|
||||
#include "overlay/msg.h"
|
||||
|
||||
struct Overlay
|
||||
{
|
||||
@ -41,9 +42,6 @@ extern struct LG_OverlayOps LGOverlayMsg;
|
||||
|
||||
void overlayAlert_show(LG_MsgAlert type, const char * fmt, va_list args);
|
||||
|
||||
bool overlayMsg_modal(void);
|
||||
void overlayMsg_show(const char * caption, const char * fmt, va_list args);
|
||||
|
||||
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer,
|
||||
float min, float max);
|
||||
void overlayGraph_unregister();
|
||||
|
Loading…
Reference in New Issue
Block a user