wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
clip.c File Reference
#include "clip.h"
#include <cairo.h>
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <linux/input-event-codes.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <wayland-server-core.h>
#include <wayland-util.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/util/edges.h>
#include "backend/backend.h"
#include "backend/output_config.h"
#include "files.h"
#include "toolkit/toolkit.h"
Include dependency graph for clip.c:

Classes

struct  _wlmaker_clip_t
 
struct  parse_args
 

Functions

static bool _wlmaker_clip_pointer_axis (wlmtk_element_t *element_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr)
 
static bool _wlmaker_clip_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
 
static bool _wlmaker_clip_update_tiles (wlmaker_clip_t *clip_ptr, const struct wlmtk_tile_style *tile_style_ptr)
 
static void _wlmaker_clip_apply_button_state (wlmaker_clip_t *clip_ptr)
 
static bool _wlmaker_clip_update_overlay (wlmaker_clip_t *clip_ptr, const struct wlmtk_tile_style *tile_style_ptr, const wlmaker_config_clip_style_t *clip_style_ptr)
 
static bool _wlmaker_clip_update_image (wlmaker_clip_t *clip_ptr, const struct wlmtk_tile_style *tile_style_ptr)
 
static struct wlr_buffer * _wlmaker_clip_create_tile (const struct wlmtk_tile_style *tile_style_ptr, bool prev_pressed, bool next_pressed)
 
static void _wlmaker_clip_handle_workspace_changed (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_clip_handle_output_layout_change (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_clip_handle_pointer_motion (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_clip_handle_pointer_leave (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_clip_handle_theme_changed (struct wl_listener *listener_ptr, void *data_ptr)
 
wlmaker_clip_twlmaker_clip_create (wlmaker_server_t *server_ptr, bspl_dict_t *state_dict_ptr, const wlmaker_config_style_t *style_ptr)
 
void wlmaker_clip_destroy (wlmaker_clip_t *clip_ptr)
 
static void test_draw_tile (bs_test_t *test_ptr)
 

Variables

static const wlmtk_element_vmt_t _wlmaker_clip_element_vmt
 
static const bspl_enum_desc_t _wlmaker_clip_edges []
 
const bspl_desc_t _wlmaker_clip_desc []
 
static const bs_test_case_t wlmaker_clip_test_cases []
 
const bs_test_set_t wlmaker_clip_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_clip_apply_button_state()

static void _wlmaker_clip_apply_button_state ( wlmaker_clip_t clip_ptr)
static

Updates the button textures, based on current state what's pressed.

◆ _wlmaker_clip_create_tile()

struct wlr_buffer * _wlmaker_clip_create_tile ( const struct wlmtk_tile_style tile_style_ptr,
bool  prev_pressed,
bool  next_pressed 
)
static

Creates a wlr_buffer with texture suitable to show the 'next' and 'prev' buttons in each raised or pressed state.

Parameters
tile_style_ptr
prev_pressed
next_pressed
Returns
A wlr buffer.

◆ _wlmaker_clip_handle_output_layout_change()

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

Handles when output layout changes; Re-computes the output to attach.

◆ _wlmaker_clip_handle_pointer_leave()

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

Handles wlmtk_element_events_t::pointer_leave. Resets buttons.

◆ _wlmaker_clip_handle_pointer_motion()

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

◆ _wlmaker_clip_handle_theme_changed()

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

Event listener: The theme changed. Applies the new style to the clip.

◆ _wlmaker_clip_handle_workspace_changed()

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

Handler for the workspace_changed signal of wlmaker_server_t.

Will redraw the clip contents with the current workspace, and re-map the clip to the new workspace.

Parameters
listener_ptr
data_ptrPoints to the new wlmtk_workspace_t.

◆ _wlmaker_clip_pointer_axis()

bool _wlmaker_clip_pointer_axis ( wlmtk_element_t element_ptr,
struct wlr_pointer_axis_event *  wlr_pointer_axis_event_ptr 
)
static

Implements wlmtk_element_vmt_t::pointer_axis.

Moves to the next or previous workspace, depending on the axis (scroll- wheel) direction.

Parameters
element_ptr
wlr_pointer_axis_event_ptr
Returns
true

◆ _wlmaker_clip_pointer_button()

bool _wlmaker_clip_pointer_button ( wlmtk_element_t element_ptr,
const wlmtk_button_event_t button_event_ptr 
)
static

Implements wlmtk_element_vmt_t::pointer_button.

Checks if the button press is on either 'next' or 'prev' button area, updates visualization if pressed, and switches workspace if needed.

Parameters
element_ptr
button_event_ptr
Returns
true.

◆ _wlmaker_clip_update_image()

bool _wlmaker_clip_update_image ( wlmaker_clip_t clip_ptr,
const struct wlmtk_tile_style tile_style_ptr 
)
static

Updates (reloads) the content image.

◆ _wlmaker_clip_update_overlay()

bool _wlmaker_clip_update_overlay ( wlmaker_clip_t clip_ptr,
const struct wlmtk_tile_style tile_style_ptr,
const wlmaker_config_clip_style_t clip_style_ptr 
)
static

Updates the overlay buffer's content with workspace name and index.

◆ _wlmaker_clip_update_tiles()

bool _wlmaker_clip_update_tiles ( wlmaker_clip_t clip_ptr,
const struct wlmtk_tile_style tile_style_ptr 
)
static

Creates (or updates) the tile buffers for the button states.

Parameters
clip_ptr
tile_style_ptr
Returns
true on success

◆ test_draw_tile()

void test_draw_tile ( bs_test_t *  test_ptr)
static

Tests that the clip tile is drawn correctly.

◆ wlmaker_clip_create()

wlmaker_clip_t * wlmaker_clip_create ( wlmaker_server_t server_ptr,
bspl_dict_t *  state_dict_ptr,
const wlmaker_config_style_t style_ptr 
)

Creates the Clip. Needs the server to be up with workspaces running.

Parameters
server_ptr
state_dict_ptr
style_ptr
Returns
Pointer to the Clip handle, or NULL on error.

◆ wlmaker_clip_destroy()

void wlmaker_clip_destroy ( wlmaker_clip_t clip_ptr)

Destroys the Clip.

Parameters
clip_ptr

Variable Documentation

◆ _wlmaker_clip_desc

const bspl_desc_t _wlmaker_clip_desc[]
Initial value:
= {
BSPL_DESC_ENUM("Edge", true, parse_args,
positioning.edge, positioning.edge,
WLR_EDGE_NONE, _wlmaker_clip_edges),
BSPL_DESC_ENUM("Anchor", true, parse_args,
positioning.anchor, positioning.anchor,
WLR_EDGE_NONE, _wlmaker_clip_edges),
BSPL_DESC_SENTINEL(),
}
static const bspl_enum_desc_t _wlmaker_clip_edges[]
Definition clip.c:155
Definition clip.c:149

Descriptor for the clip's plist.

◆ _wlmaker_clip_edges

const bspl_enum_desc_t _wlmaker_clip_edges[]
static
Initial value:
= {
BSPL_ENUM("TOP", WLR_EDGE_TOP),
BSPL_ENUM("BOTTOM", WLR_EDGE_BOTTOM),
BSPL_ENUM("LEFT", WLR_EDGE_LEFT),
BSPL_ENUM("RIGHT", WLR_EDGE_RIGHT),
BSPL_ENUM_SENTINEL(),
}

Enum descriptor for enum wlr_edges.

◆ _wlmaker_clip_element_vmt

const wlmtk_element_vmt_t _wlmaker_clip_element_vmt
static
Initial value:
= {
.pointer_axis = _wlmaker_clip_pointer_axis,
.pointer_button = _wlmaker_clip_pointer_button,
}
static bool _wlmaker_clip_pointer_axis(wlmtk_element_t *element_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr)
Definition clip.c:390
static bool _wlmaker_clip_pointer_button(wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
Definition clip.c:420

The clip's extension to wlmtk_element_t virtual method table.

◆ wlmaker_clip_test_cases

const bs_test_case_t wlmaker_clip_test_cases[]
static
Initial value:
= {
{ true, "draw_tile", test_draw_tile },
}
static void test_draw_tile(bs_test_t *test_ptr)
Definition clip.c:944

Test cases.

◆ wlmaker_clip_test_set

const bs_test_set_t wlmaker_clip_test_set
Initial value:
= BS_TEST_SET(
true, "clip", wlmaker_clip_test_cases)
static const bs_test_case_t wlmaker_clip_test_cases[]
Definition clip.c:934

Unit test set.