Skip to content

Commit

Permalink
Rename some internal functions with _caca prefix to avoid confusion w…
Browse files Browse the repository at this point in the history
…hen we export them
  • Loading branch information
samhocevar committed Dec 7, 2021
1 parent 9a0ebef commit bd2cff9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions caca/caca_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ extern int _caca_getticks(caca_timer_t *);
/* Internal event functions */
extern void _caca_handle_resize(caca_display_t *);
#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
extern void _push_event(caca_display_t *, caca_privevent_t *);
extern int _pop_event(caca_display_t *, caca_privevent_t *);
extern void _caca_push_event(caca_display_t *, caca_privevent_t *);
extern int _caca_pop_event(caca_display_t *, caca_privevent_t *);
#endif

/* Internal window functions */
Expand Down
2 changes: 1 addition & 1 deletion caca/driver/conio.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static int conio_get_event(caca_display_t *dp, caca_privevent_t *ev)

release = *ev;
release.type = CACA_EVENT_KEY_RELEASE;
_push_event(dp, &release);
_caca_push_event(dp, &release);

return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion caca/driver/gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ static int gl_get_event_inner(caca_display_t *dp, caca_privevent_t *ev)

if(dp->drv.p->mouse_clicked)
{
_push_event(dp, ev);
_caca_push_event(dp, ev);
ev->type = CACA_EVENT_MOUSE_PRESS;
ev->data.mouse.button = dp->drv.p->mouse_button;
dp->drv.p->mouse_clicked = 0;
Expand Down
6 changes: 3 additions & 3 deletions caca/driver/ncurses.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ static int ncurses_get_event(caca_display_t *dp, caca_privevent_t *ev)
switch(mevent.bstate)
{
#define PRESS(x) ev->data.mouse.button = x; \
ev->type = CACA_EVENT_MOUSE_PRESS; _push_event(dp, ev)
ev->type = CACA_EVENT_MOUSE_PRESS; _caca_push_event(dp, ev)
#define RELEASE(x) ev->data.mouse.button = x; \
ev->type = CACA_EVENT_MOUSE_RELEASE; _push_event(dp, ev)
ev->type = CACA_EVENT_MOUSE_RELEASE; _caca_push_event(dp, ev)
#define CLICK(x) PRESS(x); RELEASE(x)
case BUTTON1_PRESSED: PRESS(1); break;
case BUTTON1_RELEASED: RELEASE(1); break;
Expand Down Expand Up @@ -530,7 +530,7 @@ static int ncurses_get_event(caca_display_t *dp, caca_privevent_t *ev)
}

if(dp->mouse.x == mevent.x && dp->mouse.y == mevent.y)
return _pop_event(dp, ev);
return _caca_pop_event(dp, ev);

dp->mouse.x = mevent.x;
dp->mouse.y = mevent.y;
Expand Down
6 changes: 3 additions & 3 deletions caca/driver/slang.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,12 @@ static int slang_get_event(caca_display_t *dp, caca_privevent_t *ev)

ev->data.mouse.button = button;
ev->type = CACA_EVENT_MOUSE_PRESS;
_push_event(dp, ev);
_caca_push_event(dp, ev);
ev->type = CACA_EVENT_MOUSE_RELEASE;
_push_event(dp, ev);
_caca_push_event(dp, ev);

if(dp->mouse.x == x && dp->mouse.y == y)
return _pop_event(dp, ev);
return _caca_pop_event(dp, ev);

dp->mouse.x = x;
dp->mouse.y = y;
Expand Down
10 changes: 5 additions & 5 deletions caca/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ static int _get_next_event(caca_display_t *dp, caca_privevent_t *ev)
&& dp->events.autorepeat_ticks > AUTOREPEAT_THRESHOLD
&& dp->events.autorepeat_ticks > AUTOREPEAT_RATE)
{
_push_event(dp, ev);
_caca_push_event(dp, ev);
dp->events.autorepeat_ticks -= AUTOREPEAT_RATE;
*ev = dp->events.last_key_event;
return 1;
Expand All @@ -403,7 +403,7 @@ static int _get_next_event(caca_display_t *dp, caca_privevent_t *ev)
&& (dp->events.last_key_ticks > AUTOREPEAT_THRESHOLD
|| (ev->type & CACA_EVENT_KEY_PRESS)))
{
_push_event(dp, ev);
_caca_push_event(dp, ev);
*ev = dp->events.last_key_event;
ev->type = CACA_EVENT_KEY_RELEASE;
dp->events.last_key_event.type = CACA_EVENT_NONE;
Expand All @@ -425,7 +425,7 @@ static int _get_next_event(caca_display_t *dp, caca_privevent_t *ev)
static int _lowlevel_event(caca_display_t *dp, caca_privevent_t *ev)
{
#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO)
int ret = _pop_event(dp, ev);
int ret = _caca_pop_event(dp, ev);

if(ret)
return ret;
Expand All @@ -435,15 +435,15 @@ static int _lowlevel_event(caca_display_t *dp, caca_privevent_t *ev)
}

#if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL)
void _push_event(caca_display_t *dp, caca_privevent_t *ev)
void _caca_push_event(caca_display_t *dp, caca_privevent_t *ev)
{
if(!ev->type || dp->events.queue == EVENTBUF_LEN)
return;
dp->events.buf[dp->events.queue] = *ev;
dp->events.queue++;
}

int _pop_event(caca_display_t *dp, caca_privevent_t *ev)
int _caca_pop_event(caca_display_t *dp, caca_privevent_t *ev)
{
int i;

Expand Down

0 comments on commit bd2cff9

Please sign in to comment.