From d164e16b5603647f9a8104cf0518cfb1d16e1765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 31 Jul 2013 07:27:12 +0200 Subject: [PATCH] Use own Xcb::sync() method in main.cpp QApplication::syncX() is a no-op in Qt 5 so we need a replacement. --- main.cpp | 4 ++-- xcbutils.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index fbe6f598b6..5757128ba7 100644 --- a/main.cpp +++ b/main.cpp @@ -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. diff --git a/xcbutils.h b/xcbutils.h index 92a17f3359..6c7c32f311 100644 --- a/xcbutils.h +++ b/xcbutils.h @@ -23,6 +23,8 @@ along with this program. If not, see . #include #include "utils.h" +#include + #include #include #include @@ -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 sync(xcb_get_input_focus_reply(c, cookie, &error)); + if (error) { + kWarning(1212) << "Sync error" << kBacktrace(); + free(error); + } +} + } // namespace X11 } // namespace KWin