Commit 857c32b0 for guacamole.apache.org

commit 857c32b056b697abc88b80a5ebf7498f07e7ab9d
Author: Brad Schroth <2342157+bferd@users.noreply.github.com>
Date:   Tue Nov 3 08:51:10 2026 -0500

    GUACAMOLE-2350: Add back and forward mouse button flags and send them to RDP as extended mouse events.

diff --git a/src/libguac/guacamole/client-constants.h b/src/libguac/guacamole/client-constants.h
index 5683278d..fa7d04df 100644
--- a/src/libguac/guacamole/client-constants.h
+++ b/src/libguac/guacamole/client-constants.h
@@ -75,6 +75,16 @@
  */
 #define GUAC_CLIENT_MOUSE_SCROLL_DOWN 0x10

+/**
+ * The flag set in the mouse button mask when the back mouse button is down.
+ */
+#define GUAC_CLIENT_MOUSE_BACK 0x20
+
+/**
+ * The flag set in the mouse button mask when the forward mouse button is down.
+ */
+#define GUAC_CLIENT_MOUSE_FORWARD 0x40
+
 /**
  * The minimum number of buffers to create before allowing free'd buffers to
  * be reclaimed. In the case a protocol rapidly creates, uses, and destroys
diff --git a/src/protocols/rdp/input-queue.c b/src/protocols/rdp/input-queue.c
index 1606d479..4486bc28 100644
--- a/src/protocols/rdp/input-queue.c
+++ b/src/protocols/rdp/input-queue.c
@@ -146,6 +146,25 @@ static void guac_rdp_handle_mouse_event(guac_rdp_client* rdp_client,

         }

+        /* Extended mouse buttons (back and forward) */
+        static const int xmasks[2] = { GUAC_CLIENT_MOUSE_BACK, GUAC_CLIENT_MOUSE_FORWARD };
+        static const UINT16 xbuttons[2] = { PTR_XFLAGS_BUTTON1, PTR_XFLAGS_BUTTON2 };
+        for (int i = 0; i < 2; i++) {
+
+            if (!((released_mask | pressed_mask) & xmasks[i]))
+                continue;
+
+            UINT16 xflags = xbuttons[i];
+            if (pressed_mask & xmasks[i])
+                xflags |= PTR_XFLAGS_DOWN;
+
+            pthread_mutex_lock(&(rdp_client->message_lock));
+            GUAC_RDP_CONTEXT(rdp_inst)->input->ExtendedMouseEvent(
+                    GUAC_RDP_CONTEXT(rdp_inst)->input, xflags, x, y);
+            pthread_mutex_unlock(&(rdp_client->message_lock));
+
+        }
+
         rdp_client->mouse_button_mask = mask;
     }