some bugfixes

svn path=/trunk/kdebase/kwin/; revision=60295
This commit is contained in:
Matthias Ettrich 2000-08-09 10:02:56 +00:00
parent 5d85790c91
commit ffbe75dfba
4 changed files with 67 additions and 58 deletions

View file

@ -421,6 +421,7 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
is_sticky = FALSE; is_sticky = FALSE;
stays_on_top = FALSE; stays_on_top = FALSE;
may_move = TRUE; may_move = TRUE;
skip_taskbar = FALSE;
getWMHints(); getWMHints();
getWindowProtocols(); getWindowProtocols();
@ -438,6 +439,9 @@ Client::Client( Workspace *ws, WId w, QWidget *parent, const char *name, WFlags
// window wants to stay on top? // window wants to stay on top?
stays_on_top = ( info->state() & NET::StaysOnTop) != 0 || transient_for == workspace()->rootWin(); 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? // 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 may_move = FALSE; // don't let fullscreen windows be moved around
} else { } else {
if ( (xSizeHint.flags & PPosition) || (xSizeHint.flags & USPosition) ) { if ( (xSizeHint.flags & PPosition) || (xSizeHint.flags & USPosition) ) {
if ( (xSizeHint.flags & USPosition) == 0 ) { QRect area = workspace()->clientArea();
QRect area = workspace()->clientArea(); if ( !area.contains( geom.topLeft() ) ) {
if ( !area.contains( geom.topLeft() ) ) { int tx = geom.x();
int tx = geom.x(); int ty = geom.y();
int ty = geom.y(); if ( tx >= 0 && tx < area.x() )
if ( tx >= 0 && tx < area.x() )
tx = area.x(); tx = area.x();
if ( ty >= 0 && ty < area.y() ) if ( ty >= 0 && ty < area.y() )
ty = area.y(); ty = area.y();
geom.moveTopLeft( QPoint( tx, ty ) ); geom.moveTopLeft( QPoint( tx, ty ) );
}
} }
placementDone = TRUE; placementDone = TRUE;
} }
@ -1456,7 +1458,7 @@ void Client::iconify()
Events::raise( Events::Iconify ); Events::raise( Events::Iconify );
setMappingState( IconicState ); setMappingState( IconicState );
if ( !isTransient() ) if ( !isTransient() && isVisible() )
animateIconifyOrDeiconify( TRUE ); animateIconifyOrDeiconify( TRUE );
hide(); hide();
@ -2257,7 +2259,7 @@ NET::WindowType Client::windowType() const
bool Client::wantsTabFocus() const bool Client::wantsTabFocus() const
{ {
return windowType() == NET::Normal && ( input || Ptakefocus ); return windowType() == NET::Normal && ( input || Ptakefocus ) && !skip_taskbar;
} }
/*! /*!

View file

@ -252,6 +252,7 @@ private:
uint stays_on_top : 1; uint stays_on_top : 1;
uint is_shape :1; uint is_shape :1;
uint may_move :1; uint may_move :1;
uint skip_taskbar :1;
uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol? uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol?
uint Ptakefocus :1;// does the window understand the TakeFocus protocol? uint Ptakefocus :1;// does the window understand the TakeFocus protocol?
uint Pcontexthelp : 1; // does the window understand the ContextHelp protocol? uint Pcontexthelp : 1; // does the window understand the ContextHelp protocol?

View file

@ -28,56 +28,55 @@ void KillWindow::start() {
PointerMotionMask | PointerMotionMask |
EnterWindowMask | LeaveWindowMask, EnterWindowMask | LeaveWindowMask,
GrabModeAsync, GrabModeAsync, None, GrabModeAsync, GrabModeAsync, None,
kill_cursor, CurrentTime) == GrabSuccess) kill_cursor, CurrentTime) == GrabSuccess) {
{ XGrabKeyboard(qt_xdisplay(), qt_xrootwin(), False,
XGrabKeyboard(qt_xdisplay(), qt_xrootwin(), False, GrabModeAsync, GrabModeAsync, CurrentTime);
GrabModeAsync, GrabModeAsync, CurrentTime);
XEvent ev; XEvent ev;
int return_pressed = 0; int return_pressed = 0;
int escape_pressed = 0; int escape_pressed = 0;
int button_released = 0; int button_released = 0;
XGrabServer(qt_xdisplay()); XGrabServer(qt_xdisplay());
while (!return_pressed && !escape_pressed && !button_released) while (!return_pressed && !escape_pressed && !button_released) {
{ XMaskEvent(qt_xdisplay(), KeyPressMask | ButtonPressMask |
XMaskEvent(qt_xdisplay(), KeyPressMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask, &ev);
ButtonReleaseMask | PointerMotionMask, &ev);
if (ev.type == KeyPress) if (ev.type == KeyPress) {
{ int kc = XKeycodeToKeysym(qt_xdisplay(), ev.xkey.keycode, 0);
int kc = XKeycodeToKeysym(qt_xdisplay(), ev.xkey.keycode, 0); int mx = 0;
int mx = 0; int my = 0;
int my = 0; return_pressed = (kc == XK_Return) || (kc == XK_space);
return_pressed = (kc == XK_Return) || (kc == XK_space); escape_pressed = (kc == XK_Escape);
escape_pressed = (kc == XK_Escape); if (kc == XK_Left) mx = -10;
if (kc == XK_Left) mx = -10; if (kc == XK_Right) mx = 10;
if (kc == XK_Right) mx = 10; if (kc == XK_Up) my = -10;
if (kc == XK_Up) my = -10; if (kc == XK_Down) my = 10;
if (kc == XK_Down) my = 10; if (ev.xkey.state & ControlMask) {
if (ev.xkey.state & ControlMask) mx /= 10;
{ my /= 10;
mx /= 10; }
my /= 10; QCursor::setPos(QCursor::pos()+QPoint(mx, my));
} }
QCursor::setPos(QCursor::pos()+QPoint(mx, my));
}
if (ev.type == ButtonRelease) if (ev.type == ButtonRelease) {
{ button_released = (ev.xbutton.button == Button1);
button_released = (ev.xbutton.button == Button1); if ( ev.xbutton.button == Button3 ) {
workspace->killWindowAtPosition(ev.xbutton.x_root, ev.xbutton.y_root); escape_pressed = TRUE;
} break;
continue; }
} workspace->killWindowAtPosition(ev.xbutton.x_root, ev.xbutton.y_root);
if (return_pressed) }
workspace->killWindowAtPosition(QCursor::pos().x(), QCursor::pos().y()); continue;
}
if (return_pressed)
workspace->killWindowAtPosition(QCursor::pos().x(), QCursor::pos().y());
XUngrabServer(qt_xdisplay()); XUngrabServer(qt_xdisplay());
XUngrabKeyboard(qt_xdisplay(), CurrentTime); XUngrabKeyboard(qt_xdisplay(), CurrentTime);
XUngrabPointer(qt_xdisplay(), CurrentTime); XUngrabPointer(qt_xdisplay(), CurrentTime);
} }
} }

View file

@ -1581,9 +1581,6 @@ void Workspace::raiseClient( Client* c )
if ( !c ) if ( !c )
return; return;
if ( tab_box->isVisible() )
return;
ClientList saveset; ClientList saveset;
if ( c == desktop_client ) { if ( c == desktop_client ) {
@ -1629,6 +1626,9 @@ void Workspace::raiseClient( Client* c )
propagateClients( TRUE ); propagateClients( TRUE );
if ( tab_box->isVisible() )
tab_box->raise();
} }
@ -2073,6 +2073,13 @@ void Workspace::slotWindowLower()
*/ */
void Workspace::slotMouseEmulation() void Workspace::slotMouseEmulation()
{ {
if ( mouse_emulation ) {
XUngrabKeyboard(qt_xdisplay(), kwin_time);
mouse_emulation = FALSE;
return;
}
if ( XGrabKeyboard(qt_xdisplay(), if ( XGrabKeyboard(qt_xdisplay(),
root, FALSE, root, FALSE,
GrabModeAsync, GrabModeAsync, GrabModeAsync, GrabModeAsync,