[ui] avoid intempestive log tooltip display and fix partition type preservation

* Because of Windows' poor handling of toolbar buttons' tooltips, an unwanted
  tooltip could be displayed onscreen after closing the log.
* Also fix an issue when Rufus would reset the partition type to GPT after a
  user created an MBR flash drive (e.g. after creating a Windows bootable USB).
This commit is contained in:
Pete Batard 2018-05-16 12:56:31 +01:00
parent b6809679f9
commit 0d0ad389ce
2 changed files with 18 additions and 6 deletions

View File

@ -328,7 +328,8 @@ static void SetPartitionSchemeAndTargetSystem(BOOL only_target)
preferred_pt = (selected_pt >= 0) ? selected_pt : PARTITION_STYLE_GPT;
else if ((bt == BT_IMAGE) && (image_path != NULL) && (img_report.is_iso)) {
if (HAS_WINDOWS(img_report) && img_report.has_efi)
preferred_pt = allow_dual_uefi_bios? PARTITION_STYLE_MBR : PARTITION_STYLE_GPT;
preferred_pt = allow_dual_uefi_bios? PARTITION_STYLE_MBR :
((selected_pt >= 0) ? selected_pt : PARTITION_STYLE_GPT);
if (img_report.is_bootable_img)
preferred_pt = (selected_pt >= 0) ? selected_pt : PARTITION_STYLE_MBR;
}
@ -1022,6 +1023,9 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
case IDCANCEL:
ShowWindow(hDlg, SW_HIDE);
log_displayed = FALSE;
// Set focus to the Cancel button on the main dialog
// This avoids intempestive tooltip display from the log toolbar buttom
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDCANCEL), TRUE);
return TRUE;
case IDC_LOG_CLEAR:
SetWindowTextA(hLog, "");
@ -1050,6 +1054,9 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
ShowWindow(hDlg, SW_HIDE);
reset_localization(IDD_LOG);
log_displayed = FALSE;
// Set focus to the Cancel button on the main dialog
// This avoids intempestive tooltip display from the log toolbar buttom
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDCANCEL), TRUE);
return TRUE;
case UM_RESIZE_BUTTONS:
// Resize our buttons for low scaling factors
@ -3300,6 +3307,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
static_sprintf(szTimer, "00:00:00");
SendMessageA(hStatus, SB_SETTEXTA, SBT_OWNERDRAW | SB_SECTION_RIGHT, (LPARAM)szTimer);
SetTimer(hMainDialog, TID_APP_TIMER, 1000, ClockTimer);
// Set focus to the Cancel button
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDCANCEL), TRUE);
}
}
if (format_thid != NULL)
@ -3522,6 +3531,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
utf8_to_wchar_no_alloc(lmprintf(MSG_272), wtooltip, ARRAYSIZE(wtooltip));
lpttt->lpszText = wtooltip;
break;
default:
uprintf("TTN_GETDISPINFO called for unknown toolbar button!");
break;
}
break;
}

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.0.1283"
CAPTION "Rufus 3.0.1284"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -389,8 +389,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,0,1283,0
PRODUCTVERSION 3,0,1283,0
FILEVERSION 3,0,1284,0
PRODUCTVERSION 3,0,1284,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -407,13 +407,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.0.1283"
VALUE "FileVersion", "3.0.1284"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.0.1283"
VALUE "ProductVersion", "3.0.1284"
END
END
BLOCK "VarFileInfo"