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;
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;
}
/*!

View file

@ -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?

View file

@ -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);
}
}

View file

@ -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,