Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
dimbor
nx-libs
Commits
3b62184a
You need to sign in or sign up before continuing.
Commit
3b62184a
authored
Jul 23, 2017
by
Ulrich Sibiller
Committed by
Mike Gabriel
Dec 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keyboard.c: improve creation of keyboard config file
It will now create better working config files. References: ArcticaProject/nx-libs#239 ArcticaProject/nx-libs#368
parent
fb31220f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
Keyboard.c
nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+28
-16
No files found.
nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
View file @
3b62184a
...
@@ -83,7 +83,7 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout,
...
@@ -83,7 +83,7 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout,
static
void
nxagentKeycodeConversionSetup
(
char
*
rules
,
char
*
model
);
static
void
nxagentKeycodeConversionSetup
(
char
*
rules
,
char
*
model
);
void
nxagentWriteKeyboardFile
(
unsigned
int
ruleslen
,
char
*
rules
,
char
*
model
,
char
*
layout
,
char
*
variant
,
char
*
options
);
void
nxagentWriteKeyboardFile
(
char
*
rules
,
char
*
model
,
char
*
layout
,
char
*
variant
,
char
*
options
);
#endif
/* XKB */
#endif
/* XKB */
...
@@ -840,7 +840,7 @@ XkbError:
...
@@ -840,7 +840,7 @@ XkbError:
}
}
#endif
#endif
nxagentWriteKeyboardFile
(
remoterules
len
,
remoterules
,
remotemodel
,
remotelayout
,
remotevariant
,
remoteoptions
);
nxagentWriteKeyboardFile
(
remoterules
,
remotemodel
,
remotelayout
,
remotevariant
,
remoteoptions
);
nxagentKeycodeConversionSetup
(
remoterules
,
remotemodel
);
nxagentKeycodeConversionSetup
(
remoterules
,
remotemodel
);
if
(
remoterules
)
if
(
remoterules
)
...
@@ -1588,10 +1588,32 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout,
...
@@ -1588,10 +1588,32 @@ static int nxagentXkbGetNames(char **rules, char **model, char **layout,
return
n
;
return
n
;
}
}
void
nxagentWriteKeyboardFile
(
unsigned
int
ruleslen
,
char
*
rules
,
char
*
model
,
char
*
layout
,
char
*
variant
,
char
*
options
)
void
writeKeyboardfileData
(
FILE
*
out
,
char
*
rules
,
char
*
model
,
char
*
layout
,
char
*
variant
,
char
*
options
)
{
{
if
(
ruleslen
)
/*
How to set "empty" values with setxkbmap, result of trial and error:
- model and layout: empty strings are accepted by setxkbmap.
- rules: setxkbmap will fail if rules is an empty string
(code will intercept in an earlier stage in that case)
- variant: the variant line must be omitted completely.
- options: prepend value with "," to override, otherwise options will be added.
*/
fprintf
(
out
,
"rules=
\"
%s
\"\n
"
,
rules
);
fprintf
(
out
,
"model=
\"
%s
\"\n
"
,
model
?
model
:
""
);
fprintf
(
out
,
"layout=
\"
%s
\"\n
"
,
layout
?
layout
:
""
);
if
(
variant
&&
variant
[
0
]
!=
'\0'
)
fprintf
(
out
,
"variant=
\"
%s
\"\n
"
,
variant
);
fprintf
(
out
,
"options=
\"
,%s
\"\n
"
,
options
?
options
:
""
);
}
void
nxagentWriteKeyboardFile
(
char
*
rules
,
char
*
model
,
char
*
layout
,
char
*
variant
,
char
*
options
)
{
if
(
rules
&&
rules
[
0
]
!=
'\0'
)
{
{
#ifdef DEBUG
writeKeyboardfileData
(
stderr
,
rules
,
model
,
layout
,
variant
,
options
);
#endif
char
*
sessionpath
=
nxagentGetSessionPath
();
char
*
sessionpath
=
nxagentGetSessionPath
();
if
(
sessionpath
)
if
(
sessionpath
)
{
{
...
@@ -1605,18 +1627,8 @@ void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, c
...
@@ -1605,18 +1627,8 @@ void nxagentWriteKeyboardFile(unsigned int ruleslen, char *rules, char *model, c
free
(
sessionpath
);
free
(
sessionpath
);
if
((
keyboard_file
=
fopen
(
keyboard_file_path
,
"w"
)))
if
((
keyboard_file
=
fopen
(
keyboard_file_path
,
"w"
)))
{
{
if
(
rules
)
writeKeyboardfileData
(
keyboard_file
,
rules
,
model
,
layout
,
variant
,
options
);
fprintf
(
keyboard_file
,
"rules=
\"
%s
\"\n
"
,
rules
[
0
]
==
'\0'
?
","
:
rules
);
if
(
model
)
fprintf
(
keyboard_file
,
"model=
\"
%s
\"\n
"
,
model
[
0
]
==
'\0'
?
","
:
model
);
if
(
layout
)
fprintf
(
keyboard_file
,
"layout=
\"
%s
\"\n
"
,
layout
[
0
]
==
'\0'
?
","
:
layout
);
/* FIXME: this is not correct. We need to match the number of
comma separated values between variant and layout */
if
(
variant
)
fprintf
(
keyboard_file
,
"variant=
\"
%s
\"\n
"
,
variant
[
0
]
==
'\0'
?
","
:
variant
);
if
(
options
)
fprintf
(
keyboard_file
,
"options=
\"
%s
\"\n
"
,
options
[
0
]
==
'\0'
?
","
:
options
);
fclose
(
keyboard_file
);
fclose
(
keyboard_file
);
fprintf
(
stderr
,
"Info: keyboard file created: '%s'
\n
"
,
keyboard_file_path
);
fprintf
(
stderr
,
"Info: keyboard file created: '%s'
\n
"
,
keyboard_file_path
);
}
}
...
...
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