Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
I
Irrlicht
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Irrlicht
Commits
d38e1fdf
Commit
d38e1fdf
authored
Oct 18, 2018
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add char input event for i18n
only tested on win32 platform, probably not work on others
parent
3fb9852c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
51 deletions
+97
-51
include/IEventReceiver.h
include/IEventReceiver.h
+10
-3
src/CGUIEditBox.cpp
src/CGUIEditBox.cpp
+3
-8
src/CGUIEnvironment.cpp
src/CGUIEnvironment.cpp
+7
-0
src/CGUIListBox.cpp
src/CGUIListBox.cpp
+7
-4
src/CIrrDeviceConsole.cpp
src/CIrrDeviceConsole.cpp
+4
-1
src/CIrrDeviceLinux.cpp
src/CIrrDeviceLinux.cpp
+4
-2
src/CIrrDeviceSDL.cpp
src/CIrrDeviceSDL.cpp
+8
-1
src/CIrrDeviceWin32.cpp
src/CIrrDeviceWin32.cpp
+54
-31
src/CIrrDeviceWinCE.cpp
src/CIrrDeviceWinCE.cpp
+0
-1
No files found.
include/IEventReceiver.h
View file @
d38e1fdf
...
@@ -34,6 +34,9 @@ namespace irr
...
@@ -34,6 +34,9 @@ namespace irr
IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
EET_KEY_INPUT_EVENT
,
EET_KEY_INPUT_EVENT
,
//! A character input event.
EET_CHAR_INPUT_EVENT
,
//! A joystick (joypad, gamepad) input event.
//! A joystick (joypad, gamepad) input event.
/** Joystick events are created by polling all connected joysticks once per
/** Joystick events are created by polling all connected joysticks once per
device run() and then passing the events to IrrlichtDevice::postEventFromUser.
device run() and then passing the events to IrrlichtDevice::postEventFromUser.
...
@@ -315,9 +318,6 @@ struct SEvent
...
@@ -315,9 +318,6 @@ struct SEvent
//! Any kind of keyboard event.
//! Any kind of keyboard event.
struct
SKeyInput
struct
SKeyInput
{
{
//! Character corresponding to the key (0, if not a character)
wchar_t
Char
;
//! Key which has been pressed or released
//! Key which has been pressed or released
EKEY_CODE
Key
;
EKEY_CODE
Key
;
...
@@ -331,6 +331,12 @@ struct SEvent
...
@@ -331,6 +331,12 @@ struct SEvent
bool
Control
:
1
;
bool
Control
:
1
;
};
};
//! Character input event
struct
SCharInput
{
wchar_t
Char
;
};
//! A joystick event.
//! A joystick event.
/** Unlike other events, joystick events represent the result of polling
/** Unlike other events, joystick events represent the result of polling
* each connected joystick once per run() of the device. Joystick events will
* each connected joystick once per run() of the device. Joystick events will
...
@@ -417,6 +423,7 @@ struct SEvent
...
@@ -417,6 +423,7 @@ struct SEvent
struct
SGUIEvent
GUIEvent
;
struct
SGUIEvent
GUIEvent
;
struct
SMouseInput
MouseInput
;
struct
SMouseInput
MouseInput
;
struct
SKeyInput
KeyInput
;
struct
SKeyInput
KeyInput
;
struct
SCharInput
CharInput
;
struct
SJoystickEvent
JoystickEvent
;
struct
SJoystickEvent
JoystickEvent
;
struct
SLogEvent
LogEvent
;
struct
SLogEvent
LogEvent
;
struct
SUserEvent
UserEvent
;
struct
SUserEvent
UserEvent
;
...
...
src/CGUIEditBox.cpp
View file @
d38e1fdf
...
@@ -240,6 +240,9 @@ bool CGUIEditBox::OnEvent(const SEvent& event)
...
@@ -240,6 +240,9 @@ bool CGUIEditBox::OnEvent(const SEvent& event)
if
(
processKey
(
event
))
if
(
processKey
(
event
))
return
true
;
return
true
;
break
;
break
;
case
EET_CHAR_INPUT_EVENT
:
inputChar
(
event
.
CharInput
.
Char
);
return
true
;
case
EET_MOUSE_INPUT_EVENT
:
case
EET_MOUSE_INPUT_EVENT
:
if
(
processMouse
(
event
))
if
(
processMouse
(
event
))
return
true
;
return
true
;
...
@@ -266,13 +269,6 @@ bool CGUIEditBox::processKey(const SEvent& event)
...
@@ -266,13 +269,6 @@ bool CGUIEditBox::processKey(const SEvent& event)
if
(
event
.
KeyInput
.
Control
)
if
(
event
.
KeyInput
.
Control
)
{
{
// german backlash '\' entered with control + '?'
if
(
event
.
KeyInput
.
Char
==
'\\'
)
{
inputChar
(
event
.
KeyInput
.
Char
);
return
true
;
}
switch
(
event
.
KeyInput
.
Key
)
switch
(
event
.
KeyInput
.
Key
)
{
{
case
KEY_KEY_A
:
case
KEY_KEY_A
:
...
@@ -686,7 +682,6 @@ bool CGUIEditBox::processKey(const SEvent& event)
...
@@ -686,7 +682,6 @@ bool CGUIEditBox::processKey(const SEvent& event)
return
false
;
return
false
;
default:
default:
inputChar
(
event
.
KeyInput
.
Char
);
return
true
;
return
true
;
}
}
...
...
src/CGUIEnvironment.cpp
View file @
d38e1fdf
...
@@ -394,6 +394,7 @@ bool CGUIEnvironment::OnEvent(const SEvent& event)
...
@@ -394,6 +394,7 @@ bool CGUIEnvironment::OnEvent(const SEvent& event)
if
(
UserReceiver
if
(
UserReceiver
&&
(
event
.
EventType
!=
EET_MOUSE_INPUT_EVENT
)
&&
(
event
.
EventType
!=
EET_MOUSE_INPUT_EVENT
)
&&
(
event
.
EventType
!=
EET_KEY_INPUT_EVENT
)
&&
(
event
.
EventType
!=
EET_KEY_INPUT_EVENT
)
&&
(
event
.
EventType
!=
EET_CHAR_INPUT_EVENT
)
&&
(
event
.
EventType
!=
EET_GUI_EVENT
||
event
.
GUIEvent
.
Caller
!=
this
))
&&
(
event
.
EventType
!=
EET_GUI_EVENT
||
event
.
GUIEvent
.
Caller
!=
this
))
{
{
ret
=
UserReceiver
->
OnEvent
(
event
);
ret
=
UserReceiver
->
OnEvent
(
event
);
...
@@ -599,6 +600,12 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event)
...
@@ -599,6 +600,12 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event)
}
}
break
;
break
;
case
EET_CHAR_INPUT_EVENT
:
{
if
(
Focus
&&
Focus
->
OnEvent
(
event
))
return
true
;
}
break
;
default:
default:
break
;
break
;
}
// end switch
}
// end switch
...
...
src/CGUIListBox.cpp
View file @
d38e1fdf
...
@@ -303,7 +303,10 @@ bool CGUIListBox::OnEvent(const SEvent& event)
...
@@ -303,7 +303,10 @@ bool CGUIListBox::OnEvent(const SEvent& event)
}
}
return
true
;
return
true
;
}
}
else
if
(
event
.
KeyInput
.
PressedDown
&&
event
.
KeyInput
.
Char
)
break
;
case
EET_CHAR_INPUT_EVENT
:
if
(
event
.
CharInput
.
Char
)
{
{
// change selection based on text as it is typed.
// change selection based on text as it is typed.
u32
now
=
os
::
Timer
::
getTime
();
u32
now
=
os
::
Timer
::
getTime
();
...
@@ -311,16 +314,16 @@ bool CGUIListBox::OnEvent(const SEvent& event)
...
@@ -311,16 +314,16 @@ bool CGUIListBox::OnEvent(const SEvent& event)
if
(
now
-
LastKeyTime
<
500
)
if
(
now
-
LastKeyTime
<
500
)
{
{
// add to key buffer if it isn't a key repeat
// add to key buffer if it isn't a key repeat
if
(
!
(
KeyBuffer
.
size
()
==
1
&&
KeyBuffer
[
0
]
==
event
.
Key
Input
.
Char
))
if
(
!
(
KeyBuffer
.
size
()
==
1
&&
KeyBuffer
[
0
]
==
event
.
Char
Input
.
Char
))
{
{
KeyBuffer
+=
L" "
;
KeyBuffer
+=
L" "
;
KeyBuffer
[
KeyBuffer
.
size
()
-
1
]
=
event
.
Key
Input
.
Char
;
KeyBuffer
[
KeyBuffer
.
size
()
-
1
]
=
event
.
Char
Input
.
Char
;
}
}
}
}
else
else
{
{
KeyBuffer
=
L" "
;
KeyBuffer
=
L" "
;
KeyBuffer
[
0
]
=
event
.
Key
Input
.
Char
;
KeyBuffer
[
0
]
=
event
.
Char
Input
.
Char
;
}
}
LastKeyTime
=
now
;
LastKeyTime
=
now
;
...
...
src/CIrrDeviceConsole.cpp
View file @
d38e1fdf
...
@@ -231,7 +231,10 @@ bool CIrrDeviceConsole::run()
...
@@ -231,7 +231,10 @@ bool CIrrDeviceConsole::run()
e
.
KeyInput
.
Control
=
(
in
.
Event
.
KeyEvent
.
dwControlKeyState
&
(
LEFT_CTRL_PRESSED
|
RIGHT_CTRL_PRESSED
))
!=
0
;
e
.
KeyInput
.
Control
=
(
in
.
Event
.
KeyEvent
.
dwControlKeyState
&
(
LEFT_CTRL_PRESSED
|
RIGHT_CTRL_PRESSED
))
!=
0
;
e
.
KeyInput
.
Shift
=
(
in
.
Event
.
KeyEvent
.
dwControlKeyState
&
SHIFT_PRESSED
)
!=
0
;
e
.
KeyInput
.
Shift
=
(
in
.
Event
.
KeyEvent
.
dwControlKeyState
&
SHIFT_PRESSED
)
!=
0
;
e
.
KeyInput
.
Key
=
EKEY_CODE
(
in
.
Event
.
KeyEvent
.
wVirtualKeyCode
);
e
.
KeyInput
.
Key
=
EKEY_CODE
(
in
.
Event
.
KeyEvent
.
wVirtualKeyCode
);
e
.
KeyInput
.
Char
=
in
.
Event
.
KeyEvent
.
uChar
.
UnicodeChar
;
postEventFromUser
(
e
);
e
.
EventType
=
EET_CHAR_INPUT_EVENT
;
e
.
CharInput
.
Char
=
in
.
Event
.
KeyEvent
.
uChar
.
UnicodeChar
;
postEventFromUser
(
e
);
postEventFromUser
(
e
);
break
;
break
;
}
}
...
...
src/CIrrDeviceLinux.cpp
View file @
d38e1fdf
...
@@ -1042,10 +1042,12 @@ bool CIrrDeviceLinux::run()
...
@@ -1042,10 +1042,12 @@ bool CIrrDeviceLinux::run()
char
buf
[
8
]
=
{
0
};
char
buf
[
8
]
=
{
0
};
XLookupString
(
&
event
.
xkey
,
buf
,
sizeof
(
buf
),
&
mp
.
X11Key
,
NULL
);
XLookupString
(
&
event
.
xkey
,
buf
,
sizeof
(
buf
),
&
mp
.
X11Key
,
NULL
);
irrevent
.
EventType
=
irr
::
EET_CHAR_INPUT_EVENT
;
irrevent
.
CharInput
.
Char
=
irr
::
core
::
stringw
(
buf
).
c_str
();
postEventFromUser
(
irrevent
);
irrevent
.
EventType
=
irr
::
EET_KEY_INPUT_EVENT
;
irrevent
.
EventType
=
irr
::
EET_KEY_INPUT_EVENT
;
irrevent
.
KeyInput
.
PressedDown
=
(
event
.
type
==
KeyPress
);
irrevent
.
KeyInput
.
PressedDown
=
(
event
.
type
==
KeyPress
);
// mbtowc(&irrevent.KeyInput.Char, buf, sizeof(buf));
irrevent
.
KeyInput
.
Char
=
((
wchar_t
*
)(
buf
))[
0
];
irrevent
.
KeyInput
.
Control
=
(
event
.
xkey
.
state
&
ControlMask
)
!=
0
;
irrevent
.
KeyInput
.
Control
=
(
event
.
xkey
.
state
&
ControlMask
)
!=
0
;
irrevent
.
KeyInput
.
Shift
=
(
event
.
xkey
.
state
&
ShiftMask
)
!=
0
;
irrevent
.
KeyInput
.
Shift
=
(
event
.
xkey
.
state
&
ShiftMask
)
!=
0
;
...
...
src/CIrrDeviceSDL.cpp
View file @
d38e1fdf
...
@@ -409,7 +409,6 @@ bool CIrrDeviceSDL::run()
...
@@ -409,7 +409,6 @@ bool CIrrDeviceSDL::run()
}
}
#endif
#endif
irrevent
.
EventType
=
irr
::
EET_KEY_INPUT_EVENT
;
irrevent
.
EventType
=
irr
::
EET_KEY_INPUT_EVENT
;
irrevent
.
KeyInput
.
Char
=
SDL_event
.
key
.
keysym
.
unicode
;
irrevent
.
KeyInput
.
Key
=
key
;
irrevent
.
KeyInput
.
Key
=
key
;
irrevent
.
KeyInput
.
PressedDown
=
(
SDL_event
.
type
==
SDL_KEYDOWN
);
irrevent
.
KeyInput
.
PressedDown
=
(
SDL_event
.
type
==
SDL_KEYDOWN
);
irrevent
.
KeyInput
.
Shift
=
(
SDL_event
.
key
.
keysym
.
mod
&
KMOD_SHIFT
)
!=
0
;
irrevent
.
KeyInput
.
Shift
=
(
SDL_event
.
key
.
keysym
.
mod
&
KMOD_SHIFT
)
!=
0
;
...
@@ -418,6 +417,14 @@ bool CIrrDeviceSDL::run()
...
@@ -418,6 +417,14 @@ bool CIrrDeviceSDL::run()
}
}
break
;
break
;
case
SDL_TEXTINPUT
:
{
irrevent
.
EventType
=
irr
::
EET_CHAR_INPUT_EVENT
;
irrevent
.
CharInput
.
Char
=
irr
::
core
::
stringw
(
SDL_event
.
text
).
c_str
();
postEventFromUser
(
irrevent
);
}
break
;
case
SDL_QUIT
:
case
SDL_QUIT
:
Close
=
true
;
Close
=
true
;
break
;
break
;
...
...
src/CIrrDeviceWin32.cpp
View file @
d38e1fdf
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#include "COSOperator.h"
#include "COSOperator.h"
#include "dimension2d.h"
#include "dimension2d.h"
#include "IGUISpriteBank.h"
#include "IGUISpriteBank.h"
#include "IGUIEnvironment.h"
#include "IGUIElement.h"
#include <winuser.h>
#include <winuser.h>
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
#ifdef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
#ifdef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
...
@@ -28,6 +30,7 @@
...
@@ -28,6 +30,7 @@
#ifdef _MSC_VER
#ifdef _MSC_VER
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "imm32.lib")
#endif
#endif
#else
#else
#ifdef _MSC_VER
#ifdef _MSC_VER
...
@@ -749,6 +752,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -749,6 +752,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return
0
;
return
0
;
}
}
{
dev
=
getDeviceFromHWnd
(
hWnd
);
if
(
dev
)
{
irr
::
gui
::
IGUIElement
*
ele
=
dev
->
getGUIEnvironment
()
?
dev
->
getGUIEnvironment
()
->
getFocus
()
:
0
;
if
(
!
ele
||
(
ele
->
getType
()
!=
irr
::
gui
::
EGUIET_EDIT_BOX
)
||
!
ele
->
isEnabled
())
{
HIMC
hIMC
=
ImmGetContext
(
hWnd
);
if
(
hIMC
)
{
ImmNotifyIME
(
hIMC
,
NI_COMPOSITIONSTR
,
CPS_COMPLETE
,
0
);
ImmReleaseContext
(
hWnd
,
hIMC
);
}
ImmAssociateContextEx
(
hWnd
,
NULL
,
0
);
}
else
ImmAssociateContextEx
(
hWnd
,
NULL
,
IACE_DEFAULT
);
}
}
switch
(
message
)
switch
(
message
)
{
{
case
WM_PAINT
:
case
WM_PAINT
:
...
@@ -762,6 +785,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -762,6 +785,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case
WM_ERASEBKGND
:
case
WM_ERASEBKGND
:
return
0
;
return
0
;
case
WM_CHAR
:
{
if
(
wParam
<
32
||
(
wParam
>
126
&&
wParam
<
160
))
return
0
;
event
.
EventType
=
irr
::
EET_CHAR_INPUT_EVENT
;
event
.
CharInput
.
Char
=
(
wchar_t
)
wParam
;
dev
=
getDeviceFromHWnd
(
hWnd
);
if
(
dev
)
dev
->
postEventFromUser
(
event
);
return
0
;
}
case
WM_SYSKEYDOWN
:
case
WM_SYSKEYDOWN
:
case
WM_SYSKEYUP
:
case
WM_SYSKEYUP
:
case
WM_KEYDOWN
:
case
WM_KEYDOWN
:
...
@@ -773,22 +808,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -773,22 +808,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
event
.
KeyInput
.
Key
=
(
irr
::
EKEY_CODE
)
wParam
;
event
.
KeyInput
.
Key
=
(
irr
::
EKEY_CODE
)
wParam
;
event
.
KeyInput
.
PressedDown
=
(
message
==
WM_KEYDOWN
||
message
==
WM_SYSKEYDOWN
);
event
.
KeyInput
.
PressedDown
=
(
message
==
WM_KEYDOWN
||
message
==
WM_SYSKEYDOWN
);
const
UINT
MY_MAPVK_VSC_TO_VK_EX
=
3
;
// MAPVK_VSC_TO_VK_EX should be in SDK according to MSDN, but isn't in mine.
if
(
event
.
KeyInput
.
Key
==
irr
::
KEY_SHIFT
)
if
(
event
.
KeyInput
.
Key
==
irr
::
KEY_SHIFT
)
{
{
// this will fail on systems before windows NT/2000/XP, not sure _what_ will return there instead.
event
.
KeyInput
.
Key
=
(
irr
::
EKEY_CODE
)
MapVirtualKey
(
((
lParam
>>
16
)
&
255
),
MAPVK_VSC_TO_VK_EX
);
event
.
KeyInput
.
Key
=
(
irr
::
EKEY_CODE
)
MapVirtualKey
(
((
lParam
>>
16
)
&
255
),
MY_MAPVK_VSC_TO_VK_EX
);
}
}
if
(
event
.
KeyInput
.
Key
==
irr
::
KEY_CONTROL
)
if
(
event
.
KeyInput
.
Key
==
irr
::
KEY_CONTROL
)
{
{
event
.
KeyInput
.
Key
=
(
irr
::
EKEY_CODE
)
MapVirtualKey
(
((
lParam
>>
16
)
&
255
),
M
Y_M
APVK_VSC_TO_VK_EX
);
event
.
KeyInput
.
Key
=
(
irr
::
EKEY_CODE
)
MapVirtualKey
(
((
lParam
>>
16
)
&
255
),
MAPVK_VSC_TO_VK_EX
);
// some keyboards will just return LEFT for both - left and right keys. So also check extend bit.
// some keyboards will just return LEFT for both - left and right keys. So also check extend bit.
if
(
lParam
&
0x1000000
)
if
(
lParam
&
0x1000000
)
event
.
KeyInput
.
Key
=
irr
::
KEY_RCONTROL
;
event
.
KeyInput
.
Key
=
irr
::
KEY_RCONTROL
;
}
}
if
(
event
.
KeyInput
.
Key
==
irr
::
KEY_MENU
)
if
(
event
.
KeyInput
.
Key
==
irr
::
KEY_MENU
)
{
{
event
.
KeyInput
.
Key
=
(
irr
::
EKEY_CODE
)
MapVirtualKey
(
((
lParam
>>
16
)
&
255
),
M
Y_M
APVK_VSC_TO_VK_EX
);
event
.
KeyInput
.
Key
=
(
irr
::
EKEY_CODE
)
MapVirtualKey
(
((
lParam
>>
16
)
&
255
),
MAPVK_VSC_TO_VK_EX
);
if
(
lParam
&
0x1000000
)
if
(
lParam
&
0x1000000
)
event
.
KeyInput
.
Key
=
irr
::
KEY_RMENU
;
event
.
KeyInput
.
Key
=
irr
::
KEY_RMENU
;
}
}
...
@@ -798,26 +831,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -798,26 +831,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
event
.
KeyInput
.
Shift
=
((
allKeys
[
VK_SHIFT
]
&
0x80
)
!=
0
);
event
.
KeyInput
.
Shift
=
((
allKeys
[
VK_SHIFT
]
&
0x80
)
!=
0
);
event
.
KeyInput
.
Control
=
((
allKeys
[
VK_CONTROL
]
&
0x80
)
!=
0
);
event
.
KeyInput
.
Control
=
((
allKeys
[
VK_CONTROL
]
&
0x80
)
!=
0
);
// Handle unicode and deadkeys in a way that works since Windows 95 and nt4.0
// Using ToUnicode instead would be shorter, but would to my knowledge not run on 95 and 98.
WORD
keyChars
[
2
];
UINT
scanCode
=
HIWORD
(
lParam
);
int
conversionResult
=
ToAsciiEx
(
wParam
,
scanCode
,
allKeys
,
keyChars
,
0
,
KEYBOARD_INPUT_HKL
);
if
(
conversionResult
==
1
)
{
WORD
unicodeChar
;
MultiByteToWideChar
(
KEYBOARD_INPUT_CODEPAGE
,
MB_PRECOMPOSED
,
// default
(
LPCSTR
)
keyChars
,
sizeof
(
keyChars
),
(
WCHAR
*
)
&
unicodeChar
,
1
);
event
.
KeyInput
.
Char
=
unicodeChar
;
}
else
event
.
KeyInput
.
Char
=
0
;
// allow composing characters like '@' with Alt Gr on non-US keyboards
// allow composing characters like '@' with Alt Gr on non-US keyboards
if
((
allKeys
[
VK_MENU
]
&
0x80
)
!=
0
)
if
((
allKeys
[
VK_MENU
]
&
0x80
)
!=
0
)
event
.
KeyInput
.
Control
=
0
;
event
.
KeyInput
.
Control
=
0
;
...
@@ -826,10 +839,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -826,10 +839,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if
(
dev
)
if
(
dev
)
dev
->
postEventFromUser
(
event
);
dev
->
postEventFromUser
(
event
);
if
(
message
==
WM_SYSKEYDOWN
||
message
==
WM_SYSKEYUP
)
break
;
return
DefWindowProc
(
hWnd
,
message
,
wParam
,
lParam
);
else
return
0
;
}
}
case
WM_SIZE
:
case
WM_SIZE
:
...
@@ -904,6 +914,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -904,6 +914,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
KEYBOARD_INPUT_HKL
=
GetKeyboardLayout
(
0
);
KEYBOARD_INPUT_HKL
=
GetKeyboardLayout
(
0
);
KEYBOARD_INPUT_CODEPAGE
=
LocaleIdToCodepage
(
LOWORD
(
KEYBOARD_INPUT_HKL
)
);
KEYBOARD_INPUT_CODEPAGE
=
LocaleIdToCodepage
(
LOWORD
(
KEYBOARD_INPUT_HKL
)
);
return
0
;
return
0
;
case
WM_IME_STARTCOMPOSITION
:
{
dev
=
getDeviceFromHWnd
(
hWnd
);
irr
::
gui
::
IGUIElement
*
ele
=
dev
->
getGUIEnvironment
()
->
getFocus
();
if
(
!
ele
)
break
;
irr
::
core
::
position2di
pos
=
ele
->
getAbsolutePosition
().
UpperLeftCorner
;
HIMC
hIMC
=
ImmGetContext
(
hWnd
);
COMPOSITIONFORM
CompForm
=
{
CFS_POINT
,
{
pos
.
X
,
pos
.
Y
+
ele
->
getAbsolutePosition
().
getHeight
()
}
};
ImmSetCompositionWindow
(
hIMC
,
&
CompForm
);
ImmReleaseContext
(
hWnd
,
hIMC
);
}
break
;
}
}
return
DefWindowProc
(
hWnd
,
message
,
wParam
,
lParam
);
return
DefWindowProc
(
hWnd
,
message
,
wParam
,
lParam
);
}
}
...
@@ -1797,8 +1821,7 @@ void CIrrDeviceWin32::handleSystemMessages()
...
@@ -1797,8 +1821,7 @@ void CIrrDeviceWin32::handleSystemMessages()
while
(
PeekMessage
(
&
msg
,
NULL
,
0
,
0
,
PM_REMOVE
))
while
(
PeekMessage
(
&
msg
,
NULL
,
0
,
0
,
PM_REMOVE
))
{
{
// No message translation because we don't use WM_CHAR and it would conflict with our
TranslateMessage
(
&
msg
);
// deadkey handling.
if
(
ExternalWindow
&&
msg
.
hwnd
==
HWnd
)
if
(
ExternalWindow
&&
msg
.
hwnd
==
HWnd
)
WndProc
(
HWnd
,
msg
.
message
,
msg
.
wParam
,
msg
.
lParam
);
WndProc
(
HWnd
,
msg
.
message
,
msg
.
wParam
,
msg
.
lParam
);
...
...
src/CIrrDeviceWinCE.cpp
View file @
d38e1fdf
...
@@ -305,7 +305,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
...
@@ -305,7 +305,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
*/
*/
// event.KeyInput.Shift = ((allKeys[VK_SHIFT] & 0x80)!=0);
// event.KeyInput.Shift = ((allKeys[VK_SHIFT] & 0x80)!=0);
// event.KeyInput.Control = ((allKeys[VK_CONTROL] & 0x80)!=0);
// event.KeyInput.Control = ((allKeys[VK_CONTROL] & 0x80)!=0);
// event.KeyInput.Char = (KeyAsc & 0x00ff); //KeyAsc >= 0 ? KeyAsc : 0;
if
(
dev
)
if
(
dev
)
dev
->
postEventFromUser
(
event
);
dev
->
postEventFromUser
(
event
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment