Exemple #1
0
/*
 * Called when the properties on the root window change, e.g. when the screen
 * resolution changes. If so we update the window to cover the whole screen
 * and also redraw the image, if any.
 *
 */
void handle_screen_resize(void) {
    xcb_get_geometry_cookie_t geomc;
    xcb_get_geometry_reply_t *geom;
    geomc = xcb_get_geometry(conn, screen->root);
    if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL)
        return;

    if (last_resolution[0] == geom->width &&
            last_resolution[1] == geom->height) {
        free(geom);
        return;
    }

    last_resolution[0] = geom->width;
    last_resolution[1] = geom->height;

    free(geom);

    redraw_screen();

    uint32_t mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
    xcb_configure_window(conn, win, mask, last_resolution);
    xcb_flush(conn);

    xinerama_query_screens();
    redraw_screen();
}
Exemple #2
0
void event_loop(void)
{
	GP_Event ev;

	for (;;) {
		GP_BackendWaitEvent(win, &ev);

		switch (ev.type) {
		case GP_EV_KEY:
			if (ev.code != GP_EV_KEY_DOWN)
				continue;

			switch (ev.val.key.key) {
			case GP_KEY_SPACE:
				if (font)
					font_flag = (font_flag + 1) % 5;
				else
					font_flag = (font_flag + 1) % 4;

				redraw_screen();
				GP_BackendFlip(win);
			break;
			case GP_KEY_UP:
				tracking++;
				redraw_screen();
				GP_BackendFlip(win);
			break;
			case GP_KEY_DOWN:
				tracking--;
				redraw_screen();
				GP_BackendFlip(win);
			break;
			case GP_KEY_B:
				font_h++;
				if (font_path) {
					GP_FontFaceFree(font);
					font = GP_FontFaceLoad(font_path, 0, font_h);
					redraw_screen();
					GP_BackendFlip(win);
				}
			break;
			case GP_KEY_S:
				font_h--;
				if (font_path) {
					GP_FontFaceFree(font);
					font = GP_FontFaceLoad(font_path, 0, font_h);
					redraw_screen();
					GP_BackendFlip(win);
				}
			break;
			case GP_KEY_ESC:
				GP_BackendExit(win);
				exit(0);
			break;
			}
		}
	}
}
Exemple #3
0
static void input_done(void) {
    if (clear_pam_wrong_timeout) {
        ev_timer_stop(main_loop, clear_pam_wrong_timeout);
        free(clear_pam_wrong_timeout);
        clear_pam_wrong_timeout = NULL;
    }

    pam_state = STATE_PAM_VERIFY;
    redraw_screen();

    if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) {
        DEBUG("successfully authenticated\n");
        clear_password_memory();
	if (shell_auth_done_command) {
	  system(shell_auth_done_command);
	}
        exit(0);
    }
    else
    {
	if (shell_auth_fail_command) {
	    system(shell_auth_fail_command);
	}
    }

    if (debug_mode)
        fprintf(stderr, "Authentication failure\n");

    pam_state = STATE_PAM_WRONG;
    clear_input();
    redraw_screen();

    /* Clear this state after 2 seconds (unless the user enters another
     * password during that time). */
    ev_now_update(main_loop);
    if ((clear_pam_wrong_timeout = calloc(sizeof(struct ev_timer), 1))) {
        ev_timer_init(clear_pam_wrong_timeout, clear_pam_wrong, 2.0, 0.);
        ev_timer_start(main_loop, clear_pam_wrong_timeout);
    }

    /* Cancel the clear_indicator_timeout, it would hide the unlock indicator
     * too early. */
    stop_clear_indicator_timeout();

    /* beep on authentication failure, if enabled */
    if (beep) {
        xcb_bell(conn, 100);
        xcb_flush(conn);
    }
}
Exemple #4
0
int main(int argc, char *argv[])
{
	const char *backend_opts = "X11";

	print_instructions();

	if (argc > 1) {
		font_path = argv[1];
		fprintf(stderr, "\nLoading font '%s'\n", argv[1]);
		font = gp_font_face_load(argv[1], 0, font_h);
	}

	win = gp_backend_init(backend_opts, "Font Test");

	if (win == NULL) {
		fprintf(stderr, "Failed to initalize backend '%s'\n",
		        backend_opts);
		return 1;
	}

	white_pixel     = gp_rgb_to_pixmap_pixel(0xff, 0xff, 0xff, win->pixmap);
	gray_pixel      = gp_rgb_to_pixmap_pixel(0xbe, 0xbe, 0xbe, win->pixmap);
	dark_gray_pixel = gp_rgb_to_pixmap_pixel(0x7f, 0x7f, 0x7f, win->pixmap);
	black_pixel     = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, win->pixmap);
	red_pixel       = gp_rgb_to_pixmap_pixel(0xff, 0x00, 0x00, win->pixmap);
	blue_pixel      = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0xff, win->pixmap);

	redraw_screen();
	gp_backend_flip(win);

	event_loop();

	return 0;
}
Exemple #5
0
/* 游戏主循环。
 * 在初始化工作结束后,main函数就跳转到主循环执行。
 * 在主循环执行期间随时会插入异步的中断。时钟中断最终调用timer_event,
 * 键盘中断最终调用keyboard_event。中断处理完成后将返回主循环原位置继续执行。
 *
 * tick是时钟中断中维护的信号,数值含义是“系统到当前时刻已经发生过的时钟中断数”
 * HZ是时钟控制器硬件每秒产生的中断数,在include/device/timer.h中定义
 * now是主循环已经正确处理的时钟中断数,即游戏已经处理到的物理时间点
 * */
void
main_loop(void) {
	int now = 0, target;
	int num_draw = 0;
	bool redraw;

	while (true) {
		wait_intr();
		cli();
		if (now == tick) {
			sti();
			continue;
		}
		assert(now < tick);
		target = tick; /* now总是小于tick,因此我们需要“追赶”当前的时间 */
		sti();

		redraw = false;
		while (update_keypress())
			;

		/* 依次模拟已经错过的时钟中断。一次主循环如果执行时间长,期间可能到来多次时钟中断,
		 * 从而主循环中维护的时钟可能与实际时钟相差较多。为了维持游戏的正常运行,必须补上
		 * 期间错过的每一帧游戏逻辑。 */
		while (now < target) { 
			/* 每隔一定时间产生一个新的字符 */
			if (now % (HZ / CHARACTER_PER_SECOND) == 0) {
				create_new_letter();
			} 
			/* 每隔一定时间更新屏幕上字符的位置 */
			if (now % (HZ / UPDATE_PER_SECOND) == 0) {
				update_letter_pos();
			}
			/* 每隔一定时间需要刷新屏幕。注意到这里实现了“跳帧”的机制:假设
			 *   HZ = 1000, FPS = 100, now = 10, target = 1000
			 * 即我们要模拟990个时钟中断之间发生的事件,其中包含了9次屏幕更新,
			 * 但redraw flag只被置一次。 */

			/* 以上是余大神的解释,但我觉得怎么应该是: */
			/* 即我们要模拟990个时钟中断,其中redraw flag被重置了99次(应该更新99次), */
			/* 但实际上屏幕只更新了一次 */
			if (now % (HZ / FPS) == 0) {
				redraw = true;
			}
			/* 更新fps统计信息 */
			if (now % (HZ / 2) == 0) {
				int now_fps = num_draw * 2 + 1;
				if (now_fps > FPS) now_fps = FPS;
				set_fps(now_fps);
				num_draw = 0;
			}
			now ++;
		}

		if (redraw) { /* 当需要重新绘图时重绘 */
			num_draw ++;
			redraw_screen();
		}
	}
}
Exemple #6
0
int main(int argc, char **args)
{
	RAND = ((int)time(NULL))%10;
	init_console();
	init_buffer();
	init_clipboard();
	if (argc > 1)
	{
		FILENAME = (unsigned char *)malloc(256*sizeof(char));
		strcpy((char *)FILENAME, args[1]);
		file_to_buffer();
	}
	else 
	{
		MAX_VPOS = 1;
	}
	while (RUN)
	{
		redraw_screen();
#ifdef DEBUG_MODE
		printf("%d", INPUT_KEY);
#endif
		INPUT_KEY = _getch();
		process_key();
	}
	DestroyAndExit("Exiting...");
	return 0;
}
Exemple #7
0
int main(void)
{
	const char *backend_opts = "X11";

	win = GP_BackendInit(backend_opts, "Random Shape Test", stderr);

	if (win == NULL) {
		fprintf(stderr, "Failed to initalize backend '%s'\n",
		        backend_opts);
		return 1;
	}

	white = GP_ColorToContextPixel(GP_COL_WHITE, win->context);
	black = GP_ColorToContextPixel(GP_COL_BLACK, win->context);

	for (;;) {
		GP_BackendPoll(win);
		event_loop();

		usleep(20000);

		if (pause_flag)
			continue;

		redraw_screen();
		GP_BackendFlip(win);
	}
}
Exemple #8
0
static void handleUpdateWhileScrolling(volatile bool& doneScrolling, int refresh) {
	while(!doneScrolling) {
		sf::sleep(sf::milliseconds(10));
		redraw_screen(refresh);
	}
	mainPtr.setActive(false);
}
Exemple #9
0
/*
 * Hides the unlock indicator completely when there is no content in the
 * password buffer.
 *
 */
void clear_indicator(void) {
    if (input_position == 0) {
        unlock_state = STATE_STARTED;
    } else
        unlock_state = STATE_KEY_PRESSED;
    redraw_screen();
}
Exemple #10
0
int main(int argc, char *argv[])
{
	const char *backend_opts = "X11";

	if (argc > 1)
		font = GP_FontFaceLoad(argv[1], 0, 20);

	print_instructions();

	win = GP_BackendInit(backend_opts, "Font Align Test");

	if (win == NULL) {
		fprintf(stderr, "Failed to initalize backend '%s'\n",
		        backend_opts);
		return 1;
	}

	black_pixel    = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
	red_pixel      = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context);
	blue_pixel     = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context);
	green_pixel    = GP_RGBToContextPixel(0x00, 0xff, 0x00, win->context);
	yellow_pixel   = GP_RGBToContextPixel(0xff, 0xff, 0x00, win->context);
	white_pixel   = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
	darkgray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context);

	redraw_screen();
	GP_BackendFlip(win);
	event_loop();

	return 0;
}
Exemple #11
0
void Handle_Update() {
	redraw_screen(REFRESH_NONE);
	
	if(map_visible) draw_map(false);
	else mini_map.setVisible(false);
	
}
Exemple #12
0
int main(int argc, char *argv[])
{
	const char *backend_opts = "X11";

	print_instructions();

	if (argc > 1) {
		font_path = argv[1];
		fprintf(stderr, "\nLoading font '%s'\n", argv[1]);
		font = GP_FontFaceLoad(argv[1], 0, font_h);
	}

	win = GP_BackendInit(backend_opts, "Font Test");

	if (win == NULL) {
		fprintf(stderr, "Failed to initalize backend '%s'\n",
		        backend_opts);
		return 1;
	}

	white_pixel     = GP_RGBToContextPixel(0xff, 0xff, 0xff, win->context);
	gray_pixel      = GP_RGBToContextPixel(0xbe, 0xbe, 0xbe, win->context);
	dark_gray_pixel = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, win->context);
	black_pixel     = GP_RGBToContextPixel(0x00, 0x00, 0x00, win->context);
	red_pixel       = GP_RGBToContextPixel(0xff, 0x00, 0x00, win->context);
	blue_pixel      = GP_RGBToContextPixel(0x00, 0x00, 0xff, win->context);

	redraw_screen();
	GP_BackendFlip(win);

	event_loop();

	return 0;
}
Exemple #13
0
int main(void)
{
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
        fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError());
        return 1;
    }

    display = SDL_SetVideoMode(W, H, 0, SDL_SWSURFACE);

    if (display == NULL) {
        fprintf(stderr, "Could not open display: %s\n", SDL_GetError());
        SDL_Quit();
        return 1;
    }

    GP_ContextFromSDLSurface(&context, display);

    black_pixel     = GP_RGBToContextPixel(0x00, 0x00, 0x00, &context);
    darkgray_pixel  = GP_RGBToContextPixel(0x7f, 0x7f, 0x7f, &context);

    redraw_screen();
    SDL_Flip(display);

    event_loop();

    SDL_Quit();
    return 0;
}
Exemple #14
0
void end_talk_mode()
{

	DeleteObject(talk_gworld);
	talk_gworld = NULL;
    if((PSD [SDF_ASK_ABOUT_TEXT_BOX] == 1) && (talk_edit_box != NULL)){
        DestroyWindow(talk_edit_box);
	    talk_edit_box = NULL;
    }

    overall_mode = store_pre_talk_mode;

	create_clip_region();
	if (overall_mode == MODE_TALK_TOWN)
		overall_mode = MODE_TOWN;
	if (overall_mode == MODE_TOWN) {
		center = c_town.p_loc;
		update_explored(center);
		}

	stat_screen_mode = 0;

    put_item_screen(stat_window,0);
	put_pc_screen();
	redraw_screen(0);


}
Exemple #15
0
void event_loop(void)
{
    SDL_Event event;

    while (SDL_WaitEvent(&event) > 0) {
        switch (event.type) {

        case SDL_VIDEOEXPOSE:
            redraw_screen();
            SDL_Flip(display);
            break;

        case SDL_KEYDOWN:
            switch (event.key.keysym.sym) {
            case SDLK_ESCAPE:
                return;
            default:
                break;
            }
            break;

        case SDL_QUIT:
            return;
        }
    }
}
Exemple #16
0
/*
 * Name:    zoom_window
 * Purpose: To blow-up current window.
 * Date:    September 1, 1991
 * Passed:  window:  pointer to current window
 * Notes:   Make all windows, visible and hidden, full size.
 */
int  zoom_window( WINDOW *window )
{
    register WINDOW *wp;

    if (window != NULL) {
        entab_linebuff( );
        un_copy_line( window->ll, window, TRUE );
        for (wp=g_status.window_list; wp != NULL; wp=wp->next) {
            if (wp != window && wp->visible)
                wp->visible = FALSE;

            /*
             * can't diff one window, reset the diff
             */
            diff.defined = FALSE;
            if (wp->top_line != 1)
                wp->cline = wp->cline - (wp->top_line+wp->ruler) + 1;
            wp->top_line = 1;
            wp->bottom_line = g_display.nlines;
            wp->end_col   = g_display.ncols - 1;
            wp->start_col = 0;
            wp->vertical  = FALSE;
            check_virtual_col( wp, wp->rcol, wp->ccol );
            make_ruler( wp );
        }
        redraw_screen( window );
        show_ruler( window );
    }
    return( OK );
}
Exemple #17
0
int main(void)
{
	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
		fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError());
		return 1;
	}

	display = SDL_SetVideoMode(W, H, 0, SDL_SWSURFACE);

	if (display == NULL) {
		fprintf(stderr, "Could not open display: %s\n", SDL_GetError());
		SDL_Quit();
		return 1;
	}

	gp_pixmap_from_sdl_surface(&pixmap, display);

	black_pixel     = gp_rgb_to_pixmap_pixel(0x00, 0x00, 0x00, &pixmap);
	darkgray_pixel  = gp_rgb_to_pixmap_pixel(0x7f, 0x7f, 0x7f, &pixmap);

	redraw_screen();
	SDL_Flip(display);

	event_loop();

	SDL_Quit();
	return 0;
}
Exemple #18
0
static void input_done(void) {
    STOP_TIMER(clear_pam_wrong_timeout);
    pam_state = STATE_PAM_VERIFY;
    redraw_screen();

    if (pam_authenticate(pam_handle, 0) == PAM_SUCCESS) {
        DEBUG("successfully authenticated\n");
        clear_password_memory();
        /* Turn the screen on, as it may have been turned off
         * on release of the 'enter' key. */
        turn_monitors_on();

        /* PAM credentials should be refreshed, this will for example update any kerberos tickets.
         * Related to credentials pam_end() needs to be called to cleanup any temporary
         * credentials like kerberos /tmp/krb5cc_pam_* files which may of been left behind if the
         * refresh of the credentials failed. */
        pam_setcred(pam_handle, PAM_REFRESH_CRED);
        pam_end(pam_handle, PAM_SUCCESS);

        exit(0);
    }

    if (debug_mode)
        fprintf(stderr, "Authentication failure\n");

    pam_state = STATE_PAM_WRONG;
    failed_attempts += 1;
    clear_input();
    if (unlock_indicator)
        redraw_screen();

    /* Clear this state after 2 seconds (unless the user enters another
     * password during that time). */
    ev_now_update(main_loop);
    START_TIMER(clear_pam_wrong_timeout, TSTAMP_N_SECS(2), clear_pam_wrong);

    /* Cancel the clear_indicator_timeout, it would hide the unlock indicator
     * too early. */
    STOP_TIMER(clear_indicator_timeout);

    /* beep on authentication failure, if enabled */
    if (beep) {
        xcb_bell(conn, 100);
        xcb_flush(conn);
    }
}
Exemple #19
0
static void warp_down(int lines)
{
	while (lines-- > 0)
		if (first_line->next != NULL)
			first_line = first_line->next;

	redraw_screen();
	GP_BackendFlip(backend);
}
Exemple #20
0
static void warp_up(int lines)
{
	while (lines-- > 0)
		if (first_line->prev != NULL)
			first_line = first_line->prev;

	redraw_screen();
	GP_BackendFlip(backend);
}
Exemple #21
0
bool handle_action(sf::Event event) {
	short i;
	
	location the_point;
	
	bool to_return = false;
	
	the_point = {event.mouseButton.x, event.mouseButton.y};
	
	if(file_in_mem.empty())
		return false;
	
	for(i = 0; i < 6; i++)
		if((the_point.in(pc_area_buttons[i][0])) &&
		   (univ.party[i].main_status != eMainStatus::ABSENT)) {
			do_button_action(0,i);
			current_active_pc = i;
			redraw_screen();
		}
	for(i = 0; i < 5; i++)
		if((the_point.in(edit_rect[i])) &&
		   (univ.party[current_active_pc].main_status != eMainStatus::ABSENT)) {
			do_button_action(0,i + 10);
			switch(i) {
				case 0:
					display_pc(current_active_pc,10,nullptr);
					break;
				case 1:
			 		display_pc(current_active_pc,11,nullptr);
					break;
				case 2:
					pick_race_abil(&univ.party[current_active_pc],0);
					break;
				case 3:
					spend_xp(current_active_pc,2,nullptr);
					break;
				case 4:
					edit_xp(&univ.party[current_active_pc]);
					
					break;
			}
		}
	for(i = 0; i < 24; i++)
		if((the_point.in(item_string_rects[i][1])) && // drop item
		   univ.party[current_active_pc].items[i].variety != eItemType::NO_ITEM) {
			flash_rect(item_string_rects[i][1]);
			univ.party[current_active_pc].take_item(i);
		}
	for(i = 0; i < 24; i++)
		if((the_point.in(item_string_rects[i][2])) && // identify item
		   univ.party[current_active_pc].items[i].variety != eItemType::NO_ITEM) {
			flash_rect(item_string_rects[i][2]);
			univ.party[current_active_pc].items[i].ident = true;
		}
	
	return to_return;
}
Exemple #22
0
/*
 * Resets pam_state to STATE_PAM_IDLE 2 seconds after an unsuccessful
 * authentication event.
 *
 */
static void clear_pam_wrong(EV_P_ ev_timer *w, int revents) {
    DEBUG("clearing pam wrong\n");
    pam_state = STATE_PAM_IDLE;
    unlock_state = STATE_STARTED;
    redraw_screen();

    /* Now free this timeout. */
    STOP_TIMER(clear_pam_wrong_timeout);
}
Exemple #23
0
static void drawscreen (void) {

/* This is the screen redrawing routine that event_loop assumes exists.  *
 * It erases whatever is on screen, then calls redraw_screen to redraw   *
 * it.                                                                   */

 clearscreen();
 redraw_screen ();
}
Exemple #24
0
/* 游戏主循环。
 * 在初始化工作结束后,main函数就跳转到主循环执行。
 * 在主循环执行期间随时会插入异步的中断。时钟中断最终调用timer_event,
 * 键盘中断最终调用keyboard_event。中断处理完成后将返回主循环原位置继续执行。
 *
 * tick是时钟中断中维护的信号,数值含义是“系统到当前时刻已经发生过的时钟中断数”
 * HZ是时钟控制器硬件每秒产生的中断数,在include/device/timer.h中定义
 * now是主循环已经正确处理的时钟中断数,即游戏已经处理到的物理时间点
 *
 * 由于qemu-kvm在访问内存映射IO区域时每次都会产生陷入,在30FPS时,
 * 对显存区域每秒会产生30*320*200/4次陷入,从而消耗过多时间导致跳帧的产生(实际FPS<30)。
 * 在CFLAGS中增加-DSLOW可以在此情况下提升FPS。如果FPS仍太小,可以尝试
 * -DTOOSLOW,此时将会采用隔行扫描的方式更新屏幕(可能会降低显示效果)。
 * 这些机制的实现在device/video.c中。
 * */
void
main_loop(void) {
    int now = 0, target;
    int num_draw = 0;
    bool redraw;

    while (TRUE) {
        wait_for_interrupt();
        /*disable_interrupt();*/
        if (now == tick) {
            /*enable_interrupt();*/
            continue;
        }
        assert(now < tick);
        target = tick; /* now总是小于tick,因此我们需要“追赶”当前的时间 */
        /*enable_interrupt();*/

        redraw = FALSE;
        while (update_keypress())
            ;

        /* 依次模拟已经错过的时钟中断。一次主循环如果执行时间长,期间可能到来多次时钟中断,
         * 从而主循环中维护的时钟可能与实际时钟相差较多。为了维持游戏的正常运行,必须补上
         * 期间错过的每一帧游戏逻辑。 */
        while (now < target) {
            /* 每隔一定时间产生一个新的字符 */
            if (now % (HZ / CHARACTER_PER_SECOND) == 0) {
                create_new_letter();
            }
            /* 每隔一定时间更新屏幕上字符的位置 */
            if (now % (HZ / UPDATE_PER_SECOND) == 0) {
                update_letter_pos();
            }
            /* 每隔一定时间需要刷新屏幕。注意到这里实现了“跳帧”的机制:假设
             *   HZ = 1000, FPS = 100, now = 10, target = 1000
             * 即我们要模拟990个时钟中断之间发生的事件,其中包含了9次屏幕更新,
             * 但redraw flag只被置一次。 */
            if (now % (HZ / FPS) == 0) {
                redraw = TRUE;
            }
            /* 更新fps统计信息 */
            if (now % (HZ / 2) == 0) {
                int now_fps = num_draw * 2 + 1;
                if (now_fps > FPS) now_fps = FPS;
                set_fps(now_fps);
                num_draw = 0;
            }
            now ++;
        }

        if (redraw) { /* 当需要重新绘图时重绘 */
            num_draw ++;
            redraw_screen();
        }
    }
}
Exemple #25
0
/*
 * Hides the unlock indicator completely when there is no content in the
 * password buffer.
 *
 */
static void clear_indicator(EV_P_ ev_timer *w, int revents) {
    if (input_position == 0) {
        unlock_state = STATE_STARTED;
    } else unlock_state = STATE_KEY_PRESSED;
    redraw_screen();

    ev_timer_stop(main_loop, clear_indicator_timeout);
    free(clear_indicator_timeout);
    clear_indicator_timeout = NULL;
}
Exemple #26
0
/*
 * Resets pam_state to STATE_PAM_IDLE 2 seconds after an unsuccesful
 * authentication event.
 *
 */
static void clear_pam_wrong(EV_P_ ev_timer *w, int revents) {
    DEBUG("clearing pam wrong\n");
    pam_state = STATE_PAM_IDLE;
    unlock_state = STATE_STARTED;
    redraw_screen();

    /* Now free this timeout. */
    ev_timer_stop(main_loop, clear_pam_wrong_timeout);
    free(clear_pam_wrong_timeout);
    clear_pam_wrong_timeout = NULL;
}
Exemple #27
0
void pause(short length) {
	long len;
	
	len = (long) length;
	
	// Before pausing, make sure the screen is updated.
	redraw_screen(REFRESH_NONE);
	
	if(get_bool_pref("DrawTerrainFrills", true))
		sf::sleep(time_in_ticks(len));
}
Exemple #28
0
static void clear_input(void) {
    input_position = 0;
    clear_password_memory();
    password[input_position] = '\0';

    /* Hide the unlock indicator after a bit if the password buffer is
     * empty. */
    start_clear_indicator_timeout();
    unlock_state = STATE_BACKSPACE_ACTIVE;
    redraw_screen();
    unlock_state = STATE_KEY_PRESSED;
}
Exemple #29
0
/*
 * Resets pam_state to STATE_PAM_IDLE 2 seconds after an unsuccessful
 * authentication event.
 *
 */
static void clear_pam_wrong(EV_P_ ev_timer *w, int revents) {
    DEBUG("clearing pam wrong\n");
    pam_state = STATE_PAM_IDLE;
    redraw_screen();

    /* Clear modifier string. */
    if (modifier_string != NULL) {
        free(modifier_string);
        modifier_string = NULL;
    }

    /* Now free this timeout. */
    STOP_TIMER(clear_pam_wrong_timeout);
}
Exemple #30
0
// TODO: Pass the event object around instead of keeping a global one
void Mouse_Pressed() {
	if(had_text_freeze > 0) {
		had_text_freeze--;
		return;
	}
	
	if(overall_mode != MODE_STARTUP) {
		location mousePos(event.mouseButton.x, event.mouseButton.y);
		volatile bool doneScrolling = false;
		if(mousePos.in(text_sbar->getBounds())) {
			mainPtr.setActive(false);
			boost::thread updater(std::bind(handleUpdateWhileScrolling, std::ref(doneScrolling), REFRESH_TRANS));
			text_sbar->handleClick(mousePos);
			doneScrolling = true;
			updater.join();
			redraw_screen(REFRESH_TRANS);
		} else if(mousePos.in(item_sbar->getBounds())) {
			mainPtr.setActive(false);
			boost::thread updater(std::bind(handleUpdateWhileScrolling, std::ref(doneScrolling), REFRESH_INVEN));
			item_sbar->handleClick(mousePos);
			doneScrolling = true;
			updater.join();
			redraw_screen(REFRESH_INVEN);
		} else if(overall_mode == MODE_SHOPPING && mousePos.in(shop_sbar->getBounds())) {
			mainPtr.setActive(false);
			boost::thread updater(std::bind(handleUpdateWhileScrolling, std::ref(doneScrolling), REFRESH_DLOG));
			shop_sbar->handleClick(mousePos);
			doneScrolling = true;
			updater.join();
			redraw_screen(REFRESH_DLOG);
		} else All_Done = handle_action(event);
	} else All_Done = handle_startup_press({event.mouseButton.x, event.mouseButton.y});
	
	menu_activate();
	
}