Re: Problems with Opaque Window Moving
Bjorn Danielsson <[email protected]>
| Newsgroups | gmane.comp.window-managers.fluxbox.user |
|---|---|
| Organization | The Knights Who Say "Ni!" |
| Message-ID | <yqfmye9eial.fsf@knights-who-say-ni> |
I wrote: > When I use the "Opaque Window Moving" option, I get a very slow > update on the screen, resulting in several seconds of lag before > the moved window settles in the final position. There are also > large ugly artefacts on the screen during this slow motion. >[...] > However when I tried fluxbox in an Xnest window, the problem > disappeared completely. So opaque window moving works in Xnest, > but not in the root window. The part about Xnest turned out to be untrue -- the problem became noticeable in Xnest too when I added a custom background and more windows (the reason I tried Xnest was for testing the git version of fluxbox without affecting my main screen). I played around a bit with the source code today, and I think I have found a quick-and-dirty solution. I don't know if this solution breaks anything else, since I am not familiar with the internal machinery of fluxbox. But it solves the problem for me, and the patch is very simple: When a window is in motion, FluxboxWindow::motionNotifyEvent() ignores the current event if the next event is also a MotionNotify event. This causes the lag to disappear completely. The artefacts are still there (i.e. LSD-like tracers) but they are not as disturbing as before since the whole system feels more responsive. My patch is attached below. -- Bjorn Danielsson <[email protected]> ------------------------------------------------------------------------------ _______________________________________________ Fluxbox-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fluxbox-users
fluxbox-opaque-motion-speedup.patch
(text/x-patch, 992 B)
diff --git a/src/Window.cc b/src/Window.cc
index 4b4d1dc..614e483 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2417,12 +2417,29 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
}
+static Bool peekNextEvent(Display *, XEvent *e, char *args) {
+ XEvent **e1 = (XEvent**) args;
+ if (*e1 == NULL) {
+ *e1 = e;
+ }
+ return False;
+}
void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
if (isMoving() && me.window == parent()) {
me.window = frame().window().window();
}
+ if (isMoving()) {
+ // return immediately if the next queued event is also a motion event
+ XEvent dummy;
+ XEvent *e = NULL;
+ XCheckIfEvent(display, &dummy, peekNextEvent, (char*) &e);
+ if (e != NULL && e->type == MotionNotify) {
+ return;
+ }
+ }
+
bool inside_titlebar = frame().insideTitlebar( me.window );
if (Fluxbox::instance()->getIgnoreBorder() && m_attaching_tab == 0