Use own Xcb::sync() method in main.cpp

QApplication::syncX() is a no-op in Qt 5 so we need a replacement.
icc-effect-5.14.5
Martin Gräßlin 2013-07-31 07:27:12 +02:00
parent 8da23f76d3
commit d164e16b56
2 changed files with 16 additions and 2 deletions

View File

@ -258,7 +258,7 @@ Application::Application()
// Check whether another windowmanager is running
XSelectInput(display(), rootWindow(), SubstructureRedirectMask);
syncX(); // Trigger error now
Xcb::sync(); // Trigger error now
atoms = new Atoms;
@ -271,7 +271,7 @@ Application::Application()
// create workspace.
(void) new Workspace(isSessionRestored());
syncX(); // Trigger possible errors, there's still a chance to abort
Xcb::sync(); // Trigger possible errors, there's still a chance to abort
initting = false; // Startup done, we are up and running now.

View File

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinglobals.h>
#include "utils.h"
#include <KDE/KDebug>
#include <QRect>
#include <QRegion>
#include <QVector>
@ -685,6 +687,18 @@ static inline void setInputFocus(xcb_window_t window, uint8_t revertTo, xcb_time
xcb_set_input_focus(connection(), revertTo, window, time);
}
static inline void sync()
{
auto *c = connection();
const auto cookie = xcb_get_input_focus(c);
xcb_generic_error_t *error = nullptr;
ScopedCPointer<xcb_get_input_focus_reply_t> sync(xcb_get_input_focus_reply(c, cookie, &error));
if (error) {
kWarning(1212) << "Sync error" << kBacktrace();
free(error);
}
}
} // namespace X11
} // namespace KWin