wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
server.c File Reference
#include "server.h"
#include <inttypes.h>
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <linux/input-event-codes.h>
#include <stdlib.h>
#include <wayland-server-protocol.h>
#include <wayland-util.h>
#include <xkbcommon/xkbcommon-keysyms.h>
#include <wlr/backend.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_scene.h>
#include "keyboard.h"
#include "toolkit/toolkit.h"
Include dependency graph for server.c:

Classes

struct  wlmaker_input_device_t
 
struct  _wlmaker_key_binding_t
 

Functions

static bool register_input_device (wlmaker_server_t *server_ptr, struct wlr_input_device *wlr_input_device_ptr, void *handle_ptr)
 
static void handle_new_input_device (struct wl_listener *listener_ptr, void *data_ptr)
 
static void handle_destroy_input_device (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_server_unclaimed_button_event_handler (struct wl_listener *listener_ptr, void *data_ptr)
 
wlmaker_server_twlmaker_server_create (bspl_dict_t *config_dict_ptr, const wlmaker_server_options_t *options_ptr)
 
void wlmaker_server_destroy (wlmaker_server_t *server_ptr)
 
void wlmaker_server_activate_task_list (wlmaker_server_t *server_ptr)
 
void wlmaker_server_deactivate_task_list (wlmaker_server_t *server_ptr)
 
struct wlr_output * wlmaker_server_get_output_at_cursor (wlmaker_server_t *server_ptr)
 
wlmaker_key_binding_twlmaker_server_bind_key (wlmaker_server_t *server_ptr, const wlmaker_key_combo_t *key_combo_ptr, wlmaker_keybinding_callback_t callback)
 
void wlmaker_server_unbind_key (wlmaker_server_t *server_ptr, wlmaker_key_binding_t *key_binding_ptr)
 
bool wlmaker_keyboard_process_bindings (wlmaker_server_t *server_ptr, xkb_keysym_t keysym, uint32_t modifiers)
 
static void test_bind (bs_test_t *test_ptr)
 
bool test_binding_callback (const wlmaker_key_combo_t *key_combo_ptr)
 

Variables

static const char * seat_name_ptr = "seat0"
 
const uint32_t wlmaker_modifier_default_mask
 
const bs_test_case_t wlmaker_server_test_cases []
 

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_server_unclaimed_button_event_handler()

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

Handles unclaimed button events: Right 'down' opens root menu.

◆ handle_destroy_input_device()

void 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

◆ handle_new_input_device()

void 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

◆ register_input_device()

bool register_input_device ( wlmaker_server_t server_ptr,
struct wlr_input_device *  wlr_input_device_ptr,
void *  handle_ptr 
)
static

Registers the input device at |handle_ptr| with |server_ptr|.

Parameters
server_ptr
wlr_input_device_ptr
handle_ptr
Returns
true on success.

◆ test_bind()

void test_bind ( bs_test_t *  test_ptr)
static

Tests key bindings.

◆ test_binding_callback()

bool test_binding_callback ( const wlmaker_key_combo_t key_combo_ptr)

Test helper: Callback for a keybinding.

◆ wlmaker_keyboard_process_bindings()

bool wlmaker_keyboard_process_bindings ( wlmaker_server_t server_ptr,
xkb_keysym_t  keysym,
uint32_t  modifiers 
)

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

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

◆ wlmaker_server_activate_task_list()

void wlmaker_server_activate_task_list ( wlmaker_server_t server_ptr)

Activates the task list.

Parameters
server_ptr

◆ wlmaker_server_bind_key()

wlmaker_key_binding_t * wlmaker_server_bind_key ( wlmaker_server_t server_ptr,
const wlmaker_key_combo_t key_combo_ptr,
wlmaker_keybinding_callback_t  callback 
)

Binds a particular key to a callback.

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

◆ wlmaker_server_create()

wlmaker_server_t * wlmaker_server_create ( bspl_dict_t *  config_dict_ptr,
const wlmaker_server_options_t options_ptr 
)

Creates the server and initializes all needed sub-modules.

Parameters
config_dict_ptrConfiguration, as dictionary object. The server will keep a reference on it until destroyed.
options_ptrOptions for the server. The server expects the pointed area to outlive the server.
Returns
The server handle or NULL on failure. The handle must be freed by calling wlmaker_server_destroy().

◆ wlmaker_server_deactivate_task_list()

void wlmaker_server_deactivate_task_list ( wlmaker_server_t server_ptr)

De-activates the task list.

Parameters
server_ptr

◆ wlmaker_server_destroy()

void wlmaker_server_destroy ( wlmaker_server_t server_ptr)

Destroys the server handle, as created by wlmaker_server_create().

Parameters
server_ptr

◆ wlmaker_server_get_output_at_cursor()

struct wlr_output * wlmaker_server_get_output_at_cursor ( wlmaker_server_t server_ptr)

Looks up which output serves the current cursor coordinates and returns that.

Parameters
server_ptr
Returns
Pointer to the output at the seat's cursor position.

◆ wlmaker_server_unbind_key()

void wlmaker_server_unbind_key ( wlmaker_server_t server_ptr,
wlmaker_key_binding_t key_binding_ptr 
)

Releases a key binding.

See also
wlmaker_bind_key.
Parameters
server_ptr
key_binding_ptr

Variable Documentation

◆ seat_name_ptr

const char* seat_name_ptr = "seat0"
static

Name of the "seat".

◆ wlmaker_modifier_default_mask

const uint32_t wlmaker_modifier_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.

◆ wlmaker_server_test_cases

const bs_test_case_t wlmaker_server_test_cases[]
Initial value:
= {
{ 1, "bind", test_bind },
{ 0, NULL, NULL }
}
static void test_bind(bs_test_t *test_ptr)
Definition server.c:664

Test cases for the server.