MCPcopy Create free account
hub / github.com/cppla/ServerStatus / gui_messagebox

Function gui_messagebox

server/src/system.c:1783–1823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1781}
1782
1783void gui_messagebox(const char *title, const char *message)
1784{
1785#if defined(CONF_PLATFORM_MACOSX)
1786 DialogRef theItem;
1787 DialogItemIndex itemIndex;
1788
1789 /* FIXME: really needed? can we rely on glfw? */
1790 /* HACK - get events without a bundle */
1791 ProcessSerialNumber psn;
1792 GetCurrentProcess(&psn);
1793 TransformProcessType(&psn,kProcessTransformToForegroundApplication);
1794 SetFrontProcess(&psn);
1795 /* END HACK */
1796
1797 CreateStandardAlert(kAlertStopAlert,
1798 CFStringCreateWithCString(NULL, title, kCFStringEncodingASCII),
1799 CFStringCreateWithCString(NULL, message, kCFStringEncodingASCII),
1800 NULL,
1801 &theItem);
1802
1803 RunStandardAlert(theItem, NULL, &itemIndex);
1804#elif defined(CONF_FAMILY_UNIX)
1805 static char cmd[1024];
1806 int err;
1807 /* use xmessage which is available on nearly every X11 system */
1808 snprintf(cmd, sizeof(cmd), "xmessage -center -title '%s' '%s'",
1809 title,
1810 message);
1811
1812 err = system(cmd);
1813 dbg_msg("gui/msgbox", "result = %i", err);
1814#elif defined(CONF_FAMILY_WINDOWS)
1815 MessageBox(NULL,
1816 message,
1817 title,
1818 MB_ICONEXCLAMATION | MB_OK);
1819#else
1820 /* this is not critical */
1821 #warning not implemented
1822#endif
1823}
1824
1825int str_isspace(char c) { return c == ' ' || c == '\n' || c == '\t'; }
1826

Callers

nothing calls this directly

Calls 1

dbg_msgFunction · 0.85

Tested by

no test coverage detected