XCB: do not assume that sizeof(long)==4
The code was using the "long" type when a 32 bit type was actually needed. This can cause bugs in those systems where "long" is 64 bits wide, such as Linux x86-64 (which is LP64). Task-number: QTBUG-34861 Change-Id: Iab289b2af3847dd62d8b4ecea51896936ca4c7a2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
This commit is contained in:
parent
09644cb12f
commit
911cfc4e90
@ -154,7 +154,7 @@ enum QX11EmbedMessageType {
|
|||||||
XEMBED_ACTIVATE_ACCELERATOR = 14
|
XEMBED_ACTIVATE_ACCELERATOR = 14
|
||||||
};
|
};
|
||||||
|
|
||||||
const long XEMBED_VERSION = 0;
|
const quint32 XEMBED_VERSION = 0;
|
||||||
|
|
||||||
// Returns \c true if we should set WM_TRANSIENT_FOR on \a w
|
// Returns \c true if we should set WM_TRANSIENT_FOR on \a w
|
||||||
static inline bool isTransient(const QWindow *w)
|
static inline bool isTransient(const QWindow *w)
|
||||||
@ -403,7 +403,7 @@ void QXcbWindow::create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the PID to let the WM kill the application if unresponsive
|
// set the PID to let the WM kill the application if unresponsive
|
||||||
long pid = getpid();
|
quint32 pid = getpid();
|
||||||
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
|
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
|
||||||
atom(QXcbAtom::_NET_WM_PID), XCB_ATOM_CARDINAL, 32,
|
atom(QXcbAtom::_NET_WM_PID), XCB_ATOM_CARDINAL, 32,
|
||||||
1, &pid));
|
1, &pid));
|
||||||
@ -422,7 +422,7 @@ void QXcbWindow::create()
|
|||||||
1, &leader));
|
1, &leader));
|
||||||
|
|
||||||
/* Add XEMBED info; this operation doesn't initiate the embedding. */
|
/* Add XEMBED info; this operation doesn't initiate the embedding. */
|
||||||
long data[] = { XEMBED_VERSION, XEMBED_MAPPED };
|
quint32 data[] = { XEMBED_VERSION, XEMBED_MAPPED };
|
||||||
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
|
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
|
||||||
atom(QXcbAtom::_XEMBED_INFO),
|
atom(QXcbAtom::_XEMBED_INFO),
|
||||||
atom(QXcbAtom::_XEMBED_INFO),
|
atom(QXcbAtom::_XEMBED_INFO),
|
||||||
@ -1824,7 +1824,7 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
|
|||||||
xcb_get_property_reply(xcb_connection(), get_cookie, NULL);
|
xcb_get_property_reply(xcb_connection(), get_cookie, NULL);
|
||||||
|
|
||||||
if (reply && reply->format == 32 && reply->type == wmStateAtom) {
|
if (reply && reply->format == 32 && reply->type == wmStateAtom) {
|
||||||
const long *data = (const long *)xcb_get_property_value(reply);
|
const quint32 *data = (const quint32 *)xcb_get_property_value(reply);
|
||||||
if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
|
if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0])
|
||||||
newState = Qt::WindowMinimized;
|
newState = Qt::WindowMinimized;
|
||||||
}
|
}
|
||||||
@ -1995,8 +1995,8 @@ bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sends an XEmbed message.
|
// Sends an XEmbed message.
|
||||||
void QXcbWindow::sendXEmbedMessage(xcb_window_t window, long message,
|
void QXcbWindow::sendXEmbedMessage(xcb_window_t window, quint32 message,
|
||||||
long detail, long data1, long data2)
|
quint32 detail, quint32 data1, quint32 data2)
|
||||||
{
|
{
|
||||||
xcb_client_message_event_t event;
|
xcb_client_message_event_t event;
|
||||||
|
|
||||||
|
@ -169,8 +169,8 @@ private:
|
|||||||
void updateDoesNotAcceptFocus(bool doesNotAcceptFocus);
|
void updateDoesNotAcceptFocus(bool doesNotAcceptFocus);
|
||||||
|
|
||||||
QRect windowToWmGeometry(QRect r) const;
|
QRect windowToWmGeometry(QRect r) const;
|
||||||
void sendXEmbedMessage(xcb_window_t window, long message,
|
void sendXEmbedMessage(xcb_window_t window, quint32 message,
|
||||||
long detail = 0, long data1 = 0, long data2 = 0);
|
quint32 detail = 0, quint32 data1 = 0, quint32 data2 = 0);
|
||||||
void handleXEmbedMessage(const xcb_client_message_event_t *event);
|
void handleXEmbedMessage(const xcb_client_message_event_t *event);
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
Loading…
Reference in New Issue
Block a user