I was just gonna write an answer, but turns out, I already did =)
See: How to release the mouse when debugging in gdb
The mentioned python script (which is not accessible anymore) looked like:
# release mouse when breaking into debugger for SDL2 programs
# by KittyCat, some comments + gdb.write() messages by Daniel Gibson
# put this next to the executable you wanna debug and name it
# Make sure that it's in a subdir of an allowed GDB auto-loading safe-path,
# see https://sourceware.org/gdb/onlinedocs/gdb/Auto_002dloading-safe-path.html
# e.g. by executing in a terminal:
# $ echo "add-auto-load-safe-path /path/to/project" >> ~/.gdbinit
def release_mouse (event):
gdb.write("GDB/SDL2: Releasing mouse\n")
# TODO: if you use SDL_SetWindowGrab(), you may have to write
# function with no arguments to call it with your SDL_Window*
# handle and call this as well, like:
# TODO: the following doesn't seem to work, maybe it does for you.
# either way, it needs xdotool installed.
#gdb.execute("exec xdotool key XF86Ungrab")
gdb.write("GDB/SDL2: installed release mouse for SDL2\n")
By the way, nowadays for the
gdb.execute("call SDL_SetWindowGrab(SDL_GetGrabbedWindow(), 0)")
might work, but this is completely untested.