mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[ui] fix missing partition scheme tooltip after selecting an ISO
* Tooltips can only be manipulated from the same thread as the one that created their parent * Also increase the SetLGP() timeout as this seems to be problematic * Closes #764
This commit is contained in:
parent
bf679271b8
commit
b9da0cf057
5 changed files with 24 additions and 12 deletions
10
src/rufus.c
10
src/rufus.c
|
@ -102,6 +102,7 @@ int default_fs;
|
||||||
uint32_t dur_mins, dur_secs;
|
uint32_t dur_mins, dur_secs;
|
||||||
loc_cmd* selected_locale = NULL;
|
loc_cmd* selected_locale = NULL;
|
||||||
WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
|
WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
|
||||||
|
DWORD MainThreadId;
|
||||||
HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL;
|
HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL;
|
||||||
HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hStatusToolbar;
|
HWND hLogDlg = NULL, hProgress = NULL, hInfo, hDiskID, hStatusToolbar;
|
||||||
BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, togo_mode;
|
BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, togo_mode;
|
||||||
|
@ -591,7 +592,8 @@ static void SetTargetSystem(void)
|
||||||
ts = 0; // MBR/BIOS|UEFI
|
ts = 0; // MBR/BIOS|UEFI
|
||||||
}
|
}
|
||||||
IGNORE_RETVAL(ComboBox_SetCurSel(hPartitionScheme, ts));
|
IGNORE_RETVAL(ComboBox_SetCurSel(hPartitionScheme, ts));
|
||||||
SetPartitionSchemeTooltip();
|
// Can't call SetPartitionSchemeTooltip() directly, as we may be on a different thread
|
||||||
|
SendMessage(hMainDialog, UM_SET_PARTITION_SCHEME_TOOLTIP, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetProposedLabel(int ComboIndex)
|
static void SetProposedLabel(int ComboIndex)
|
||||||
|
@ -1634,6 +1636,7 @@ void InitDialog(HWND hDlg)
|
||||||
|
|
||||||
// Quite a burden to carry around as parameters
|
// Quite a burden to carry around as parameters
|
||||||
hMainDialog = hDlg;
|
hMainDialog = hDlg;
|
||||||
|
MainThreadId = GetCurrentThreadId();
|
||||||
hDeviceList = GetDlgItem(hDlg, IDC_DEVICE);
|
hDeviceList = GetDlgItem(hDlg, IDC_DEVICE);
|
||||||
hPartitionScheme = GetDlgItem(hDlg, IDC_PARTITION_TYPE);
|
hPartitionScheme = GetDlgItem(hDlg, IDC_PARTITION_TYPE);
|
||||||
hFileSystem = GetDlgItem(hDlg, IDC_FILESYSTEM);
|
hFileSystem = GetDlgItem(hDlg, IDC_FILESYSTEM);
|
||||||
|
@ -2694,6 +2697,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||||
FormatStatus = 0;
|
FormatStatus = 0;
|
||||||
format_op_in_progress = FALSE;
|
format_op_in_progress = FALSE;
|
||||||
return (INT_PTR)TRUE;
|
return (INT_PTR)TRUE;
|
||||||
|
|
||||||
|
// Ensures that SetPartitionSchemeTooltip() can be called from the original thread
|
||||||
|
case UM_SET_PARTITION_SCHEME_TOOLTIP:
|
||||||
|
SetPartitionSchemeTooltip();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return (INT_PTR)FALSE;
|
return (INT_PTR)FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@ enum user_message_type {
|
||||||
UM_PROGRESS_INIT,
|
UM_PROGRESS_INIT,
|
||||||
UM_PROGRESS_EXIT,
|
UM_PROGRESS_EXIT,
|
||||||
UM_NO_UPDATE,
|
UM_NO_UPDATE,
|
||||||
|
UM_SET_PARTITION_SCHEME_TOOLTIP,
|
||||||
// Start of the WM IDs for the language menu items
|
// Start of the WM IDs for the language menu items
|
||||||
UM_LANGUAGE_MENU = WM_APP + 0x100
|
UM_LANGUAGE_MENU = WM_APP + 0x100
|
||||||
};
|
};
|
||||||
|
@ -364,7 +365,7 @@ extern HWND hInfo, hProgress, hDiskID, hStatusToolbar;
|
||||||
extern float fScale;
|
extern float fScale;
|
||||||
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH];
|
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH];
|
||||||
extern char* image_path;
|
extern char* image_path;
|
||||||
extern DWORD FormatStatus, DownloadStatus;
|
extern DWORD FormatStatus, DownloadStatus, MainThreadId;
|
||||||
extern BOOL PromptOnError;
|
extern BOOL PromptOnError;
|
||||||
extern unsigned long syslinux_ldlinux_len[2];
|
extern unsigned long syslinux_ldlinux_len[2];
|
||||||
extern const int nb_steps[FS_MAX];
|
extern const int nb_steps[FS_MAX];
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 2.10.941"
|
CAPTION "Rufus 2.10.942"
|
||||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||||
|
@ -320,8 +320,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 2,10,941,0
|
FILEVERSION 2,10,942,0
|
||||||
PRODUCTVERSION 2,10,941,0
|
PRODUCTVERSION 2,10,942,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -338,13 +338,13 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "2.10.941"
|
VALUE "FileVersion", "2.10.942"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus.exe"
|
VALUE "OriginalFilename", "rufus.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "2.10.941"
|
VALUE "ProductVersion", "2.10.942"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -803,7 +803,7 @@ BOOL SetLGP(BOOL bRestore, BOOL* bExistingKey, const char* szPath, const char* s
|
||||||
uprintf("SetLGP: Unable to start thread");
|
uprintf("SetLGP: Unable to start thread");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (WaitForSingleObject(thread_id, 5000) != WAIT_OBJECT_0) {
|
if (WaitForSingleObject(thread_id, 60000) != WAIT_OBJECT_0) {
|
||||||
uprintf("SetLGP: Killing stuck thread!");
|
uprintf("SetLGP: Killing stuck thread!");
|
||||||
TerminateThread(thread_id, 0);
|
TerminateThread(thread_id, 0);
|
||||||
CloseHandle(thread_id);
|
CloseHandle(thread_id);
|
||||||
|
|
11
src/stdlg.c
11
src/stdlg.c
|
@ -963,12 +963,10 @@ INT_PTR CALLBACK TooltipCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
|
||||||
for (i=0; i<MAX_TOOLTIPS; i++) {
|
for (i=0; i<MAX_TOOLTIPS; i++) {
|
||||||
if (ttlist[i].hTip == hDlg) break;
|
if (ttlist[i].hTip == hDlg) break;
|
||||||
}
|
}
|
||||||
if (i == MAX_TOOLTIPS) {
|
if (i == MAX_TOOLTIPS)
|
||||||
return (INT_PTR)FALSE;
|
return (INT_PTR)FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
switch (message)
|
switch (message) {
|
||||||
{
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
switch (((LPNMHDR)lParam)->code) {
|
switch (((LPNMHDR)lParam)->code) {
|
||||||
case TTN_GETDISPINFOW:
|
case TTN_GETDISPINFOW:
|
||||||
|
@ -979,6 +977,11 @@ INT_PTR CALLBACK TooltipCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef _DEBUG
|
||||||
|
// comctl32 causes issues if the tooltips are not being manipulated from the same thread as their parent controls
|
||||||
|
if (GetCurrentThreadId() != MainThreadId)
|
||||||
|
uprintf("Warning: Tooltip callback is being called from wrong thread");
|
||||||
|
#endif
|
||||||
return CallWindowProc(ttlist[i].original_proc, hDlg, message, wParam, lParam);
|
return CallWindowProc(ttlist[i].original_proc, hDlg, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue