Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
942a70c7
Commit
942a70c7
authored
1 year ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Fix up input so it's always in the current codepage
parent
88cc7fe8
No related branches found
No related tags found
1 merge request
!463
MRC mods by Codefenix (2024-10-20)
Pipeline
#4113
passed
1 year ago
Stage: build
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/conio/sdl_con.c
+11
-3
11 additions, 3 deletions
src/conio/sdl_con.c
src/conio/x_events.c
+4
-2
4 additions, 2 deletions
src/conio/x_events.c
src/syncterm/term.c
+0
-6
0 additions, 6 deletions
src/syncterm/term.c
with
15 additions
and
11 deletions
src/conio/sdl_con.c
+
11
−
3
View file @
942a70c7
...
...
@@ -718,6 +718,14 @@ static void sdl_add_key(unsigned int keyval, struct video_stats *vs)
}
}
static
void
sdl_add_key_uc
(
unsigned
int
keyval
,
struct
video_stats
*
vs
)
{
if
(
keyval
<
128
)
keyval
=
cpchar_from_unicode_cpoint
(
getcodepage
(),
keyval
,
keyval
);
sdl_add_key
(
keyval
,
vs
);
}
/* Called from event thread only */
static
unsigned
int
sdl_get_char_code
(
unsigned
int
keysym
,
unsigned
int
mod
)
{
...
...
@@ -942,11 +950,11 @@ void sdl_video_event_thread(void *data)
||
ev
.
key
.
keysym
.
sym
==
SDLK_KP_PLUS
||
ev
.
key
.
keysym
.
sym
==
SDLK_KP_PERIOD
))
break
;
sdl_add_key
(
sdl_get_char_code
(
ev
.
key
.
keysym
.
sym
,
ev
.
key
.
keysym
.
mod
),
&
cvstat
);
sdl_add_key
_uc
(
sdl_get_char_code
(
ev
.
key
.
keysym
.
sym
,
ev
.
key
.
keysym
.
mod
),
&
cvstat
);
}
else
if
(
!
isprint
(
ev
.
key
.
keysym
.
sym
))
{
if
(
ev
.
key
.
keysym
.
sym
<
128
)
sdl_add_key
(
ev
.
key
.
keysym
.
sym
,
&
cvstat
);
sdl_add_key
_uc
(
ev
.
key
.
keysym
.
sym
,
&
cvstat
);
}
break
;
case
SDL_TEXTINPUT
:
...
...
@@ -954,7 +962,7 @@ void sdl_video_event_thread(void *data)
unsigned
int
charcode
=
sdl_get_char_code
(
last_sym
,
last_mod
&
~
(
KMOD_ALT
));
// If the key is exactly what we would expect, use sdl_get_char_code()
if
(
*
(
uint8_t
*
)
ev
.
text
.
text
==
charcode
)
sdl_add_key
(
sdl_get_char_code
(
last_sym
,
last_mod
),
&
cvstat
);
sdl_add_key
_uc
(
sdl_get_char_code
(
last_sym
,
last_mod
),
&
cvstat
);
else
sdl_add_keys
((
uint8_t
*
)
ev
.
text
.
text
,
&
cvstat
);
}
...
...
This diff is collapsed.
Click to expand it.
src/conio/x_events.c
+
4
−
2
View file @
942a70c7
...
...
@@ -976,8 +976,8 @@ static int x11_event(XEvent *ev)
case
XLookupChars
:
if
(
lus
==
XLookupChars
||
((
ev
->
xkey
.
state
&
(
Mod1Mask
|
ControlMask
))
==
0
))
{
for
(
i
=
0
;
i
<
cnt
;
i
++
)
{
if
(
wbuf
[
i
]
<
12
7
)
ch
=
wbuf
[
i
]
;
if
(
wbuf
[
i
]
<
12
8
)
ch
=
cpchar_from_unicode_cpoint
(
getcodepage
(),
wbuf
[
i
],
wbuf
[
i
])
;
else
ch
=
cpchar_from_unicode_cpoint
(
getcodepage
(),
wbuf
[
i
],
0
);
if
(
ch
)
{
...
...
@@ -1164,6 +1164,8 @@ static int x11_event(XEvent *ev)
}
if
(
scan
!=
0xffff
)
{
uint16_t
key
=
scan
;
if
(
key
<
128
)
key
=
cpchar_from_unicode_cpoint
(
getcodepage
(),
key
,
key
);
write
(
key_pipe
[
1
],
&
key
,
(
scan
&
0xff
)
?
1
:
2
);
}
break
;
...
...
This diff is collapsed.
Click to expand it.
src/syncterm/term.c
+
0
−
6
View file @
942a70c7
...
...
@@ -4244,8 +4244,6 @@ doterm(struct bbslist *bbs)
case
96
:
/* No backtick */
break
;
default:
if
(
key
<
128
)
key
=
cpchar_from_unicode_cpoint
(
getcodepage
(),
key
,
key
);
if
(
key
<
256
)
{
/* ASCII Translation */
if
(
key
<
123
)
{
...
...
@@ -4330,8 +4328,6 @@ doterm(struct bbslist *bbs)
conn_send
(
ch
,
1
,
0
);
break
;
default:
if
(
key
<
128
)
key
=
cpchar_from_unicode_cpoint
(
getcodepage
(),
key
,
key
);
if
(
key
<
256
)
{
ch
[
0
]
=
key
;
conn_send
(
ch
,
1
,
0
);
...
...
@@ -4535,8 +4531,6 @@ doterm(struct bbslist *bbs)
/* FALLTHROUGH to default */
default:
if
(
key
<
128
)
key
=
cpchar_from_unicode_cpoint
(
getcodepage
(),
key
,
key
);
if
((
key
<
256
)
&&
(
key
>=
0
))
{
ch
[
0
]
=
key
;
conn_send
(
ch
,
1
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment