sync function
@@ -55,6 +55,10 @@ }
s_app = 0; } +void App::sync(bool discard) { + XSync(display(), discard); +} + void App::eventLoop() { XEvent ev; while (!m_done) {
@@ -47,6 +47,7 @@ explicit App(const char *displayname=0);
virtual ~App(); /// display connection Display *display() const { return m_display; } + void sync(bool discard); /// starts event loop virtual void eventLoop(); /// forces an end to event loop
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Keys.cc,v 1.38 2003/10/05 07:19:30 rathnor Exp $ +//$Id: Keys.cc,v 1.39 2003/12/04 21:31:02 fluxgen Exp $ #include "Keys.hh"@@ -111,7 +111,7 @@
//free memory of previous grabs deleteTree(); - XSync(m_display, False); + FbTk::App::instance()->sync(false); //open the file ifstream infile(filename);
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.243 2003/12/04 00:08:05 fluxgen Exp $ +// $Id: Screen.cc,v 1.244 2003/12/04 21:31:02 fluxgen Exp $ #include "Screen.hh"@@ -279,7 +279,7 @@ rootWindow().setEventMask(ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask); - XSync(disp, False); + FbTk::App::instance()->sync(false); XSetErrorHandler((XErrorHandler) old);@@ -810,7 +810,7 @@ if (! m_current_workspace || id >= m_workspaces_list.size() ||
id == m_current_workspace->workspaceID()) return; - XSync(FbTk::App::instance()->display(), true); + FbTk::App::instance()->sync(true); WinClient *focused_client = Fluxbox::instance()->getFocusedWindow(); FluxboxWindow *focused = 0;@@ -877,7 +877,7 @@ win = client->fbwindow();
} - XSync(FbTk::App::instance()->display(), True); + FbTk::App::instance()->sync(true); if (win && &win->screen() == this && (! win->isStuck())) {@@ -1012,7 +1012,7 @@ (*it)->sendConfigNotify(e);
} FluxboxWindow *BScreen::createWindow(Window client) { - XSync(FbTk::App::instance()->display(), false); + FbTk::App::instance()->sync(false); #ifdef SLIT #ifdef KDE@@ -1121,7 +1121,7 @@ if (!win->isIconic() && (win->workspaceNumber() == currentWorkspaceID() || win->isStuck())) {
win->show(); } - XSync(FbTk::App::instance()->display(), False); + FbTk::App::instance()->sync(false); return win; }@@ -2005,9 +2005,8 @@
} void BScreen::shutdown() { - Display *disp = FbTk::App::instance()->display(); rootWindow().setEventMask(NoEventMask); - XSync(disp, False); + FbTk::App::instance()->sync(false); m_shutdown = true; for_each(m_workspaces_list.begin(), m_workspaces_list.end(),
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WinClient.cc,v 1.30 2003/10/06 06:22:43 rathnor Exp $ +// $Id: WinClient.cc,v 1.31 2003/12/04 21:31:02 fluxgen Exp $ #include "WinClient.hh"@@ -555,7 +555,7 @@ }
bool WinClient::validateClient() const { Display *display = FbTk::App::instance()->display(); - XSync(display, false); + FbTk::App::instance()->sync(false); XEvent e; if (( XCheckTypedWindowEvent(display, window(), DestroyNotify, &e) ||
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.246 2003/11/27 22:02:28 fluxgen Exp $ +// $Id: Window.cc,v 1.247 2003/12/04 21:31:02 fluxgen Exp $ #include "Window.hh"@@ -262,7 +262,7 @@ iconic(false), focused(false),
stuck(false), m_managed(false), maximized(MAX_NONE), m_screen(scr), - display(0), + display(FbTk::App::instance()->display()), m_windowmenu(*scr.menuTheme(), scr.screenNumber(), scr.imageControl(), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_old_decoration(DECOR_NORMAL),@@ -393,9 +393,6 @@
frame().resize(m_client->width(), m_client->height()); m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0; - - // display connection - display = FbTk::App::instance()->display(); m_blackbox_attrib.workspace = m_workspace_number = ~0;@@ -558,20 +555,20 @@
if (m_shaped) shape(); - XSync(display, false); + FbTk::App::instance()->sync(false); + } /// apply shape to this window void FluxboxWindow::shape() { #ifdef SHAPE if (m_shaped) { - Display *disp = FbTk::App::instance()->display(); - XShapeCombineShape(disp, + XShapeCombineShape(display, frame().window().window(), ShapeBounding, 0, frame().clientArea().y(), // xOff, yOff m_client->window(), ShapeBounding, ShapeSet); - XFlush(disp); + XFlush(display); } #endif // SHAPE@@ -1971,14 +1968,13 @@ shape();
} else { m_shaped = false; // set no shape - Display *disp = FbTk::App::instance()->display(); - XShapeCombineMask(disp, + XShapeCombineMask(display, frame().window().window(), ShapeBounding, 0, 0, None, ShapeSet); } - XSync(FbTk::App::instance()->display(), False); + FbTk::App::instance()->sync(false); break; } #endif // SHAPE@@ -2813,7 +2809,7 @@
screen().hideGeometry(); XUngrabPointer(display, CurrentTime); - XSync(display, False); //make sure the redraw is made before we continue + FbTk::App::instance()->sync(false); //make sure the redraw is made before we continue } void FluxboxWindow::pauseMoving() {@@ -2837,7 +2833,8 @@
if (m_workspace_number == screen().currentWorkspaceID()) { frame().show(); } - XSync(display,false); + + FbTk::App::instance()->sync(false); parent().drawRectangle(screen().rootTheme().opGC(), m_last_move_x, m_last_move_y,
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.203 2003/12/03 00:49:20 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.204 2003/12/04 21:31:02 fluxgen Exp $ #include "fluxbox.hh"@@ -585,7 +585,7 @@ // setup theme manager to have our style file ready to be scanned
FbTk::ThemeManager::instance().load(getStyleFilename()); XSynchronize(disp, False); - XSync(disp, False); + sync(false); m_reconfigure_wait = m_reread_menu_wait = false;@@ -1516,7 +1516,7 @@ //send shutdown to all screens
for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::shutdown)); m_shutdown = true; - XSync(FbTk::App::instance()->display(), False); + sync(false); }