wlmaker
Loading...
Searching...
No Matches
Functions | Variables
wlmeyes.c File Reference
#include <cairo.h>
#include <libbase/libbase.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <wayland-server-core.h>
#include <wayland-util.h>
#include <xkbcommon/xkbcommon-keysyms.h>
#include <xkbcommon/xkbcommon.h>
#include "wlclient/xdg_toplevel.h"
#include "wlclient/wlclient.h"
#include "wlclient/icon.h"
#include "wlclient/dblbuf.h"
Include dependency graph for wlmeyes.c:

Functions

static void _handle_key (struct wl_listener *listener_ptr, void *data_ptr)
 
static double sqr (double x)
 
void _draw_around (cairo_t *cairo_ptr, double x, double y, int width, int height)
 
void _draw_pupil (cairo_t *cairo_ptr, double pointer_x, double pointer_y, double px, double py, double w, double h, int width, int height)
 
static bool _callback (bs_gfxbuf_t *gfxbuf_ptr, void *ud_ptr)
 
static void _position_callback (double x, double y, void *ud_ptr)
 
static bool _icon_callback (bs_gfxbuf_t *gfxbuf_ptr, void *ud_ptr)
 
static void _icon_position_callback (double x, double y, void *ud_ptr)
 
static void _handle_toplevel_configure (void *ud_ptr, uint32_t width, uint32_t height)
 
static void _handle_icon_configure (void *ud_ptr, uint32_t width, uint32_t height)
 
int main (int argc, const char **argv)
 

Variables

wlmcl_client_twlclient_ptr
 
static wlmcl_dblbuf_ttoplevel_dblbuf_ptr
 
static wlmcl_dblbuf_ticon_dblbuf_ptr
 
static struct wl_listener _key_listener
 
double pointer_x
 
double pointer_y
 
double icon_pointer_x
 
double icon_pointer_y
 
uint32_t toplevel_width
 
uint32_t toplevel_height
 
static const bs_arg_t _wlmeyes_args []
 

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

◆ _callback()

static bool _callback ( bs_gfxbuf_t *  gfxbuf_ptr,
void *  ud_ptr 
)
static

Draws something into the buffer.

◆ _draw_around()

void _draw_around ( cairo_t *  cairo_ptr,
double  x,
double  y,
int  width,
int  height 
)

Draws the white + border of the eye.

◆ _draw_pupil()

void _draw_pupil ( cairo_t *  cairo_ptr,
double  pointer_x,
double  pointer_y,
double  px,
double  py,
double  w,
double  h,
int  width,
int  height 
)

Draws the eyes' pupil, in relative coordinates.

◆ _handle_icon_configure()

static void _handle_icon_configure ( void *  ud_ptr,
uint32_t  width,
uint32_t  height 
)
static

Handles configure events for the icon.

◆ _handle_key()

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

Handles key events.

◆ _handle_toplevel_configure()

static void _handle_toplevel_configure ( void *  ud_ptr,
uint32_t  width,
uint32_t  height 
)
static

Handles configure events for the toplevel.

◆ _icon_callback()

static bool _icon_callback ( bs_gfxbuf_t *  gfxbuf_ptr,
void *  ud_ptr 
)
static

Called when the icon is ready to refresh.

◆ _icon_position_callback()

static void _icon_position_callback ( double  x,
double  y,
void *  ud_ptr 
)
static

Updates pointer position for the icon.

◆ _position_callback()

static void _position_callback ( double  x,
double  y,
void *  ud_ptr 
)
static

Updates pointer position.

◆ main()

int main ( int  argc,
const char **  argv 
)

Main program.

◆ sqr()

static double sqr ( double  x)
inlinestatic
Returns
x * x.

Variable Documentation

◆ _key_listener

struct wl_listener _key_listener
static

Listener for key events.

◆ _wlmeyes_args

const bs_arg_t _wlmeyes_args[]
static
Initial value:
= {
BS_ARG_UINT32(
"width",
"Desired width of the XDG toplevel window, in pixels.",
512,
1,
INT32_MAX,
BS_ARG_UINT32(
"height",
"Desired height of the XDG toplevel window, in pixels.",
384,
1,
INT32_MAX,
BS_ARG_SENTINEL(),
}
uint32_t toplevel_width
Definition wlmeyes.c:59
uint32_t toplevel_height
Definition wlmeyes.c:61

Commandline arguments.

◆ icon_dblbuf_ptr

wlmcl_dblbuf_t* icon_dblbuf_ptr
static

Double buffer for icon.

◆ icon_pointer_x

double icon_pointer_x

Most recent X position of the pointer relative to the ivon.

◆ icon_pointer_y

double icon_pointer_y

Most recent Y position of the pointer relative to the ivon.

◆ pointer_x

double pointer_x

Most recent X position of the pointer.

◆ pointer_y

double pointer_y

Most recent Y position of the pointer.

◆ toplevel_dblbuf_ptr

wlmcl_dblbuf_t* toplevel_dblbuf_ptr
static

Double buffer for toplevel.

◆ toplevel_height

uint32_t toplevel_height

Desired height of the toplevel, in pixels.

◆ toplevel_width

uint32_t toplevel_width

Desired width of the toplevel, in pixels.

◆ wlclient_ptr

wlmcl_client_t* wlclient_ptr

State of the client.