<https://github.com/JetBrains/compose-jb/tree/mast...
# compose-desktop
k
https://github.com/JetBrains/compose-jb/tree/master/tutorials/Mouse_Events#mouse-rightmiddle-clicks-and-keyboard-modifiers has been reworked recently from
Modifier.pointerInput
to
Modifier.mouseClickable
. At the very end it says
If you need more information about events there is an available raw AWT mouse event object in mouseEvent property of PointerEvent
but it's not clear where is that
PointerEvent
. More specifically, what is the equivalent of
MouseEvent.isPopupTrigger
- which is pressed on mac, but released on windows?
OK, so I got this finally
Copy code
Modifier.pointerInput(Unit) {
  while (true) {
     val lastMouseEvent = awaitPointerEventScope { awaitPointerEvent() }.mouseEvent
     if (lastMouseEvent?.isPopupTrigger) {
        ...
     }
   }
}
i
Thanks! We will add information about obtaining awt events, it will be useful.
k
Thanks, that looks good
Maybe, since the section is about AWT events, the condition in line 236 should look at the AWT event and not at Compose event?
i
I am not sure. It is always better to use the Compose event directly, if there is a analogue of the Swing property.
k
Any chance to get the equivalent of
isPopupTrigger
? 🙂
Maybe there's something already wired in text views for showing context menus, and I missed that
i
Any chance to get the equivalent of 
isPopupTrigger
? 🙂
At the first glance, it looks like it shouldn't be as a part of
PointerEvent
, as it implementation details of Popup, not Event. Maybe we can provide something like this in the future:
Copy code
interface PopupConfiguration {
  fun isPopupTrigger(event: PointerEvent)

  companion object {
     val Platform = ...
  }
}
but not sure, we need to design it.
something already wired in text views for showing context menus
Actually now we open Context menu always on press, not on release. I think, we should fix that for Windows/Linux(?)
k
That's the reason why I'm asking. Ideally it would be aligned with the platform guidelines to be consistent for the user across their apps on their machine
I think there's already something platform-specific in pointer event for macOS
So it's already treating Ctrl+Click as non-primary on macOS (which is a popup trigger, correctly handled by
MouseEvent.isPopupTrigger
i
Ideally it would be aligned with the platform guidelines to be consistent for the user across their apps on their machine
Yes, Compose should comply guidelines of the platform, on which it runs, as much as possible for non-native application. I am not sure about "look", as it can be the same on all platforms (or just implement some other design system, such Material), but sure about "feel", as non-native feel would look weird for users.