static status initialiseAttribute(Attribute att, Any name, Any value) { initialiseProgramObject(att); assign(att, name, name); assign(att, value, value); succeed; }
status initialiseBehaviour(Behaviour b, Name name, Any ctx) { initialiseProgramObject(b); if ( isDefault(ctx) ) ctx = NIL; assign(b, name, name); assign(b, context, ctx); succeed; }
static status initialiseHyper(Hyper h, Any from, Any to, Name fname, Name bname) { Any av[2]; initialiseProgramObject(h); if ( isDefault(fname) ) fname = NAME_hypered; if ( isDefault(bname) ) bname = fname; assign(h, from, from); assign(h, to, to); assign(h, forward_name, fname); assign(h, backward_name, bname); av[0] = h; av[1] = to; TRY(sendv(from, NAME_attachHyper, 2, av)); av[1] = from; return sendv(to, NAME_attachHyper, 2, av); }
static status initialiseEvent(EventObj e, Name id, Any window, Int x, Int y, Int bts, Int time) { unsigned long t = valInt(time); initialiseProgramObject(e); if ( notNil(EVENT->value) ) { EventObj parent = EVENT->value; if ( isDefault(x) ) x = parent->x; if ( isDefault(y) ) y = parent->y; if ( isDefault(bts) ) bts = parent->buttons; if ( isDefault(window) ) window = parent->window; if ( isDefault(time) ) t = max(last_time, parent->time); } else { if ( isDefault(x) ) x = last_x; if ( isDefault(y) ) y = last_y; if ( isDefault(bts) ) bts = last_buttons; if ( isDefault(window) ) window = last_window; if ( isDefault(time) ) t = last_time; } host_last_time = mclock(); last_time = t; last_buttons = bts; /* save these values */ last_x = x; last_y = y; assign(e, window, window); assign(e, receiver, window); assign(e, id, id); assign(e, x, x); assign(e, y, y); assign(e, buttons, bts); e->time = t; if ( isDownEvent(e) ) { int clt = CLICK_TYPE_single; int px = valInt(x); int py = valInt(y); DEBUG(NAME_multiclick, Cprintf("t: %ld (%ld), x: %d (%d), y: %d (%d) --> ", t, last_down_time, px, last_down_x, py, last_down_y)); if ( (valInt(e->buttons) & CLICK_TYPE_mask) == CLICK_TYPE_double ) { switch( last_click_type ) { case CLICK_TYPE_single: clt = CLICK_TYPE_double; break; case CLICK_TYPE_double: clt = CLICK_TYPE_triple; break; default: clt = CLICK_TYPE_single; break; } e->buttons = toInt(valInt(e->buttons) & ~CLICK_TYPE_mask); } else { if ( (t - last_down_time) < multi_click_time && abs(last_down_x - px) <= multi_click_diff && abs(last_down_y - py) <= multi_click_diff && (valInt(last_down_bts)&BUTTON_mask) == (valInt(bts)&BUTTON_mask) && last_window == window ) { switch( last_click_type ) { case CLICK_TYPE_single: clt = CLICK_TYPE_double; break; case CLICK_TYPE_double: clt = CLICK_TYPE_triple; break; } } } last_click_type = clt; assign(e, buttons, toInt(valInt(e->buttons) | clt)); DEBUG(NAME_multiclick, Cprintf("%s\n", strName(getMulticlickEvent(e)))); last_down_bts = bts; last_down_time = t; last_down_x = px; last_down_y = py; } else if ( isUpEvent(e) ) { assign(e, buttons, toInt(valInt(e->buttons) | last_click_type)); } if ( !onFlag(window, F_FREED|F_FREEING) ) last_window = window; if ( loc_still_posted ) { if ( isAEvent(e, NAME_locMove) ) { DEBUG(NAME_locStill, Cprintf("Re-enabled loc-still on %s\n", pp(e->id))); loc_still_posted = FALSE; } } else if ( isAEvent(e, NAME_area) || isAEvent(e, NAME_deactivateKeyboardFocus) ) { DEBUG(NAME_locStill, Cprintf("Disabled loc-still on %s\n", pp(e->id))); loc_still_posted = TRUE; } succeed; }
status initialiseCode(Code c) { return initialiseProgramObject(c); }