mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 406088 - crash reporter sucks in rtl, fix for Win32. r=dcamp
This commit is contained in:
parent
a46e4f3f66
commit
bdf0ce1ea5
@ -84,6 +84,22 @@ typedef struct {
|
||||
wstring serverResponse;
|
||||
} SendThreadData;
|
||||
|
||||
/*
|
||||
* Per http://msdn2.microsoft.com/en-us/library/ms645398(VS.85).aspx
|
||||
* "The DLGTEMPLATEEX structure is not defined in any standard header file.
|
||||
* The structure definition is provided here to explain the format of an
|
||||
* extended template for a dialog box.
|
||||
*/
|
||||
typedef struct {
|
||||
WORD dlgVer;
|
||||
WORD signature;
|
||||
DWORD helpID;
|
||||
DWORD exStyle;
|
||||
// There's more to this struct, but it has weird variable-length
|
||||
// members, and I only actually need to touch exStyle on an existing
|
||||
// instance, so I've omitted the rest.
|
||||
} DLGTEMPLATEEX;
|
||||
|
||||
static HANDLE gThreadHandle;
|
||||
static SendThreadData gSendData = { 0, };
|
||||
static vector<string> gRestartArgs;
|
||||
@ -91,6 +107,7 @@ static map<wstring,wstring> gQueryParameters;
|
||||
static wstring gCrashReporterKey(L"Software\\Mozilla\\Crash Reporter");
|
||||
static wstring gURLParameter;
|
||||
static int gCheckboxPadding = 6;
|
||||
static bool gRTLlayout = false;
|
||||
|
||||
// When vertically resizing the dialog, these items should move down
|
||||
static set<UINT> gAttachedBottom;
|
||||
@ -272,6 +289,10 @@ typedef HRESULT (WINAPI*CloseThemeDataPtr)(HANDLE hTheme);
|
||||
typedef HRESULT (WINAPI*GetThemePartSizePtr)(HANDLE hTheme, HDC hdc, int iPartId,
|
||||
int iStateId, RECT* prc, int ts,
|
||||
SIZE* psz);
|
||||
typedef HRESULT (WINAPI*GetThemeContentRectPtr)(HANDLE hTheme, HDC hdc, int iPartId,
|
||||
int iStateId, const RECT* pRect,
|
||||
RECT* pContentRect);
|
||||
|
||||
|
||||
static void GetThemeSizes(HWND hwnd)
|
||||
{
|
||||
@ -650,9 +671,11 @@ static LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||
wchar_t* txt = (wchar_t*)GetProp(hwnd, L"PROP_GRAYTEXT");
|
||||
// Get the actual edit control rect
|
||||
CallWindowProc(super, hwnd, EM_GETRECT, 0, (LPARAM)&r);
|
||||
UINT format = DT_EDITCONTROL | DT_NOPREFIX | DT_WORDBREAK | DT_INTERNAL;
|
||||
if (gRTLlayout)
|
||||
format |= DT_RIGHT;
|
||||
if (txt)
|
||||
DrawText(hdc, txt, wcslen(txt), &r,
|
||||
DT_EDITCONTROL | DT_NOPREFIX | DT_WORDBREAK | DT_INTERNAL);
|
||||
DrawText(hdc, txt, wcslen(txt), &r, format);
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
}
|
||||
@ -806,6 +829,39 @@ static void SubmitReportChecked(HWND hwndDlg)
|
||||
SetDlgItemVisible(hwndDlg, IDC_PROGRESSTEXT, enabled);
|
||||
}
|
||||
|
||||
static INT_PTR DialogBoxParamMaybeRTL(UINT idd, HWND hwndParent,
|
||||
DLGPROC dlgProc, LPARAM param)
|
||||
{
|
||||
INT_PTR rv = 0;
|
||||
if (gRTLlayout) {
|
||||
// We need to toggle the WS_EX_LAYOUTRTL style flag on the dialog
|
||||
// template.
|
||||
HRSRC hDialogRC = FindResource(NULL, MAKEINTRESOURCE(idd),
|
||||
RT_DIALOG);
|
||||
HGLOBAL hDlgTemplate = LoadResource(NULL, hDialogRC);
|
||||
DLGTEMPLATEEX* pDlgTemplate = (DLGTEMPLATEEX*)LockResource(hDlgTemplate);
|
||||
unsigned long sizeDlg = SizeofResource(NULL, hDialogRC);
|
||||
HGLOBAL hMyDlgTemplate = GlobalAlloc(GPTR, sizeDlg);
|
||||
DLGTEMPLATEEX* pMyDlgTemplate =
|
||||
(DLGTEMPLATEEX*)GlobalLock(hMyDlgTemplate);
|
||||
memcpy(pMyDlgTemplate, pDlgTemplate, sizeDlg);
|
||||
|
||||
pMyDlgTemplate->exStyle |= WS_EX_LAYOUTRTL;
|
||||
|
||||
rv = DialogBoxIndirectParam(NULL, (LPCDLGTEMPLATE)pMyDlgTemplate,
|
||||
hwndParent, dlgProc, param);
|
||||
GlobalUnlock(hMyDlgTemplate);
|
||||
GlobalFree(hMyDlgTemplate);
|
||||
}
|
||||
else {
|
||||
rv = DialogBoxParam(NULL, MAKEINTRESOURCE(idd), hwndParent,
|
||||
dlgProc, param);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static BOOL CALLBACK CrashReporterDialogProc(HWND hwndDlg, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
@ -991,6 +1047,7 @@ static BOOL CALLBACK CrashReporterDialogProc(HWND hwndDlg, UINT message,
|
||||
SendDlgItemMessage(hwndDlg, IDC_DESCRIPTIONTEXT, EM_SETCHARFORMAT,
|
||||
SCF_SELECTION, (LPARAM)&fmt);
|
||||
SendDlgItemMessage(hwndDlg, IDC_DESCRIPTIONTEXT, EM_SETSEL, 0, 0);
|
||||
|
||||
SendDlgItemMessage(hwndDlg, IDC_DESCRIPTIONTEXT,
|
||||
EM_SETTARGETDEVICE, (WPARAM)NULL, 0);
|
||||
|
||||
@ -1054,7 +1111,7 @@ static BOOL CALLBACK CrashReporterDialogProc(HWND hwndDlg, UINT message,
|
||||
if (HIWORD(wParam) == BN_CLICKED) {
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDC_VIEWREPORTBUTTON:
|
||||
DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_VIEWREPORTDIALOG), hwndDlg,
|
||||
DialogBoxParamMaybeRTL(IDD_VIEWREPORTDIALOG, hwndDlg,
|
||||
(DLGPROC)ViewReportDialogProc, 0);
|
||||
break;
|
||||
case IDC_SUBMITREPORTCHECK:
|
||||
@ -1245,8 +1302,12 @@ bool UIShowCrashUI(const string& dumpFile,
|
||||
|
||||
gRestartArgs = restartArgs;
|
||||
|
||||
return DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_SENDDIALOG), NULL,
|
||||
(DLGPROC)CrashReporterDialogProc, 0) == 1;
|
||||
if (gStrings.find("isRTL") != gStrings.end() &&
|
||||
gStrings["isRTL"] == "yes")
|
||||
gRTLlayout = true;
|
||||
|
||||
return 1 == DialogBoxParamMaybeRTL(IDD_SENDDIALOG, NULL,
|
||||
(DLGPROC)CrashReporterDialogProc, 0);
|
||||
}
|
||||
|
||||
void UIError_impl(const string& message)
|
||||
|
@ -1,5 +1,10 @@
|
||||
# This file is in the UTF-8 encoding
|
||||
[Strings]
|
||||
# LOCALIZATION NOTE (isRTL):
|
||||
# Leave this entry empty unless your language requires right-to-left layout,
|
||||
# for example like Arabic, Hebrew, Persian. If your language needs RTL, please
|
||||
# use the untranslated English word "yes" as value
|
||||
isRTL=
|
||||
CrashReporterTitle=Crash Reporter
|
||||
# LOCALIZATION NOTE (CrashReporterVendorTitle): %s is replaced with the vendor name. (i.e. "Mozilla")
|
||||
CrashReporterVendorTitle=%s Crash Reporter
|
||||
|
Loading…
Reference in New Issue
Block a user