X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ion3.git;a=blobdiff_plain;f=ioncore%2Fevent.c;h=75384a15ba8c38581b407e917b36e0f0e7cc61e3;hp=9a3b95790f4b7e33ac19c296835abc14df5908c9;hb=HEAD;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d diff --git a/ioncore/event.c b/ioncore/event.c index 9a3b957..75384a1 100644 --- a/ioncore/event.c +++ b/ioncore/event.c @@ -1,12 +1,9 @@ /* * ion/ioncore/event.c * - * Copyright (c) Tuomo Valkonen 1999-2007. + * Copyright (c) Tuomo Valkonen 1999-2009. * - * 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 - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -172,24 +169,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 +227,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); } }