wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
manager.c File Reference
#include "manager.h"
#include <inttypes.h>
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <stdlib.h>
#include <toolkit/toolkit.h>
#include <wayland-server-protocol.h>
#include <wlr/backend.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_seat.h>
#include <xkbcommon/xkbcommon-keysyms.h>
#include "cursor.h"
#include "keyboard.h"
#include "pointer.h"
Include dependency graph for manager.c:

Classes

struct  _wlmim_t
 
struct  wlmim_device
 
struct  _wlmim_keybinding_t
 
struct  _wlmim_process_arg
 

Functions

static void _wlmim_handle_new_input_device (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmim_handle_destroy_input_device (struct wl_listener *listener_ptr, void *data_ptr)
 
static bool _wlmim_device_register (wlmim_t *input_manager_ptr, struct wlr_input_device *wlr_input_device_ptr, void *handle_ptr)
 
static void _wlmim_device_unregister (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
static void _wlmim_device_update_capabilities (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
static bool _wlmim_process_keybinding (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
static void _wlmim_unbind_node (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
wlmim_twlmim_input_manager_create (struct wlr_backend *wlr_backend_ptr, struct wlr_output_layout *wlr_output_layout_ptr, struct wlr_seat *wlr_seat_ptr, bspl_dict_t *config_dict_ptr, const struct wlmim_cursor_style *cursor_style_ptr, wlmtk_root_t *root_ptr)
 
void wlmim_input_manager_destroy (wlmim_t *input_manager_ptr)
 
struct wlmim_eventswlmim_events (wlmim_t *input_manager_ptr)
 
struct wlr_cursor * wlmim_wlr_cursor (wlmim_t *input_manager_ptr)
 
void wlmim_report_activity (wlmim_t *input_manager_ptr)
 
void wlmim_set_keyboard_group_index (wlmim_t *input_manager_ptr, uint32_t index)
 
uint32_t wlmim_get_keyboard_group_index (wlmim_t *input_manager_ptr)
 
wlmim_keybinding_twlmim_bind_key (wlmim_t *input_manager_ptr, const struct wlmim_keybinding_combo *keybinding_combo_ptr, wlmim_keybinding_callback_t callback)
 
void wlmim_unbind_key (wlmim_t *input_manager_ptr, wlmim_keybinding_t *keybinding_ptr)
 
bool wlmim_process_key (wlmim_t *im_ptr, xkb_keysym_t keysym, uint32_t modifiers)
 
static void _wlmim_test_bind (bs_test_t *test_ptr)
 
bool _wlmim_test_binding_callback (const struct wlmim_keybinding_combo *keybinding_combo_ptr)
 

Variables

const uint32_t wlmim_modifiers_default_mask
 
static const bs_test_case_t _wlmim_test_cases []
 
const bs_test_set_t wlmim_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

◆ _wlmim_device_register()

bool _wlmim_device_register ( wlmim_t input_manager_ptr,
struct wlr_input_device *  wlr_input_device_ptr,
void *  handle_ptr 
)
static

Creates and registers the device node.

Parameters
input_manager_ptr
wlr_input_device_ptr
handle_ptr
Returns
true on success.

◆ _wlmim_device_unregister()

void _wlmim_device_unregister ( bs_dllist_node_t *  dlnode_ptr,
void *  ud_ptr 
)
static

Unregisters and destroys the device node.

Parameters
dlnode_ptr
ud_ptr

◆ _wlmim_device_update_capabilities()

void _wlmim_device_update_capabilities ( bs_dllist_node_t *  dlnode_ptr,
void *  ud_ptr 
)
static

Updates the capabilities bitmask. Iterator for bs_dllist_for_each.

Parameters
dlnode_ptr
ud_ptrPoints to a uint32_t capabilities bitmask.

◆ _wlmim_handle_destroy_input_device()

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

Handler for the destroy signal raised by wlr_input_device.

Parameters
listener_ptr
data_ptr

◆ _wlmim_handle_new_input_device()

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

Handler for the new_input signal raised by wlr_backend.

Parameters
listener_ptr
data_ptr

◆ _wlmim_process_keybinding()

bool _wlmim_process_keybinding ( bs_dllist_node_t *  dlnode_ptr,
void *  ud_ptr 
)
static

Process one keybinding, as iterator to bs_dllist_all.

Parameters
dlnode_ptr
ud_ptr
Returns
true if the keybinding matched, and the callback returned true.

◆ _wlmim_test_bind()

void _wlmim_test_bind ( bs_test_t *  test_ptr)
static

Tests key bindings.

◆ _wlmim_test_binding_callback()

bool _wlmim_test_binding_callback ( const struct wlmim_keybinding_combo keybinding_combo_ptr)

Test helper: Callback for a keybinding.

◆ _wlmim_unbind_node()

void _wlmim_unbind_node ( bs_dllist_node_t *  dlnode_ptr,
void *  ud_ptr 
)
static

Unbinds keybinding at the node, as iterator to bs_dllist_for_each.

◆ wlmim_bind_key()

wlmim_keybinding_t * wlmim_bind_key ( wlmim_t input_manager_ptr,
const struct wlmim_keybinding_combo key_combo_ptr,
wlmim_keybinding_callback_t  callback 
)

Binds a particular key combination to a callback.

Parameters
input_manager_ptr
key_combo_ptr
callback
Returns
The key binding handle or NULL on error.

◆ wlmim_events()

struct wlmim_events * wlmim_events ( wlmim_t input_manager_ptr)
Returns
Pointer to wlmim_t::events.

◆ wlmim_get_keyboard_group_index()

uint32_t wlmim_get_keyboard_group_index ( wlmim_t input_manager_ptr)

◆ wlmim_input_manager_create()

wlmim_t * wlmim_input_manager_create ( struct wlr_backend *  wlr_backend_ptr,
struct wlr_output_layout *  wlr_output_layout_ptr,
struct wlr_seat *  wlr_seat_ptr,
bspl_dict_t *  config_dict_ptr,
const struct wlmim_cursor_style cursor_style_ptr,
wlmtk_root_t root_ptr 
)

Creates an input manager: Registers input devices and ensures event routing will be set up as desired.

Parameters
wlr_backend_ptr
wlr_output_layout_ptr
wlr_seat_ptr
config_dict_ptr
cursor_style_ptr
root_ptr
Returns
Pointer to the input manager handle.

◆ wlmim_input_manager_destroy()

void wlmim_input_manager_destroy ( wlmim_t input_manager_ptr)

Destroys the input manager.

Parameters
input_manager_ptr

◆ wlmim_process_key()

bool wlmim_process_key ( wlmim_t input_manager_ptr,
xkb_keysym_t  keysym,
uint32_t  modifiers 
)

Processes key combo: Call back if a matching binding is found.

Parameters
input_manager_ptr
keysym
modifiers
Returns
true if a binding was found AND the callback returned true.

◆ wlmim_report_activity()

void wlmim_report_activity ( wlmim_t input_manager_ptr)

Reports input activity. Used to reset idle timers.

Parameters
input_manager_ptr

◆ wlmim_set_keyboard_group_index()

void wlmim_set_keyboard_group_index ( wlmim_t input_manager_ptr,
uint32_t  index 
)

◆ wlmim_unbind_key()

void wlmim_unbind_key ( wlmim_t input_manager_ptr,
wlmim_keybinding_t keybinding_ptr 
)

Releases a key binding.

See also
wlmim_bind_key.
Parameters
input_manager_ptr
keybinding_ptr

◆ wlmim_wlr_cursor()

struct wlr_cursor * wlmim_wlr_cursor ( wlmim_t input_manager_ptr)
Returns
Pointer to struct wlr_cursor of wlmim_t::cursor_ptr.

Variable Documentation

◆ _wlmim_test_cases

const bs_test_case_t _wlmim_test_cases[]
static
Initial value:
= {
{ true, "bind", _wlmim_test_bind },
}
static void _wlmim_test_bind(bs_test_t *test_ptr)
Definition manager.c:551

Test cases for the input manager.

◆ wlmim_modifiers_default_mask

const uint32_t wlmim_modifiers_default_mask
Initial value:
= (
WLR_MODIFIER_SHIFT |
WLR_MODIFIER_CTRL |
WLR_MODIFIER_ALT |
WLR_MODIFIER_MOD2 |
WLR_MODIFIER_MOD3 |
WLR_MODIFIER_LOGO |
WLR_MODIFIER_MOD5)

All modifiers to use by default.

◆ wlmim_test_set

const bs_test_set_t wlmim_test_set
Initial value:
= BS_TEST_SET(
true, "server", _wlmim_test_cases)
static const bs_test_case_t _wlmim_test_cases[]
Definition manager.c:535

Unit test set.