hello! in undone patches of gpm there is one that makes gpm working inside Screen session. i'm using screen and gpm a lot so i adopted that patch for sys-libs/gpm 1.20.1-r6 and 1.20.6 and also add one or two fixes. i've test it with mc, vim, and others. for now it'll work properly if you export TTY environment variable in caller program and set it to `tty`. (for example add export TTY=`tty` to .bashrc)
Created attachment 203306 [details] /usr/local/portage/sys-libs/gpm/files/gpm-1.20.6-screen.patch patch for gpm-1.20.6
ps. add :set ttymouse="" to .vimrc to help vim determine screen pty properly
please send this patch to the upstream authors. i'm not really qualified to verify the correctness of this patch. it's simple to post to them: http://www.nico.schottelius.org/software/gpm/