Beispiel #1
0
void
XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
{
    EventListPtr        events;
    int                 nevents, i;
    DeviceIntPtr        ptr;

    /* If dev is a slave device, and the SD is attached, do nothing. If we'd
     * post through the attached master pointer we'd get duplicate events.
     *
     * if dev is a master keyboard, post through the XTEST device
     *
     * if dev is a floating slave, post through the device itself.
     */

    if (IsMaster(dev))
        ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
    else if (!dev->u.master)
        ptr = dev;
    else
        return;

    events = InitEventList(GetMaximumEventsNum());
    OsBlockSignals();
    nevents = GetPointerEvents(events, ptr,
                               press ? ButtonPress : ButtonRelease, button,
                               0 /* flags */, 0 /* first */,
                               0 /* num_val */, NULL);
    OsReleaseSignals();

    for (i = 0; i < nevents; i++)
        mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);

    FreeEventList(events, GetMaximumEventsNum());
}
BOOL CPageEvents::OnInitDialog() 
{
  // Perform default processing
  CPropertyPage::OnInitDialog();

  // Get the instance of the AGCEventLogger on which we will operate
  if (NULL != m_spEventLogger && NULL != m_spXMLDoc)
  {
    // Initialize the tree and list controls
    InitEventTree();
    InitEventList();

    // Populate the tree and list controls with the event hierarchy
    PopulateTreeAndList();
  }
  else
  {
    // FORNOW: Disable the whole window
    EnableWindow(false);
  }

  // Select the Tree control view
  CheckDlgButton(IDC_BY_GROUP, BST_CHECKED);
  OnByGroup();

  // Return true to set the focus to the first tabstop control
  return true;
}
Beispiel #3
0
void
XTestExtensionInit(void)
{
    AddExtension(XTestExtensionName, 0, 0,
                 ProcXTestDispatch, SProcXTestDispatch,
                 XTestExtensionTearDown, StandardMinorOpcode);

    xtest_evlist = InitEventList(GetMaximumEventsNum());
}
Beispiel #4
0
void
XTestExtensionInit(INITARGS)
{
    AddExtension(XTestExtensionName, 0, 0,
            ProcXTestDispatch, SProcXTestDispatch,
            NULL, StandardMinorOpcode);

    xtest_evlist = InitEventList(GetMaximumEventsNum());
}
Beispiel #5
0
/**
 * Move the device's pointer to the x/y coordinates on the given screen.
 * This function generates and enqueues pointer events.
 *
 * @param pDev The device to move
 * @param pScreen The screen the device is on
 * @param x The x coordinate in per-screen coordinates
 * @param y The y coordinate in per-screen coordinates
 */
void
miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
    int i, nevents;
    int valuators[2];
    ValuatorMask mask;

    miPointerMoveNoEvent(pDev, pScreen, x, y);

    /* generate motion notify */
    valuators[0] = x;
    valuators[1] = y;

    if (!events)
    {
        events = InitEventList(GetMaximumEventsNum());

        if (!events)
        {
            FatalError("Could not allocate event store.\n");
            return;
        }
    }

    valuator_mask_set_range(&mask, 0, 2, valuators);
    nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
                               POINTER_SCREEN | POINTER_ABSOLUTE | POINTER_NORAW, &mask);

    OsBlockSignals();
#ifdef XQUARTZ
    darwinEvents_lock();
#endif
    for (i = 0; i < nevents; i++)
        mieqEnqueue(pDev, &events[i]);
#ifdef XQUARTZ
    darwinEvents_unlock();
#endif
    OsReleaseSignals();
}
Beispiel #6
0
Bool
DarwinEQInit(void)
{
    int *p;

    for (p = darwin_x11_modifier_mask_list; *p; p++) {
        darwin_x11_modifier_mask |= *p;
    }

    darwin_all_modifier_mask = darwin_x11_modifier_mask;
    for (p = darwin_all_modifier_mask_additions; *p; p++) {
        darwin_all_modifier_mask |= *p;
    }

    mieqInit();
    mieqSetHandler(ET_XQuartz, DarwinEventHandler);

    /* Note that this *could* cause a potential async issue, since we're checking
     * darwinEvents without holding the lock, but darwinEvents is only ever set
     * here, so I don't bother.
     */
    if (!darwinEvents) {
        darwinEvents = InitEventList(GetMaximumEventsNum());

        if (!darwinEvents)
            FatalError("Couldn't allocate event buffer\n");

        darwinEvents_lock();
        pthread_cond_broadcast(&mieq_ready_cond);
        darwinEvents_unlock();
    }

    if (!fd_add_tid)
        fd_add_tid = create_thread(DarwinProcessFDAdditionQueue_thread, NULL);

    return TRUE;
}
Beispiel #7
0
static
void
ManagerThreadProc (
    ClientData clientData
    )
{
    BlockAllSignals();

    Tcl_MutexLock(&spointsLock);

    /* Notify creator thread we're ready */
    threadReady = 1;
    Tcl_ConditionNotify(&spointsCV);

    while (1) {
	Queue eventQueue;
	SignalMapSearch iterator;
	SyncPoint *spointPtr;

	while (condReady == 0) {
	    Tcl_ConditionWait(&spointsCV, &spointsLock, NULL);
	}
	condReady = 0;

	if (shutdownRequested) {
	    break;
	}

	InitEventList(&eventQueue);

	HarvestDanglingSyncpoints(&danglingSpoints, &eventQueue);

	spointPtr = FirstSigMapEntry(&syncpoints, &iterator);
	while (spointPtr != NULL) {
	    HarvestSyncpoint(spointPtr, &eventQueue);
	    spointPtr = NextSigMapEntry(&iterator);
	}

	Tcl_MutexUnlock(&spointsLock);

	{
	    SignalEvent *evPtr;
	    Tcl_ThreadId lastId;

	    evPtr = QueuePop(&eventQueue);
	    lastId = evPtr->threadId;
	    do {
		SignalEvent *nextEvPtr;
		Tcl_ThreadId threadId;

		nextEvPtr = QueuePop(&eventQueue);
		threadId = evPtr->threadId;
		Tcl_ThreadQueueEvent(threadId,
			(Tcl_Event*) evPtr, TCL_QUEUE_TAIL);
		if (threadId != lastId) {
		    Tcl_ThreadAlert(lastId);
		}
		printf("Sent %d to %x\n",
			evPtr->signum, evPtr->threadId);
		evPtr = nextEvPtr;
		lastId = threadId;
	    } while (evPtr != NULL);
	    Tcl_ThreadAlert(lastId);
	}

	Tcl_MutexLock(&spointsLock);
    }

    /* Notify creator thread we're finished.
     * Note that the spointsLock is held at this point. */
    threadReady = 1;
    Tcl_ConditionNotify(&spointsCV);
    Tcl_MutexUnlock(&spointsLock);
}