wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
root.c File Reference
#include "root.h"
#include <libbase/libbase.h>
#include <stdlib.h>
#include <wayland-server-protocol.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_scene.h>
#include "desktop.h"
#include "element.h"
#include "input.h"
#include "output_tracker.h"
#include "test.h"
#include "tile.h"
#include "util.h"
#include "window.h"
#include "workspace.h"
Include dependency graph for root.c:

Classes

struct  _wlmtk_root_t
 
struct  wlmtk_root_output_t
 

Functions

static void _wlmtk_root_output_handle_frame (struct wl_listener *listener_ptr, void *data_ptr)
 
static void * _wlmtk_root_output_tracker_create (struct wlr_output *wlr_output_ptr, void *ud_ptr)
 
static void _wlmtk_root_output_tracker_destroy (struct wlr_output *wlr_output_ptr, void *ud_ptr, void *output_ptr)
 
wlmtk_root_twlmtk_root_create (wlmtk_element_t *element_ptr, struct wlr_output_layout *wlr_output_layout_ptr)
 
void wlmtk_root_destroy (wlmtk_root_t *root_ptr)
 
wlmtk_root_events_twlmtk_root_events (wlmtk_root_t *root_ptr)
 
wlmtk_element_twlmtk_root_element (wlmtk_root_t *root_ptr)
 
bool wlmtk_root_pointer_motion (wlmtk_root_t *root_ptr, double x, double y, uint32_t time_msec, wlmtk_pointer_t *pointer_ptr)
 
bool wlmtk_root_pointer_button (wlmtk_root_t *root_ptr, const struct wlr_pointer_button_event *event_ptr, uint32_t modifiers)
 
bool wlmtk_root_pointer_axis (wlmtk_root_t *root_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr)
 
static void test_pointer_button (bs_test_t *test_ptr)
 
static void test_pointer_move (bs_test_t *test_ptr)
 

Variables

static const bs_test_case_t _wlmtk_root_test_cases []
 
const bs_test_set_t wlmtk_root_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

◆ _wlmtk_root_output_handle_frame()

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

Handles frame: Updates layout.

◆ _wlmtk_root_output_tracker_create()

void * _wlmtk_root_output_tracker_create ( struct wlr_output *  wlr_output_ptr,
void *  ud_ptr 
)
static

Ctor for struct wlmtk_root_output.

◆ _wlmtk_root_output_tracker_destroy()

void _wlmtk_root_output_tracker_destroy ( struct wlr_output *  wlr_output_ptr,
void *  ud_ptr,
void *  output_ptr 
)
static

Dtor for struct wlmtk_root_output.

◆ test_pointer_button()

void test_pointer_button ( bs_test_t *  test_ptr)
static

Tests wlmtk_root_pointer_button.

◆ test_pointer_move()

void test_pointer_move ( bs_test_t *  test_ptr)
static

Tests pointer moves. Finicky, because ws switch renders them invisible.

◆ wlmtk_root_create()

wlmtk_root_t * wlmtk_root_create ( wlmtk_element_t element_ptr,
struct wlr_output_layout *  wlr_output_layout_ptr 
)

Creates the root element wrapper.

Parameters
element_ptrThe wrapped element.
wlr_output_layout_ptrwlroots output layout to track output frames on.
Returns
Handle of the root wrapper or NULL on error.

◆ wlmtk_root_destroy()

void wlmtk_root_destroy ( wlmtk_root_t root_ptr)

Destroys the root wrapper.

Parameters
root_ptrRoot wrapper handle.

◆ wlmtk_root_element()

wlmtk_element_t * wlmtk_root_element ( wlmtk_root_t root_ptr)

Gets the wrapped element.

Parameters
root_ptrRoot wrapper handle.
Returns
Pointer to the wrapped wlmtk_element_t.

◆ wlmtk_root_events()

wlmtk_root_events_t * wlmtk_root_events ( wlmtk_root_t root_ptr)

Gets the set of events available in root.

Parameters
root_ptrRoot wrapper handle.
Returns
Pointer to wlmtk_root_events_t.

◆ wlmtk_root_pointer_axis()

bool wlmtk_root_pointer_axis ( wlmtk_root_t root_ptr,
struct wlr_pointer_axis_event *  wlr_pointer_axis_event_ptr 
)

Handles a pointer axis event.

Parameters
root_ptrRoot wrapper handle.
wlr_pointer_axis_event_ptrwlroots axis event pointer.
Returns
Whether the axis event was consumed.

◆ wlmtk_root_pointer_button()

bool wlmtk_root_pointer_button ( wlmtk_root_t root_ptr,
const struct wlr_pointer_button_event *  event_ptr,
uint32_t  modifiers 
)

Handles a button event: Translates to button down/up/click/dblclick events.

Each button activity (button pressed or released) will directly trigger a corresponding BUTTON_DOWN or BUTTON_UP event. Depending on timing and motion, a "released" event may also triccer a CLICK, DOUBLE_CLICK or DRAG event. These events will be forwarded to the event currently having pointer focus.

TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Implement DOUBLE_CLICK and DRAG events, and make it well tested.

Parameters
root_ptrRoot wrapper handle.
event_ptrWayland button event pointer.
modifiersKeyboard modifiers state.
Returns
Whether the button event was consumed.

◆ wlmtk_root_pointer_motion()

bool wlmtk_root_pointer_motion ( wlmtk_root_t root_ptr,
double  x,
double  y,
uint32_t  time_msec,
wlmtk_pointer_t pointer_ptr 
)

Handles a pointer motion event.

Parameters
root_ptrRoot wrapper handle.
xX coordinate of the motion event.
yY coordinate of the motion event.
time_msecTimestamp of the motion event.
pointer_ptrPointer state reference.
Returns
Whether there was an element under the pointer.

Variable Documentation

◆ _wlmtk_root_test_cases

const bs_test_case_t _wlmtk_root_test_cases[]
static
Initial value:
= {
{ true, "pointer_button", test_pointer_button },
{ true, "pointer_move", test_pointer_move },
}
static void test_pointer_button(bs_test_t *test_ptr)
Definition root.c:264
static void test_pointer_move(bs_test_t *test_ptr)
Definition root.c:326

Test cases for the root wrapper.

◆ wlmtk_root_test_set

const bs_test_set_t wlmtk_root_test_set
Initial value:
= BS_TEST_SET(
true, "root", _wlmtk_root_test_cases)
static const bs_test_case_t _wlmtk_root_test_cases[]
Definition root.c:253

Unit test cases.