Files
Emilio Cobos Álvarez 2861287f6d Bug 2054311 - Sort headers in widget/. r=stransky,win-reviewers,geckoview-reviewers,gstoll,owlish
Autogenerated with:

    cp dom/.clang-format widget/ && mach format widget/**.{cpp,h,mm}

Manual changes:

 * Had to add a manual override in nsWaylandDisplay.h /
   DMABufFormats.cpp to include mozwayland before protocols.
 * Missing includes in nsWindowWayland/X11.h / nsDragService.
 * nsFilePicker missed an nsWindow forward declaration.
 * Various overrides in widget/windows because windows headers are order
   dependent.

Differential Revision: https://phabricator.services.mozilla.com/D311688
2026-07-14 16:17:37 +00:00

75 lines
1.7 KiB
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _mozilla_widget_nsShmImage_h_
#define _mozilla_widget_nsShmImage_h_
#if defined(MOZ_X11)
# define MOZ_HAVE_SHMIMAGE
#endif
#ifdef MOZ_HAVE_SHMIMAGE
# include <X11/Xlib-xcb.h>
# include <xcb/shm.h>
# include "Units.h"
# include "mozilla/gfx/2D.h"
# include "nsIWidget.h"
class nsShmImage {
// bug 1168843, compositor thread may create shared memory instances that are
// destroyed by main thread on shutdown, so this must use thread-safe RC to
// avoid hitting assertion
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsShmImage)
public:
static bool UseShm();
already_AddRefed<mozilla::gfx::DrawTarget> CreateDrawTarget(
const mozilla::LayoutDeviceIntRegion& aRegion);
void Put(const mozilla::LayoutDeviceIntRegion& aRegion);
nsShmImage(Display* aDisplay, Drawable aWindow, Visual* aVisual,
unsigned int aDepth);
private:
~nsShmImage();
bool InitExtension();
bool CreateShmSegment();
void DestroyShmSegment();
bool CreateImage(const mozilla::gfx::IntSize& aSize);
void DestroyImage();
void WaitIfPendingReply();
Display* mDisplay;
xcb_connection_t* mConnection;
Window mWindow;
Visual* mVisual;
unsigned int mDepth;
mozilla::gfx::SurfaceFormat mFormat;
mozilla::gfx::IntSize mSize;
int mStride;
xcb_pixmap_t mPixmap;
xcb_gcontext_t mGC;
xcb_get_input_focus_cookie_t mSyncRequest;
bool mRequestPending;
xcb_shm_seg_t mShmSeg;
int mShmId;
uint8_t* mShmAddr;
};
#endif // MOZ_HAVE_SHMIMAGE
#endif