mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[misc] use GetWindowLongPtr/SetWindowLongPtr everywhere
* Also remove WS_EX_RIGHT style from IDC_PERSISTENCE_SIZE since we apply it manually
This commit is contained in:
parent
efcdbe30e5
commit
619dd9862b
4 changed files with 22 additions and 20 deletions
11
src/rufus.c
11
src/rufus.c
|
@ -824,7 +824,8 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
HFONT hf;
|
HFONT hf;
|
||||||
long lfHeight, style;
|
LONG lfHeight;
|
||||||
|
LONG_PTR style;
|
||||||
DWORD log_size;
|
DWORD log_size;
|
||||||
char *log_buffer = NULL, *filepath;
|
char *log_buffer = NULL, *filepath;
|
||||||
EXT_DECL(log_ext, "rufus.log", __VA_GROUP__("*.log"), __VA_GROUP__("Rufus log"));
|
EXT_DECL(log_ext, "rufus.log", __VA_GROUP__("*.log"), __VA_GROUP__("Rufus log"));
|
||||||
|
@ -849,12 +850,12 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
// the displayed text becomes a mess due to Windows trying to interpret
|
// the displayed text becomes a mess due to Windows trying to interpret
|
||||||
// dots, parenthesis, columns and so on in an RTL context...
|
// dots, parenthesis, columns and so on in an RTL context...
|
||||||
// We also take this opportunity to fix the scroll bar and text alignment.
|
// We also take this opportunity to fix the scroll bar and text alignment.
|
||||||
style = GetWindowLong(hLog, GWL_EXSTYLE);
|
style = GetWindowLongPtr(hLog, GWL_EXSTYLE);
|
||||||
style &= ~(WS_EX_RTLREADING | WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR);
|
style &= ~(WS_EX_RTLREADING | WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR);
|
||||||
SetWindowLong(hLog, GWL_EXSTYLE, style);
|
SetWindowLongPtr(hLog, GWL_EXSTYLE, style);
|
||||||
style = GetWindowLong(hLog, GWL_STYLE);
|
style = GetWindowLongPtr(hLog, GWL_STYLE);
|
||||||
style &= ~(ES_RIGHT);
|
style &= ~(ES_RIGHT);
|
||||||
SetWindowLong(hLog, GWL_STYLE, style);
|
SetWindowLongPtr(hLog, GWL_STYLE, style);
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
|
|
12
src/rufus.rc
12
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||||
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 3.2.1377"
|
CAPTION "Rufus 3.2.1378"
|
||||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||||
|
@ -47,7 +47,7 @@ BEGIN
|
||||||
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,65,216,8
|
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,65,216,8
|
||||||
COMBOBOX IDC_IMAGE_OPTION,8,74,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_IMAGE_OPTION,8,74,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
CONTROL "",IDC_PERSISTENCE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,125,76,34,8
|
CONTROL "",IDC_PERSISTENCE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,125,76,34,8
|
||||||
EDITTEXT IDC_PERSISTENCE_SIZE,160,74,36,12,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
|
EDITTEXT IDC_PERSISTENCE_SIZE,160,74,36,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||||
COMBOBOX IDC_PERSISTENCE_UNITS,200,74,24,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_PERSISTENCE_UNITS,200,74,24,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,87,96,8
|
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,87,96,8
|
||||||
COMBOBOX IDC_PARTITION_TYPE,8,96,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_PARTITION_TYPE,8,96,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
@ -392,8 +392,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 3,2,1377,0
|
FILEVERSION 3,2,1378,0
|
||||||
PRODUCTVERSION 3,2,1377,0
|
PRODUCTVERSION 3,2,1378,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -411,13 +411,13 @@ BEGIN
|
||||||
VALUE "Comments", "https://akeo.ie"
|
VALUE "Comments", "https://akeo.ie"
|
||||||
VALUE "CompanyName", "Akeo Consulting"
|
VALUE "CompanyName", "Akeo Consulting"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "3.2.1377"
|
VALUE "FileVersion", "3.2.1378"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
|
||||||
VALUE "OriginalFilename", "rufus-3.2.exe"
|
VALUE "OriginalFilename", "rufus-3.2.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "3.2.1377"
|
VALUE "ProductVersion", "3.2.1378"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
12
src/stdlg.c
12
src/stdlg.c
|
@ -506,7 +506,7 @@ void ResizeButtonHeight(HWND hDlg, int id)
|
||||||
*/
|
*/
|
||||||
INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
long style;
|
LONG_PTR style;
|
||||||
HWND hLicense;
|
HWND hLicense;
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
@ -515,12 +515,12 @@ INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM
|
||||||
CenterDialog(hDlg);
|
CenterDialog(hDlg);
|
||||||
ResizeButtonHeight(hDlg, IDCANCEL);
|
ResizeButtonHeight(hDlg, IDCANCEL);
|
||||||
// Suppress any inherited RTL flags
|
// Suppress any inherited RTL flags
|
||||||
style = GetWindowLong(hLicense, GWL_EXSTYLE);
|
style = GetWindowLongPtr(hLicense, GWL_EXSTYLE);
|
||||||
style &= ~(WS_EX_RTLREADING | WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR);
|
style &= ~(WS_EX_RTLREADING | WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR);
|
||||||
SetWindowLong(hLicense, GWL_EXSTYLE, style);
|
SetWindowLongPtr(hLicense, GWL_EXSTYLE, style);
|
||||||
style = GetWindowLong(hLicense, GWL_STYLE);
|
style = GetWindowLongPtr(hLicense, GWL_STYLE);
|
||||||
style &= ~(ES_RIGHT);
|
style &= ~(ES_RIGHT);
|
||||||
SetWindowLong(hLicense, GWL_STYLE, style);
|
SetWindowLongPtr(hLicense, GWL_STYLE, style);
|
||||||
SetDlgItemTextA(hDlg, IDC_LICENSE_TEXT, gplv3);
|
SetDlgItemTextA(hDlg, IDC_LICENSE_TEXT, gplv3);
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
|
@ -1891,7 +1891,7 @@ static void CALLBACK FormatPromptHook(HWINEVENTHOOK hWinEventHook, DWORD Event,
|
||||||
BOOL found;
|
BOOL found;
|
||||||
|
|
||||||
if (Event == EVENT_SYSTEM_FOREGROUND) {
|
if (Event == EVENT_SYSTEM_FOREGROUND) {
|
||||||
if (GetWindowLong(hWnd, GWL_STYLE) & WS_POPUPWINDOW) {
|
if (GetWindowLongPtr(hWnd, GWL_STYLE) & WS_POPUPWINDOW) {
|
||||||
str[0] = 0;
|
str[0] = 0;
|
||||||
GetWindowTextU(hWnd, str, sizeof(str));
|
GetWindowTextU(hWnd, str, sizeof(str));
|
||||||
if (safe_strcmp(str, fp_title_str) == 0) {
|
if (safe_strcmp(str, fp_title_str) == 0) {
|
||||||
|
|
7
src/ui.c
7
src/ui.c
|
@ -643,16 +643,17 @@ void TogglePersistenceControls(BOOL display)
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
HWND hSize, hUnits;
|
HWND hSize, hUnits;
|
||||||
LONG style, width = fw - bsw - ssw;
|
LONG_PTR style;
|
||||||
|
LONG width = fw - bsw - ssw;
|
||||||
hSize = GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE);
|
hSize = GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE);
|
||||||
hUnits = GetDlgItem(hMainDialog, IDC_PERSISTENCE_UNITS);
|
hUnits = GetDlgItem(hMainDialog, IDC_PERSISTENCE_UNITS);
|
||||||
|
|
||||||
style = GetWindowLong(hSize, GWL_EXSTYLE);
|
style = GetWindowLongPtr(hSize, GWL_EXSTYLE);
|
||||||
if (display)
|
if (display)
|
||||||
style |= WS_EX_RIGHT;
|
style |= WS_EX_RIGHT;
|
||||||
else
|
else
|
||||||
style &= ~WS_EX_RIGHT;
|
style &= ~WS_EX_RIGHT;
|
||||||
SetWindowLong(hSize, GWL_EXSTYLE, style);
|
SetWindowLongPtr(hSize, GWL_EXSTYLE, style);
|
||||||
|
|
||||||
if (display) {
|
if (display) {
|
||||||
GetWindowRect(hUnits, &rc);
|
GetWindowRect(hUnits, &rc);
|
||||||
|
|
Loading…
Reference in a new issue