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
4ccb7eda
Unverified
Commit
4ccb7eda
authored
Jul 17, 2017
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uli42-pr/fix_keystroke_files' into 3.6.x
Attributes GH PR #487:
https://github.com/ArcticaProject/nx-libs/pull/487
parents
ccd7c696
79001dd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
52 deletions
+35
-52
Keystroke.c
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+35
-52
No files found.
nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
View file @
4ccb7eda
...
...
@@ -253,6 +253,24 @@ static Bool read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystr
return
False
;
}
char
*
checkKeystrokeFile
(
char
*
filename
)
{
if
(
!
filename
)
return
NULL
;
if
(
access
(
filename
,
R_OK
)
==
0
)
{
return
filename
;
}
else
{
#ifdef WARNING
fprintf
(
stderr
,
"Warning: Cannot read keystroke file '%s'.
\n
"
,
filename
);
#endif
return
NULL
;
}
}
/*
* searches a keystroke xml file
*
...
...
@@ -302,63 +320,24 @@ void nxagentInitKeystrokes(Bool force)
envvar
=
"NXAGENT_KEYSTROKEFILE"
;
}
if
(
nxagentKeystrokeFile
&&
access
(
nxagentKeystrokeFile
,
R_OK
)
==
0
)
char
*
homepath
=
NULL
;
char
*
homedir
=
getenv
(
"HOME"
);
if
(
homedir
)
{
if
(
!
(
filename
=
strdup
(
nxagentKeystrokeFile
)))
if
(
!
(
homepath
=
calloc
(
1
,
strlen
(
homedir
)
+
strlen
(
homefile
)
+
1
)))
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
}
}
else
if
(
nxagentKeystrokeFile
)
{
fprintf
(
stderr
,
"Warning: Cannot read keystroke file '%s'.
\n
"
,
nxagentKeystrokeFile
);
if
((
filename
=
getenv
(
envvar
))
&&
access
(
filename
,
R_OK
)
==
0
)
{
if
(
!
(
filename
=
strdup
(
filename
)))
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
}
}
else
{
char
*
homedir
=
getenv
(
"HOME"
);
filename
=
NULL
;
if
(
homedir
)
{
if
(
!
(
filename
=
calloc
(
1
,
strlen
(
homefile
)
+
strlen
(
homedir
)
+
1
)))
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
}
strcpy
(
filename
,
homedir
);
strcpy
(
filename
+
strlen
(
homedir
),
homefile
);
}
if
(
access
(
filename
,
R_OK
)
==
0
)
{
/* empty */
}
else
if
(
access
(
etcfile
,
R_OK
)
==
0
)
{
free
(
filename
);
if
(
!
(
filename
=
strdup
(
etcfile
)))
{
fprintf
(
stderr
,
"malloc failed"
);
exit
(
EXIT_FAILURE
);
}
}
else
{
free
(
filename
);
filename
=
NULL
;
}
}
strcpy
(
homepath
,
homedir
);
strcpy
(
homepath
+
strlen
(
homedir
),
homefile
);
}
/* now we know which file to read, if any */
if
(
filename
)
/* if any of the files can be read we have our candidate */
if
((
filename
=
checkKeystrokeFile
(
nxagentKeystrokeFile
))
||
(
filename
=
checkKeystrokeFile
(
getenv
(
envvar
)))
||
(
filename
=
checkKeystrokeFile
(
homepath
))
||
(
filename
=
checkKeystrokeFile
(
etcfile
)))
{
LIBXML_TEST_VERSION
xmlDoc
*
doc
=
xmlReadFile
(
filename
,
NULL
,
0
);
...
...
@@ -405,9 +384,11 @@ void nxagentInitKeystrokes(Bool force)
map
[
j
].
modifierMask
==
map
[
idx
].
modifierMask
&&
map
[
j
].
modifierAltMeta
==
map
[
idx
].
modifierAltMeta
)
{
#ifdef WARNING
fprintf
(
stderr
,
"Warning: ignoring keystroke '%s' (already in use by '%s')
\n
"
,
nxagentSpecialKeystrokeNames
[
map
[
idx
].
stroke
],
nxagentSpecialKeystrokeNames
[
map
[
j
].
stroke
]);
#endif
store
=
False
;
break
;
}
...
...
@@ -430,13 +411,15 @@ void nxagentInitKeystrokes(Bool force)
xmlFreeDoc
(
doc
);
xmlCleanupParser
();
}
else
#ifdef WARNING
else
/* if (doc) */
{
fprintf
(
stderr
,
"Warning: could not read/parse keystrokes file '%s'
\n
"
,
filename
);
}
free
(
filename
);
#endif
filename
=
NULL
;
}
free
(
homepath
);
if
(
map
==
default_map
)
{
...
...
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