291 |
|
|
292 |
|
|
293 |
void interrupt(); |
void interrupt(); |
294 |
void eventLoop(bool wait); |
bool eventLoop(bool wait); |
295 |
|
|
296 |
/* |
/* |
297 |
void addIdle(IdleTasks *task) { |
void addIdle(IdleTasks *task) { |
677 |
write(interruptPipe[1], &intr, 1); |
write(interruptPipe[1], &intr, 1); |
678 |
} |
} |
679 |
|
|
680 |
void LXWindowSystem::eventLoop(bool wait) { |
bool LXWindowSystem::eventLoop(bool wait) { |
681 |
DBG(dbg) << "In C++ eventloop : "<<wait<<"\n"; |
DBG(dbg) << "In C++ eventloop : "<<wait<<"\n"; |
682 |
|
bool ret = false; |
683 |
// We don't want to block; |
// We don't want to block; |
684 |
while(1) { |
while(1) { |
685 |
DBG(dbg) << "Start loop\n"; |
DBG(dbg) << "Start loop\n"; |
687 |
bool eventsWaiting = XEventsQueued(dpy, QueuedAfterFlush); |
bool eventsWaiting = XEventsQueued(dpy, QueuedAfterFlush); |
688 |
|
|
689 |
// If we should not wait and there are no events, return now |
// If we should not wait and there are no events, return now |
690 |
if(!wait && !eventsWaiting) return; |
if(!wait && !eventsWaiting) return ret; |
691 |
// We only wait once: on the next iteration of the loop, |
// We only wait once: on the next iteration of the loop, |
692 |
// we'll return |
// we'll return |
693 |
wait = false; |
wait = false; |
711 |
LXWindow *w = windowsByX[timeouts[i].window]; |
LXWindow *w = windowsByX[timeouts[i].window]; |
712 |
timeouts.erase(timeouts.begin()+i); |
timeouts.erase(timeouts.begin()+i); |
713 |
w->deliverTimeout(id); |
w->deliverTimeout(id); |
714 |
return; |
return ret; |
715 |
} else { |
} else { |
716 |
int ms = timeouts[i].time - t; |
int ms = timeouts[i].time - t; |
717 |
if(ms < timeout.tv_usec / 1000) |
if(ms < timeout.tv_usec / 1000) |
735 |
|
|
736 |
XEvent e; |
XEvent e; |
737 |
XNextEvent(dpy, &e); |
XNextEvent(dpy, &e); |
738 |
|
ret = true; |
739 |
//cout << "getWindow\n"; |
//cout << "getWindow\n"; |
740 |
LXWindow *w = windowsByX[e.xkey.window]; |
LXWindow *w = windowsByX[e.xkey.window]; |
741 |
if(!w) { |
if(!w) { |