wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
resizebar_area.c File Reference
#include "resizebar_area.h"
#include <cairo.h>
#include <inttypes.h>
#include <libbase/libbase.h>
#include <linux/input-event-codes.h>
#include <stdlib.h>
#include <wlr/interfaces/wlr_buffer.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/util/edges.h>
#include "buffer.h"
#include "gfxbuf.h"
#include "input.h"
#include "primitives.h"
#include "window.h"
Include dependency graph for resizebar_area.c:

Classes

struct  _wlmtk_resizebar_area_t
 

Functions

static void _wlmtk_resizebar_area_element_destroy (wlmtk_element_t *element_ptr)
 
static bool _wlmtk_resizebar_area_element_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
 
static void draw_state (wlmtk_resizebar_area_t *resizebar_area_ptr)
 
static struct wlr_buffer * create_buffer (bs_gfxbuf_t *gfxbuf_ptr, unsigned position, unsigned width, const wlmtk_resizebar_style_t *style_ptr, bool pressed)
 
wlmtk_resizebar_area_twlmtk_resizebar_area_create (wlmtk_window_t *window_ptr, uint32_t edges)
 
void wlmtk_resizebar_area_destroy (wlmtk_resizebar_area_t *resizebar_area_ptr)
 
bool wlmtk_resizebar_area_redraw (wlmtk_resizebar_area_t *resizebar_area_ptr, bs_gfxbuf_t *gfxbuf_ptr, unsigned position, unsigned width, const wlmtk_resizebar_style_t *style_ptr)
 
wlmtk_element_twlmtk_resizebar_area_element (wlmtk_resizebar_area_t *resizebar_area_ptr)
 
static void test_area (bs_test_t *test_ptr)
 

Variables

static const wlmtk_element_vmt_t resizebar_area_element_vmt
 
const bs_test_case_t wlmtk_resizebar_area_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

◆ _wlmtk_resizebar_area_element_destroy()

void _wlmtk_resizebar_area_element_destroy ( wlmtk_element_t element_ptr)
static

Dtor.

◆ _wlmtk_resizebar_area_element_pointer_button()

bool _wlmtk_resizebar_area_element_pointer_button ( wlmtk_element_t element_ptr,
const wlmtk_button_event_t button_event_ptr 
)
static

◆ create_buffer()

struct wlr_buffer * create_buffer ( bs_gfxbuf_t *  gfxbuf_ptr,
unsigned  position,
unsigned  width,
const wlmtk_resizebar_style_t style_ptr,
bool  pressed 
)
static

Creates a resizebar area texture.

Parameters
gfxbuf_ptr
position
width
style_ptr
pressed
Returns
A pointer to a newly allocated struct wlr_buffer.

◆ draw_state()

void draw_state ( wlmtk_resizebar_area_t resizebar_area_ptr)
static

Draws the buffer in current state (released or pressed).

Parameters
resizebar_area_ptr

◆ test_area()

void test_area ( bs_test_t *  test_ptr)
static

Tests the area behaviour.

◆ wlmtk_resizebar_area_create()

wlmtk_resizebar_area_t * wlmtk_resizebar_area_create ( wlmtk_window_t window_ptr,
uint32_t  edges 
)

Creates a resizebar button.

Parameters
window_ptr
edges
Returns
Pointer to the resizebar button.

◆ wlmtk_resizebar_area_destroy()

void wlmtk_resizebar_area_destroy ( wlmtk_resizebar_area_t resizebar_area_ptr)

Destroys the resizebar element.

Parameters
resizebar_area_ptr

◆ wlmtk_resizebar_area_element()

wlmtk_element_t * wlmtk_resizebar_area_element ( wlmtk_resizebar_area_t resizebar_area_ptr)

Returns the button's super_buffer.super_element address.

◆ wlmtk_resizebar_area_redraw()

bool wlmtk_resizebar_area_redraw ( wlmtk_resizebar_area_t resizebar_area_ptr,
bs_gfxbuf_t *  gfxbuf_ptr,
unsigned  position,
unsigned  width,
const wlmtk_resizebar_style_t style_ptr 
)

Redraws the element, with updated position and width.

Parameters
resizebar_area_ptr
gfxbuf_ptr
position
width
style_ptr
Returns
true on success.

Variable Documentation

◆ resizebar_area_element_vmt

const wlmtk_element_vmt_t resizebar_area_element_vmt
static
Initial value:
= {
}
static bool _wlmtk_resizebar_area_element_pointer_button(wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
Definition resizebar_area.c:191
static void _wlmtk_resizebar_area_element_destroy(wlmtk_element_t *element_ptr)
Definition resizebar_area.c:182

Buffer implementation for title of the title bar.

◆ wlmtk_resizebar_area_test_cases

const bs_test_case_t wlmtk_resizebar_area_test_cases[]
Initial value:
= {
{ 1, "area", test_area },
{ 0, NULL, NULL }
}
static void test_area(bs_test_t *test_ptr)
Definition resizebar_area.c:292

Unit test cases.