mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Fixed two trivial XCB related bugs.
This commit is contained in:
parent
9f2aecf9cf
commit
8dd31f2f52
@ -194,24 +194,21 @@ bool InputImpl::isMouseButtonPressed(Mouse::Button button)
|
||||
|
||||
// Get pointer mask
|
||||
xcb_query_pointer_reply_t* pointer = xcb_query_pointer_reply(connection, xcb_query_pointer(connection, XDefaultRootWindow(display)), NULL);
|
||||
uint16_t mask = pointer->mask;
|
||||
free(pointer);
|
||||
|
||||
// Close the connection with the X server
|
||||
CloseDisplay(display);
|
||||
|
||||
bool result = false;
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case Mouse::Left: result = pointer->mask & XCB_BUTTON_MASK_1;
|
||||
case Mouse::Right: result = pointer->mask & XCB_BUTTON_MASK_3;
|
||||
case Mouse::Middle: result = pointer->mask & XCB_BUTTON_MASK_2;
|
||||
case Mouse::XButton1: // not supported by X
|
||||
case Mouse::XButton2: // not supported by X
|
||||
default: result = false;
|
||||
case Mouse::Left: return mask & XCB_BUTTON_MASK_1;
|
||||
case Mouse::Right: return mask & XCB_BUTTON_MASK_3;
|
||||
case Mouse::Middle: return mask & XCB_BUTTON_MASK_2;
|
||||
case Mouse::XButton1: return false; // not supported by X
|
||||
case Mouse::XButton2: return false; // not supported by X
|
||||
default: return false;
|
||||
}
|
||||
|
||||
free(pointer);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -530,12 +530,10 @@ void WindowImplX11::setIcon(unsigned int width, unsigned int height, const Uint8
|
||||
xcb_free_gc(m_connection, iconGC);
|
||||
|
||||
xcb_generic_error_t* errptr = xcb_request_check(m_connection, cookie);
|
||||
bool setWindowIconFailed = (errptr != NULL);
|
||||
free(errptr);
|
||||
|
||||
if (setWindowIconFailed)
|
||||
if (errptr)
|
||||
{
|
||||
err() << "Failed to set the window's icon: Error code " << (int)errptr->error_code << std::endl;
|
||||
err() << "Failed to set the window's icon: Error code " << static_cast<int>(errptr->error_code) << std::endl;
|
||||
free(errptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user