Implemented QXcbScreen::topLevelAt(const QPoint &p).
This makes the tst_QWidget::widgetAt() auto-test pass.bb10
parent
36b2c31ba8
commit
4f1a6ac732
|
|
@ -282,6 +282,8 @@ public:
|
|||
template<typename T>
|
||||
inline xcb_generic_event_t *checkEvent(const T &checker);
|
||||
|
||||
QXcbWindow *platformWindowFromId(xcb_window_t id);
|
||||
|
||||
private slots:
|
||||
void processXcbEvents();
|
||||
|
||||
|
|
@ -291,8 +293,6 @@ private:
|
|||
#ifdef XCB_USE_DRI2
|
||||
void initializeDri2();
|
||||
#endif
|
||||
QXcbWindow *platformWindowFromId(xcb_window_t id);
|
||||
|
||||
xcb_connection_t *m_connection;
|
||||
const xcb_setup_t *m_setup;
|
||||
|
||||
|
|
|
|||
|
|
@ -215,6 +215,8 @@ QPixmap QXcbIntegration::grabWindow(WId window, int x, int y, int width, int hei
|
|||
y = translate_reply->dst_y;
|
||||
|
||||
window = root;
|
||||
|
||||
free(translate_reply);
|
||||
free(reply);
|
||||
reply = root_reply;
|
||||
} else {
|
||||
|
|
@ -338,7 +340,6 @@ QPixmap QXcbIntegration::grabWindow(WId window, int x, int y, int width, int hei
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool QXcbIntegration::hasOpenGL() const
|
||||
{
|
||||
#if defined(XCB_USE_GLX)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "qxcbscreen.h"
|
||||
#include "qxcbwindow.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -145,6 +146,51 @@ QXcbScreen::~QXcbScreen()
|
|||
{
|
||||
}
|
||||
|
||||
QWindow *QXcbScreen::topLevelAt(const QPoint &p) const
|
||||
{
|
||||
xcb_window_t root = m_screen->root;
|
||||
|
||||
int x = p.x();
|
||||
int y = p.y();
|
||||
|
||||
xcb_generic_error_t *error;
|
||||
|
||||
xcb_window_t parent = root;
|
||||
xcb_window_t child = root;
|
||||
|
||||
do {
|
||||
xcb_translate_coordinates_cookie_t translate_cookie =
|
||||
xcb_translate_coordinates(xcb_connection(), parent, child, x, y);
|
||||
|
||||
xcb_translate_coordinates_reply_t *translate_reply =
|
||||
xcb_translate_coordinates_reply(xcb_connection(), translate_cookie, &error);
|
||||
|
||||
if (!translate_reply) {
|
||||
if (error) {
|
||||
connection()->handleXcbError(error);
|
||||
free(error);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
parent = child;
|
||||
child = translate_reply->child;
|
||||
x = translate_reply->dst_x;
|
||||
y = translate_reply->dst_y;
|
||||
|
||||
free(translate_reply);
|
||||
|
||||
if (!child || child == root)
|
||||
return 0;
|
||||
|
||||
QPlatformWindow *platformWindow = connection()->platformWindowFromId(child);
|
||||
if (platformWindow)
|
||||
return platformWindow->window();
|
||||
} while (parent != child);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const xcb_visualtype_t *QXcbScreen::visualForId(xcb_visualid_t visualid) const
|
||||
{
|
||||
QMap<xcb_visualid_t, xcb_visualtype_t>::const_iterator it = m_visuals.find(visualid);
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ public:
|
|||
QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int number);
|
||||
~QXcbScreen();
|
||||
|
||||
QWindow *topLevelAt(const QPoint &point) const;
|
||||
|
||||
QRect geometry() const;
|
||||
int depth() const;
|
||||
QImage::Format format() const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue