示例#1
0
Bool
dri3_event_init(void)
{
    dri3_event_type = CreateNewResourceType(dri3_free_event, "DRI3Event");
    if (!dri3_event_type)
        return FALSE;

    GERegisterExtension(dri3_request, dri3_event_swap);
    return TRUE;
}
示例#2
0
Bool
present_event_init(void)
{
    present_event_type = CreateNewResourceType(present_free_event, "PresentEvent");
    if (!present_event_type)
        return FALSE;

    GERegisterExtension(present_request, present_event_swap);
    return TRUE;
}
示例#3
0
文件: extinit.c 项目: nikai3d/xserver
void
XInputExtensionInit(void)
{
    ExtensionEntry *extEntry;
    XExtensionVersion thisversion = { XI_Present,
                                      SERVER_XI_MAJOR_VERSION,
                                      SERVER_XI_MINOR_VERSION,
                                    };

    if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
        FatalError("Cannot request private for XI.\n");

    if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
        FatalError("Failed to add callback to XI.\n");

    extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
                            SProcIDispatch, IResetProc, StandardMinorOpcode);
    if (extEntry) {
        IReqCode = extEntry->base;
        IEventBase = extEntry->eventBase;
        XIVersion = thisversion;
        MakeDeviceTypeAtoms();
        RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone,
                                               "INPUTCLIENT");
        if (!RT_INPUTCLIENT)
            FatalError("Failed to add resource type for XI.\n");
        FixExtensionEvents(extEntry);
        ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
        EventSwapVector[DeviceValuator] = SEventIDispatch;
        EventSwapVector[DeviceKeyPress] = SEventIDispatch;
        EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
        EventSwapVector[DeviceButtonPress] = SEventIDispatch;
        EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
        EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
        EventSwapVector[DeviceFocusIn] = SEventIDispatch;
        EventSwapVector[DeviceFocusOut] = SEventIDispatch;
        EventSwapVector[ProximityIn] = SEventIDispatch;
        EventSwapVector[ProximityOut] = SEventIDispatch;
        EventSwapVector[DeviceStateNotify] = SEventIDispatch;
        EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
        EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
        EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
        EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
        EventSwapVector[DevicePresenceNotify] = SEventIDispatch;

        GERegisterExtension(IReqCode, XI2EventSwap);


        memset(&xi_all_devices, 0, sizeof(xi_all_devices));
        memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
        xi_all_devices.id = XIAllDevices;
        xi_all_devices.name = "XIAllDevices";
        xi_all_master_devices.id = XIAllMasterDevices;
        xi_all_master_devices.name = "XIAllMasterDevices";

        inputInfo.all_devices = &xi_all_devices;
        inputInfo.all_master_devices = &xi_all_master_devices;

        XIResetProperties();
    } else {
        FatalError("IExtensionInit: AddExtensions failed\n");
    }
}