wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
keyboard.c File Reference
#include "keyboard.h"
#include <ctype.h>
#include <ini.h>
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wayland-server-core.h>
#include <wayland-server-protocol.h>
#include <wayland-util.h>
#include <wlr/types/wlr_keyboard.h>
#include <xkbcommon/xkbcommon.h>
#include "idle.h"
#include "server.h"
#include "toolkit/toolkit.h"
Include dependency graph for keyboard.c:

Classes

struct  _wlmaker_keyboard_t
 

Functions

static bspl_dict_t * _wlmaker_keyboard_populate_rules (bspl_dict_t *dict_ptr, struct xkb_rule_names *rules_ptr)
 
static bool _wlmaker_keyboard_populate_repeat (bspl_dict_t *dict_ptr, int32_t *rate_ptr, int32_t *delay_ptr)
 
static int _wlmaker_keyboard_config_ini_handler (void *user_ptr, const char *section_ptr, const char *name_ptr, const char *value_ptr)
 
static void handle_key (struct wl_listener *listener_ptr, void *data_ptr)
 
static void handle_modifiers (struct wl_listener *listener_ptr, void *data_ptr)
 
wlmaker_keyboard_twlmaker_keyboard_create (wlmaker_server_t *server_ptr, struct wlr_keyboard *wlr_keyboard_ptr, struct wlr_seat *wlr_seat_ptr)
 
void wlmaker_keyboard_destroy (wlmaker_keyboard_t *keyboard_ptr)
 
static void _wlmaker_keyboard_test_rmlvo (bs_test_t *test_ptr)
 
static void _wlmaker_keyboard_test_keyboard_file (bs_test_t *test_ptr)
 

Variables

static const bs_test_case_t wlmaker_keyboard_test_cases []
 
const bs_test_set_t wlmaker_keyboard_test_set
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ _wlmaker_keyboard_config_ini_handler()

int _wlmaker_keyboard_config_ini_handler ( void *  user_ptr,
const char *  section_ptr,
const char *  name_ptr,
const char *  value_ptr 
)
static

inih parser callback. Fills XKB config file values into the dict.

Parameters
user_ptrPoints to a bspl_dict_t.
section_ptr
name_ptr
value_ptr
Returns
0 on success.

◆ _wlmaker_keyboard_populate_repeat()

bool _wlmaker_keyboard_populate_repeat ( bspl_dict_t *  dict_ptr,
int32_t *  rate_ptr,
int32_t *  delay_ptr 
)
static

Retrieves and converts the 'Repeat' parameters from the config dict.

Parameters
dict_ptr
rate_ptr
delay_ptr
Returns
true on success.

◆ _wlmaker_keyboard_populate_rules()

bspl_dict_t * _wlmaker_keyboard_populate_rules ( bspl_dict_t *  dict_ptr,
struct xkb_rule_names *  rules_ptr 
)
static

Populates the XKB rules struct from the config dict.

Parameters
dict_ptr
rules_ptr
Returns
A referenced bspl_dict_t holding rules details, or NULL on error.

◆ _wlmaker_keyboard_test_keyboard_file()

void _wlmaker_keyboard_test_keyboard_file ( bs_test_t *  test_ptr)
static

Tests keyboard rules are loaded from XKB configuration file.

◆ _wlmaker_keyboard_test_rmlvo()

void _wlmaker_keyboard_test_rmlvo ( bs_test_t *  test_ptr)
static

Tests keyboard rules are loaded from a given RMLVO dict.

◆ handle_key()

void handle_key ( struct wl_listener *  listener_ptr,
void *  data_ptr 
)
static

Handles key signals, ie. key presses.

Parameters
listener_ptr
data_ptrPoints to a wlr_keyboard_key_event.

◆ handle_modifiers()

void handle_modifiers ( struct wl_listener *  listener_ptr,
void *  data_ptr 
)
static

Handles modifiers signals, ie. updates to the modifiers.

Parameters
listener_ptr
data_ptrPoints to wlr_keyboard.

◆ wlmaker_keyboard_create()

wlmaker_keyboard_t * wlmaker_keyboard_create ( wlmaker_server_t server_ptr,
struct wlr_keyboard *  wlr_keyboard_ptr,
struct wlr_seat *  wlr_seat_ptr 
)

Creates a handle for a registered keyboard.

Parameters
server_ptr
wlr_keyboard_ptr
wlr_seat_ptr
Returns
The handle or NULL on error. Free via wlmaker_keyboard_destroy().

◆ wlmaker_keyboard_destroy()

void wlmaker_keyboard_destroy ( wlmaker_keyboard_t keyboard_ptr)

Destroys the keyboard handle.

Parameters
keyboard_ptr

Variable Documentation

◆ wlmaker_keyboard_test_cases

const bs_test_case_t wlmaker_keyboard_test_cases[]
static
Initial value:
= {
{ true, "rmlvo", _wlmaker_keyboard_test_rmlvo },
{ true, "keyboard_file", _wlmaker_keyboard_test_keyboard_file },
}
static void _wlmaker_keyboard_test_keyboard_file(bs_test_t *test_ptr)
Definition keyboard.c:487
static void _wlmaker_keyboard_test_rmlvo(bs_test_t *test_ptr)
Definition keyboard.c:466

Unit test cases.

◆ wlmaker_keyboard_test_set

const bs_test_set_t wlmaker_keyboard_test_set
Initial value:
= BS_TEST_SET(
true, "keyboard", wlmaker_keyboard_test_cases)
static const bs_test_case_t wlmaker_keyboard_test_cases[]
Definition keyboard.c:455

Unit test set for wlmaker_keyboard_t.