sync function

This commit is contained in:
fluxgen 2003-12-04 21:31:02 +00:00
parent a8f39f0d7a
commit 29beda2d6b
7 changed files with 30 additions and 29 deletions

View file

@ -55,6 +55,10 @@ App::~App() {
s_app = 0; s_app = 0;
} }
void App::sync(bool discard) {
XSync(display(), discard);
}
void App::eventLoop() { void App::eventLoop() {
XEvent ev; XEvent ev;
while (!m_done) { while (!m_done) {

View file

@ -47,6 +47,7 @@ public:
virtual ~App(); virtual ~App();
/// display connection /// display connection
Display *display() const { return m_display; } Display *display() const { return m_display; }
void sync(bool discard);
/// starts event loop /// starts event loop
virtual void eventLoop(); virtual void eventLoop();
/// forces an end to event loop /// forces an end to event loop

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "Keys.hh"
@ -111,7 +111,7 @@ bool Keys::load(const char *filename) {
//free memory of previous grabs //free memory of previous grabs
deleteTree(); deleteTree();
XSync(m_display, False); FbTk::App::instance()->sync(false);
//open the file //open the file
ifstream infile(filename); ifstream infile(filename);

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "Screen.hh"
@ -279,7 +279,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
SubstructureRedirectMask | KeyPressMask | KeyReleaseMask | SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask); ButtonPressMask | ButtonReleaseMask| SubstructureNotifyMask);
XSync(disp, False); FbTk::App::instance()->sync(false);
XSetErrorHandler((XErrorHandler) old); XSetErrorHandler((XErrorHandler) old);
@ -810,7 +810,7 @@ void BScreen::changeWorkspaceID(unsigned int id) {
id == m_current_workspace->workspaceID()) id == m_current_workspace->workspaceID())
return; return;
XSync(FbTk::App::instance()->display(), true); FbTk::App::instance()->sync(true);
WinClient *focused_client = Fluxbox::instance()->getFocusedWindow(); WinClient *focused_client = Fluxbox::instance()->getFocusedWindow();
FluxboxWindow *focused = 0; FluxboxWindow *focused = 0;
@ -877,7 +877,7 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS
} }
XSync(FbTk::App::instance()->display(), True); FbTk::App::instance()->sync(true);
if (win && &win->screen() == this && if (win && &win->screen() == this &&
(! win->isStuck())) { (! win->isStuck())) {
@ -1012,7 +1012,7 @@ void BScreen::updateNetizenConfigNotify(XEvent &e) {
} }
FluxboxWindow *BScreen::createWindow(Window client) { FluxboxWindow *BScreen::createWindow(Window client) {
XSync(FbTk::App::instance()->display(), false); FbTk::App::instance()->sync(false);
#ifdef SLIT #ifdef SLIT
#ifdef KDE #ifdef KDE
@ -1121,7 +1121,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
win->show(); win->show();
} }
XSync(FbTk::App::instance()->display(), False); FbTk::App::instance()->sync(false);
return win; return win;
} }
@ -2005,9 +2005,8 @@ void BScreen::createStyleMenu(FbTk::Menu &menu,
} }
void BScreen::shutdown() { void BScreen::shutdown() {
Display *disp = FbTk::App::instance()->display();
rootWindow().setEventMask(NoEventMask); rootWindow().setEventMask(NoEventMask);
XSync(disp, False); FbTk::App::instance()->sync(false);
m_shutdown = true; m_shutdown = true;
for_each(m_workspaces_list.begin(), for_each(m_workspaces_list.begin(),
m_workspaces_list.end(), m_workspaces_list.end(),

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "WinClient.hh"
@ -555,7 +555,7 @@ void WinClient::removeModal() {
bool WinClient::validateClient() const { bool WinClient::validateClient() const {
Display *display = FbTk::App::instance()->display(); Display *display = FbTk::App::instance()->display();
XSync(display, false); FbTk::App::instance()->sync(false);
XEvent e; XEvent e;
if (( XCheckTypedWindowEvent(display, window(), DestroyNotify, &e) || if (( XCheckTypedWindowEvent(display, window(), DestroyNotify, &e) ||

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "Window.hh"
@ -262,7 +262,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
stuck(false), m_managed(false), stuck(false), m_managed(false),
maximized(MAX_NONE), maximized(MAX_NONE),
m_screen(scr), m_screen(scr),
display(0), display(FbTk::App::instance()->display()),
m_windowmenu(*scr.menuTheme(), scr.screenNumber(), scr.imageControl(), m_windowmenu(*scr.menuTheme(), scr.screenNumber(), scr.imageControl(),
*scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
m_old_decoration(DECOR_NORMAL), m_old_decoration(DECOR_NORMAL),
@ -394,9 +394,6 @@ void FluxboxWindow::init() {
m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0; 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; m_blackbox_attrib.workspace = m_workspace_number = ~0;
m_blackbox_attrib.flags = m_blackbox_attrib.attrib = m_blackbox_attrib.stack = 0; m_blackbox_attrib.flags = m_blackbox_attrib.attrib = m_blackbox_attrib.stack = 0;
@ -558,20 +555,20 @@ void FluxboxWindow::init() {
if (m_shaped) if (m_shaped)
shape(); shape();
XSync(display, false); FbTk::App::instance()->sync(false);
} }
/// apply shape to this window /// apply shape to this window
void FluxboxWindow::shape() { void FluxboxWindow::shape() {
#ifdef SHAPE #ifdef SHAPE
if (m_shaped) { if (m_shaped) {
Display *disp = FbTk::App::instance()->display(); XShapeCombineShape(display,
XShapeCombineShape(disp,
frame().window().window(), ShapeBounding, frame().window().window(), ShapeBounding,
0, frame().clientArea().y(), // xOff, yOff 0, frame().clientArea().y(), // xOff, yOff
m_client->window(), m_client->window(),
ShapeBounding, ShapeSet); ShapeBounding, ShapeSet);
XFlush(disp); XFlush(display);
} }
#endif // SHAPE #endif // SHAPE
@ -1971,14 +1968,13 @@ void FluxboxWindow::handleEvent(XEvent &event) {
} else { } else {
m_shaped = false; m_shaped = false;
// set no shape // set no shape
Display *disp = FbTk::App::instance()->display(); XShapeCombineMask(display,
XShapeCombineMask(disp,
frame().window().window(), ShapeBounding, frame().window().window(), ShapeBounding,
0, 0, 0, 0,
None, ShapeSet); None, ShapeSet);
} }
XSync(FbTk::App::instance()->display(), False); FbTk::App::instance()->sync(false);
break; break;
} }
#endif // SHAPE #endif // SHAPE
@ -2813,7 +2809,7 @@ void FluxboxWindow::stopMoving() {
screen().hideGeometry(); screen().hideGeometry();
XUngrabPointer(display, CurrentTime); 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() { void FluxboxWindow::pauseMoving() {
@ -2837,7 +2833,8 @@ void FluxboxWindow::resumeMoving() {
if (m_workspace_number == screen().currentWorkspaceID()) { if (m_workspace_number == screen().currentWorkspaceID()) {
frame().show(); frame().show();
} }
XSync(display,false);
FbTk::App::instance()->sync(false);
parent().drawRectangle(screen().rootTheme().opGC(), parent().drawRectangle(screen().rootTheme().opGC(),
m_last_move_x, m_last_move_y, m_last_move_x, m_last_move_y,

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "fluxbox.hh"
@ -585,7 +585,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
FbTk::ThemeManager::instance().load(getStyleFilename()); FbTk::ThemeManager::instance().load(getStyleFilename());
XSynchronize(disp, False); XSynchronize(disp, False);
XSync(disp, False); sync(false);
m_reconfigure_wait = m_reread_menu_wait = false; m_reconfigure_wait = m_reread_menu_wait = false;
@ -1516,7 +1516,7 @@ void Fluxbox::shutdown() {
for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::shutdown)); for_each(m_screen_list.begin(), m_screen_list.end(), mem_fun(&BScreen::shutdown));
m_shutdown = true; m_shutdown = true;
XSync(FbTk::App::instance()->display(), False); sync(false);
} }