示例#1
0
void gui_poll(bool active)
{

	struct gui_window *tmp;
    short mx, my, dummy;
    unsigned short nkc = 0;

    aes_event_in.emi_tlow = schedule_run();

    if(active || rendering)
        aes_event_in.emi_tlow = 0;

    if(aes_event_in.emi_tlow < 0) {
        aes_event_in.emi_tlow = 10000;
        printf("long poll!\n");
    }

    struct gui_window * g;

    if( !active ) {
        if(input_window && input_window->root->redraw_slots.areas_used > 0) {
            window_process_redraws(input_window->root);
        }
    }

    graf_mkstate(&mx, &my, &dummy, &dummy);
    aes_event_in.emi_m1.g_x = mx;
    aes_event_in.emi_m1.g_y = my;
    evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out);
    if(!gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out)) {
        if( (aes_event_out.emo_events & MU_MESAG) != 0 ) {
            LOG(("WM: %d\n", aes_msg_out[0]));
            switch(aes_msg_out[0]) {

            case MN_SELECTED:
                LOG(("Menu Item: %d\n",aes_msg_out[4]));
                deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]);
                break;
            default:
                break;
            }
        }
        if((aes_event_out.emo_events & MU_KEYBD) != 0) {
            uint16_t nkc = gem_to_norm( (short)aes_event_out.emo_kmeta,
                                        (short)aes_event_out.emo_kreturn);
            deskmenu_dispatch_keypress(aes_event_out.emo_kreturn,
                                       aes_event_out.emo_kmeta, nkc);
        }
    }

    tmp = window_list;
    while(tmp){
		if(tmp->root->redraw_slots.areas_used > 0){
			window_process_redraws(tmp->root);
		}
		tmp = tmp->next;
    }

    if(hl.tv->redraw){
		atari_treeview_redraw(hl.tv);
    }

    if(gl_history.tv->redraw){
		atari_treeview_redraw(gl_history.tv);
    }
}
示例#2
0
文件: gui.c 项目: mmuman/NetSurf
/**
 * Core atari event processing.
 */
static void atari_poll(void)
{

    struct gui_window *tmp;
    short mx, my, dummy;

    aes_event_in.emi_tlow = schedule_run();

    if(rendering){
	aes_event_in.emi_tlow = nsoption_int(atari_gui_poll_timeout);
    }

    if(aes_event_in.emi_tlow < 0) {
	aes_event_in.emi_tlow = 10000;
	printf("long poll!\n");
    }

    if(input_window && input_window->root->redraw_slots.areas_used > 0) {
	window_process_redraws(input_window->root);
    }


    graf_mkstate(&mx, &my, &dummy, &dummy);
    aes_event_in.emi_m1.g_x = mx;
    aes_event_in.emi_m1.g_y = my;
    evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out);
    if(gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out) == 0) {
	if( (aes_event_out.emo_events & MU_MESAG) != 0 ) {
	    LOG("WM: %d\n", aes_msg_out[0]);
	    switch(aes_msg_out[0]) {

	    case MN_SELECTED:
		LOG("Menu Item: %d\n", aes_msg_out[4]);
		deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]);
		break;

	    case AP_TERM:
		atari_quit = true;
		break;
	    default:
		break;
	    }
	}
	if((aes_event_out.emo_events & MU_KEYBD) != 0) {
	    uint16_t nkc = gem_to_norm( (short)aes_event_out.emo_kmeta,
					(short)aes_event_out.emo_kreturn);
	    deskmenu_dispatch_keypress(aes_event_out.emo_kreturn,
				       aes_event_out.emo_kmeta, nkc);
	}
    }

    tmp = window_list;
    while(tmp){
	if(tmp->root->redraw_slots.areas_used > 0){
	    window_process_redraws(tmp->root);
	}
	tmp = tmp->next;
    }

    /** @todo implement generic treeview redraw function. */
    /** @todo rename hl to atari_hotlist or create getter for it... */

    atari_treeview_flush_redraws();
}