X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=ioncore%2Fevent.c;h=260d6b01e509c6c0dbb0d2d8021a7f61c3be8632;hp=9a3b95790f4b7e33ac19c296835abc14df5908c9;hb=20070318;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d diff --git a/ioncore/event.c b/ioncore/event.c index 9a3b957..260d6b0 100644 --- a/ioncore/event.c +++ b/ioncore/event.c @@ -172,24 +172,29 @@ static void skip_enterwindow() } -void ioncore_flush() +void ioncore_flushfocus() { - if(ioncore_g.focus_next!=NULL && - ioncore_g.input_mode==IONCORE_INPUTMODE_NORMAL){ - bool warp=ioncore_g.warp_next; - WRegion *next=ioncore_g.focus_next; + WRegion *next; + bool warp; + + if(ioncore_g.input_mode!=IONCORE_INPUTMODE_NORMAL) + return; + + next=ioncore_g.focus_next; + warp=ioncore_g.warp_next; + + if(next==NULL) + return; - ioncore_g.focus_next=NULL; + ioncore_g.focus_next=NULL; - region_do_set_focus(next, warp); + region_do_set_focus(next, warp); - /* Just greedily eating it all away that X has to offer - * seems to be the best we can do with Xlib. - */ + /* Just greedily eating it all away that X has to offer + * seems to be the best we can do with Xlib. + */ + if(warp) skip_enterwindow(); - } - - XFlush(ioncore_g.dpy); } @@ -225,12 +230,22 @@ void ioncore_mainloop() while(1){ check_signals(); mainloop_execute_deferred(); - ioncore_flush(); - - if(QLength(ioncore_g.dpy)>0) - ioncore_x_connection_handler(ioncore_g.conn, NULL); - else - mainloop_select(); + + if(QLength(ioncore_g.dpy)==0){ + XSync(ioncore_g.dpy, False); + + if(QLength(ioncore_g.dpy)==0){ + ioncore_flushfocus(); + XSync(ioncore_g.dpy, False); + + if(QLength(ioncore_g.dpy)==0){ + mainloop_select(); + continue; + } + } + } + + ioncore_x_connection_handler(ioncore_g.conn, NULL); } }