Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
BuffyBox
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
postmarketOS
BuffyBox
Commits
f7278d8b
Commit
f7278d8b
authored
2 years ago
by
Johannes Marbach
Browse files
Options
Downloads
Patches
Plain Diff
Add config option to disable input sources
parent
83628144
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
config.c
+18
-2
18 additions, 2 deletions
config.c
config.h
+14
-0
14 additions, 0 deletions
config.h
indev.c
+16
-7
16 additions, 7 deletions
indev.c
indev.h
+5
-1
5 additions, 1 deletion
indev.h
main.c
+1
-1
1 addition, 1 deletion
main.c
unl0kr.conf
+5
-0
5 additions, 0 deletions
unl0kr.conf
with
59 additions
and
11 deletions
config.c
+
18
−
2
View file @
f7278d8b
...
...
@@ -85,6 +85,9 @@ static void init_opts(ul_config_opts *opts) {
opts
->
textarea
.
bullet
=
LV_SYMBOL_BULLET
;
opts
->
theme
.
default_id
=
UL_THEMES_THEME_BREEZY_DARK
;
opts
->
theme
.
alternate_id
=
UL_THEMES_THEME_BREEZY_LIGHT
;
opts
->
input
.
keyboard
=
true
;
opts
->
input
.
pointer
=
true
;
opts
->
input
.
touchscreen
=
true
;
}
static
void
parse_file
(
const
char
*
path
,
ul_config_opts
*
opts
)
{
...
...
@@ -133,8 +136,7 @@ static int parsing_handler(void* user_data, const char* section, const char* key
if
(
parse_bool
(
value
,
&
(
opts
->
textarea
.
obscured
)))
{
return
1
;
}
}
if
(
strcmp
(
key
,
"bullet"
)
==
0
)
{
}
else
if
(
strcmp
(
key
,
"bullet"
)
==
0
)
{
char
*
bullet
=
strdup
(
value
);
if
(
bullet
)
{
opts
->
textarea
.
bullet
=
bullet
;
...
...
@@ -155,6 +157,20 @@ static int parsing_handler(void* user_data, const char* section, const char* key
return
1
;
}
}
}
else
if
(
strcmp
(
section
,
"input"
)
==
0
)
{
if
(
strcmp
(
key
,
"keyboard"
)
==
0
)
{
if
(
parse_bool
(
value
,
&
(
opts
->
input
.
keyboard
)))
{
return
1
;
}
}
else
if
(
strcmp
(
key
,
"pointer"
)
==
0
)
{
if
(
parse_bool
(
value
,
&
(
opts
->
input
.
pointer
)))
{
return
1
;
}
}
else
if
(
strcmp
(
key
,
"touchscreen"
)
==
0
)
{
if
(
parse_bool
(
value
,
&
(
opts
->
input
.
touchscreen
)))
{
return
1
;
}
}
}
ul_log
(
UL_LOG_LEVEL_ERROR
,
"Ignoring invalid config value
\"
%s
\"
for key
\"
%s
\"
in section
\"
%s
\"
"
,
value
,
key
,
section
);
...
...
This diff is collapsed.
Click to expand it.
config.h
+
14
−
0
View file @
f7278d8b
...
...
@@ -74,6 +74,18 @@ typedef struct {
ul_themes_theme_id_t
alternate_id
;
}
ul_config_opts_theme
;
/**
* Options related to input devices
*/
typedef
struct
{
/* If true and a keyboard device is connected, use it for input */
bool
keyboard
;
/* If true and a pointer device is connected, use it for input */
bool
pointer
;
/* If true and a touchscreen device is connected, use it for input */
bool
touchscreen
;
}
ul_config_opts_input
;
/**
* Options parsed from config file(s)
*/
...
...
@@ -86,6 +98,8 @@ typedef struct {
ul_config_opts_textarea
textarea
;
/* Options related to the theme */
ul_config_opts_theme
theme
;
/* Options related to input devices */
ul_config_opts_input
input
;
}
ul_config_opts
;
/**
...
...
This diff is collapsed.
Click to expand it.
indev.c
+
16
−
7
View file @
f7278d8b
...
...
@@ -154,13 +154,19 @@ static void libinput_read_cb(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) {
* Public functions
*/
void
ul_indev_auto_connect
()
{
auto_connect
(
LIBINPUT_CAPABILITY_KEYBOARD
,
MAX_KEYBOARD_DEVS
,
&
num_keyboard_devs
,
keyboard_devs
,
keyboard_indevs
,
keyboard_indev_drvs
,
keyboard_drv_states
);
auto_connect
(
LIBINPUT_CAPABILITY_POINTER
,
MAX_POINTER_DEVS
,
&
num_pointer_devs
,
pointer_devs
,
pointer_indevs
,
pointer_indev_drvs
,
pointer_drv_states
);
auto_connect
(
LIBINPUT_CAPABILITY_TOUCH
,
MAX_TOUCHSCREEN_DEVS
,
&
num_touchscreen_devs
,
touchscreen_devs
,
touchscreen_indevs
,
touchscreen_indev_drvs
,
touchscreen_drv_states
);
void
ul_indev_auto_connect
(
bool
keyboard
,
bool
pointer
,
bool
touchscreen
)
{
if
(
keyboard
)
{
auto_connect
(
LIBINPUT_CAPABILITY_KEYBOARD
,
MAX_KEYBOARD_DEVS
,
&
num_keyboard_devs
,
keyboard_devs
,
keyboard_indevs
,
keyboard_indev_drvs
,
keyboard_drv_states
);
}
if
(
pointer
)
{
auto_connect
(
LIBINPUT_CAPABILITY_POINTER
,
MAX_POINTER_DEVS
,
&
num_pointer_devs
,
pointer_devs
,
pointer_indevs
,
pointer_indev_drvs
,
pointer_drv_states
);
}
if
(
touchscreen
)
{
auto_connect
(
LIBINPUT_CAPABILITY_TOUCH
,
MAX_TOUCHSCREEN_DEVS
,
&
num_touchscreen_devs
,
touchscreen_devs
,
touchscreen_indevs
,
touchscreen_indev_drvs
,
touchscreen_drv_states
);
}
}
bool
ul_indev_is_keyboard_connected
()
{
...
...
@@ -181,6 +187,9 @@ void ul_indev_set_up_textarea_for_keyboard_input(lv_obj_t *textarea) {
}
void
ul_indev_set_up_mouse_cursor
()
{
if
(
num_pointer_devs
==
0
)
{
return
;
}
lv_obj_t
*
cursor_obj
=
lv_img_create
(
lv_scr_act
());
lv_img_set_src
(
cursor_obj
,
&
ul_cursor_img_dsc
);
for
(
int
i
=
0
;
i
<
num_pointer_devs
;
++
i
)
{
...
...
This diff is collapsed.
Click to expand it.
indev.h
+
5
−
1
View file @
f7278d8b
...
...
@@ -27,8 +27,12 @@
/**
* Auto-connect currently available keyboard, pointer and touchscreen input devices.
*
* @param keyboard if true, auto-connect keyboard devices
* @param pointer if true, auto-connect pointer devices
* @param touchscreen if true, auto-connect touchscreen devices
*/
void
ul_indev_auto_connect
();
void
ul_indev_auto_connect
(
bool
keyboard
,
bool
pointer
,
bool
touchscreen
);
/**
* Check if any keyboard devices are connected.
...
...
This diff is collapsed.
Click to expand it.
main.c
+
1
−
1
View file @
f7278d8b
...
...
@@ -416,7 +416,7 @@ int main(int argc, char *argv[]) {
lv_disp_drv_register
(
&
disp_drv
);
/* Connect input devices */
ul_indev_auto_connect
();
ul_indev_auto_connect
(
conf_opts
.
input
.
keyboard
,
conf_opts
.
input
.
pointer
,
conf_opts
.
input
.
touchscreen
);
ul_indev_set_up_mouse_cursor
();
/* Hide the on-screen keyboard by default if a physical keyboard is connected */
...
...
This diff is collapsed.
Click to expand it.
unl0kr.conf
+
5
−
0
View file @
f7278d8b
...
...
@@ -15,3 +15,8 @@ obscured=true
[
theme
]
default
=
breezy
-
dark
alternate
=
breezy
-
light
#[input]
#keyboard=false
#pointer=false
#touchscreen=false
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