/*
* 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
- * 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 <X11/Xmd.h>
}
-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);
}
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);
}
}