Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
fc440f95
Commit
fc440f95
authored
Apr 16, 2010
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor cleanup on Jiang's patch
parent
f9a83415
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
SDL_events.h
include/SDL_events.h
+1
-0
SDL_keyboard.c
src/events/SDL_keyboard.c
+9
-4
SDL_cocoakeyboard.m
src/video/cocoa/SDL_cocoakeyboard.m
+3
-2
No files found.
include/SDL_events.h
View file @
fc440f95
...
...
@@ -139,6 +139,7 @@ typedef struct SDL_TextEditingEvent
{
Uint32
type
;
/**< ::SDL_TEXTEDITING */
Uint32
windowID
;
/**< The window with keyboard focus, if any */
Uint8
which
;
/**< The keyboard device index */
char
text
[
SDL_TEXTEDITINGEVENT_TEXT_SIZE
];
/**< The editing text */
int
start
;
/**< The start cursor of selected editing text */
int
length
;
/**< The length of selected editing text */
...
...
src/events/SDL_keyboard.c
View file @
fc440f95
...
...
@@ -679,8 +679,10 @@ SDL_SetKeyboardFocus(int index, SDL_Window * window)
if
(
keyboard
->
focus
)
{
SDL_SendWindowEvent
(
keyboard
->
focus
,
SDL_WINDOWEVENT_FOCUS_GAINED
,
0
,
0
);
if
(
SDL_EventState
(
SDL_TEXTINPUT
,
SDL_QUERY
))
if
(
SDL_EventState
(
SDL_TEXTINPUT
,
SDL_QUERY
))
{
SDL_StartTextInput
();
}
}
}
...
...
@@ -832,6 +834,7 @@ SDL_SendKeyboardText(int index, const char *text)
if
(
SDL_GetEventState
(
SDL_TEXTINPUT
)
==
SDL_ENABLE
)
{
SDL_Event
event
;
event
.
text
.
type
=
SDL_TEXTINPUT
;
event
.
text
.
windowID
=
keyboard
->
focus
?
keyboard
->
focus
->
id
:
0
;
event
.
text
.
which
=
(
Uint8
)
index
;
SDL_strlcpy
(
event
.
text
.
text
,
text
,
SDL_arraysize
(
event
.
text
.
text
));
event
.
text
.
windowID
=
keyboard
->
focus
->
id
;
...
...
@@ -846,18 +849,20 @@ SDL_SendEditingText(int index, const char *text, int start, int length)
SDL_Keyboard
*
keyboard
=
SDL_GetKeyboard
(
index
);
int
posted
;
if
(
!
keyboard
)
if
(
!
keyboard
)
{
return
0
;
}
/* Post the event, if desired */
posted
=
0
;
if
(
SDL_GetEventState
(
SDL_TEXTEDITING
)
==
SDL_ENABLE
)
{
SDL_Event
event
;
event
.
edit
.
type
=
SDL_TEXTEDITING
;
event
.
edit
.
windowID
=
keyboard
->
focus
?
keyboard
->
focus
->
id
:
0
;
event
.
text
.
which
=
(
Uint8
)
index
;
event
.
edit
.
start
=
start
;
event
.
edit
.
length
=
length
;
SDL_strlcpy
(
event
.
edit
.
text
,
text
,
SDL_arraysize
(
event
.
text
.
text
));
event
.
edit
.
windowID
=
keyboard
->
focus
->
id
;
SDL_strlcpy
(
event
.
edit
.
text
,
text
,
SDL_arraysize
(
event
.
edit
.
text
));
posted
=
(
SDL_PushEvent
(
&
event
)
>
0
);
}
return
(
posted
);
...
...
src/video/cocoa/SDL_cocoakeyboard.m
View file @
fc440f95
...
...
@@ -638,13 +638,14 @@ Cocoa_StartTextInput(_THIS)
* than one copy. When we switched to another window and requesting for
* text input, simply remove the field editor from its superview then add
* it to the front most window's content view */
if
(
!
data
->
fieldEdit
)
if
(
!
data
->
fieldEdit
)
{
data
->
fieldEdit
=
[[
SDLTranslatorResponder
alloc
]
initWithFrame
:
NSMakeRect
(
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
)];
}
[
data
->
fieldEdit
setKeyboard
:
data
->
keyboard
];
if
(
!
[[
data
->
fieldEdit
superview
]
isEqual
:
parentView
])
if
(
!
[[
data
->
fieldEdit
superview
]
isEqual
:
parentView
])
{
// DEBUG_IME(@"add fieldEdit to window contentView");
[
data
->
fieldEdit
removeFromSuperview
];
...
...
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