As stated in the other answer you may consider to install Emacs 29 from source.
I have installed Emacs 29 from source with X-support on Linux Mint 21 Cinnamon two days ago.
(framep(selected-frame)) returns x
Here are my documentation of the process which maybe work the same way also on other Linux versions.
Install git if it is not available on your system by default, then:
~ $ git clone --depth 1 --branch emacs-29 https://git.savannah.gnu.org/git/emacs.git
# clones into the directory emacs in the current directory which
# I have then renamed to:
~ $ cd /A/su/txtEditors/emacs/emacs-29.0.60_git-clone
# and archived in an emacs-29.0.60_git-clone.tar.xz archive
# there is no file configure in this directory but autogen.sh which
# will create it:
~ $ ./autogen.sh
# in order to enable imagemagick installed various -dev files.
# the standard value is --with-x-toolkit=gtk but I want the athena
# toolkit (i.e. lucid) recommended as more stable than gtk:
~ $ ./configure --with-x-toolkit=athena --with-imagemagick
# =athena =yes are same as =lucid
# not using --with-native-compilation=yes (=yes or empty)
# ./configure is missing the libacl (not an error) and because the
# ~ $ apt install libacl1
# libacl1 was already installed it was necessary only to:
~ $ apt install libacl1-dev
# compile the C and elisp files:
~ $ make
# install the binary in /usr/local/bin:
~ $ sudo make install
# delete object and executable files:
~ $ make clean
# along with the files created by ./configure:
~ $ make distclean
# change the look of the Emacs menu ( for: ~ $ emacs -q & )
# by creating a new file:
~/.Xdefaults
# with following content:
Emacs.pane.menubar.background: SeaGreen
Emacs.pane.menubar.foreground: black
Emacs*shadowThickness: 1
# and running:
~ $ xrdb -merge ~/.Xdefaults
to install it with X support yourself (default is gtk).
Depending on your system you will maybe need to download some other packages and their development versions. See the output of ./configure for hints which ones and then check with Synaptic Package Manager or other package management app with search function the actual names you have to use to install them as they can differ from these you see in the ./configure output.