[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: Re: [Kwin] kwin performance (kde 3.2b2)
From: aviv bergman <aviv_brg () yahoo ! com>
Date: 2004-01-20 12:18:46
Message-ID: 20040120121846.45543.qmail () web13125 ! mail ! yahoo ! com
[Download RAW message or body]
ok - more tests...
i've added some code to count the number of different
events/second in Application::x11EventFilter, the
results: (well, a representative sample of the
results)
a. standard kwin (draging a konqueror window from the
caption)
MotionNotify - 60
EnterNotify - 0
LeaveNotify - 0
Expose - 279
ConfigureNotify - 120
PropertyNotify - 60
window movement is quite jerky (pointer & window are
not in sync), low cpu usage
b. standard kwin + add Enter/Leave NotifyMask to
XGrabPointer:
MotionNotify - 32
EnterNotify - 45
LeaveNotify - 45
Expose - 318
ConfigureNotify - 154
PropertyNotify - 77
window movement still jerky, low cpu usage
c. same as (b), but dragging using alt-click, from the
center of konqueror window (empty directory):
MotionNotify - 113
EnterNotify - 3
LeaveNotify - 3
Expose - 394
ConfigureNotify - 238
PropertyNotify - 119
smooth window movement, higher cpu usage
d. owner_events set to TRUE
MotionNotify - 32
EnterNotify - 354
LeaveNotify - 354
Expose - 544
ConfigureNotify - 248
PropertyNotify - 124
smooth window movement, higher cpu usage
e. same as (d), but dragging kcalc from the center of
the window with alt-click:
MotionNotify - 25
EnterNotify - 15
LeaveNotify - 15
Expose - 65
ConfigureNotify - 56
PropertyNotify - 28
_very_ jerky movement, low cpu usage.
same results with original kwin.
also - i've managed twice to loose the window -
started drag, stopped (mouse still down) - the pointer
was not at the position (in the window) it was at the
beginning of the drag. moving a bit more caused the
window to "jump" into place --> some events are
missing.
(b.t.w. - metacity has the same behavior)
kcalc is probably the worst - i guess due to lots of
child windows.
f. so - just for testing, i patched kwin to grab a
full-screen input only window (draging kcalc with
alt-click):
MotionNotify - 125
EnterNotify - 0
LeaveNotify - 0
Expose - 184
ConfigureNotify - 250
PropertyNotify - 125
very smooth movement, higher cpu then default, but
much lower then (d)
so...
the only explanation i can think of is that it's an X
bug, probably related to enter/leave event regarding
child windows (?)
i'm attaching my patch, so u can test it - it's a
hack, but it works best for me.
(i havn't tested the rate limiting patch, since i
belive the problem is not there)
aviv
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
["kwin.diff" (application/octet-stream)]
diff -U 3 -dHN kdebase-3.1.94/kwin/events.cpp kdebase-patch/kwin/events.cpp
--- kdebase-3.1.94/kwin/events.cpp 2003-11-30 11:43:13.000000000 +0200
+++ kdebase-patch/kwin/events.cpp 2004-01-20 12:10:08.000000000 +0200
@@ -166,6 +166,10 @@
*/
bool Workspace::workspaceEvent( XEvent * e )
{
+
+ if ((m_grabWindow != 0) && (e->xany.window == m_grabWindow))
+ e->xany.window = movingClient->frameId();
+
if ( mouse_emulation && (e->type == ButtonPress || e->type == ButtonRelease ) )
{
mouse_emulation = FALSE;
diff -U 3 -dHN kdebase-3.1.94/kwin/geometry.cpp kdebase-patch/kwin/geometry.cpp
--- kdebase-3.1.94/kwin/geometry.cpp 2003-11-30 11:43:13.000000000 +0200
+++ kdebase-patch/kwin/geometry.cpp 2004-01-20 12:11:29.000000000 +0200
@@ -1496,7 +1496,7 @@
if( QApplication::activePopupWidget() != NULL )
return false; // popups have grab
bool has_grab = false;
- if( XGrabPointer( qt_xdisplay(), frameId(), False, ButtonPressMask | \
ButtonReleaseMask | PointerMotionMask, + if( XGrabPointer( \
qt_xdisplay(),workspace()->getGrabWindow(), False, ButtonPressMask | \
ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync, None, cursor.handle(), qt_x_time ) == Success \
) has_grab = true;
if( XGrabKeyboard( qt_xdisplay(), frameId(), False, GrabModeAsync, \
GrabModeAsync, qt_x_time ) == Success ) @@ -1552,6 +1552,7 @@
XUngrabServer( qt_xdisplay() );
XUngrabKeyboard( qt_xdisplay(), qt_x_time );
XUngrabPointer( qt_xdisplay(), qt_x_time );
+ workspace()->clearGrabWindow();
workspace()->setClientIsMoving(0);
if( move_faked_activity )
workspace()->unfakeActivity( this );
diff -U 3 -dHN kdebase-3.1.94/kwin/workspace.cpp kdebase-patch/kwin/workspace.cpp
--- kdebase-3.1.94/kwin/workspace.cpp 2003-11-30 11:43:14.000000000 +0200
+++ kdebase-patch/kwin/workspace.cpp 2004-01-20 12:25:21.000000000 +0200
@@ -174,6 +174,7 @@
if (options->electricBorders() == Options::ElectricAlways)
createBorderWindows();
+ m_grabWindow = 0;
supportWindow = new QWidget;
XLowerWindow( qt_xdisplay(), supportWindow->winId()); // see usage in layers.cpp
@@ -1813,6 +1814,39 @@
clientMoved(p, now);
}
+void Workspace::clearGrabWindow()
+{
+ if (m_grabWindow == 0)
+ return;
+
+ XUnmapWindow(qt_xdisplay(),m_grabWindow);
+ XDestroyWindow(qt_xdisplay(),m_grabWindow);
+
+ m_grabWindow = 0;
+}
+
+Window Workspace::getGrabWindow()
+{
+ if (m_grabWindow != 0)
+ return m_grabWindow;
+
+ unsigned long attr_mask = CWEventMask;
+ XSetWindowAttributes attributes;
+ attributes.event_mask = ButtonMotionMask;
+ m_grabWindow = XCreateWindow(qt_xdisplay(),
+ RootWindow(qt_xdisplay(), DefaultScreen(qt_xdisplay())),
+ 0, 0,
+ QApplication::desktop()->width(), \
QApplication::desktop()->height(), + 0,
+ 0,InputOnly,CopyFromParent,
+ attr_mask,&attributes);
+
+ XMapRaised(qt_xdisplay(),m_grabWindow);
+
+ return m_grabWindow;
+}
+
+
// electric borders (input only windows) have to be always on the
// top. For that reason kwm calls this function always after some
// windows have been raised.
@@ -1989,4 +2023,5 @@
} // namespace
+
#include "workspace.moc"
diff -U 3 -dHN kdebase-3.1.94/kwin/workspace.h kdebase-patch/kwin/workspace.h
--- kdebase-3.1.94/kwin/workspace.h 2003-11-30 11:43:14.000000000 +0200
+++ kdebase-patch/kwin/workspace.h 2004-01-20 12:14:03.000000000 +0200
@@ -123,7 +123,9 @@
* Indicates that the client c is being moved around by the user.
*/
void setClientIsMoving( Client *c );
-
+ void clearGrabWindow();
+ Window getGrabWindow();
+
void place(Client *c);
void placeSmart( Client* c );
@@ -389,7 +391,8 @@
void updateClientArea( bool force );
SystemTrayWindowList systemTrayWins;
-
+
+ Window m_grabWindow;
int current_desktop;
int number_of_desktops;
QMemArray<int> desktop_focus_chain;
_______________________________________________
Kwin mailing list
Kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic