To prevent users accidentally swiping back to the lockscreen while entering their PIN.
This prevents swiping on the buttons, but not swiping on the gaps in between the buttons.
There's probably a simpler and/or cleaner way to implement this. This the first time I've worked with GTK so I'm unfamiliar with its event handling and propagation model. This is the approach that worked for me, and is a contained change.
While trying out Phosh, I found myself accidentally doing this a few times over a few days. It's a minor annoyance, but preventable.
On my Android devices, the simple solution used is to prevent swiping gestures once the keypad is revealed. One can only return to the lockscreen by toggling the power button or using the back button / gesture.
Since there's no back button in Phosh currently, I think blocking swiping on the keypad specifically is a reasonable workaround. That'll be where most accidental swiping occurs.