Skip to content

Instantly share code, notes, and snippets.

@paulrouget
Created October 25, 2019 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulrouget/14bc427edde9d2660521583e21d99328 to your computer and use it in GitHub Desktop.
Save paulrouget/14bc427edde9d2660521583e21d99328 to your computer and use it in GitHub Desktop.
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
/**
* Servo options
*/
typedef struct {
const char *args;
const char *url;
int32_t width;
int32_t height;
float density;
void *vr_pointer;
bool enable_subpixel_text_antialiasing;
const char *const *vslogger_mod_list;
uint32_t vslogger_mod_size;
} CInitOptions;
/**
* Callback used by Servo internals
*/
typedef struct {
void (*flush)();
void (*make_current)();
void (*on_alert)(const char *message);
void (*on_load_started)();
void (*on_load_ended)();
void (*on_title_changed)(const char *title);
bool (*on_allow_navigation)(const char *url);
void (*on_url_changed)(const char *url);
void (*on_history_changed)(bool can_go_back, bool can_go_forward);
void (*on_animating_changed)(bool animating);
void (*on_shutdown_complete)();
void (*on_ime_state_changed)(bool show);
const char *(*get_clipboard_contents)();
void (*set_clipboard_contents)(const char *contents);
} CHostCallbacks;
void click(int32_t x, int32_t y);
void deinit(void);
void go_back(void);
void go_forward(void);
void init_with_egl(CInitOptions opts, void (*wakeup)(void), CHostCallbacks callbacks);
void init_with_gl(CInitOptions opts, void (*wakeup)(void), CHostCallbacks callbacks);
void load_uri(const char *url);
void perform_updates(void);
void pinchzoom(float factor, int32_t x, int32_t y);
void pinchzoom_end(float factor, int32_t x, int32_t y);
void pinchzoom_start(float factor, int32_t x, int32_t y);
void refresh(void);
void register_panic_handler(void (*on_panic)(const char*));
void reload(void);
void request_shutdown(void);
void resize(int32_t width, int32_t height);
void scroll(int32_t dx, int32_t dy, int32_t x, int32_t y);
void scroll_end(int32_t dx, int32_t dy, int32_t x, int32_t y);
void scroll_start(int32_t dx, int32_t dy, int32_t x, int32_t y);
/**
* The returned string is not freed. This will leak.
*/
const char *servo_version(void);
void set_batch_mode(bool batch);
void stop(void);
void touch_cancel(float x, float y, int32_t pointer_id);
void touch_down(float x, float y, int32_t pointer_id);
void touch_move(float x, float y, int32_t pointer_id);
void touch_up(float x, float y, int32_t pointer_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment