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 <limits.h>
#include <linux/input-event-codes.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.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 "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_pointer_motion (wlmtk_element_t *element_ptr, wlmtk_pointer_motion_event_t *motion_event_ptr)
 
static void _wlmaker_clip_update_buttons (wlmaker_clip_t *clip_ptr)
 
static void _wlmaker_clip_update_overlay (wlmaker_clip_t *clip_ptr)
 
static struct wlr_buffer * _wlmaker_clip_create_tile (const wlmtk_tile_style_t *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_leave (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 char * lookup_paths []
 
const bs_test_case_t wlmaker_clip_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_clip_create_tile()

struct wlr_buffer * _wlmaker_clip_create_tile ( const wlmtk_tile_style_t 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
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_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_pointer_motion()

bool _wlmaker_clip_pointer_motion ( wlmtk_element_t element_ptr,
wlmtk_pointer_motion_event_t motion_event_ptr 
)
static

Implements wlmtk_element_vmt_t::pointer_motion.

Tracks whether the pointer is within any of the 'Next' or 'Previous' button areas, and triggers an update to the tile's texture.

Parameters
element_ptr
motion_event_ptr
Returns
See wlmtk_element_vmt_t::pointer_motion.

◆ _wlmaker_clip_update_buttons()

static void _wlmaker_clip_update_buttons ( wlmaker_clip_t clip_ptr)
static

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

◆ _wlmaker_clip_update_overlay()

void _wlmaker_clip_update_overlay ( wlmaker_clip_t clip_ptr)
static

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

◆ 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:136
Definition clip.c:130

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,
.pointer_motion = _wlmaker_clip_pointer_motion,
}
static bool _wlmaker_clip_pointer_axis(wlmtk_element_t *element_ptr, struct wlr_pointer_axis_event *wlr_pointer_axis_event_ptr)
Definition clip.c:378
static bool _wlmaker_clip_pointer_motion(wlmtk_element_t *element_ptr, wlmtk_pointer_motion_event_t *motion_event_ptr)
Definition clip.c:467
static bool _wlmaker_clip_pointer_button(wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
Definition clip.c:408

The clip's extension to wlmtk_element_t virtual method table.

◆ lookup_paths

const char* lookup_paths[]
static
Initial value:
= {
"/usr/share/icons/wlmaker",
"/usr/local/share/icons/wlmaker",
NULL
}

Lookup paths for icons – FIXME: de-duplicate this!

◆ wlmaker_clip_test_cases

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

Unit test cases.