< prev index next >
src/java.desktop/windows/native/libawt/windows/awt_Component.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 255,264 ****
--- 255,266 ----
if (!sm_PrimaryDynamicTableBuilt) {
// do it once.
AwtComponent::BuildPrimaryDynamicTable();
sm_PrimaryDynamicTableBuilt = TRUE;
}
+
+ deadKeyActive = FALSE;
}
AwtComponent::~AwtComponent()
{
DASSERT(AwtToolkit::IsMainThread());
*** 2950,2959 ****
--- 2952,2962 ----
{0x00B8, java_awt_event_KeyEvent_VK_DEAD_CEDILLA},
{0x02DB, java_awt_event_KeyEvent_VK_DEAD_OGONEK},
{0x037A, java_awt_event_KeyEvent_VK_DEAD_IOTA}, // ASCII ???
{0x309B, java_awt_event_KeyEvent_VK_DEAD_VOICED_SOUND},
{0x309C, java_awt_event_KeyEvent_VK_DEAD_SEMIVOICED_SOUND},
+ {0x0004, java_awt_event_KeyEvent_VK_COMPOSE},
{0,0}
};
// The full map of the current keyboard state including
// windows virtual key, scancode, java virtual key, and unicode
*** 3442,3453 ****
static const BYTE KEY_STATE_DOWN = 0x80;
BYTE keyboardState[AwtToolkit::KB_STATE_SIZE];
AwtToolkit::GetKeyboardState(keyboardState);
// apply modifiers to keyboard state if necessary
if (modifiers) {
! BOOL shiftIsDown = modifiers & java_awt_event_InputEvent_SHIFT_DOWN_MASK;
BOOL altIsDown = modifiers & java_awt_event_InputEvent_ALT_DOWN_MASK;
BOOL ctrlIsDown = modifiers & java_awt_event_InputEvent_CTRL_DOWN_MASK;
// Windows treats AltGr as Ctrl+Alt
if (modifiers & java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK) {
--- 3445,3457 ----
static const BYTE KEY_STATE_DOWN = 0x80;
BYTE keyboardState[AwtToolkit::KB_STATE_SIZE];
AwtToolkit::GetKeyboardState(keyboardState);
// apply modifiers to keyboard state if necessary
+ BOOL shiftIsDown = FALSE;
if (modifiers) {
! shiftIsDown = modifiers & java_awt_event_InputEvent_SHIFT_DOWN_MASK;
BOOL altIsDown = modifiers & java_awt_event_InputEvent_ALT_DOWN_MASK;
BOOL ctrlIsDown = modifiers & java_awt_event_InputEvent_CTRL_DOWN_MASK;
// Windows treats AltGr as Ctrl+Alt
if (modifiers & java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK) {
*** 3515,3536 ****
}
} // ctrlIsDown && altIsDown
} // ctrlIsDown
} // modifiers
- // instead of creating our own conversion tables, I'll let Win32
- // convert the character for me.
WORD wChar[2];
UINT scancode = ::MapVirtualKey(wkey, 0);
! int converted = ::ToUnicodeEx(wkey, scancode, keyboardState,
wChar, 2, 0, GetKeyboardLayout());
UINT translation;
BOOL deadKeyFlag = (converted == 2);
// Dead Key
! if (converted < 0) {
translation = java_awt_event_KeyEvent_CHAR_UNDEFINED;
} else
// No translation available -- try known conversions or else punt.
if (converted == 0) {
if (wkey == VK_DELETE) {
--- 3519,3549 ----
}
} // ctrlIsDown && altIsDown
} // ctrlIsDown
} // modifiers
WORD wChar[2];
+ int converted = 1;
+ UINT ch = ::MapVirtualKey(wkey, 2);
+ if (ch & 0x80000000) {
+ // Dead key which is handled as a normal key
+ isDeadKey = deadKeyActive = TRUE;
+ } else if (deadKeyActive) {
+ // We cannot use ::ToUnicodeEx if dead key is active because this will
+ // break dead key function
+ wChar[0] = shiftIsDown ? ch : tolower(ch);
+ } else {
UINT scancode = ::MapVirtualKey(wkey, 0);
! converted = ::ToUnicodeEx(wkey, scancode, keyboardState,
wChar, 2, 0, GetKeyboardLayout());
+ }
UINT translation;
BOOL deadKeyFlag = (converted == 2);
// Dead Key
! if (converted < 0 || wChar[0] == 0 || isDeadKey) {
translation = java_awt_event_KeyEvent_CHAR_UNDEFINED;
} else
// No translation available -- try known conversions or else punt.
if (converted == 0) {
if (wkey == VK_DELETE) {
*** 3680,3689 ****
--- 3693,3704 ----
}
MsgRouting AwtComponent::WmChar(UINT character, UINT repCnt, UINT flags,
BOOL system)
{
+ deadKeyActive = FALSE;
+
// Will only get WmChar messages with DBCS if we create them for
// an Edit class in the WmForwardChar method. These synthesized
// DBCS chars are ok to pass on directly to the default window
// procedure. They've already been filtered through the Java key
// event queue. We will never get the trail byte since the edit
< prev index next >