no mouse flickering

This commit is contained in:
p.kosyh 2009-11-29 16:00:22 +00:00
parent 2fea1c1347
commit 5a8ed04ed7
2 changed files with 7 additions and 7 deletions

View file

@ -1510,7 +1510,6 @@ int game_highlight(int x, int y, int on)
static xref_t hxref = NULL; static xref_t hxref = NULL;
xref_t xref = NULL; xref_t xref = NULL;
int up = 0; int up = 0;
if (on) { if (on) {
xref = look_xref(x, y, &elem); xref = look_xref(x, y, &elem);
if (xref && opt_hl) { if (xref && opt_hl) {
@ -2257,6 +2256,7 @@ int game_loop(void)
} }
// game_highlight(ev.x, ev.y, 1); // game_highlight(ev.x, ev.y, 1);
} }
if (old_xref) if (old_xref)
game_highlight(x, y, 1); game_highlight(x, y, 1);
else { else {

View file

@ -54,19 +54,19 @@ int input(struct inp_event *inp, int wait)
inp->type = 0; inp->type = 0;
inp->count = 1; inp->count = 1;
switch(event.type){ switch(event.type){
case SDL_USEREVENT: {
void (*p) (void*) = event.user.data1;
p(event.user.data2);
return AGAIN;
}
case SDL_ACTIVEEVENT: case SDL_ACTIVEEVENT:
if (event.active.state & (SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS)) { if (event.active.state & (SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS)) {
if (event.active.gain) if (event.active.gain)
m_focus = 1; m_focus = 1;
else if (event.active.state & SDL_APPMOUSEFOCUS) else if (event.active.state & SDL_APPMOUSEFOCUS)
m_focus = 0; m_focus = !!(SDL_GetAppState() & SDL_APPMOUSEFOCUS);
} }
return 0; return 0;
case SDL_USEREVENT: {
void (*p) (void*) = event.user.data1;
p(event.user.data2);
return AGAIN;
}
case SDL_QUIT: case SDL_QUIT:
game_running = 0; game_running = 0;
return -1; return -1;