patch: make window.focus() raise the window

Simon Hausmann hausmann at kde.org
Mon Sep 23 22:43:28 BST 2002


Hi,

According the Netscape docu window.focus() should not only set the
keyboard focus on the specified window but it should also bring it
to the foreground (make it visible) . The attached simple patch does
the trick (see also http://bugs.kde.org/show_bug.cgi?id=31916) .

Ok to commit?

Simon
-------------- next part --------------
Index: kjs_window.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_window.cpp,v
retrieving revision 1.274
diff -u -p -r1.274 kjs_window.cpp
--- kjs_window.cpp	2002/09/18 10:16:43	1.274
+++ kjs_window.cpp	2002/09/23 21:39:58
@@ -1296,8 +1296,10 @@ Value WindowFunc::tryCall(ExecState *exe
     (const_cast<Window*>(window))->clearTimeout(v.toInt32(exec));
     return Undefined();
   case Window::Focus:
-    if (widget)
+    if (widget) {
+      widget->topLevelWidget()->raise();
       widget->setActiveWindow();
+    }
     return Undefined();
   case Window::Blur:
     // TODO


More information about the kfm-devel mailing list