Esempio n. 1
0
void
considerLocStillEvent()
{ if ( !loc_still_posted )
  { unsigned long now = mclock();

    if ( now - host_last_time < (unsigned long)loc_still_time )
    { DEBUG(NAME_locStill, Cprintf("TimeDiff = %d (ignored)\n", now - host_last_time));
      return;
    }

    if ( !pceMTTryLock(LOCK_PCE) )
      return;
    if ( instanceOfObject(last_window, ClassWindow) &&
	 !onFlag(last_window, F_FREED|F_FREEING) &&
	 valInt(last_x) > 0 && valInt(last_y) > 0 )
    { ServiceMode(is_service_window(last_window),
		  { AnswerMark mark;
		    EventObj e;

		    markAnswerStack(mark);
		    e = newObject(ClassEvent,
				  NAME_locStill, last_window,
				  last_x, last_y, last_buttons,
				  toInt(last_time + now - host_last_time), EAV);
		    addCodeReference(e);
		    postNamedEvent(e, (Graphical) last_window, DEFAULT, NAME_postEvent);
		    delCodeReference(e);
		    freeableObj(e);
		    rewindAnswerStack(mark, NIL);
		  })
    }
Esempio n. 2
0
status
cancelGesture(Gesture g, EventObj ev)
{ PceWindow sw = ev->window;
  EventObj fe = sw->focus_event;
  EventObj oev;

  addCodeReference(fe);
  assign(g, active, OFF);
  send(sw, NAME_focus, NIL, EAV);
  if ( notNil(fe) )
    send(sw, NAME_event, fe, EAV);

  if ( ev != sw->focus_event )
  { addCodeReference(ev);
    oev = sw->current_event;
    assign(sw, current_event, NIL);
    send(sw, NAME_postEvent, ev, EAV);
    assign(sw, current_event, oev);
    delCodeReference(ev);
  }

  assign(g, active, ON);
  delCodeReference(fe);
  freeableObj(fe);
  assign(g, status, NAME_inactive);

  succeed;
}
Esempio n. 3
0
static int
Sclose_object(void *handle)
{ OpenObject h = handle;

  if ( isFreedObj(h->object) )
  { errno = EIO;
    return -1;
  }

  delCodeReference(h->object);
  freeableObj(h->object);

  unalloc(sizeof(*h), h);

  return 0;
}
Esempio n. 4
0
static void
x_event_window(PceWindow sw, XEvent *event)
{ EventObj ev;
  FrameObj fr = getFrameWindow(sw, OFF);
  FrameObj bfr;
  Any receiver = sw;

#ifdef O_XDND
  if ( event->xany.type == MapNotify )
  { if ( hasSendMethodObject(sw, NAME_dropFiles) )
      setDndAwareFrame(fr);
  }
#endif /*O_XDND*/

  if ( fr && (bfr=blockedByModalFrame(fr)) )
  { switch( event->xany.type )
    { case KeyPress:
      { receiver = bfr;
	break;
      }
      case ButtonRelease:
	send(fr, NAME_bell, EAV);
      case ButtonPress:
	send(bfr, NAME_expose, EAV);
      default:
	return;
    }
  }

  if ( (ev = CtoEvent(sw, event)) )
  { addCodeReference(ev);
    postNamedEvent(ev, receiver, DEFAULT, NAME_postEvent);
    delCodeReference(ev);
    freeableObj(ev);

    RedrawDisplayManager(TheDisplayManager()); /* optional? */
  }
}