Introduce idlers.

SVN revision: 21980
This commit is contained in:
Kim Woelders 2006-04-09 10:18:34 +00:00
parent 57e5fb09d4
commit 05e7471a1a
12 changed files with 102 additions and 32 deletions

View File

@ -971,6 +971,11 @@ Qentry *GetHeadTimerQueue(void);
void HandleTimerEvent(void);
int RemoveTimerEvent(const char *name);
struct _idler;
void IdlerAdd(int order, void (*func) (void *data), void *data);
void IdlerDel(struct _idler *id);
void IdlersRun(void);
/* warp.c */
void WarpFocus(int delta);

View File

@ -1047,6 +1047,12 @@ DesksStackingCheck(void)
}
}
static void
_DesksIdler(void *data __UNUSED__)
{
DesksStackingCheck();
}
static void
DeskMove(Desk * dsk, int x, int y)
{
@ -2198,10 +2204,7 @@ DesksSighan(int sig, void *prm __UNUSED__)
case ESIGNAL_START:
/* Draw all the buttons that belong on the desktop */
DeskShowButtons();
break;
case ESIGNAL_IDLE:
DesksStackingCheck();
IdlerAdd(50, _DesksIdler, NULL);
break;
}
}

View File

@ -1725,8 +1725,8 @@ DialogUpdate(Dialog * d)
d->xu2 = d->yu2 = 0;
}
void
DialogsCheckUpdate(void)
static void
_DialogsCheckUpdate(void *data __UNUSED__)
{
Dialog *d;
@ -1742,6 +1742,12 @@ DialogsCheckUpdate(void)
}
}
void
DialogsInit(void)
{
IdlerAdd(50, _DialogsCheckUpdate, NULL);
}
static void
DialogItemsRealize(Dialog * d)
{

View File

@ -127,7 +127,7 @@ void DialogItemAreaSetEventFunc(DItem * di,
void DialogCallbackClose(Dialog * d, int val, void *data);
void DialogsCheckUpdate(void);
void DialogsInit(void);
EWin *FindEwinByDialog(Dialog * d);

View File

@ -2136,6 +2136,18 @@ ECompMgrRepaint(void)
allDamage = None;
}
static void
_ECompMgrIdler(void *data __UNUSED__)
{
/* Do we get here on auto? */
if (!allDamage /* || Conf_compmgr.mode == ECM_MODE_AUTO */ )
return;
ECompMgrRepaint();
#if 0 /* FIXME - Was here - Why? */
XSync(disp, False);
#endif
}
static void
ECompMgrRootConfigure(void *prm __UNUSED__, XEvent * ev)
{
@ -2622,14 +2634,7 @@ ECompMgrSighan(int sig, void *prm __UNUSED__)
ECompMgrInit();
if (Conf_compmgr.enable)
ECompMgrStart();
break;
case ESIGNAL_IDLE:
/* Do we get here on auto? */
if (!allDamage /* || Conf_compmgr.mode == ECM_MODE_AUTO */ )
return;
ECompMgrRepaint();
XSync(disp, False);
IdlerAdd(50, _ECompMgrIdler, NULL);
break;
}
}

View File

@ -49,7 +49,6 @@ typedef enum
ESIGNAL_CONFIGURE,
ESIGNAL_START,
ESIGNAL_EXIT,
ESIGNAL_IDLE,
ESIGNAL_AREA_CONFIGURED,
ESIGNAL_AREA_SWITCH_START,
ESIGNAL_AREA_SWITCH_DONE,

View File

@ -23,7 +23,6 @@
*/
#include "E.h"
#include "aclass.h"
#include "dialog.h" /* FIXME - Should not be here */
#include "emodule.h"
#include "xwin.h"
#include <sys/time.h>
@ -626,8 +625,7 @@ EventsMain(void)
if (EventDebug(EDBUG_TYPE_EVENTS))
Eprintf("EventsMain - Idlers\n");
DialogsCheckUpdate(); /* FIXME - Shouldn't be here */
ModulesSignal(ESIGNAL_IDLE, NULL);
IdlersRun();
if (pfetch)
{

View File

@ -863,6 +863,15 @@ FocusInitTimeout(int val __UNUSED__, void *data __UNUSED__)
FocusInit();
}
static void
_FocusIdler(void *data __UNUSED__)
{
if (!focus_inhibit && focus_pending_why)
FocusSet();
if (focus_pending_update_grabs)
doFocusGrabsUpdate();
}
static void
FocusSighan(int sig, void *prm __UNUSED__)
{
@ -870,19 +879,13 @@ FocusSighan(int sig, void *prm __UNUSED__)
{
case ESIGNAL_START:
/* Delay focusing a bit to allow things to settle down */
IdlerAdd(50, _FocusIdler, NULL);
DoIn("FOCUS_INIT_TIMEOUT", 0.5, FocusInitTimeout, 0, NULL);
break;
case ESIGNAL_EXIT:
FocusExit();
break;
case ESIGNAL_IDLE:
if (!focus_inhibit && focus_pending_why)
FocusSet();
if (focus_pending_update_grabs)
doFocusGrabsUpdate();
break;
}
}

View File

@ -23,6 +23,7 @@
*/
#include "E.h"
#include "desktops.h"
#include "dialog.h"
#include "emodule.h"
#include "hints.h"
#include "snaps.h"
@ -286,6 +287,7 @@ main(int argc, char **argv)
#endif
ModulesSignal(ESIGNAL_START, NULL);
DialogsInit();
/* Map the clients */
MapUnmap(1);

View File

@ -282,7 +282,7 @@ ActionResizeStart(EWin * ewin, int grab, int hv)
EGrabServer();
ModulesSignal(ESIGNAL_ANIMATION_SUSPEND, NULL);
/* Run idlers (stacking, border updates, ...) before drawing lines */
ModulesSignal(ESIGNAL_IDLE, NULL);
IdlersRun();
}
else
{

View File

@ -775,6 +775,12 @@ PagerUpdateTimeout(int val __UNUSED__, void *data __UNUSED__)
PagersCheckUpdate();
}
static void
_PagersIdler(void *data __UNUSED__)
{
PagersCheckUpdate();
}
static void
PagerEwinUpdateFromPager(Pager * p, EWin * ewin)
{
@ -1904,11 +1910,7 @@ PagersSighan(int sig, void *prm)
break;
Conf_pagers.enable = 0;
PagersShow(1);
PagersCheckUpdate();
break;
case ESIGNAL_IDLE:
PagersCheckUpdate();
IdlerAdd(50, _PagersIdler, NULL);
break;
case ESIGNAL_AREA_CONFIGURED:

View File

@ -21,6 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "e16-ecore_list.h"
#include <sys/time.h>
double
@ -132,3 +133,49 @@ RemoveTimerEvent(const char *name)
return 0;
}
static Ecore_List *idler_list = NULL;
typedef struct _idler Idler;
typedef void (IdlerFunc) (void *data);
struct _idler
{
int order;
IdlerFunc *func;
void *data;
};
void
IdlerAdd(int order, IdlerFunc * func, void *data)
{
Idler *id;
id = Emalloc(sizeof(Idler));
if (!id)
return;
id->order = order; /* Not used atm. */
id->func = func;
id->data = data;
if (!idler_list)
idler_list = ecore_list_new();
ecore_list_append(idler_list, id);
}
void
IdlerDel(Idler * id)
{
ecore_list_remove_node(idler_list, id);
Efree(id);
}
void
IdlersRun(void)
{
Idler *id;
ECORE_LIST_FOR_EACH(idler_list, id) id->func(id->data);
}