From kde-core-devel Tue Dec 21 23:25:16 1999 From: David Faure Date: Tue, 21 Dec 1999 23:25:16 +0000 To: kde-core-devel Subject: Fwd: kwin bugs [and patches !] X-MARC-Message: https://marc.info/?l=kde-core-devel&m=94581873809861 Just received this - I have no clue about kwin so I'll let somebody else apply, but the patches look very good, please consider applying ! Mosfet ? Matthias ? ----- Forwarded message from slamb@oh.yeah.org ----- Date: Tue, 21 Dec 1999 17:18:35 -0600 (CST) From: slamb@oh.yeah.org To: David Faure Subject: kwin bugs Hi. I just downloaded the KRASH release yesterday. Looks and feels awesome, but found several problems in kwin. (If there's someone else who should see this message, please forward it. I would be sending it to the kde-devel list, but I am having trouble subscribing, probably due to my messed-up DNS setup. If you have problems replying, try srlamb@home.com instead.) Anyway, the problems: - Click to focus mode is hardcoded in. - Typo: s/FocusStricklyFollowsMouse/FocusStrictlyFollowsMouse/g - Focus follows mouse gives the focus to the root window. - Changing window decorations on-the-fly doesn't work correctly, nor is the Be mode saved correctly. The mode saving problem is just that it saves it as "Be," yet checks for "be" while loading the config file. But when changing decorations on the fly, it only changes the current window, and not the entire desktop's behavior, which would be consistent with the way new windows open in the changed decoration style. I think I've managed to fix these problems in the included patch. The focus-follows-mouse mode fix is kind of a kludge: I copied over the code from clientFactory() that checks if the window's text string is "THE DESKTOP" and ignored its enter events. Works, though. The window decorations thing is trickier. I did see that plans for the future include moving all of the different clients into dynamically loading libraries. I don't think this patch will cause any problems with that. But unfortunately the way I go through all of the clients, tear them apart, and rebuild them changes the focus and stacking order of the windows. I'm not sure how to fix this, though it probably isn't that big of a deal. There's one other annoying problem that I noticed but haven't fixed yet. Windows seem to sometimes unshade partially, leaving the window horizontally sized correctly but vertically only a portion of the correct height. For example, I'm looking at a konqueror window that's large enough to display the toolbars but not any of the content pane. It isn't just KDE applications, either; Netscape has the same problem. Anyway, thanks for the great software...alpha release or not, there's no way I'm going back to GNOME/Enlightenment. -- Scott Lamb (slamb@oh.yeah.org / http://digitech.org/~slamb/) "The illiterate of the 21st century will not be those who cannot read and write, but those who cannot learn, unlearn, and relearn." - Alvin Toffler Content-Description: bugfixes *** /home/slamb/kdebase/kwin/client.cpp Mon Dec 6 17:14:25 1999 --- client.cpp Tue Dec 21 16:47:52 1999 *************** *** 1247,1262 **** bool Client::x11Event( XEvent * e) { if ( e->type == EnterNotify ) { ! if ( options->focusPolicy != Options::ClickToFocus ) workspace()->requestFocus( this ); return TRUE; } if ( e->type == LeaveNotify ) { if ( !buttonDown ) setCursor( arrowCursor ); ! if ( options->focusPolicy == Options::FocusStricklyUnderMouse ) { ! if ( isActive() && !rect().contains( QPoint( e->xcrossing.x, e->xcrossing.y ) ) ) workspace()->requestFocus( 0 ) ; } return TRUE; } --- 1247,1273 ---- bool Client::x11Event( XEvent * e) { if ( e->type == EnterNotify ) { ! if ( options->focusPolicy != Options::ClickToFocus ) { ! char* name = 0; ! QString s; ! if ( XFetchName( qt_xdisplay(), (Window) win, &name ) && name ) { ! s = QString::fromLatin1( name ); ! XFree( name ); ! } ! if ( s == "THE DESKTOP" ) ! return TRUE; workspace()->requestFocus( this ); + } return TRUE; } if ( e->type == LeaveNotify ) { if ( !buttonDown ) setCursor( arrowCursor ); ! if ( options->focusPolicy == Options::FocusStrictlyUnderMouse ) { ! if ( isActive() && !rect().contains( QPoint( e->xcrossing.x, e->xcrossing.y ) ) ) { ! qDebug ("Giving up focus"); workspace()->requestFocus( 0 ) ; + } } return TRUE; } *** /home/slamb/kdebase/kwin/options.cpp Wed Dec 15 17:14:37 1999 --- options.cpp Tue Dec 21 16:36:47 1999 *************** *** 50,60 **** void Options::reload() { - focusPolicy = ClickToFocus; - QPalette pal = QApplication::palette(); KConfig *config = KGlobal::config(); config->setGroup("WM"); // normal colors colors[Frame] = pal.normal().background(); --- 50,69 ---- void Options::reload() { QPalette pal = QApplication::palette(); KConfig *config = KGlobal::config(); config->setGroup("WM"); + + QString focusPolicyString = config->readEntry ("focusPolicy"); + if (focusPolicyString == "FocusFollowsMouse") { + focusPolicy = FocusFollowsMouse; + } else if (focusPolicyString == "FocusUnderMouse") { + focusPolicy = FocusUnderMouse; + } else if (focusPolicyString == "FocusStrictlyUnderMouse") { + focusPolicy = FocusStrictlyUnderMouse; + } else { + focusPolicy = ClickToFocus; + } // normal colors colors[Frame] = pal.normal().background(); *** /home/slamb/kdebase/kwin/workspace.cpp Sun Dec 19 17:13:51 1999 --- workspace.cpp Tue Dec 21 16:18:42 1999 *************** *** 1419,1465 **** KWM::switchToDesktop( current_desktop ); // ### compatibility } - - // experimental void Workspace::setDecorationStyle( int deco ) { if ( !popup_client ) return; - Client* c = popup_client; - WId w = c->window(); - clients.remove( c ); - stacking_order.remove( c ); - focus_chain.remove( c ); - bool mapped = c->isVisible(); - c->hide(); - c->releaseWindow(); - KWM::moveToDesktop( w, c->desktop() ); KConfig* config = KGlobal::config(); switch ( deco ) { ! case 2: ! c = new BeClient( this, w); ! config->writeEntry("Plugin", "Be"); ! break; ! case 3: ! c = new SystemClient(this, w); ! config->writeEntry("Plugin", "system"); ! break; ! case 4: ! c = new NextClient(this, w); ! config->writeEntry("Plugin", "next"); ! break; ! default: ! c = new StdClient( this, w ); ! config->writeEntry("Plugin", "standard"); } ! config->sync(); ! clients.append( c ); ! stacking_order.append( c ); ! c->manage( mapped ); ! activateClient( c ); ! } QWidget* Workspace::desktopWidget() { --- 1419,1462 ---- KWM::switchToDesktop( current_desktop ); // ### compatibility } // experimental void Workspace::setDecorationStyle( int deco ) { if ( !popup_client ) return; KConfig* config = KGlobal::config(); switch ( deco ) { ! case 2: config->writeEntry("Plugin", "be"); break; ! case 3: config->writeEntry("Plugin", "system"); break; ! case 4: config->writeEntry("Plugin", "next"); break; ! default: config->writeEntry("Plugin", "default"); break; } ! config->sync(); ! for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) { ! Client *oldClient = (*it); ! ! // Remove oldClient from the display ! bool mapped = oldClient->isVisible(); ! WId w = oldClient->window(); ! KWM::moveToDesktop( w, oldClient->desktop() ); // why is this necessary? ! oldClient->hide(); ! oldClient->releaseWindow(); + // Replace oldClient with newClient in all lists + Client *newClient = clientFactory (this, w); + (*it) = newClient; + ClientList::Iterator jt = stacking_order.find (oldClient); + //assert (jt != stacking_order.end()); + (*jt) = newClient; + jt = focus_chain.find (oldClient); + //assert (jt != focus_chain.end()); + (*jt) = newClient; + + // Delete the old, display the new + delete oldClient; + newClient->manage (mapped); + } + } QWidget* Workspace::desktopWidget() { *** /home/slamb/kdebase/kwin/options.h Mon Nov 29 17:15:52 1999 --- options.h Tue Dec 21 16:30:23 1999 *************** *** 29,46 ****
  • FocusUnderMouse - The window that happens to be under the mouse pointer becomes active. !
  • FocusStricklyUnderMouse - Only the window under the mouse pointer is active. If the mouse points nowhere, nothing has the focus. In practice, this is the same as FocusUnderMouse, since kdesktop can take the focus. ! Note that FocusUnderMouse and FocusStricklyUnderMouse are not particulary useful. They are only provided for old-fashined die-hard UNIX people ;-) */ ! enum FocusPolicy { ClickToFocus, FocusFollowsMouse, FocusUnderMouse, FocusStricklyUnderMouse }; FocusPolicy focusPolicy; enum MoveResizeMode { Transparent, Opaque }; --- 29,46 ----
  • FocusUnderMouse - The window that happens to be under the mouse pointer becomes active. !
  • FocusStrictlyUnderMouse - Only the window under the mouse pointer is active. If the mouse points nowhere, nothing has the focus. In practice, this is the same as FocusUnderMouse, since kdesktop can take the focus. ! Note that FocusUnderMouse and FocusStrictlyUnderMouse are not particulary useful. They are only provided for old-fashined die-hard UNIX people ;-) */ ! enum FocusPolicy { ClickToFocus, FocusFollowsMouse, FocusUnderMouse, FocusStrictlyUnderMouse }; FocusPolicy focusPolicy; enum MoveResizeMode { Transparent, Opaque }; ----- End forwarded message ----- -- David FAURE david@mandrakesoft.com, faure@kde.org http://home.clara.net/faure/ KDE, Making The Future of Computing Available Today