From 79b77e78cf141cc8a7111c9e4e26842bad092d17 Mon Sep 17 00:00:00 2001
From: Simon Long <simon@raspberrypi.org>
Date: Tue, 1 Aug 2017 12:50:38 +0100
Subject: [PATCH] Add Anholt patch to speed up dragging.

---
 Makefile.am          |  1 +
 openbox/moveresize.c | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index f25bf8e..af45399 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -185,6 +185,7 @@ openbox_openbox_LDADD = \
 	$(SM_LIBS) \
 	$(GLIB_LIBS) \
 	$(X_LIBS) \
+	$(XSYNC_LIBS) \
 	$(XCURSOR_LIBS) \
 	$(LIBSN_LIBS) \
 	$(XML_LIBS) \
diff --git a/openbox/moveresize.c b/openbox/moveresize.c
index bdfcc0a..ac52182 100644
--- a/openbox/moveresize.c
+++ b/openbox/moveresize.c
@@ -953,9 +953,22 @@ gboolean moveresize_event(XEvent *e)
         }
     } else if (e->type == MotionNotify) {
         if (moving) {
+			XEvent ce;
+			ObtXQueueWindowType wt;
+
+			wt.window = e->xmotion.window;
+			wt.type = MotionNotify;
+			while (xqueue_remove_local(&ce, xqueue_match_window_type, &wt)) {
+				e->xmotion.x = ce.xmotion.x;
+				e->xmotion.y = ce.xmotion.y;
+				e->xmotion.x_root = ce.xmotion.x_root;
+				e->xmotion.y_root = ce.xmotion.y_root;
+			}
+
             cur_x = start_cx + e->xmotion.x_root - start_x;
             cur_y = start_cy + e->xmotion.y_root - start_y;
             do_move(FALSE, 0);
+            XSync(obt_display, FALSE);
             do_edge_warp(e->xmotion.x_root, e->xmotion.y_root);
         } else {
             gint dw, dh;
