wlmaker
Loading...
Searching...
No Matches
server.c File Reference
#include "server.h"
#include "config.h"
#include "output.h"
#include "toolkit/toolkit.h"
#include <libbase/libbase.h>
#include <wlr/types/wlr_cursor.h>
Include dependency graph for server.c:

Classes

struct  wlmaker_input_device_t
 
struct  _wlmaker_server_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_output (struct wl_listener *listener_ptr, void *data_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 handle_output_layout_change (struct wl_listener *listener_ptr, void *data_ptr)
 
static void set_extents (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
static void arrange_views (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
static void wlmaker_server_switch_to_workspace (wlmaker_server_t *server_ptr, wlmaker_workspace_t *workspace_ptr)
 
wlmaker_server_twlmaker_server_create (void)
 
void wlmaker_server_destroy (wlmaker_server_t *server_ptr)
 
void wlmaker_server_output_add (wlmaker_server_t *server_ptr, wlmaker_output_t *output_ptr)
 
void wlmaker_server_output_remove (wlmaker_server_t *server_ptr, wlmaker_output_t *output_ptr)
 
wlmaker_server_key_binding_twlmaker_server_bind_key (wlmaker_server_t *server_ptr, xkb_keysym_t key_sym, uint32_t modifiers, wlmaker_server_bind_key_callback_t callback, void *callback_arg_ptr)
 
void wlmaker_server_unbind_key (wlmaker_server_t *server_ptr, wlmaker_server_key_binding_t *key_binding_ptr)
 
bool wlmaker_server_process_key (wlmaker_server_t *server_ptr, xkb_keysym_t key_sym, uint32_t modifiers)
 
wlmaker_workspace_twlmaker_server_get_current_workspace (wlmaker_server_t *server_ptr)
 
void wlmaker_server_switch_to_next_workspace (wlmaker_server_t *server_ptr)
 
void wlmaker_server_switch_to_previous_workspace (wlmaker_server_t *server_ptr)
 
struct wlr_output * wlmaker_server_get_output_at_cursor (wlmaker_server_t *server_ptr)
 

Variables

static const char * seat_name_ptr = "seat0"
 

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

◆ arrange_views()

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

Callback for bs_dllist_for_each to arrange views in a workspace.

Parameters
dlnode_ptr
ud_ptr

◆ 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

◆ handle_new_output()

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

Handler for the new_output signal raised by wlr_backend.

Parameters
listener_ptr
data_ptr

◆ handle_output_layout_change()

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

Signal handler for change event of wlr_output_layout.

Is emitted whenever the output layout changes. For us, this means each workspace should consider re-arranging views suitably.

Parameters
listener_ptr
data_ptrPoints to a struct wlr_output_layout.

◆ 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.

◆ set_extents()

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

Callback for bs_dllist_for_each to set extents of the workspace.

Parameters
dlnode_ptr
ud_ptr

◆ wlmaker_server_bind_key()

wlmaker_server_key_binding_t * wlmaker_server_bind_key ( wlmaker_server_t * server_ptr,
xkb_keysym_t key_sym,
uint32_t modifiers,
wlmaker_server_bind_key_callback_t callback,
void * callback_arg_ptr )

Binds the callback to the specified key and modifiers.

Parameters
server_ptr
key_symThe key to bind. Both upper- and lower-case will be bound!
modifiersModifiers of the bound key.
callbackCallback for when key is pressed.
callback_arg_ptrArgument to pass to |callback|.

◆ wlmaker_server_create()

wlmaker_server_t * wlmaker_server_create ( void )

Creates the server and initializes all needed sub-modules.

Returns
The server handle or NULL on failure. The handle must be freed by calling wlmaker_server_destroy().

◆ 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_current_workspace()

wlmaker_workspace_t * wlmaker_server_get_current_workspace ( wlmaker_server_t * server_ptr)

Returns the currently active workspace.

Parameters
server_ptr
Returns
Pointer to the wlmaker_workspace_t currently active.

◆ 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_output_add()

void wlmaker_server_output_add ( wlmaker_server_t * server_ptr,
wlmaker_output_t * output_ptr )

Adds the output.

Parameters
server_ptr
output_ptr

◆ wlmaker_server_output_remove()

void wlmaker_server_output_remove ( wlmaker_server_t * server_ptr,
wlmaker_output_t * output_ptr )

Removes the output.

Parameters
server_ptr
output_ptr

◆ wlmaker_server_process_key()

bool wlmaker_server_process_key ( wlmaker_server_t * server_ptr,
xkb_keysym_t key_sym,
uint32_t modifiers )

Processes a key press: Looks for matching bindings and runs the callback.

Parameters
server_ptr
key_sym
modifiers
Returns
true, if there was a matching binding; false if not.

◆ wlmaker_server_switch_to_next_workspace()

void wlmaker_server_switch_to_next_workspace ( wlmaker_server_t * server_ptr)

Switches to the next workspace.

Parameters
server_ptr

◆ wlmaker_server_switch_to_previous_workspace()

void wlmaker_server_switch_to_previous_workspace ( wlmaker_server_t * server_ptr)

Switches to the previous workspace.

Parameters
server_ptr

◆ wlmaker_server_switch_to_workspace()

void wlmaker_server_switch_to_workspace ( wlmaker_server_t * server_ptr,
wlmaker_workspace_t * workspace_ptr )
static

Switches the current workspace to workspace_ptr.

Note: workspace_ptr must be contained in workspaces of server_ptr.

Parameters
server_ptr
workspace_ptr

◆ wlmaker_server_unbind_key()

void wlmaker_server_unbind_key ( wlmaker_server_t * server_ptr,
wlmaker_server_key_binding_t * key_binding_ptr )

Releases a previously-bound key binding.

Parameters
server_ptr
key_binding_ptr

Variable Documentation

◆ seat_name_ptr

const char* seat_name_ptr = "seat0"
static

Name of the "seat".