/* * eventHandler * Callback handler for Xplugin events. */ static void eventHandler(unsigned int type, const void *arg, unsigned int arg_size, void *data) { switch (type) { case XP_EVENT_DISPLAY_CHANGED: DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); DarwinSendDDXEvent(kXquartzDisplayChanged, 0); break; case XP_EVENT_WINDOW_STATE_CHANGED: if (arg_size >= sizeof(xp_window_state_event)) { const xp_window_state_event *ws_arg = arg; DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state); DarwinSendDDXEvent(kXquartzWindowState, 2, ws_arg->id, ws_arg->state); } else { DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n"); } break; case XP_EVENT_WINDOW_MOVED: DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n"); if (arg_size == sizeof(xp_window_id)) { xp_window_id id = * (xp_window_id *) arg; DarwinSendDDXEvent(kXquartzWindowMoved, 1, id); } break; case XP_EVENT_SURFACE_DESTROYED: DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n"); case XP_EVENT_SURFACE_CHANGED: DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n"); if (arg_size == sizeof(xp_surface_id)) { int kind; if (type == XP_EVENT_SURFACE_DESTROYED) kind = AppleDRISurfaceNotifyDestroyed; else kind = AppleDRISurfaceNotifyChanged; DRISurfaceNotify(*(xp_surface_id *) arg, kind); } break; #ifdef XP_EVENT_SPACE_CHANGED case XP_EVENT_SPACE_CHANGED: DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n"); if(arg_size == sizeof(uint32_t)) { uint32_t space_id = *(uint32_t *)arg; DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id); } break; #endif default: ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type); } }
/* * The assumption is that this is called when the refCount of a surface * drops to <= 0, or the window/pixmap is destroyed. */ Bool DRIDrawablePrivDelete(pointer pResource, XID id) { DrawablePtr pDrawable = (DrawablePtr)pResource; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); DRIDrawablePrivPtr pDRIDrawablePriv = NULL; WindowPtr pWin = NULL; PixmapPtr pPix = NULL; if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); } else if (pDrawable->type == DRAWABLE_PIXMAP) { pPix = (PixmapPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix); } if (pDRIDrawablePriv == NULL) { /* * We reuse __func__ and the resource type for the GLXPixmap code. * Attempt to free a pixmap buffer associated with the resource * if possible. */ return DRIFreePixmapImp(pDrawable); } if (pDRIDrawablePriv->drawableIndex != -1) { /* release drawable table entry */ pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; } if (pDRIDrawablePriv->sid != 0) { DRISurfaceNotify(pDRIDrawablePriv->sid, AppleDRISurfaceNotifyDestroyed); } if (pDRIDrawablePriv->notifiers != NULL) x_hook_free(pDRIDrawablePriv->notifiers); free(pDRIDrawablePriv); if (pDrawable->type == DRAWABLE_WINDOW) { dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); } else if (pDrawable->type == DRAWABLE_PIXMAP) { dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL); } --pDRIPriv->nrWindows; return TRUE; }
/* * eventHandler * Callback handler for Xplugin events. */ static void eventHandler(unsigned int type, const void *arg, unsigned int arg_size, void *data) { switch (type) { case XP_EVENT_DISPLAY_CHANGED: QuartzMessageServerThread(kXDarwinDisplayChanged, 0); break; case XP_EVENT_WINDOW_STATE_CHANGED: if (arg_size >= sizeof(xp_window_state_event)) { const xp_window_state_event *ws_arg = arg; QuartzMessageServerThread(kXDarwinWindowState, 2, ws_arg->id, ws_arg->state); } break; case XP_EVENT_WINDOW_MOVED: if (arg_size == sizeof(xp_window_id)) { xp_window_id id = * (xp_window_id *) arg; QuartzMessageServerThread(kXDarwinWindowMoved, 1, id); } break; case XP_EVENT_SURFACE_DESTROYED: case XP_EVENT_SURFACE_CHANGED: if (arg_size == sizeof(xp_surface_id)) { int kind; if (type == XP_EVENT_SURFACE_DESTROYED) kind = AppleDRISurfaceNotifyDestroyed; else kind = AppleDRISurfaceNotifyChanged; DRISurfaceNotify(*(xp_surface_id *) arg, kind); } break; } }