Compare commits
No commits in common. "dd3f77a0aaa11fca85e271cc86338c454afcb3c4" and "30e0eee1a82df265642cff6d57452ff660f0f2c9" have entirely different histories.
dd3f77a0aa
...
30e0eee1a8
39
.travis.yml
Normal file
39
.travis.yml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
language: c
|
||||||
|
notifications:
|
||||||
|
irc:
|
||||||
|
channels: "irc.janouch.name#dev"
|
||||||
|
use_notice: true
|
||||||
|
skip_join: true
|
||||||
|
template:
|
||||||
|
- "%{repository_name}#%{build_number} on %{branch}: %{message}"
|
||||||
|
- " %{compare_url}"
|
||||||
|
- " %{build_url}"
|
||||||
|
on_success: change
|
||||||
|
on_failure: always
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- secure: "rzavv9NhQeZ3Zn6g9WgabUuTsXG1ncc+dWyXw3ytN15uWa4UelVzjAYvr31XeyXwsqZi3rDRHuz8ooIi1NLeLewozpEdkyakLjZOAnggqCnkF/yw/secuRo8MzweGXAefF+7cR2JYyH/E/PfMfAY8Qb0NnfEV1j7X9GCN2sJcxA="
|
||||||
|
addons:
|
||||||
|
coverity_scan:
|
||||||
|
project:
|
||||||
|
name: "pjanouch/termo"
|
||||||
|
description: "Terminal key input library"
|
||||||
|
notification_email: p.janouch@gmail.com
|
||||||
|
build_command_prepend: "cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON"
|
||||||
|
build_command: "make all demos"
|
||||||
|
branch_pattern: coverity_scan
|
||||||
|
compiler:
|
||||||
|
- clang
|
||||||
|
- gcc
|
||||||
|
before_install:
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
install:
|
||||||
|
- sudo apt-get install -y libncursesw5-dev libglib2.0-dev
|
||||||
|
before_script:
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
script:
|
||||||
|
- cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTING=ON
|
||||||
|
- make all demos
|
||||||
|
- ctest -V
|
||||||
|
- cpack -G DEB
|
@ -49,20 +49,20 @@ set (lib_headers
|
|||||||
|
|
||||||
# Project libraries
|
# Project libraries
|
||||||
# We need ncurses for one of the demos, so we're always looking
|
# We need ncurses for one of the demos, so we're always looking
|
||||||
if (Ncursesw_FOUND)
|
if (NCURSESW_FOUND)
|
||||||
include_directories (${Ncursesw_INCLUDE_DIRS})
|
include_directories (${NCURSESW_INCLUDE_DIRS})
|
||||||
set (curses_libraries ${Ncursesw_LIBRARIES})
|
set (curses_libraries ${NCURSESW_LIBRARIES})
|
||||||
elseif (CURSES_FOUND)
|
elseif (CURSES_FOUND)
|
||||||
include_directories (${CURSES_INCLUDE_DIR})
|
include_directories (${CURSES_INCLUDE_DIR})
|
||||||
set (curses_libraries ${CURSES_LIBRARY})
|
set (curses_libraries ${CURSES_LIBRARY})
|
||||||
endif (Ncursesw_FOUND)
|
endif (NCURSESW_FOUND)
|
||||||
|
|
||||||
if (unibilium_FOUND)
|
if (unibilium_FOUND)
|
||||||
include_directories (${unibilium_INCLUDE_DIRS})
|
include_directories (${unibilium_INCLUDE_DIRS})
|
||||||
set (lib_libraries ${unibilium_LIBRARIES})
|
set (lib_libraries ${unibilium_LIBRARIES})
|
||||||
add_definitions (-DHAVE_UNIBILIUM)
|
add_definitions (-DHAVE_UNIBILIUM)
|
||||||
elseif (curses_libraries)
|
elseif (curses_libraries)
|
||||||
include_directories (${Ncursesw_INCLUDE_DIRS})
|
include_directories (${NCURSESW_INCLUDE_DIRS})
|
||||||
set (lib_libraries ${curses_libraries})
|
set (lib_libraries ${curses_libraries})
|
||||||
else (CURSES_FOUND)
|
else (CURSES_FOUND)
|
||||||
message (SEND_ERROR "Unibilium not found, Curses not found")
|
message (SEND_ERROR "Unibilium not found, Curses not found")
|
||||||
@ -147,7 +147,6 @@ set (project_tests
|
|||||||
30mouse
|
30mouse
|
||||||
31position
|
31position
|
||||||
32modereport
|
32modereport
|
||||||
33focus
|
|
||||||
39csi)
|
39csi)
|
||||||
|
|
||||||
if (BUILD_TESTING)
|
if (BUILD_TESTING)
|
||||||
@ -174,8 +173,8 @@ install (FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
|
|||||||
|
|
||||||
# CPack
|
# CPack
|
||||||
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Terminal key input library")
|
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Terminal key input library")
|
||||||
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
|
set (CPACK_PACKAGE_VENDOR "Premysl Janouch")
|
||||||
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
|
set (CPACK_PACKAGE_CONTACT "Přemysl Janouch <p@janouch.name>")
|
||||||
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||||
set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR})
|
set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR})
|
||||||
set (CPACK_PACKAGE_VERSION_MINOR ${project_VERSION_MINOR})
|
set (CPACK_PACKAGE_VERSION_MINOR ${project_VERSION_MINOR})
|
||||||
|
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
Copyright (c) 2007-2014 Paul Evans <leonerd@leonerd.org.uk>
|
Copyright (c) 2007-2014 Paul Evans <leonerd@leonerd.org.uk>
|
||||||
Copyright (c) 2014-2020 Přemysl Eric Janouch <p@janouch.name>
|
Copyright (c) 2014 Přemysl Janouch <p@janouch.name>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -68,7 +68,7 @@ Bitcoin donations are accepted at: 12r5uEWEgcHC46xd64tt3hHt9EUvYYDHe9
|
|||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
'termo' is based on the 'termkey' library, originally written by Paul Evans
|
'termo' is based on the 'termkey' library, originally written by Paul Evans
|
||||||
<leonerd@leonerd.org.uk>, with additional changes made by Přemysl Eric Janouch
|
<leonerd@leonerd.org.uk>, with additional changes made by Přemysl Janouch
|
||||||
<p@janouch.name>.
|
<p@janouch.name>.
|
||||||
|
|
||||||
You may use the software under the terms of the MIT license, the text of which
|
You may use the software under the terms of the MIT license, the text of which
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
# Public Domain
|
# Public Domain
|
||||||
|
|
||||||
find_package (PkgConfig REQUIRED)
|
find_package (PkgConfig REQUIRED)
|
||||||
pkg_check_modules (Ncursesw QUIET ncursesw)
|
pkg_check_modules (NCURSESW QUIET ncursesw)
|
||||||
|
|
||||||
# OpenBSD doesn't provide a pkg-config file
|
# OpenBSD doesn't provide a pkg-config file
|
||||||
set (required_vars Ncursesw_LIBRARIES)
|
set (required_vars NCURSESW_LIBRARIES)
|
||||||
if (NOT Ncursesw_FOUND)
|
if (NOT NCURSESW_FOUND)
|
||||||
find_library (Ncursesw_LIBRARIES NAMES ncursesw)
|
find_library (NCURSESW_LIBRARIES NAMES ncursesw)
|
||||||
find_path (Ncursesw_INCLUDE_DIRS ncurses.h)
|
find_path (NCURSESW_INCLUDE_DIRS ncurses.h)
|
||||||
list (APPEND required_vars Ncursesw_INCLUDE_DIRS)
|
list (APPEND required_vars NCURSESW_INCLUDE_DIRS)
|
||||||
endif (NOT Ncursesw_FOUND)
|
endif (NOT NCURSESW_FOUND)
|
||||||
|
|
||||||
include (FindPackageHandleStandardArgs)
|
include (FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS (Ncursesw DEFAULT_MSG ${required_vars})
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS (NCURSESW DEFAULT_MSG ${required_vars})
|
||||||
|
|
||||||
mark_as_advanced (Ncursesw_LIBRARIES Ncursesw_INCLUDE_DIRS)
|
mark_as_advanced (NCURSESW_LIBRARIES NCURSESW_INCLUDE_DIRS)
|
||||||
|
30
driver-csi.c
30
driver-csi.c
@ -331,33 +331,6 @@ handle_csi_m (termo_t *tk, termo_key_t *key, int cmd, long *arg, int args)
|
|||||||
return TERMO_RES_NONE;
|
return TERMO_RES_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Handler for CSI I / CSI O focus events
|
|
||||||
//
|
|
||||||
|
|
||||||
static termo_result_t
|
|
||||||
handle_csi_IO (termo_t *tk, termo_key_t *key, int cmd, long *arg, int args)
|
|
||||||
{
|
|
||||||
(void) tk;
|
|
||||||
(void) arg;
|
|
||||||
(void) args;
|
|
||||||
|
|
||||||
switch (cmd &= 0xff)
|
|
||||||
{
|
|
||||||
case 'I':
|
|
||||||
key->type = TERMO_TYPE_FOCUS;
|
|
||||||
key->code.focused = true;
|
|
||||||
return TERMO_RES_KEY;
|
|
||||||
case 'O':
|
|
||||||
key->type = TERMO_TYPE_FOCUS;
|
|
||||||
key->code.focused = false;
|
|
||||||
return TERMO_RES_KEY;
|
|
||||||
default:
|
|
||||||
return TERMO_RES_NONE;
|
|
||||||
}
|
|
||||||
return TERMO_RES_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
termo_result_t
|
termo_result_t
|
||||||
termo_interpret_mouse (termo_t *tk, const termo_key_t *key,
|
termo_interpret_mouse (termo_t *tk, const termo_key_t *key,
|
||||||
termo_mouse_event_t *event, int *button, int *line, int *col)
|
termo_mouse_event_t *event, int *button, int *line, int *col)
|
||||||
@ -698,9 +671,6 @@ register_keys (void)
|
|||||||
csi_handlers['M' - 0x20] = &handle_csi_m;
|
csi_handlers['M' - 0x20] = &handle_csi_m;
|
||||||
csi_handlers['m' - 0x20] = &handle_csi_m;
|
csi_handlers['m' - 0x20] = &handle_csi_m;
|
||||||
|
|
||||||
csi_handlers['I' - 0x20] = &handle_csi_IO;
|
|
||||||
csi_handlers['O' - 0x20] = &handle_csi_IO;
|
|
||||||
|
|
||||||
csi_handlers['R' - 0x20] = &handle_csi_R;
|
csi_handlers['R' - 0x20] = &handle_csi_R;
|
||||||
|
|
||||||
csi_handlers['y' - 0x20] = &handle_csi_y;
|
csi_handlers['y' - 0x20] = &handle_csi_y;
|
||||||
|
7
termo.c
7
termo.c
@ -156,9 +156,6 @@ print_key (termo_t *tk, termo_key_t *key)
|
|||||||
ev, button, line, col);
|
ev, button, line, col);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TERMO_TYPE_FOCUS:
|
|
||||||
fprintf (stderr, "%s\n", key->code.focused ? "Focused" : "Defocused");
|
|
||||||
break;
|
|
||||||
case TERMO_TYPE_POSITION:
|
case TERMO_TYPE_POSITION:
|
||||||
{
|
{
|
||||||
int line, col;
|
int line, col;
|
||||||
@ -1575,8 +1572,6 @@ termo_strfkey_generic (termo_t *tk, char *buffer, size_t len,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TERMO_TYPE_FOCUS:
|
|
||||||
l = snprintf (buffer + pos, len - pos, "Focus(%d)", key->code.focused);
|
|
||||||
case TERMO_TYPE_POSITION:
|
case TERMO_TYPE_POSITION:
|
||||||
l = snprintf (buffer + pos, len - pos, "Position");
|
l = snprintf (buffer + pos, len - pos, "Position");
|
||||||
break;
|
break;
|
||||||
@ -1831,8 +1826,6 @@ termo_keycmp (termo_t *tk,
|
|||||||
return cmp;
|
return cmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TERMO_TYPE_FOCUS:
|
|
||||||
return key1.code.focused - key2.code.focused;
|
|
||||||
case TERMO_TYPE_POSITION:
|
case TERMO_TYPE_POSITION:
|
||||||
{
|
{
|
||||||
int line1, col1, line2, col2;
|
int line1, col1, line2, col2;
|
||||||
|
2
termo.h
2
termo.h
@ -97,7 +97,6 @@ enum termo_type
|
|||||||
TERMO_TYPE_MOUSE,
|
TERMO_TYPE_MOUSE,
|
||||||
TERMO_TYPE_POSITION,
|
TERMO_TYPE_POSITION,
|
||||||
TERMO_TYPE_MODEREPORT,
|
TERMO_TYPE_MODEREPORT,
|
||||||
TERMO_TYPE_FOCUS,
|
|
||||||
// add other recognised types here
|
// add other recognised types here
|
||||||
|
|
||||||
TERMO_TYPE_UNKNOWN_CSI = -1
|
TERMO_TYPE_UNKNOWN_CSI = -1
|
||||||
@ -160,7 +159,6 @@ struct termo_key
|
|||||||
uint32_t codepoint; // TERMO_TYPE_KEY
|
uint32_t codepoint; // TERMO_TYPE_KEY
|
||||||
int number; // TERMO_TYPE_FUNCTION
|
int number; // TERMO_TYPE_FUNCTION
|
||||||
termo_sym_t sym; // TERMO_TYPE_KEYSYM
|
termo_sym_t sym; // TERMO_TYPE_KEYSYM
|
||||||
int focused; // TERMO_TYPE_FOCUS
|
|
||||||
|
|
||||||
// TERMO_TYPE_MODEREPORT
|
// TERMO_TYPE_MODEREPORT
|
||||||
// opaque, see termo_interpret_modereport()
|
// opaque, see termo_interpret_modereport()
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
#include "../termo.h"
|
|
||||||
#include "taplib.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
termo_t *tk;
|
|
||||||
termo_key_t key;
|
|
||||||
|
|
||||||
plan_tests (6);
|
|
||||||
|
|
||||||
tk = termo_new_abstract ("vt100", NULL, 0);
|
|
||||||
|
|
||||||
termo_push_bytes (tk, "\e[I", 3);
|
|
||||||
is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
|
|
||||||
"getkey yields RES_KEY for focus in");
|
|
||||||
is_int (key.type, TERMO_TYPE_FOCUS, "key.type for focus in");
|
|
||||||
is_int (key.code.focused, 1, "focused indicator for focus in");
|
|
||||||
|
|
||||||
termo_push_bytes (tk, "\e[O", 3);
|
|
||||||
is_int (termo_getkey (tk, &key), TERMO_RES_KEY,
|
|
||||||
"getkey yields RES_KEY for focus out");
|
|
||||||
is_int (key.type, TERMO_TYPE_FOCUS, "key.type for focus out");
|
|
||||||
is_int (key.code.focused, 0, "focused indicator for focus out");
|
|
||||||
|
|
||||||
termo_destroy (tk);
|
|
||||||
return exit_status ();
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user