From ffbe75dfbabb52a0fb3eae62a2f5d39ac04ea863 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Wed, 9 Aug 2000 10:02:56 +0000 Subject: [PATCH] some bugfixes svn path=/trunk/kdebase/kwin/; revision=60295 --- client.cpp | 26 ++++++++------- client.h | 1 + killwindow.cpp | 85 +++++++++++++++++++++++++------------------------- workspace.cpp | 13 ++++++-- 4 files changed, 67 insertions(+), 58 deletions(-) diff --git a/client.cpp b/client.cpp index cbd2349873..dab7268b2b 100644 --- a/client.cpp +++ b/client.cpp @@ -421,6 +421,7 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags is_sticky = FALSE; stays_on_top = FALSE; may_move = TRUE; + skip_taskbar = FALSE; getWMHints(); getWindowProtocols(); @@ -438,6 +439,9 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags // window wants to stay on top? stays_on_top = ( info->state() & NET::StaysOnTop) != 0 || transient_for == workspace()->rootWin(); + + // window does not want a taskbar entry? + skip_taskbar = ( info->state() & NET::SkipTaskbar) != 0; // should we open this window on a certain desktop? @@ -488,17 +492,15 @@ bool Client::manage( bool isMapped, bool doNotShow ) may_move = FALSE; // don't let fullscreen windows be moved around } else { if ( (xSizeHint.flags & PPosition) || (xSizeHint.flags & USPosition) ) { - if ( (xSizeHint.flags & USPosition) == 0 ) { - QRect area = workspace()->clientArea(); - if ( !area.contains( geom.topLeft() ) ) { - int tx = geom.x(); - int ty = geom.y(); - if ( tx >= 0 && tx < area.x() ) + QRect area = workspace()->clientArea(); + if ( !area.contains( geom.topLeft() ) ) { + int tx = geom.x(); + int ty = geom.y(); + if ( tx >= 0 && tx < area.x() ) tx = area.x(); - if ( ty >= 0 && ty < area.y() ) - ty = area.y(); - geom.moveTopLeft( QPoint( tx, ty ) ); - } + if ( ty >= 0 && ty < area.y() ) + ty = area.y(); + geom.moveTopLeft( QPoint( tx, ty ) ); } placementDone = TRUE; } @@ -1456,7 +1458,7 @@ void Client::iconify() Events::raise( Events::Iconify ); setMappingState( IconicState ); - if ( !isTransient() ) + if ( !isTransient() && isVisible() ) animateIconifyOrDeiconify( TRUE ); hide(); @@ -2257,7 +2259,7 @@ NET::WindowType Client::windowType() const bool Client::wantsTabFocus() const { - return windowType() == NET::Normal && ( input || Ptakefocus ); + return windowType() == NET::Normal && ( input || Ptakefocus ) && !skip_taskbar; } /*! diff --git a/client.h b/client.h index 9da4aaa6af..f030aed929 100644 --- a/client.h +++ b/client.h @@ -252,6 +252,7 @@ private: uint stays_on_top : 1; uint is_shape :1; uint may_move :1; + uint skip_taskbar :1; uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol? uint Ptakefocus :1;// does the window understand the TakeFocus protocol? uint Pcontexthelp : 1; // does the window understand the ContextHelp protocol? diff --git a/killwindow.cpp b/killwindow.cpp index 4b0d350e64..7d1192ff22 100644 --- a/killwindow.cpp +++ b/killwindow.cpp @@ -28,56 +28,55 @@ void KillWindow::start() { PointerMotionMask | EnterWindowMask | LeaveWindowMask, GrabModeAsync, GrabModeAsync, None, - kill_cursor, CurrentTime) == GrabSuccess) - { - XGrabKeyboard(qt_xdisplay(), qt_xrootwin(), False, - GrabModeAsync, GrabModeAsync, CurrentTime); + kill_cursor, CurrentTime) == GrabSuccess) { + XGrabKeyboard(qt_xdisplay(), qt_xrootwin(), False, + GrabModeAsync, GrabModeAsync, CurrentTime); - XEvent ev; - int return_pressed = 0; - int escape_pressed = 0; - int button_released = 0; + XEvent ev; + int return_pressed = 0; + int escape_pressed = 0; + int button_released = 0; - XGrabServer(qt_xdisplay()); + XGrabServer(qt_xdisplay()); - while (!return_pressed && !escape_pressed && !button_released) - { - XMaskEvent(qt_xdisplay(), KeyPressMask | ButtonPressMask | - ButtonReleaseMask | PointerMotionMask, &ev); + while (!return_pressed && !escape_pressed && !button_released) { + XMaskEvent(qt_xdisplay(), KeyPressMask | ButtonPressMask | + ButtonReleaseMask | PointerMotionMask, &ev); - if (ev.type == KeyPress) - { - int kc = XKeycodeToKeysym(qt_xdisplay(), ev.xkey.keycode, 0); - int mx = 0; - int my = 0; - return_pressed = (kc == XK_Return) || (kc == XK_space); - escape_pressed = (kc == XK_Escape); - if (kc == XK_Left) mx = -10; - if (kc == XK_Right) mx = 10; - if (kc == XK_Up) my = -10; - if (kc == XK_Down) my = 10; - if (ev.xkey.state & ControlMask) - { - mx /= 10; - my /= 10; - } - QCursor::setPos(QCursor::pos()+QPoint(mx, my)); - } + if (ev.type == KeyPress) { + int kc = XKeycodeToKeysym(qt_xdisplay(), ev.xkey.keycode, 0); + int mx = 0; + int my = 0; + return_pressed = (kc == XK_Return) || (kc == XK_space); + escape_pressed = (kc == XK_Escape); + if (kc == XK_Left) mx = -10; + if (kc == XK_Right) mx = 10; + if (kc == XK_Up) my = -10; + if (kc == XK_Down) my = 10; + if (ev.xkey.state & ControlMask) { + mx /= 10; + my /= 10; + } + QCursor::setPos(QCursor::pos()+QPoint(mx, my)); + } - if (ev.type == ButtonRelease) - { - button_released = (ev.xbutton.button == Button1); - workspace->killWindowAtPosition(ev.xbutton.x_root, ev.xbutton.y_root); - } - continue; - } - if (return_pressed) - workspace->killWindowAtPosition(QCursor::pos().x(), QCursor::pos().y()); + if (ev.type == ButtonRelease) { + button_released = (ev.xbutton.button == Button1); + if ( ev.xbutton.button == Button3 ) { + escape_pressed = TRUE; + break; + } + workspace->killWindowAtPosition(ev.xbutton.x_root, ev.xbutton.y_root); + } + continue; + } + if (return_pressed) + workspace->killWindowAtPosition(QCursor::pos().x(), QCursor::pos().y()); - XUngrabServer(qt_xdisplay()); + XUngrabServer(qt_xdisplay()); - XUngrabKeyboard(qt_xdisplay(), CurrentTime); - XUngrabPointer(qt_xdisplay(), CurrentTime); + XUngrabKeyboard(qt_xdisplay(), CurrentTime); + XUngrabPointer(qt_xdisplay(), CurrentTime); } } diff --git a/workspace.cpp b/workspace.cpp index 0da7df0e59..7acb122665 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1581,9 +1581,6 @@ void Workspace::raiseClient( Client* c ) if ( !c ) return; - if ( tab_box->isVisible() ) - return; - ClientList saveset; if ( c == desktop_client ) { @@ -1629,6 +1626,9 @@ void Workspace::raiseClient( Client* c ) propagateClients( TRUE ); + + if ( tab_box->isVisible() ) + tab_box->raise(); } @@ -2073,6 +2073,13 @@ void Workspace::slotWindowLower() */ void Workspace::slotMouseEmulation() { + + if ( mouse_emulation ) { + XUngrabKeyboard(qt_xdisplay(), kwin_time); + mouse_emulation = FALSE; + return; + } + if ( XGrabKeyboard(qt_xdisplay(), root, FALSE, GrabModeAsync, GrabModeAsync,