Bug 1016010 - Get basic layers sort of working with Qt. r=romaxa

This commit is contained in:
Tom Schuster 2014-05-29 21:55:44 +02:00
parent 5b42f172f8
commit ae99a509cc
2 changed files with 29 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#ifdef MOZ_X11
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "gfxXlibSurface.h"
#endif //MOZ_X11
#include "nsXULAppAPI.h"
@ -806,6 +807,32 @@ nsWindow::GetGLFrameBufferFormat()
return LOCAL_GL_NONE;
}
TemporaryRef<DrawTarget>
nsWindow::StartRemoteDrawing()
{
if (!mWidget) {
return nullptr;
}
#ifdef MOZ_X11
Display* dpy = gfxQtPlatform::GetXDisplay(mWidget);
Screen* screen = DefaultScreenOfDisplay(dpy);
Visual* defaultVisual = DefaultVisualOfScreen(screen);
gfxASurface* surf = new gfxXlibSurface(dpy, mWidget->winId(), defaultVisual,
gfxIntSize(mWidget->width(),
mWidget->height()));
IntSize size(surf->GetSize().width, surf->GetSize().height);
if (size.width <= 0 || size.height <= 0) {
return nullptr;
}
return gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surf, size);
#else
return nullptr;
#endif
}
NS_IMETHODIMP
nsWindow::SetCursor(nsCursor aCursor)
{

View File

@ -151,6 +151,8 @@ public:
virtual uint32_t GetGLFrameBufferFormat() MOZ_OVERRIDE;
mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() MOZ_OVERRIDE;
// Widget notifications
virtual void OnPaint();
virtual nsEventStatus focusInEvent(QFocusEvent* aEvent);