Skip to content

windowManager: Only accept numeric values as Enum values

When doing a touch-pad driven workspace switch, JS is showing errors, this is because the Meta.MotionDirection enum object also contains a "$gtype" object and this value should be ignored, as it's not a valid direction.

The Object serializaion in fact shows: { "UP": -1, "DOWN": -2, "LEFT": -3, "RIGHT": -4, "UP_LEFT":-5, "UP_RIGHT": -6, "DOWN_LEFT": -7, "DOWN_RIGHT": -8, "$gtype": { } }

And so we should ignore anything that is not a number.

!428 (closed)


The error I was getting was:

(gnome-shell:4541): Gjs-WARNING **: 23:44:45.098: JS ERROR: Exception in callback for signal: motion: Error: Expected type enum for Argument 'direction' but got type 'GIRepositoryGType'                                                      
_prepareWorkspaceSwitch@resource:///org/gnome/shell/ui/windowManager.js:1900:22                                        
_switchWorkspaceMotion@resource:///org/gnome/shell/ui/windowManager.js:1103:13                                         
_emit@resource:///org/gnome/gjs/modules/signals.js:142:27
_handleEvent@resource:///org/gnome/shell/ui/windowManager.js:506:13
Edited by Marco Trevisan

Merge request reports