Exemplo n.º 1
0
Bool
CopyGrab(GrabPtr dst, const GrabPtr src)
{
    Mask *mdetails_mask = NULL;
    Mask *details_mask = NULL;
    XI2Mask *xi2mask;

    if (src->modifiersDetail.pMask) {
        int len = MasksPerDetailMask * sizeof(Mask);

        mdetails_mask = malloc(len);
        if (!mdetails_mask)
            return FALSE;
        memcpy(mdetails_mask, src->modifiersDetail.pMask, len);
    }

    if (src->detail.pMask) {
        int len = MasksPerDetailMask * sizeof(Mask);

        details_mask = malloc(len);
        if (!details_mask) {
            free(mdetails_mask);
            return FALSE;
        }
        memcpy(details_mask, src->detail.pMask, len);
    }

    if (!dst->xi2mask) {
        xi2mask = xi2mask_new();
        if (!xi2mask) {
            free(mdetails_mask);
            free(details_mask);
            return FALSE;
        }
    }
    else {
        xi2mask = dst->xi2mask;
        xi2mask_zero(xi2mask, -1);
    }

    *dst = *src;
    dst->modifiersDetail.pMask = mdetails_mask;
    dst->detail.pMask = details_mask;
    dst->xi2mask = xi2mask;
    dst->cursor = RefCursor(src->cursor);

    xi2mask_merge(dst->xi2mask, src->xi2mask);

    return TRUE;
}
Exemplo n.º 2
0
static Bool
xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
{
    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;

    cursor = RefCursor(cursor);
    if (xf86_config->cursor)
        FreeCursor(xf86_config->cursor, None);
    xf86_config->cursor = cursor;

    if (cursor->bits->width > cursor_info->MaxWidth ||
        cursor->bits->height > cursor_info->MaxHeight)
        return FALSE;

    return TRUE;
}
Exemplo n.º 3
0
GrabPtr
CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
           WindowPtr window, enum InputLevel grabtype, GrabMask *mask,
           GrabParameters *param, int type,
           KeyCode keybut,        /* key or button */
           WindowPtr confineTo, CursorPtr cursor)
{
    GrabPtr grab;

    grab = AllocGrab(NULL);
    if (!grab)
        return (GrabPtr) NULL;
    grab->resource = FakeClientID(client);
    grab->device = device;
    grab->window = window;
    if (grabtype == CORE || grabtype == XI)
        grab->eventMask = mask->core;       /* same for XI */
    else
        grab->eventMask = 0;
    grab->deviceMask = 0;
    grab->ownerEvents = param->ownerEvents;
    grab->keyboardMode = param->this_device_mode;
    grab->pointerMode = param->other_devices_mode;
    grab->modifiersDetail.exact = param->modifiers;
    grab->modifiersDetail.pMask = NULL;
    grab->modifierDevice = modDevice;
    grab->type = type;
    grab->grabtype = grabtype;
    grab->detail.exact = keybut;
    grab->detail.pMask = NULL;
    grab->confineTo = confineTo;
    grab->cursor = RefCursor(cursor);
    grab->next = NULL;

    if (grabtype == XI2)
        xi2mask_merge(grab->xi2mask, mask->xi2mask);
    return grab;

}
Exemplo n.º 4
0
static Bool
xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
{
    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;

    cursor = RefCursor(cursor);
    if (xf86_config->cursor)
        FreeCursor(xf86_config->cursor, None);
    xf86_config->cursor = cursor;

    /* Make sure ARGB support is available */
    if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
        return FALSE;

    if (cursor->bits->width > cursor_info->MaxWidth ||
        cursor->bits->height > cursor_info->MaxHeight)
        return FALSE;

    return TRUE;
}