wlmaker
Loading...
Searching...
No Matches
Typedefs | Functions
dblbuf.h File Reference
#include <libbase/libbase.h>
#include <stdbool.h>
Include dependency graph for dblbuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _wlmcl_dblbuf_t wlmcl_dblbuf_t
 
typedef bool(* wlmcl_dblbuf_ready_callback_t) (bs_gfxbuf_t *gfxbuf_ptr, void *ud_ptr)
 

Functions

wlmcl_dblbuf_twlmcl_dblbuf_create (const char *app_id_ptr, struct wl_surface *wl_surface_ptr, struct wl_shm *wl_shm_ptr, unsigned width, unsigned height)
 
void wlmcl_dblbuf_destroy (wlmcl_dblbuf_t *dblbuf_ptr)
 
void wlmcl_dblbuf_register_ready_callback (wlmcl_dblbuf_t *dblbuf_ptr, wlmcl_dblbuf_ready_callback_t callback, void *callback_ud_ptr)
 

Detailed Description

Functions for working with a double buffer on a wayland surface.

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.

Typedef Documentation

◆ wlmcl_dblbuf_ready_callback_t

typedef bool(* wlmcl_dblbuf_ready_callback_t) (bs_gfxbuf_t *gfxbuf_ptr, void *ud_ptr)

Callback that indicates the buffer is ready to draw into.

◆ wlmcl_dblbuf_t

Forward declaration: Double buffer state.

Function Documentation

◆ wlmcl_dblbuf_create()

wlmcl_dblbuf_t * wlmcl_dblbuf_create ( const char *  app_id_ptr,
struct wl_surface *  wl_surface_ptr,
struct wl_shm *  wl_shm_ptr,
unsigned  width,
unsigned  height 
)

Creates a double buffer for the surface with provided dimensions.

Parameters
app_id_ptrApplication ID, used to prefix the name of the shared memory object. Can be NULL.
wl_surface_ptr
wl_shm_ptr
width
height
Returns
Pointer to state of the double buffer, or NULL on error. Call wlmcl_dblbuf_destroy for freeing up the associated resources.

◆ wlmcl_dblbuf_destroy()

void wlmcl_dblbuf_destroy ( wlmcl_dblbuf_t dblbuf_ptr)

Destroys the double buffer.

◆ wlmcl_dblbuf_register_ready_callback()

void wlmcl_dblbuf_register_ready_callback ( wlmcl_dblbuf_t dblbuf_ptr,
wlmcl_dblbuf_ready_callback_t  callback,
void *  callback_ud_ptr 
)

Registers a callback for when a frame can be drawn into the buffer.

The frame can be drawn if (1) it is due, and (2) there is a back buffer available ("released") for drawing into. If these conditions hold true, callback will be called right away. Otherwise, it will be called once these conditions are fulfilled.

The callback will be called only once. If the client wishes further notifications, they must call wlmcl_dblbuf_register_ready_callback again.

The callback must be registered only after the surface is ready. Eg. for an XDG toplevel, after it has received & acknowledged configure.

Parameters
dblbuf_ptr
callbackThe callback function, or NULL to clear the callback.
callback_ud_ptrArgument to use for callback.