本文整理汇总了C++中QPlatformNativeInterface::nativeResourceForWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ QPlatformNativeInterface::nativeResourceForWindow方法的具体用法?C++ QPlatformNativeInterface::nativeResourceForWindow怎么用?C++ QPlatformNativeInterface::nativeResourceForWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPlatformNativeInterface
的用法示例。
在下文中一共展示了QPlatformNativeInterface::nativeResourceForWindow方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeHardware
void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display *)
{
qDebug() << "Initializing GLX integration";
QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
if (nativeInterface) {
mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->window()));
if (!mDisplay)
qFatal("could not retireve Display from platform integration");
} else {
qFatal("Platform integration doesn't have native interface");
}
mScreen = XDefaultScreen(mDisplay);
mHandler = new XCompositeHandler(m_compositor->handle(), mDisplay);
QOpenGLContext *glContext = new QOpenGLContext();
glContext->create();
m_glxBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT"));
if (!m_glxBindTexImageEXT) {
qDebug() << "Did not find glxBindTexImageExt, everything will FAIL!";
}
m_glxReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT"));
if (!m_glxReleaseTexImageEXT) {
qDebug() << "Did not find glxReleaseTexImageExt";
}
delete glContext;
}
示例2: dbg
QHimePlatformInputContext::QHimePlatformInputContext()
{
dbg("QHimePlatformInputContext::QHimePlatformInputContext() \n");
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
if(!native)
return;
Display *display = static_cast<Display *>(native->nativeResourceForWindow("display", NULL));
if (!(hime_ch = hime_im_client_open(display))) {
perror("cannot open hime_ch");
dbg("hime_im_client_open error\n");
return;
}
dbg("QHimePlatformInputContext succ\n");
}
示例3: GetWindow
/**************************************************************\
* IOleWindow *
**************************************************************/
HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetWindow(HWND *phwnd)
{
*phwnd = 0;
QAccessibleInterface *accessible = accessibleInterface();
accessibleDebugClientCalls(accessible);
if (!accessible)
return E_FAIL;
QWindow *window = QWindowsAccessibility::windowHelper(accessible);
if (!window)
return E_FAIL;
QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
Q_ASSERT(platform);
*phwnd = (HWND)platform->nativeResourceForWindow("handle", window);
accessibleDebug("QWindowsAccessible::GetWindow(): %p", *phwnd);
return S_OK;
}
示例4: Surface
Surface *Surface::fromQt(QWindow *window, QObject *parent)
{
if (!QGuiApplication::platformName().startsWith(QLatin1String("wayland")))
return Q_NULLPTR;
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
if (!native)
return Q_NULLPTR;
wl_surface *surface = reinterpret_cast<wl_surface *>(
native->nativeResourceForWindow(QByteArrayLiteral("surface"), window));
if (!surface)
return Q_NULLPTR;
Surface *s = new Surface(parent);
SurfacePrivate::get(s)->init(surface);
return s;
}
示例5: request
/**
* Request the video to avoid the conflicts
**/
bool VideoWidget::request( struct vout_window_t *p_wnd )
{
if( stable )
{
msg_Dbg( p_intf, "embedded video already in use" );
return false;
}
assert( !p_window );
/* The owner of the video window needs a stable handle (WinId). Reparenting
* in Qt4-X11 changes the WinId of the widget, so we need to create another
* dummy widget that stays within the reparentable widget. */
stable = new QWidget();
QPalette plt = palette();
plt.setColor( QPalette::Window, Qt::black );
stable->setPalette( plt );
stable->setAutoFillBackground(true);
/* Force the widget to be native so that it gets a winId() */
stable->setAttribute( Qt::WA_NativeWindow, true );
/* Indicates that the widget wants to draw directly onto the screen.
Widgets with this attribute set do not participate in composition
management */
/* This is currently disabled on X11 as it does not seem to improve
* performance, but causes the video widget to be transparent... */
#if !defined (QT5_HAS_X11)
stable->setAttribute( Qt::WA_PaintOnScreen, true );
#else
stable->setMouseTracking( true );
setMouseTracking( true );
#endif
layout->addWidget( stable );
sync();
p_window = p_wnd;
p_wnd->type = p_intf->p_sys->voutWindowType;
switch( p_wnd->type )
{
case VOUT_WINDOW_TYPE_XID:
p_wnd->handle.xid = stable->winId();
p_wnd->display.x11 = NULL;
break;
case VOUT_WINDOW_TYPE_HWND:
p_wnd->handle.hwnd = (void *)stable->winId();
break;
case VOUT_WINDOW_TYPE_NSOBJECT:
p_wnd->handle.nsobject = (void *)stable->winId();
break;
#ifdef QT5_HAS_WAYLAND
case VOUT_WINDOW_TYPE_WAYLAND:
{
QWindow *window = stable->windowHandle();
assert(window != NULL);
window->create();
QPlatformNativeInterface *qni = qApp->platformNativeInterface();
assert(qni != NULL);
p_wnd->handle.wl = static_cast<wl_surface*>(
qni->nativeResourceForWindow(QByteArrayLiteral("surface"),
window));
p_wnd->display.wl = static_cast<wl_display*>(
qni->nativeResourceForIntegration(QByteArrayLiteral("wl_display")));
break;
}
#endif
default:
vlc_assert_unreachable();
}
return true;
}
示例6: initializeHardware
void WaylandEglClientBufferIntegration::initializeHardware(QtWayland::Display *waylandDisplay)
{
Q_D(WaylandEglClientBufferIntegration);
const bool ignoreBindDisplay = !qgetenv("QT_WAYLAND_IGNORE_BIND_DISPLAY").isEmpty();
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
qWarning("QtCompositor: Failed to initialize EGL display. No native platform interface available.");
return;
}
d->egl_display = nativeInterface->nativeResourceForWindow("EglDisplay", m_compositor->window());
if (!d->egl_display) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not get EglDisplay for window.");
return;
}
const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS);
if ((!extensionString || !strstr(extensionString, "EGL_WL_bind_wayland_display")) && !ignoreBindDisplay) {
qWarning("QtCompositor: Failed to initialize EGL display. There is no EGL_WL_bind_wayland_display extension.");
return;
}
d->egl_bind_wayland_display = reinterpret_cast<PFNEGLBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglBindWaylandDisplayWL"));
d->egl_unbind_wayland_display = reinterpret_cast<PFNEGLUNBINDWAYLANDDISPLAYWL>(eglGetProcAddress("eglUnbindWaylandDisplayWL"));
if ((!d->egl_bind_wayland_display || !d->egl_unbind_wayland_display) && !ignoreBindDisplay) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL.");
return;
}
d->egl_query_wayland_buffer = reinterpret_cast<PFNEGLQUERYWAYLANDBUFFERWL_compat>(eglGetProcAddress("eglQueryWaylandBufferWL"));
if (!d->egl_query_wayland_buffer) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglQueryWaylandBufferWL.");
return;
}
d->egl_create_image = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
d->egl_destroy_image = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
if (!d->egl_create_image || !d->egl_destroy_image) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR.");
return;
}
d->gl_egl_image_target_texture_2d = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
if (!d->gl_egl_image_target_texture_2d) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not find glEGLImageTargetTexture2DOES.");
return;
}
if (d->egl_bind_wayland_display && d->egl_unbind_wayland_display) {
d->display_bound = d->egl_bind_wayland_display(d->egl_display, waylandDisplay->handle());
if (!d->display_bound) {
if (!ignoreBindDisplay) {
qWarning("QtCompositor: Failed to initialize EGL display. Could not bind Wayland display.");
return;
} else {
qWarning("QtCompositor: Could not bind Wayland display. Ignoring.");
}
}
}
d->valid = true;
}
示例7: notifyAccessibilityUpdate
void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
{
QString soundName;
switch (event->type()) {
case QAccessible::PopupMenuStart:
soundName = QLatin1String("MenuPopup");
break;
case QAccessible::MenuCommand:
soundName = QLatin1String("MenuCommand");
break;
case QAccessible::Alert:
soundName = event->object()->inherits("QMessageBox") ?
messageBoxAlertSound(event->object()) : QStringLiteral("SystemAsterisk");
break;
default:
break;
}
if (!soundName.isEmpty()) {
#ifndef QT_NO_SETTINGS
QSettings settings(QLatin1String("HKEY_CURRENT_USER\\AppEvents\\Schemes\\Apps\\.Default\\") + soundName,
QSettings::NativeFormat);
QString file = settings.value(QLatin1String(".Current/.")).toString();
#else
QString file;
#endif
if (!file.isEmpty()) {
PlaySound(reinterpret_cast<const wchar_t *>(soundName.utf16()), 0, SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
}
}
#if defined(Q_OS_WINCE) // ### TODO: check for NotifyWinEvent in CE 6.0
// There is no user32.lib nor NotifyWinEvent for CE
return;
#else
// An event has to be associated with a window,
// so find the first parent that is a widget and that has a WId
QAccessibleInterface *iface = event->accessibleInterface();
if (!isActive() || !iface || !iface->isValid())
return;
QWindow *window = QWindowsAccessibility::windowHelper(iface);
if (!window) {
window = QGuiApplication::focusWindow();
if (!window)
return;
}
QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
if (!window->handle()) // Called before show(), no native window yet.
return;
HWND hWnd = (HWND)platform->nativeResourceForWindow("handle", window);
if (event->type() != QAccessible::MenuCommand && // MenuCommand is faked
event->type() != QAccessible::ObjectDestroyed) {
::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, QAccessible::uniqueId(iface));
}
#endif // Q_OS_WINCE
}