X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fevent.c;h=260d6b01e509c6c0dbb0d2d8021a7f61c3be8632;hb=2cbfb1bd74fdc6b0c3733abb07e95ba9fa334929;hp=84943d56ee046441d4c06808d13d866c66344270;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/ioncore/event.c b/ioncore/event.c index 84943d5..260d6b0 100644 --- a/ioncore/event.c +++ b/ioncore/event.c @@ -1,7 +1,7 @@ /* * ion/ioncore/event.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * Copyright (c) Tuomo Valkonen 1999-2007. * * Ion is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by @@ -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); } }