Browse Source

Add WINDOWS_ICON_ID build macro, show msgbox on windows on error

Signed-off-by: falkTX <falktx@falktx.com>
pull/375/head
falkTX 3 years ago
parent
commit
ddf878c13a
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 34 additions and 3 deletions
  1. +4
    -0
      Makefile.base.mk
  2. +24
    -1
      dgl/src/pugl.cpp
  3. +6
    -2
      distrho/src/DistrhoPluginJACK.cpp

+ 4
- 0
Makefile.base.mk View File

@@ -444,6 +444,10 @@ ifeq ($(FILE_BROWSER_DISABLED),true)
BUILD_CXX_FLAGS += -DDGL_FILE_BROWSER_DISABLED
endif

ifneq ($(WINDOWS_ICON_ID),)
BUILD_CXX_FLAGS += -DDGL_WINDOWS_ICON_ID=$(WINDOWS_ICON_ID)
endif

ifeq ($(USE_OPENGL3),true)
BUILD_CXX_FLAGS += -DDGL_USE_OPENGL3
endif


+ 24
- 1
dgl/src/pugl.cpp View File

@@ -567,7 +567,30 @@ void puglWin32ShowCentered(PuglView* const view)
}
else
{
ShowWindow(impl->hwnd, SW_SHOWNORMAL);
#ifdef DGL_WINDOWS_ICON_ID
WNDCLASSEX wClass;
std::memset(&wClass, 0, sizeof(wClass));

const HINSTANCE hInstance = GetModuleHandle(nullptr);

if (GetClassInfoEx(hInstance, view->world->className, &wClass))
wClass.hIcon = LoadIcon(nullptr, MAKEINTRESOURCE(DGL_WINDOWS_ICON_ID));

SetClassLongPtr(impl->hwnd, GCLP_HICON, (LONG_PTR) LoadIcon(hInstance, MAKEINTRESOURCE(DGL_WINDOWS_ICON_ID)));
#endif

MONITORINFO mInfo;
std::memset(&mInfo, 0, sizeof(mInfo));
mInfo.cbSize = sizeof(mInfo);

if (GetMonitorInfo(MonitorFromWindow(impl->hwnd, MONITOR_DEFAULTTOPRIMARY), &mInfo))
SetWindowPos(impl->hwnd,
HWND_TOP,
mInfo.rcWork.left + (mInfo.rcWork.right - view->frame.width) / 2,
mInfo.rcWork.top + (mInfo.rcWork.bottom - view->frame.height) / 2,
0, 0, SWP_SHOWWINDOW|SWP_NOSIZE);
else
ShowWindow(impl->hwnd, SW_NORMAL);
}

SetFocus(impl->hwnd);


+ 6
- 2
distrho/src/DistrhoPluginJACK.cpp View File

@@ -944,11 +944,15 @@ int main(int argc, char* argv[])
if (errorString.isNotEmpty())
{
errorString[errorString.length()-2] = '.';
d_stderr("Failed to create jack client, reason was:\n%s", errorString.buffer());
d_stderr("Failed to create the JACK client, reason was:\n%s", errorString.buffer());
}
else
d_stderr("Failed to create jack client, cannot continue!");
d_stderr("Failed to create the JACK client, cannot continue!");

#if defined(DISTRHO_OS_WINDOWS) && DISTRHO_PLUGIN_HAS_UI
const String win32error = "Failed to create JACK client, reason was:\n" + errorString;
MessageBoxA(nullptr, win32error.buffer(), "", MB_ICONERROR);
#endif
return 1;
}



Loading…
Cancel
Save