Logo Search packages:      
Sourcecode: waimea version File versions  Download package

timeout ( int  signal  ) 

Timeout handler function.

Handles the SIGALRM signal. Invokes actions for interrupt and updates timevalues for the interrupts.

Parameters:
signal The signal we received

Definition at line 225 of file Timer.cc.

References waexec().

                         {
    Interrupt *i = timer->interrupts.front();
    timer->interrupts.pop_front();

    list<Interrupt *>::iterator it = timer->interrupts.begin();
    for (; it != timer->interrupts.end(); ++it) {
        (*it)->delay.tv_sec -= i->delay.tv_sec;
        (*it)->delay.tv_usec -= i->delay.tv_usec;

        if ((*it)->delay.tv_usec < 0) {
            (*it)->delay.tv_sec--;
            (*it)->delay.tv_usec += 1000000;
        }
    }

    map<Window, WindowObject *>::iterator wit;
    if ((wit = timer->waimea->window_table.find(i->id)) !=
        timer->waimea->window_table.end()) {
        WindowObject *wo = (*wit).second;

        switch (wo->type) {
            case WindowType: {
                WaWindow *wa = (WaWindow *) wo;    
                if (i->action->exec)
                    waexec(i->action->exec, wa->wascreen->displaystring);
                else {
                    ((*wa).*(i->action->winfunc))(&i->event, i->action);
                    XSync(wa->display, false);
                }
            } break;
            case MenuTitleType:
            case MenuItemType:
            case MenuCBItemType:
            case MenuSubType: {
                WaMenuItem *wm = (WaMenuItem *) wo;
                if (i->action->exec)
                    waexec(i->action->exec, wm->menu->wascreen->displaystring);
                else { 
                    ((*wm).*(i->action->menufunc))(&i->event, i->action);
                    XSync(wm->menu->display, false);
                }
            } break;
            case RootType: {
                WaScreen *ws = (WaScreen *) wo;
                if (i->action->exec) 
                    waexec(i->action->exec, ws->displaystring);
                else {
                    ((*ws).*(i->action->rootfunc))(&i->event, i->action);
                    XSync(ws->display, false);
                }
            } break;
        }
    }
    delete i;
    timer->Start();
}


Generated by  Doxygen 1.6.0   Back to index