It seems when I call Gdk.Seat.grab() in GJS I get an error:
Gjs-WARNING **: JS ERROR: TypeError: Gdk.Seat.grab is not a function
This function and class is listed in the GJS Docs, but maybe I'm calling it wrong? If I call typeof
on Gdk.Seat.grab
it comes back undefined
. Is this not possible, or is there another way I can grab focus in this way?
My use case is gathering a keybinding from a user, for which I can use Gtk.CellRendererAccel
, but I would prefer not to use a Gtk.TreeView
. The docs say about CellRenderers that:
These objects are used primarily by the GtkTreeView widget, though they aren’t tied to them in any specific way.
and...
The primary use of a GtkCellRenderer is for drawing a certain graphical elements on a cairo_t.
Which implies I could use it outside of TreeView, but with no hints as to how.
grab()
is a method ofGdk.Seat
, so you need aGdk.Seat
object to call it on. It looks like you're calling it as a static method,Gdk.Seat.grab()
. So, you'll need something likeGdk.DeviceManager.get().get_default_display().get_default_seat()
or you can get aGdk.Seat
object from aGdk.Event
.It's not clear from the described use case what you are trying to do with the grab, but there may be an easier way to accomplish it.