Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
logkeys
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
logkeys
Commits
3aea01f9
Commit
3aea01f9
authored
Feb 06, 2016
by
Jeff Zohrab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor: move variable to where used.
Code is clearer if the definition is placed where needed.
parent
78321c6e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
logkeys.cc
src/logkeys.cc
+5
-2
No files found.
src/logkeys.cc
View file @
3aea01f9
...
...
@@ -46,7 +46,6 @@
#endif
#define COMMAND_STR_DUMPKEYS ( EXE_DUMPKEYS " -n | " EXE_GREP " '^\\([[:space:]]shift[[:space:]]\\)*\\([[:space:]]altgr[[:space:]]\\)*keycode'" )
#define COMMAND_STR_DEVICES ( EXE_GREP " -E 'Handlers|EV=' /proc/bus/input/devices | " EXE_GREP " -B1 'EV=120013' | " EXE_GREP " -Eo 'event[0-9]+' ")
#define COMMAND_STR_GET_PID ( (std::string(EXE_PS " ax | " EXE_GREP " '") + program_invocation_name + "' | " EXE_GREP " -v grep").c_str() )
#define INPUT_EVENT_PATH "/dev/input/" // standard path
...
...
@@ -331,7 +330,11 @@ void determine_input_device()
setegid
(
65534
);
seteuid
(
65534
);
// extract input number from /proc/bus/input/devices (I don't know how to do it better. If you have an idea, please let me know.)
std
::
stringstream
output
(
execute
(
COMMAND_STR_DEVICES
));
// The compiler automatically concatenates these adjacent strings to a single string.
const
char
*
cmd
=
EXE_GREP
" -E 'Handlers|EV=' /proc/bus/input/devices | "
EXE_GREP
" -B1 'EV=120013' | "
EXE_GREP
" -Eo 'event[0-9]+' "
;
std
::
stringstream
output
(
execute
(
cmd
));
std
::
vector
<
std
::
string
>
results
;
std
::
string
line
;
...
...
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