wlmaker
Loading...
Searching...
No Matches
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 "libwlclient/xdg_toplevel.h"
#include "libwlclient/libwlclient.h"
#include "libwlclient/icon.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)
int main (int argc, const char **argv)

Variables

wlclient_twlclient_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()

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_key()

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

Handles key events.

◆ _icon_callback()

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

Called when the icon is ready to refresh.

◆ _icon_position_callback()

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

Updates pointer position for the icon.

◆ _position_callback()

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()

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:53
uint32_t toplevel_height
Definition wlmeyes.c:55

Commandline arguments.

◆ 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_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

wlclient_t* wlclient_ptr

State of the client.