From a189cb2c459a75c1a26b9ba3ea33f3e04a50b018 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Fri, 5 Jan 2001 18:28:24 +0000 Subject: [PATCH] some attempt for dirk svn path=/trunk/kdebase/kwin/; revision=76503 --- client.cpp | 9 +++++---- main.cpp | 34 ++++++++++++++++++++++++++++++++++ workspace.cpp | 1 - 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/client.cpp b/client.cpp index 6c866f52aa..b31cd5623b 100644 --- a/client.cpp +++ b/client.cpp @@ -1357,9 +1357,9 @@ void Client::mouseReleaseEvent( QMouseEvent * e) if ( ( isMove() && options->moveMode != Options::Opaque ) || ( isResize() && options->resizeMode != Options::Opaque ) ) XUngrabServer( qt_xdisplay() ); + moveResizeMode = FALSE; setGeometry( geom ); Events::raise( isResize() ? Events::ResizeEnd : Events::MoveEnd ); - moveResizeMode = FALSE; workspace()->setFocusChangeEnabled(true); releaseMouse(); releaseKeyboard(); @@ -1511,7 +1511,7 @@ void Client::mouseMoveEvent( QMouseEvent * e) } } - QApplication::syncX(); // process our own configure events synchronously. +// QApplication::syncX(); // process our own configure events synchronously. } /*! @@ -1538,7 +1538,7 @@ void Client::leaveEvent( QEvent * ) void Client::setGeometry( int x, int y, int w, int h ) { QWidget::setGeometry(x, y, w, h); - if ( !isResize() ) + if ( !isResize() && !isMove() ) sendSynteticConfigureNotify(); } @@ -1548,7 +1548,8 @@ void Client::setGeometry( int x, int y, int w, int h ) void Client::move( int x, int y ) { QWidget::move( x, y ); - sendSynteticConfigureNotify(); + if ( !isMove() ) + sendSynteticConfigureNotify(); } diff --git a/main.cpp b/main.cpp index e38b107928..03242ba26e 100644 --- a/main.cpp +++ b/main.cpp @@ -197,6 +197,40 @@ extern "C" { int kdemain(int, char *[]); } int kdemain( int argc, char * argv[] ) { + + Display* dpy = XOpenDisplay( NULL ); + if ( !dpy ) { + fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n", + argv[0], XDisplayName(NULL ) ); + exit (1); + } + int number_of_screens = ScreenCount( dpy ); + int screen_number= DefaultScreen( dpy ); + int pos; // temporarily needed to reconstruct DISPLAY var if multi-head + QCString display_name = XDisplayString( dpy ); + XCloseDisplay( dpy ); + if ((pos = display_name.findRev('.')) != -1 ) + display_name.remove(pos,10); // 10 is enough to be sure we removed ".s" + QCString envir; + if (number_of_screens != 1) { + for (int i = 0; i < number_of_screens; i++ ) { + // if execution doesn't pass by here, then kwin + // acts exactly as previously + if ( i != screen_number && fork() == 0 ) { + screen_number = i; + } + } + // in the next statement, display_name shouldn't contain a screen + // number. If it had it, it was removed at the "pos" check + envir.sprintf("DISPLAY=%s.%d", display_name.data(), screen_number); + if (putenv(envir.data())) { + fprintf(stderr, + "%s: WARNING: unable to set DISPLAY environment variable\n", + argv[0]); + perror("putenv()"); + } + } + KAboutData aboutData( "kwin", I18N_NOOP("KWin"), version, description, KAboutData::License_BSD, "(c) 1999-2000, The KDE Developers"); diff --git a/workspace.cpp b/workspace.cpp index 60eb5e577f..49ea31349b 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1215,7 +1215,6 @@ void Workspace::showWindowMenuAt( unsigned long id, int x, int y ) return; QPopupMenu* p = clientPopup( target ); - p->setFocus(); p->popup( QPoint( x, y ) ); }