Ver código fonte

* Cosmetic changes here and there.

tags/v0.99.beta14
Sam Hocevar sam 18 anos atrás
pai
commit
e44a01f08d
8 arquivos alterados com 39 adições e 31 exclusões
  1. +2
    -2
      caca/caca.c
  2. +9
    -2
      caca/caca_internals.h
  3. +3
    -3
      caca/driver_gl.c
  4. +5
    -5
      caca/driver_ncurses.c
  5. +4
    -4
      caca/driver_slang.c
  6. +6
    -5
      caca/driver_win32.c
  7. +4
    -4
      caca/driver_x11.c
  8. +6
    -6
      caca/event.c

+ 2
- 2
caca/caca.c Ver arquivo

@@ -79,8 +79,8 @@ caca_t * caca_attach(cucul_t * qq)
kk->timer.last_usec = 0;
kk->lastticks = 0;

kk->mouse_x = kk->qq->width / 2;
kk->mouse_y = kk->qq->height / 2;
kk->mouse.x = kk->qq->width / 2;
kk->mouse.y = kk->qq->height / 2;

kk->resize = 0;
kk->resize_event = 0;


+ 9
- 2
caca/caca_internals.h Ver arquivo

@@ -86,8 +86,10 @@ struct caca_timer
/* Internal caca context */
struct caca_context
{
/* A link to our cucul canvas */
cucul_t *qq;

/* Device-specific functions */
struct drv
{
enum caca_driver driver;
@@ -103,12 +105,17 @@ struct caca_context
unsigned int (* get_event) (caca_t *);
} drv;

//unsigned int width, height;
unsigned int mouse_x, mouse_y;
/* Mouse position */
struct mouse
{
unsigned int x, y;
} mouse;

/* Window resize handling */
int resize;
int resize_event;

/* Framerate handling */
unsigned int delay, rendertime;
struct caca_timer timer;
int lastticks;


+ 3
- 3
caca/driver_gl.c Ver arquivo

@@ -331,9 +331,9 @@ static unsigned int gl_get_event(caca_t *kk)
event |= CACA_EVENT_MOUSE_PRESS | kk->drv.p->mouse_button;
kk->drv.p->mouse_clicked = 0;
}
kk->mouse_x = kk->drv.p->mouse_x;
kk->mouse_y = kk->drv.p->mouse_y;
event |= CACA_EVENT_MOUSE_MOTION | (kk->mouse_x << 12) | kk->mouse_y;
kk->mouse.x = kk->drv.p->mouse_x;
kk->mouse.y = kk->drv.p->mouse_y;
event |= CACA_EVENT_MOUSE_MOTION | (kk->mouse.x << 12) | kk->mouse.y;
kk->drv.p->mouse_changed = 0;
}



+ 5
- 5
caca/driver_ncurses.c Ver arquivo

@@ -360,14 +360,14 @@ static unsigned int ncurses_get_event(caca_t *kk)
break;
}

if(kk->mouse_x == (unsigned int)mevent.x &&
kk->mouse_y == (unsigned int)mevent.y)
if(kk->mouse.x == (unsigned int)mevent.x &&
kk->mouse.y == (unsigned int)mevent.y)
return _pop_event(kk);

kk->mouse_x = mevent.x;
kk->mouse_y = mevent.y;
kk->mouse.x = mevent.x;
kk->mouse.y = mevent.y;

return CACA_EVENT_MOUSE_MOTION | (kk->mouse_x << 12) | kk->mouse_y;
return CACA_EVENT_MOUSE_MOTION | (kk->mouse.x << 12) | kk->mouse.y;
}

event = CACA_EVENT_KEY_PRESS;


+ 4
- 4
caca/driver_slang.c Ver arquivo

@@ -287,13 +287,13 @@ static unsigned int slang_get_event(caca_t *kk)
_push_event(kk, CACA_EVENT_MOUSE_PRESS | button);
_push_event(kk, CACA_EVENT_MOUSE_RELEASE | button);

if(kk->mouse_x == x && kk->mouse_y == y)
if(kk->mouse.x == x && kk->mouse.y == y)
return _pop_event(kk);

kk->mouse_x = x;
kk->mouse_y = y;
kk->mouse.x = x;
kk->mouse.y = y;

return CACA_EVENT_MOUSE_MOTION | (kk->mouse_x << 12) | kk->mouse_y;
return CACA_EVENT_MOUSE_MOTION | (kk->mouse.x << 12) | kk->mouse.y;
}

event = CACA_EVENT_KEY_PRESS;


+ 6
- 5
caca/driver_win32.c Ver arquivo

@@ -261,14 +261,15 @@ static unsigned int win32_get_event(caca_t *kk)
{
COORD pos = rec.Event.MouseEvent.dwMousePosition;

if(kk->mouse_x == (unsigned int)pos.X &&
kk->mouse_y == (unsigned int)pos.Y)
if(kk->mouse.x == (unsigned int)pos.X &&
kk->mouse.y == (unsigned int)pos.Y)
continue;

kk->mouse_x = pos.X;
kk->mouse_y = pos.Y;
kk->mouse.x = pos.X;
kk->mouse.y = pos.Y;

return CACA_EVENT_MOUSE_MOTION | (kk->mouse_x << 12) | kk->mouse_y;
return CACA_EVENT_MOUSE_MOTION
| (kk->mouse.x << 12) | kk->mouse.y;
}
#if 0
else if(rec.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK)


+ 4
- 4
caca/driver_x11.c Ver arquivo

@@ -387,13 +387,13 @@ static unsigned int x11_get_event(caca_t *kk)
if(newy >= kk->qq->height)
newy = kk->qq->height - 1;

if(kk->mouse_x == newx && kk->mouse_y == newy)
if(kk->mouse.x == newx && kk->mouse.y == newy)
continue;

kk->mouse_x = newx;
kk->mouse_y = newy;
kk->mouse.x = newx;
kk->mouse.y = newy;

return CACA_EVENT_MOUSE_MOTION | (kk->mouse_x << 12) | kk->mouse_y;
return CACA_EVENT_MOUSE_MOTION | (kk->mouse.x << 12) | kk->mouse.y;
}

/* Check for mouse press and release events */


+ 6
- 6
caca/event.c Ver arquivo

@@ -103,10 +103,10 @@ unsigned int caca_wait_event(caca_t *kk, unsigned int event_mask)
*/
unsigned int caca_get_mouse_x(caca_t *kk)
{
if(kk->mouse_x >= kk->qq->width)
kk->mouse_x = kk->qq->width - 1;
if(kk->mouse.x >= kk->qq->width)
kk->mouse.x = kk->qq->width - 1;

return kk->mouse_x;
return kk->mouse.x;
}

/** \brief Return the Y mouse coordinate.
@@ -120,10 +120,10 @@ unsigned int caca_get_mouse_x(caca_t *kk)
*/
unsigned int caca_get_mouse_y(caca_t *kk)
{
if(kk->mouse_y >= kk->qq->height)
kk->mouse_y = kk->qq->height - 1;
if(kk->mouse.y >= kk->qq->height)
kk->mouse.y = kk->qq->height - 1;

return kk->mouse_y;
return kk->mouse.y;
}

/*


Carregando…
Cancelar
Salvar