mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 00:26:32 +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_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 struct KeybindHandle * KeybindHandle;
|
||||||
typedef void (*KeybindFn)(int sc, void * opaque);
|
typedef void (*KeybindFn)(int sc, void * opaque);
|
||||||
|
@ -637,14 +637,25 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
|
|||||||
va_end(args);
|
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_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
MsgBoxHandle handle =
|
||||||
overlayMsg_show(caption, fmt, args);
|
overlayMsg_show(caption, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
core_updateOverlayState();
|
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)
|
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
|
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "msg.h"
|
||||||
#include "interface/overlay.h"
|
#include "interface/overlay.h"
|
||||||
#include "cimgui.h"
|
#include "cimgui.h"
|
||||||
#include "overlay_utils.h"
|
#include "overlay_utils.h"
|
||||||
@ -148,7 +149,8 @@ bool overlayMsg_modal(void)
|
|||||||
return ll_count(l_msg.messages) > 0;
|
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));
|
struct Msg * msg = malloc(sizeof(*msg));
|
||||||
msg->caption = strdup(caption);
|
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);
|
ll_push(l_msg.messages, msg);
|
||||||
app_invalidateOverlay(false);
|
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
|
#define _H_OVERLAYS_H
|
||||||
|
|
||||||
#include "interface/overlay.h"
|
#include "interface/overlay.h"
|
||||||
|
#include "overlay/msg.h"
|
||||||
|
|
||||||
struct Overlay
|
struct Overlay
|
||||||
{
|
{
|
||||||
@ -41,9 +42,6 @@ extern struct LG_OverlayOps LGOverlayMsg;
|
|||||||
|
|
||||||
void overlayAlert_show(LG_MsgAlert type, const char * fmt, va_list args);
|
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,
|
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer,
|
||||||
float min, float max);
|
float min, float max);
|
||||||
void overlayGraph_unregister();
|
void overlayGraph_unregister();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user