GPU: show more descriptive labels on unsupported GPU dialog
Thanks to Ray Molenkamp for the help with the Windows implementation. Fixes T70521 Differential Revision: https://developer.blender.org/D6023
This commit is contained in:
@@ -112,7 +112,7 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
|||||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
|
||||||
|
|
||||||
list(APPEND PLATFORM_LINKLIBS
|
list(APPEND PLATFORM_LINKLIBS
|
||||||
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32
|
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32
|
||||||
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp
|
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -70,6 +70,8 @@ extern GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle);
|
|||||||
* \param systemhandle The handle to the system
|
* \param systemhandle The handle to the system
|
||||||
* \param title Title of the message box
|
* \param title Title of the message box
|
||||||
* \param message Message of the message box
|
* \param message Message of the message box
|
||||||
|
* \param help_label Text to show on the help button that opens a link
|
||||||
|
* \param continue_label Text to show on the ok button that continues
|
||||||
* \param link Optional (hyper)link to a webpage to show when pressing help
|
* \param link Optional (hyper)link to a webpage to show when pressing help
|
||||||
* \param dialog_options Options to configure the message box.
|
* \param dialog_options Options to configure the message box.
|
||||||
* \return void.
|
* \return void.
|
||||||
@@ -77,6 +79,8 @@ extern GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle);
|
|||||||
extern void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
|
extern void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
|
||||||
const char *title,
|
const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
|
const char *help_label,
|
||||||
|
const char *continue_label,
|
||||||
const char *link,
|
const char *link,
|
||||||
GHOST_DialogOptions dialog_options);
|
GHOST_DialogOptions dialog_options);
|
||||||
|
|
||||||
|
@@ -446,11 +446,15 @@ class GHOST_ISystem {
|
|||||||
*
|
*
|
||||||
* \param title The title of the message box
|
* \param title The title of the message box
|
||||||
* \param message The message to display
|
* \param message The message to display
|
||||||
|
* \param help_label Help button label
|
||||||
|
* \param continue_label Continue button label
|
||||||
* \param link An optional hyperlink
|
* \param link An optional hyperlink
|
||||||
* \param dialog_options Options how to display the message
|
* \param dialog_options Options how to display the message
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess showMessageBox(const char * /*title*/,
|
virtual GHOST_TSuccess showMessageBox(const char * /*title*/,
|
||||||
const char * /*message*/,
|
const char * /*message*/,
|
||||||
|
const char * /*help_label*/,
|
||||||
|
const char * /*continue_label*/,
|
||||||
const char * /*link*/,
|
const char * /*link*/,
|
||||||
GHOST_DialogOptions /*dialog_options*/) const = 0;
|
GHOST_DialogOptions /*dialog_options*/) const = 0;
|
||||||
|
|
||||||
|
@@ -50,11 +50,13 @@ GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
|
|||||||
void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
|
void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
|
||||||
const char *title,
|
const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
|
const char *help_label,
|
||||||
|
const char *continue_label,
|
||||||
const char *link,
|
const char *link,
|
||||||
GHOST_DialogOptions dialog_options)
|
GHOST_DialogOptions dialog_options)
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||||
system->showMessageBox(title, message, link, dialog_options);
|
system->showMessageBox(title, message, help_label, continue_label, link, dialog_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
|
GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
|
||||||
|
@@ -313,11 +313,15 @@ class GHOST_System : public GHOST_ISystem {
|
|||||||
* Show a system message box
|
* Show a system message box
|
||||||
* \param title The title of the message box
|
* \param title The title of the message box
|
||||||
* \param message The message to display
|
* \param message The message to display
|
||||||
|
* \param help_label Help button label
|
||||||
|
* \param continue_label Continue button label
|
||||||
* \param link An optional hyperlink
|
* \param link An optional hyperlink
|
||||||
* \param dialog_options Options how to display the message
|
* \param dialog_options Options how to display the message
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess showMessageBox(const char * /*title*/,
|
virtual GHOST_TSuccess showMessageBox(const char * /*title*/,
|
||||||
const char * /*message*/,
|
const char * /*message*/,
|
||||||
|
const char * /*help_label */,
|
||||||
|
const char * /*continue_label */,
|
||||||
const char * /*link*/,
|
const char * /*link*/,
|
||||||
GHOST_DialogOptions /*dialog_options*/) const
|
GHOST_DialogOptions /*dialog_options*/) const
|
||||||
{
|
{
|
||||||
|
@@ -28,6 +28,13 @@
|
|||||||
# define _WIN32_IE 0x0501 /* shipped before XP, so doesn't impose additional requirements */
|
# define _WIN32_IE 0x0501 /* shipped before XP, so doesn't impose additional requirements */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
|
#pragma comment(linker,"\"/manifestdependency:type='win32' \
|
||||||
|
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
|
||||||
|
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
|
#include <commctrl.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <tlhelp32.h>
|
#include <tlhelp32.h>
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
@@ -35,6 +42,7 @@
|
|||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
#include "utfconv.h"
|
#include "utfconv.h"
|
||||||
|
#include "utf_winfunc.h"
|
||||||
|
|
||||||
#include "GHOST_DisplayManagerWin32.h"
|
#include "GHOST_DisplayManagerWin32.h"
|
||||||
#include "GHOST_EventButton.h"
|
#include "GHOST_EventButton.h"
|
||||||
@@ -511,6 +519,7 @@ GHOST_TSuccess GHOST_SystemWin32::getButtons(GHOST_Buttons &buttons) const
|
|||||||
GHOST_TSuccess GHOST_SystemWin32::init()
|
GHOST_TSuccess GHOST_SystemWin32::init()
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_System::init();
|
GHOST_TSuccess success = GHOST_System::init();
|
||||||
|
InitCommonControls();
|
||||||
|
|
||||||
/* Disable scaling on high DPI displays on Vista */
|
/* Disable scaling on high DPI displays on Vista */
|
||||||
HMODULE
|
HMODULE
|
||||||
@@ -1773,41 +1782,51 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
|||||||
|
|
||||||
/** \name Message Box
|
/** \name Message Box
|
||||||
* \{ */
|
* \{ */
|
||||||
static const char *MESSAGE_BOX_HELP_LINK_PTR = NULL;
|
|
||||||
VOID CALLBACK showMessageBoxCallBack(LPHELPINFO lpHelpInfo)
|
|
||||||
{
|
|
||||||
if (MESSAGE_BOX_HELP_LINK_PTR) {
|
|
||||||
ShellExecute(NULL, "open", MESSAGE_BOX_HELP_LINK_PTR, NULL, NULL, SW_SHOWNORMAL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SystemWin32::showMessageBox(const char *title,
|
GHOST_TSuccess GHOST_SystemWin32::showMessageBox(const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
|
const char *help_label,
|
||||||
|
const char *continue_label,
|
||||||
const char *link,
|
const char *link,
|
||||||
GHOST_DialogOptions dialog_options) const
|
GHOST_DialogOptions dialog_options) const
|
||||||
{
|
{
|
||||||
uint style = MB_OK |
|
const wchar_t *title_16 = alloc_utf16_from_8(title, 0);
|
||||||
(dialog_options & GHOST_DialogError ?
|
const wchar_t *message_16 = alloc_utf16_from_8(message, 0);
|
||||||
MB_ICONERROR :
|
const wchar_t *help_label_16 = alloc_utf16_from_8(help_label, 0);
|
||||||
dialog_options & GHOST_DialogWarning ? MB_ICONWARNING : MB_ICONINFORMATION);
|
const wchar_t *continue_label_16 = alloc_utf16_from_8(continue_label, 0);
|
||||||
bool show_help = link && strlen(link);
|
|
||||||
if (show_help) {
|
int nButtonPressed = 0;
|
||||||
GHOST_ASSERT(MESSAGE_BOX_HELP_LINK_PTR == NULL,
|
TASKDIALOGCONFIG config = {0};
|
||||||
"showMessageBox: MESSAGE_BOX_HELP_LINK_PTR is in use");
|
const TASKDIALOG_BUTTON buttons[] = {{IDOK, help_label_16}, {IDCONTINUE, continue_label_16}};
|
||||||
style |= MB_HELP;
|
|
||||||
MESSAGE_BOX_HELP_LINK_PTR = link;
|
config.cbSize = sizeof(config);
|
||||||
|
config.hInstance = 0;
|
||||||
|
config.dwCommonButtons = 0;
|
||||||
|
config.pszMainIcon = (dialog_options & GHOST_DialogError ?
|
||||||
|
TD_ERROR_ICON :
|
||||||
|
dialog_options & GHOST_DialogWarning ? TD_WARNING_ICON :
|
||||||
|
TD_INFORMATION_ICON);
|
||||||
|
config.pszWindowTitle = L"Blender";
|
||||||
|
config.pszMainInstruction = title_16;
|
||||||
|
config.pszContent = message_16;
|
||||||
|
config.pButtons = (link) ? buttons : buttons + 1;
|
||||||
|
config.cButtons = (link) ? 2 : 1;
|
||||||
|
|
||||||
|
TaskDialogIndirect(&config, &nButtonPressed, NULL, NULL);
|
||||||
|
switch (nButtonPressed) {
|
||||||
|
case IDOK:
|
||||||
|
ShellExecute(NULL, "open", link, NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
break;
|
||||||
|
case IDCONTINUE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break; // should never happen
|
||||||
}
|
}
|
||||||
|
|
||||||
MSGBOXPARAMSA message_box_params = {0};
|
free((void *)title_16);
|
||||||
message_box_params.cbSize = sizeof(MSGBOXCALLBACK);
|
free((void *)message_16);
|
||||||
message_box_params.lpszText = message;
|
free((void *)help_label_16);
|
||||||
message_box_params.lpszCaption = title;
|
free((void *)continue_label_16);
|
||||||
message_box_params.dwStyle = style;
|
|
||||||
message_box_params.lpszText = message;
|
|
||||||
message_box_params.lpfnMsgBoxCallback = showMessageBoxCallBack;
|
|
||||||
|
|
||||||
MessageBoxIndirectA(&message_box_params);
|
|
||||||
MESSAGE_BOX_HELP_LINK_PTR = NULL;
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
/* \} */
|
/* \} */
|
||||||
|
@@ -29,9 +29,6 @@
|
|||||||
# error WIN32 only!
|
# error WIN32 only!
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
/* require Windows XP or newer */
|
|
||||||
#undef _WIN32_WINNT
|
|
||||||
#define _WIN32_WINNT 0x501
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -208,11 +205,15 @@ class GHOST_SystemWin32 : public GHOST_System {
|
|||||||
* Show a system message box
|
* Show a system message box
|
||||||
* \param title The title of the message box
|
* \param title The title of the message box
|
||||||
* \param message The message to display
|
* \param message The message to display
|
||||||
|
* \param help_label Help button label
|
||||||
|
* \param continue_label Continue button label
|
||||||
* \param link An optional hyperlink
|
* \param link An optional hyperlink
|
||||||
* \param dialog_options Options how to display the message
|
* \param dialog_options Options how to display the message
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess showMessageBox(const char *title,
|
GHOST_TSuccess showMessageBox(const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
|
const char *help_label,
|
||||||
|
const char *continue_label,
|
||||||
const char *link,
|
const char *link,
|
||||||
GHOST_DialogOptions dialog_options) const;
|
GHOST_DialogOptions dialog_options) const;
|
||||||
|
|
||||||
|
@@ -2176,7 +2176,7 @@ class DialogData {
|
|||||||
height(175),
|
height(175),
|
||||||
padding_x(10),
|
padding_x(10),
|
||||||
padding_y(5),
|
padding_y(5),
|
||||||
button_width(50),
|
button_width(130),
|
||||||
button_height(24),
|
button_height(24),
|
||||||
button_inset_x(10),
|
button_inset_x(10),
|
||||||
button_border_size(1),
|
button_border_size(1),
|
||||||
@@ -2247,6 +2247,8 @@ static void split(const char *text, const char *seps, char ***str, int *count)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_SystemX11::showMessageBox(const char *title,
|
GHOST_TSuccess GHOST_SystemX11::showMessageBox(const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
|
const char *help_label,
|
||||||
|
const char *continue_label,
|
||||||
const char *link,
|
const char *link,
|
||||||
GHOST_DialogOptions) const
|
GHOST_DialogOptions) const
|
||||||
{
|
{
|
||||||
@@ -2325,20 +2327,24 @@ GHOST_TSuccess GHOST_SystemX11::showMessageBox(const char *title,
|
|||||||
text_splitted[i],
|
text_splitted[i],
|
||||||
(int)strlen(text_splitted[i]));
|
(int)strlen(text_splitted[i]));
|
||||||
}
|
}
|
||||||
dialog_data.drawButton(m_display, window, buttonBorderGC, buttonGC, 1, "Ok");
|
dialog_data.drawButton(m_display, window, buttonBorderGC, buttonGC, 1, continue_label);
|
||||||
if (strlen(link)) {
|
if (strlen(link)) {
|
||||||
dialog_data.drawButton(m_display, window, buttonBorderGC, buttonGC, 2, "Help");
|
dialog_data.drawButton(m_display, window, buttonBorderGC, buttonGC, 2, help_label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e.type == ButtonRelease) {
|
else if (e.type == ButtonRelease) {
|
||||||
if (dialog_data.isInsideButton(e, 1)) {
|
if (dialog_data.isInsideButton(e, 1)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (strlen(link) && dialog_data.isInsideButton(e, 2)) {
|
else if (dialog_data.isInsideButton(e, 2)) {
|
||||||
string cmd = "xdg-open \"" + string(link) + "\"";
|
if (strlen(link)) {
|
||||||
if (system(cmd.c_str()) != 0) {
|
string cmd = "xdg-open \"" + string(link) + "\"";
|
||||||
GHOST_PRINTF("GHOST_SystemX11::showMessageBox: Unable to run system command [%s]", cmd);
|
if (system(cmd.c_str()) != 0) {
|
||||||
|
GHOST_PRINTF("GHOST_SystemX11::showMessageBox: Unable to run system command [%s]",
|
||||||
|
cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -237,11 +237,15 @@ class GHOST_SystemX11 : public GHOST_System {
|
|||||||
* Show a system message box
|
* Show a system message box
|
||||||
* \param title The title of the message box
|
* \param title The title of the message box
|
||||||
* \param message The message to display
|
* \param message The message to display
|
||||||
|
* \param help_label Help button label
|
||||||
|
* \param continue_label Continue button label
|
||||||
* \param link An optional hyperlink
|
* \param link An optional hyperlink
|
||||||
* \param dialog_options Options how to display the message
|
* \param dialog_options Options how to display the message
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess showMessageBox(const char *title,
|
GHOST_TSuccess showMessageBox(const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
|
const char *help_label,
|
||||||
|
const char *continue_label,
|
||||||
const char *link,
|
const char *link,
|
||||||
GHOST_DialogOptions dialog_options) const;
|
GHOST_DialogOptions dialog_options) const;
|
||||||
#ifdef WITH_XDND
|
#ifdef WITH_XDND
|
||||||
|
@@ -152,10 +152,11 @@ bool WM_platform_support_perform_checks()
|
|||||||
/* TODO: Extra space is needed for the split function in GHOST_SystemX11. We should change
|
/* TODO: Extra space is needed for the split function in GHOST_SystemX11. We should change
|
||||||
* the behavior in GHOST_SystemX11. */
|
* the behavior in GHOST_SystemX11. */
|
||||||
STR_CONCAT(message, slen, "\n \n");
|
STR_CONCAT(message, slen, "\n \n");
|
||||||
STR_CONCAT(message,
|
STR_CONCAT(
|
||||||
slen,
|
message,
|
||||||
CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER,
|
slen,
|
||||||
"Press help to see if the support can be improved."));
|
CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER,
|
||||||
|
"Newer graphics drivers may be available to improve Blender support."));
|
||||||
STR_CONCAT(message, slen, "\n \n");
|
STR_CONCAT(message, slen, "\n \n");
|
||||||
STR_CONCAT(message, slen, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Graphics card:\n"));
|
STR_CONCAT(message, slen, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Graphics card:\n"));
|
||||||
STR_CONCAT(message, slen, GPU_platform_gpu_name());
|
STR_CONCAT(message, slen, GPU_platform_gpu_name());
|
||||||
@@ -176,10 +177,11 @@ bool WM_platform_support_perform_checks()
|
|||||||
"Your graphics card or driver is not supported."));
|
"Your graphics card or driver is not supported."));
|
||||||
|
|
||||||
STR_CONCAT(message, slen, "\n \n");
|
STR_CONCAT(message, slen, "\n \n");
|
||||||
STR_CONCAT(message,
|
STR_CONCAT(
|
||||||
slen,
|
message,
|
||||||
CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER,
|
slen,
|
||||||
"Press help to see if the support can be improved."));
|
CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER,
|
||||||
|
"Newer graphics drivers may be available to improve Blender support."));
|
||||||
|
|
||||||
STR_CONCAT(message, slen, "\n \n");
|
STR_CONCAT(message, slen, "\n \n");
|
||||||
STR_CONCAT(message, slen, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Graphics card:\n"));
|
STR_CONCAT(message, slen, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Graphics card:\n"));
|
||||||
@@ -209,8 +211,9 @@ bool WM_platform_support_perform_checks()
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else if (show_message) {
|
else if (show_message) {
|
||||||
WM_ghost_show_message_box(title, message, link, dialog_options);
|
WM_ghost_show_message_box(
|
||||||
|
title, message, "Find Latest Drivers", "Continue Anyway", link, dialog_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -2435,10 +2435,12 @@ void WM_opengl_context_release(void *context)
|
|||||||
|
|
||||||
void WM_ghost_show_message_box(const char *title,
|
void WM_ghost_show_message_box(const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
|
const char *help_label,
|
||||||
|
const char *continue_label,
|
||||||
const char *link,
|
const char *link,
|
||||||
GHOST_DialogOptions dialog_options)
|
GHOST_DialogOptions dialog_options)
|
||||||
{
|
{
|
||||||
BLI_assert(g_system);
|
BLI_assert(g_system);
|
||||||
GHOST_ShowMessageBox(g_system, title, message, link, dialog_options);
|
GHOST_ShowMessageBox(g_system, title, message, help_label, continue_label, link, dialog_options);
|
||||||
}
|
}
|
||||||
/** \} */
|
/** \} */
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
* In all other cases this message box should not be used. */
|
* In all other cases this message box should not be used. */
|
||||||
void WM_ghost_show_message_box(const char *title,
|
void WM_ghost_show_message_box(const char *title,
|
||||||
const char *message,
|
const char *message,
|
||||||
|
const char *help_label,
|
||||||
|
const char *continue_label,
|
||||||
const char *link,
|
const char *link,
|
||||||
GHOST_DialogOptions dialog_options);
|
GHOST_DialogOptions dialog_options);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user