bool SharedMemoryBasic::Map(size_t nBytes) { NS_ABORT_IF_FALSE(nullptr == mMemory, "Already Map()d"); mMemory = mmap(nullptr, nBytes, PROT_READ | PROT_WRITE, MAP_SHARED, mShmFd, 0); if (MAP_FAILED == mMemory) { LogError("ShmemAndroid::Map()"); mMemory = nullptr; return false; } Mapped(nBytes); return true; }
compzillaWindow::compzillaWindow(Display *display, Window win, XWindowAttributes *attrs) : mAttr(*attrs), mDisplay(display), mWindow(win), mPixmap(None), mDamage(None), mLastEntered(None), mIsDestroyed(false), mIsRedirected(false), mIsResizePending(false) { XSelectInput (display, win, (PropertyChangeMask | EnterWindowMask | FocusChangeMask)); #if HAVE_XSHAPE XShapeSelectInput (display, win, ShapeNotifyMask); #endif // Get notified of global cursor changes. // FIXME: This is not very useful, as X has no way of fetching the Cursor // for a given window. //XFixesSelectCursorInput (display, win, XFixesDisplayCursorNotifyMask); XGrabButton (display, AnyButton, AnyModifier, win, true, (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask), GrabModeSync, GrabModeSync, None, None); /* * Set up damage notification. RawRectangles gives us smaller grain * changes, versus NonEmpty which seems to always include the entire * contents. */ mDamage = XDamageCreate (mDisplay, mWindow, XDamageReportRawRectangles); if (mAttr.map_state == IsViewable) { mAttr.map_state = IsUnmapped; Mapped (mAttr.override_redirect); } }
/** * @pre Mapped() */ GLvoid* RawData(void) { assert(Mapped()); return _ptr; }