*/
#include "ros_lpk.h"
-#include <debug.h>
+
+WINE_DEFAULT_DEBUG_CHANNEL(bidi);
LPK_LPEDITCONTROL_LIST LpkEditControl = {EditCreate, EditIchToXY, EditMouseToIch, EditCchInWidth,
EditGetLineWidth, EditDrawText, EditHScroll, EditMoveSelection,
DeleteObject(hpen);
}
+/* Code taken from the GetProcessDefaultLayout function from Wine's user32
+ * Wine version 3.17
+ *
+ * This function should be called from LpkInitialize,
+ * which is in turn called by GdiInitializeLanguagePack (from gdi32).
+ * TODO: Move call from LpkDllInitialize to LpkInitialize when latter
+ * function is implemented.
+ */
+static void LPK_ApplyMirroring()
+{
+ static const WCHAR translationW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o',
+ '\\','T','r','a','n','s','l','a','t','i','o','n', 0 };
+ static const WCHAR filedescW[] = { '\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o',
+ '\\','%','0','4','x','%','0','4','x',
+ '\\','F','i','l','e','D','e','s','c','r','i','p','t','i','o','n',0 };
+ WCHAR *str, buffer[MAX_PATH];
+#ifdef __REACTOS__
+ DWORD i, version_layout = 0;
+ UINT len;
+#else
+ DWORD i, len, version_layout = 0;
+#endif
+ DWORD user_lang = GetUserDefaultLangID();
+ DWORD *languages;
+ void *data = NULL;
+
+ GetModuleFileNameW( 0, buffer, MAX_PATH );
+ if (!(len = GetFileVersionInfoSizeW( buffer, NULL ))) goto done;
+ if (!(data = HeapAlloc( GetProcessHeap(), 0, len ))) goto done;
+ if (!GetFileVersionInfoW( buffer, 0, len, data )) goto done;
+ if (!VerQueryValueW( data, translationW, (void **)&languages, &len ) || !len) goto done;
+
+ len /= sizeof(DWORD);
+ for (i = 0; i < len; i++) if (LOWORD(languages[i]) == user_lang) break;
+ if (i == len) /* try neutral language */
+ for (i = 0; i < len; i++)
+ if (LOWORD(languages[i]) == MAKELANGID( PRIMARYLANGID(user_lang), SUBLANG_NEUTRAL )) break;
+ if (i == len) i = 0; /* default to the first one */
+
+ sprintfW( buffer, filedescW, LOWORD(languages[i]), HIWORD(languages[i]) );
+ if (!VerQueryValueW( data, buffer, (void **)&str, &len )) goto done;
+ TRACE( "found description %s\n", debugstr_w( str ));
+ if (str[0] == 0x200e && str[1] == 0x200e) version_layout = LAYOUT_RTL;
+
+done:
+ HeapFree( GetProcessHeap(), 0, data );
+ SetProcessDefaultLayout(version_layout);
+}
+
BOOL
WINAPI
DllMain(
DisableThreadLibraryCalls(hDll);
/* Tell usp10 it is activated usp10 */
//LpkPresent();
+ LPK_ApplyMirroring();
break;
default:
}
else
{
- DPRINT1("BIDI_Reorder failed, falling back to original string.\n");
+ WARN("BIDI_Reorder failed, falling back to original string.\n");
bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, lpString, uCount, lpDx);
}