Repository: flutter
Issue: Linux: mouse click events other than primary, secondary and tertiary are not recognized
Labels: engine,platform-linux,a: mouse,has reproducible steps,P2,found in release: 3.22,team-linux,triaged-linux,found in release: 3.24

### Steps to reproduce

1. create a Linux Flutter app with

```bash
flutter create --platforms=linux --org com.test my_app
```

2. Create an implementation of BaseTapGestureRecognizer

```dart
class NthTap extends BaseTapGestureRecognizer {
  GestureTapDownCallback? onTapDown;

  NthTap({
    super.debugOwner,
    super.supportedDevices,
    super.allowedButtonsFilter,
  });

  @override
  void handleTapCancel({
    required PointerDownEvent down,
    PointerCancelEvent? cancel,
    required String reason,
  }) {}

  @override
  void handleTapDown({required PointerDownEvent down}) {
    final TapDownDetails details = TapDownDetails(
      globalPosition: down.position,
      localPosition: down.localPosition,
      kind: getKindForPointer(down.pointer),
    );

    if (onTapDown != null) {
      invokeCallback<void>('onTapDown', () => onTapDown!(details));
    }
  }

  @override
  void handleTapUp({
    required PointerDownEvent down,
    required PointerUpEvent up,
  }) {}
}
```

3. Use it inside the widget tree

```dart
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return RawGestureDetector(
      gestures: <Type, GestureRecognizerFactory>{
        NthTap: GestureRecognizerFactoryWithHandlers<NthTap>(
          () => NthTap(),
          (instance) =>
              instance.onTapDown = (details) => ScaffoldMessenger.of(context)
                ..clearSnackBars()
                ..showSnackBar(SnackBar(
                  content: Center(
                    child: Text(
                      details.globalPosition.toString(),
                    ),
                  ),
                  behavior: SnackBarBehavior.floating,
                )),
        ),
      },
      child: const Scaffold(),
    );
  }
}
```



### Expected results

All mouse buttons should be recognized

### Actual results

Only 1.,2. and 3. buttons are recognized. 4th and 5th arent

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return RawGestureDetector(
      gestures: <Type, GestureRecognizerFactory>{
        NthTap: GestureRecognizerFactoryWithHandlers<NthTap>(
          () => NthTap(),
          (instance) =>
              instance.onTapDown = (details) => ScaffoldMessenger.of(context)
                ..clearSnackBars()
                ..showSnackBar(SnackBar(
                  content: Center(
                    child: Text(
                      details.globalPosition.toString(),
                    ),
                  ),
                  behavior: SnackBarBehavior.floating,
                )),
        ),
      },
      child: const Scaffold(),
    );
  }
}

class NthTap extends BaseTapGestureRecognizer {
  GestureTapDownCallback? onTapDown;

  NthTap({
    super.debugOwner,
    super.supportedDevices,
    super.allowedButtonsFilter,
  });

  @override
  void handleTapCancel({
    required PointerDownEvent down,
    PointerCancelEvent? cancel,
    required String reason,
  }) {}

  @override
  void handleTapDown({required PointerDownEvent down}) {
    final TapDownDetails details = TapDownDetails(
      globalPosition: down.position,
      localPosition: down.localPosition,
      kind: getKindForPointer(down.pointer),
    );

    if (onTapDown != null) {
      invokeCallback<void>('onTapDown', () => onTapDown!(details));
    }
  }

  @override
  void handleTapUp({
    required PointerDownEvent down,
    required PointerUpEvent up,
  }) {}
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[[Upload media here]](https://github.com/user-attachments/assets/6ab133d5-ba36-427f-ae28-a85d62776a61)

</details>





### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
frederik@xps:~/my_app$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.5, on Ubuntu 24.04 LTS 6.8.0-31-generic, locale de_DE.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
    ✗ No Java Development Kit (JDK) found; You must have the environment variable JAVA_HOME set and the java binary in your PATH. You can download the JDK from
      https://www.oracle.com/technetwork/java/javase/downloads/.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] VS Code (version 1.91.1)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 2 categories.
```

</details>

this also happens in 3.22.2 stable