Skip to content

Commit

Permalink
for #270 - rename functions that live in native to have 'native' in t…
Browse files Browse the repository at this point in the history
…heir name.
  • Loading branch information
Cecil committed Apr 20, 2019
1 parent f2bee5c commit 6a950f8
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 84 deletions.
4 changes: 2 additions & 2 deletions shoes/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ shoes_code shoes_app_open(shoes_app *app, char *path) {
shoes_slot_init_menu(app->canvas, app->slot, 0, 0, app->width, app->height, TRUE, TRUE);
else
#endif
shoes_slot_init(app->canvas, app->slot, 0, 0, app->width, app->height, TRUE, TRUE);
shoes_native_slot_init(app->canvas, app->slot, 0, 0, app->width, app->height, TRUE, TRUE);

code = shoes_app_goto(app, path);
if (code != SHOES_OK)
Expand Down Expand Up @@ -919,7 +919,7 @@ shoes_code shoes_app_goto(shoes_app *app, char *path) {
shoes_code code = SHOES_OK;
const char http_scheme[] = "http://";
if (strlen(path) > strlen(http_scheme) && strncmp(http_scheme, path, strlen(http_scheme)) == 0) {
shoes_browser_open(path);
shoes_native_browser_open(path);
} else {
code = shoes_app_visit(app, path);
if (code == SHOES_OK) {
Expand Down
22 changes: 11 additions & 11 deletions shoes/canvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ VALUE shoes_canvas_style(int argc, VALUE *argv, VALUE self) {
static VALUE shoes_canvas_paint_call(VALUE self) {
shoes_code code = SHOES_OK;
SHOES_TIME start, mid;
shoes_get_time(&start);
shoes_native_get_time(&start);

if (self == Qnil)
return self;
Expand All @@ -196,20 +196,20 @@ static VALUE shoes_canvas_paint_call(VALUE self) {
if (canvas->cr != NULL)
goto quit;

canvas->cr = cr = shoes_cairo_create(canvas);
canvas->cr = cr = shoes_native_cairo_create(canvas);
if (cr == NULL)
goto quit;

cairo_save(cr);
shoes_canvas_draw(self, self, Qfalse);
shoes_get_time(&mid);
shoes_native_get_time(&mid);
INFO("COMPUTE: %0.6f s\n", ELAPSED);
cairo_restore(cr);

canvas->cr = cr;
cairo_save(cr);
shoes_canvas_draw(self, self, Qtrue);
shoes_get_time(&mid);
shoes_native_get_time(&mid);
INFO("DRAW: %0.6f s\n", ELAPSED);
cairo_restore(cr);

Expand All @@ -222,8 +222,8 @@ static VALUE shoes_canvas_paint_call(VALUE self) {
cairo_destroy(cr);
cr = canvas->cr = NULL;

shoes_cairo_destroy(canvas);
shoes_get_time(&mid);
shoes_native_cairo_destroy(canvas);
shoes_native_get_time(&mid);
INFO("PAINT: %0.6f s\n", ELAPSED);
shoes_canvas_send_start(self);
quit:
Expand Down Expand Up @@ -327,7 +327,7 @@ void shoes_canvas_clear(VALUE self) {
canvas->endx = 0;
canvas->topy = 0;
canvas->fully = 0;
shoes_group_clear(&canvas->group);
shoes_native_group_clear(&canvas->group);
}

shoes_canvas *shoes_canvas_init(VALUE self, SHOES_SLOT_OS *slot, VALUE attr, int width, int height) {
Expand Down Expand Up @@ -513,7 +513,7 @@ VALUE shoes_canvas_remove(VALUE self) {
shoes_canvas_remove_item(self_t->parent, self, 0, 0);
TypedData_Get_Struct(self_t->parent, shoes_canvas, &shoes_canvas_type, pc);
if (pc != self_t && DC(self_t->slot) != DC(pc->slot))
shoes_slot_destroy(self_t, pc);
shoes_native_slot_destroy(self_t, pc);
shoes_canvas_repaint_all(self);
}
shoes_canvas_send_finish(self);
Expand Down Expand Up @@ -1296,7 +1296,7 @@ VALUE shoes_canvas_send_motion(VALUE self, int x, int y, VALUE url, VALUE mods)
shoes_canvas *self_t;
TypedData_Get_Struct(self, shoes_canvas, &shoes_canvas_type, self_t);
if (self_t->app->cursor == s_link)
shoes_app_cursor(self_t->app, s_arrow_cursor);
shoes_native_app_cursor(self_t->app, s_arrow_cursor);
}
}

Expand Down Expand Up @@ -1394,7 +1394,7 @@ VALUE shoes_slot_new(VALUE klass, VALUE attr, VALUE parent) {
//
// create the slot off-screen until it can be properly placed
//
shoes_slot_init(self, pc->slot, -99, -99, 100, 100, scrolls, FALSE);
shoes_native_slot_init(self, pc->slot, -99, -99, 100, 100, scrolls, FALSE);
self_t->place.x = self_t->place.y = 0;
self_t->place.ix = self_t->place.iy = 0;
}
Expand Down Expand Up @@ -1437,7 +1437,7 @@ VALUE shoes_canvas_get_cursor(VALUE self) {

VALUE shoes_canvas_set_cursor(VALUE self, VALUE name) {
SETUP_CANVAS();
shoes_app_cursor(canvas->app, SYM2ID(name));
shoes_native_app_cursor(canvas->app, SYM2ID(name));
return name;
}

Expand Down
4 changes: 2 additions & 2 deletions shoes/http/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#define HTTP_EVENT(handler, s, last, perc, trans, tot, dat, bd, abort) \
{ SHOES_TIME ts; \
shoes_get_time(&ts); \
shoes_native_get_time(&ts); \
unsigned long elapsed = shoes_diff_time(&(last), &ts); \
if (s != SHOES_HTTP_TRANSFER || elapsed > 600 ) { \
shoes_http_event *event = SHOE_ALLOC(shoes_http_event); \
Expand Down Expand Up @@ -80,7 +80,7 @@ typedef struct {

typedef int (*shoes_http_handler)(shoes_http_event *, void *);

void shoes_get_time(SHOES_TIME *);
void shoes_native_get_time(SHOES_TIME *);
unsigned long shoes_diff_time(SHOES_TIME *, SHOES_TIME *);

#endif
2 changes: 1 addition & 1 deletion shoes/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ int shoes_http_image_handler(shoes_http_event *de, void *data) {
} else if (de->stage == SHOES_HTTP_COMPLETED) {
shoes_image_download_event *side = SHOE_ALLOC(shoes_image_download_event);
SHOE_MEMCPY(side, idat, shoes_image_download_event, 1);
return shoes_throw_message(SHOES_IMAGE_DOWNLOAD, idat->slot, side);
return shoes_native_throw_message(SHOES_IMAGE_DOWNLOAD, idat->slot, side);
}
return SHOES_DOWNLOAD_CONTINUE;
}
Expand Down
24 changes: 12 additions & 12 deletions shoes/native/cocoa.m
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentN
}

VALUE
shoes_font_list()
shoes_native_font_list()
{
INIT;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
Expand Down Expand Up @@ -665,7 +665,7 @@ - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentN
}

VALUE
shoes_load_font(const char *filename)
shoes_native_load_font(const char *filename)
{
VALUE families = Qnil;
#ifndef OLD_OSX
Expand Down Expand Up @@ -728,7 +728,7 @@ - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentN
}
}
#endif
shoes_update_fonts(shoes_font_list());
shoes_update_fonts(shoes_native_font_list());
return families;
}

Expand Down Expand Up @@ -773,7 +773,7 @@ void shoes_native_quit()
RELEASE;
}

void shoes_get_time(SHOES_TIME *ts)
void shoes_native_get_time(SHOES_TIME *ts)
{
gettimeofday(ts, NULL);
}
Expand All @@ -791,7 +791,7 @@ unsigned long shoes_diff_time(SHOES_TIME *start, SHOES_TIME *end)
return usec;
}

int shoes_throw_message(unsigned int name, VALUE obj, void *data)
int shoes_native_throw_message(unsigned int name, VALUE obj, void *data)
{
return shoes_catch_message(name, obj, data);
}
Expand Down Expand Up @@ -854,7 +854,7 @@ void shoes_native_remove_item(SHOES_SLOT_OS *slot, VALUE item, char c)
}

shoes_code
shoes_app_cursor(shoes_app *app, ID cursor)
shoes_native_app_cursor(shoes_app *app, ID cursor)
{
if (app->os.window == NULL || app->cursor == cursor)
goto done;
Expand Down Expand Up @@ -1119,15 +1119,15 @@ CGDirectDisplayID shoes_native_app_cgid(shoes_app *app) {
}

void
shoes_browser_open(char *url)
shoes_native_browser_open(char *url)
{
VALUE browser = rb_str_new2("open ");
rb_str_cat2(browser, url);
shoes_sys(RSTRING_PTR(browser), 1);
}

void
shoes_slot_init(VALUE c, SHOES_SLOT_OS *parent, int x, int y, int width, int height, int scrolls, int toplevel)
shoes_native_slot_init(VALUE c, SHOES_SLOT_OS *parent, int x, int y, int width, int height, int scrolls, int toplevel)
{
shoes_canvas *canvas;
SHOES_SLOT_OS *slot;
Expand Down Expand Up @@ -1158,7 +1158,7 @@ CGDirectDisplayID shoes_native_app_cgid(shoes_app *app) {
}

void
shoes_slot_destroy(shoes_canvas *canvas, shoes_canvas *pc)
shoes_native_slot_destroy(shoes_canvas *canvas, shoes_canvas *pc)
{
INIT;
if (canvas->slot->vscroll != NULL)
Expand All @@ -1168,7 +1168,7 @@ CGDirectDisplayID shoes_native_app_cgid(shoes_app *app) {
}

cairo_t *
shoes_cairo_create(shoes_canvas *canvas)
shoes_native_cairo_create(shoes_canvas *canvas)
{
cairo_t *cr;
canvas->slot->surface = cairo_quartz_surface_create_for_cg_context(canvas->slot->context,
Expand All @@ -1178,13 +1178,13 @@ CGDirectDisplayID shoes_native_app_cgid(shoes_app *app) {
return cr;
}

void shoes_cairo_destroy(shoes_canvas *canvas)
void shoes_native_cairo_destroy(shoes_canvas *canvas)
{
cairo_surface_destroy(canvas->slot->surface);
}

void
shoes_group_clear(SHOES_GROUP_OS *group)
shoes_native_group_clear(SHOES_GROUP_OS *group)
{
}

Expand Down
Loading

0 comments on commit 6a950f8

Please sign in to comment.