user32: Add support for legacy access keys.

oldstable
Akihiro Sagawa 2012-09-05 20:31:17 +09:00 committed by Alexandre Julliard
parent ebd1810918
commit 70937bd8dd
2 changed files with 25 additions and 9 deletions

View File

@ -773,15 +773,18 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
if( !forceMenuChar )
{
UINT i;
BOOL cjk = GetSystemMetrics( SM_DBCSENABLED );
for (i = 0; i < menu->nItems; i++, item++)
{
if( item->text)
{
WCHAR *p = item->text - 2;
const WCHAR *p = item->text - 2;
do
{
p = strchrW (p + 2, '&');
const WCHAR *q = p + 2;
p = strchrW (q, '&');
if (!p && cjk) p = strchrW (q, '\036'); /* Japanese Win16 */
}
while (p != NULL && p [1] == '&');
if (p && (toupperW(p[1]) == toupperW(key))) return i;

View File

@ -87,6 +87,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(text);
#define CR 13
#define SPACE 32
#define PREFIX 38
#define ALPHA_PREFIX 30 /* Win16: Alphabet prefix */
#define KANA_PREFIX 31 /* Win16: Katakana prefix */
#define FORWARD_SLASH '/'
#define BACK_SLASH '\\'
@ -472,8 +474,9 @@ static void TEXT_SkipChars (int *new_count, const WCHAR **new_str,
max -= n;
while (n--)
{
if (*start_str++ == PREFIX && max--)
if ((*start_str == PREFIX || *start_str == ALPHA_PREFIX) && max--)
start_str++;
start_str++;
}
start_count -= (start_str - str_on_entry);
}
@ -507,10 +510,10 @@ static int TEXT_Reprefix (const WCHAR *str, unsigned int ns,
const ellipsis_data *pe)
{
int result = -1;
unsigned int i = 0;
unsigned int i;
unsigned int n = pe->before + pe->under + pe->after;
assert (n <= ns);
while (i < n)
for (i = 0; i < n; i++, str++)
{
if (i == pe->before)
{
@ -523,16 +526,15 @@ static int TEXT_Reprefix (const WCHAR *str, unsigned int ns,
}
if (!ns) break;
ns--;
if (*str++ == PREFIX)
if (*str == PREFIX || *str == ALPHA_PREFIX)
{
str++;
if (!ns) break;
if (*str != PREFIX)
result = (i < pe->before || pe->under == 0) ? i : i - pe->under + pe->len;
/* pe->len may be non-zero while pe_under is zero */
str++;
ns--;
}
i++;
}
return result;
}
@ -631,8 +633,13 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
(str[i] != TAB || !(format & DT_EXPANDTABS)) &&
((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE)))
{
if (str[i] == PREFIX && !(format & DT_NOPREFIX) && *count > 1)
if ((format & DT_NOPREFIX) || *count <= 1)
{
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
continue;
}
if (str[i] == PREFIX || str[i] == ALPHA_PREFIX) {
(*count)--, i++; /* Throw away the prefix itself */
if (str[i] == PREFIX)
{
@ -648,6 +655,12 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
* one.
*/
}
else if (str[i] == KANA_PREFIX)
{
/* Throw away katakana access keys */
(*count)--, i++; /* skip the prefix */
(*count)--, i++; /* skip the letter */
}
else
{
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;