Esempio n. 1
0
File: gui.c Progetto: 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();
}
Esempio n. 2
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);
    }
}
Esempio n. 3
0
void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data)
{
	char sascii;
	long kstate = 0;
	long kcode = 0;
	unsigned short nkc = 0;
	unsigned short nks = 0;

	int i=0;
	bool done = false;
	struct gui_window * gw = input_window;
	struct gui_window * gw_tmp;
	if( gw == NULL )
		return;
	kstate = evnt.mkstate;
	kcode = evnt.keybd;
	nkc= gem_to_norm( (short)kstate, (short)kcode );
	nks = (nkc & 0xFF00);
	if( kstate & (K_LSHIFT|K_RSHIFT))
		kstate |= K_LSHIFT|K_RSHIFT;
	if( window_url_widget_has_focus( gw ) ) {
		/* make sure we report for the root window and report...: */
		done = tb_url_input( gw, nkc );
	}  else  {
		gw_tmp = window_list;
		/* search for active browser component: */
		while( gw_tmp != NULL && done == false ) {
			/* todo: only handle when input_window == ontop */
			if( window_widget_has_focus( (struct gui_window *)input_window,
										 BROWSER,(void*)gw_tmp->browser)) {
				done = browser_input( gw_tmp, nkc );
				break;
			} else {
				gw_tmp = gw_tmp->next;
			}
		}
	}
	sascii = keybd2ascii( evnt.keybd, K_LSHIFT);
	while( menu_evnt_tbl[i].rid != -1 && done == false) {
		if( kstate == menu_evnt_tbl[i].accel.mod && menu_evnt_tbl[i].accel.ascii != 0) {
			if( menu_evnt_tbl[i].accel.ascii == sascii) {
				menu_evnt_tbl[i].menu_func( NULL, menu_evnt_tbl[i].rid, MAINMENU, buff);
				done = true;
				break;
			}
		} else {
			/* the accel code hides in the keycode: */
			if( menu_evnt_tbl[i].accel.keycode != 0) {
				if( menu_evnt_tbl[i].accel.keycode == (nkc & 0xFF) &&
					kstate == menu_evnt_tbl[i].accel.mod &&
					menu_evnt_tbl[i].menu_func != NULL) {
						menu_evnt_tbl[i].menu_func( NULL,
							menu_evnt_tbl[i].rid,
							MAINMENU, buff
						);
						done = true;
						break;
				}
			}
		}
		i++;
	}
}