[Tex/LaTex] How to indent long frametitle (beamer)

beamerindentation

I have (sub)section numbers in the \frametitle, and I want an indentation if the frame title is too long to fit in one line (similar to default LaTeX behavior).
I fiddeled around with adding \hangindent=3em to the \frametitle argument but this does not help.

Example:

\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{1.1 A long frametitle that produces a linebreak line line line line line}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. 

\end{frame}
\end{document}

The desired outcome would be something like:

1.1 A long frametitle that produces a linebreak
    line line line line line

instead of

1.1 A long frametitle that produces a linebreak
line line line line line

Background: The whole \frametitle command with (sub)section number and actual (sub)section heading is generated by the following command:

\newcommand{\frametitledef}{\frametitle{
\ifnum\value{subsection}=0
  \thesection{} \insertsection{}
\else
  \ifnum\value{subsubsection}=0
    \thesection{}.\thesubsection{} \insertsubsection{}
  \else
    \thesection{}.\thesubsection{}.\thesubsubsection{} \insertsubsubsection{}
  \fi
\fi
}}

Best Answer

Perhaps something like this is what you are looking for:

\documentclass{beamer}

\newcommand{\frametitledef}{\frametitle{%
\ifnum\value{subsection}=0
  \parbox[t]{1em}{\thesection}%
  \parbox[t]{\dimexpr0.9\paperwidth-1em\relax}{\insertsection}%
\else
  \ifnum\value{subsubsection}=0
    \parbox[t]{2em}{\thesection.\thesubsection}%
    \parbox[t]{\dimexpr0.9\paperwidth-2em\relax}{\insertsubsection}%
  \else
    \parbox[t]{3em}{\thesection.\thesubsection.\thesubsubsection}%
    \parbox[t]{\dimexpr0.9\paperwidth-3em\relax}{\insertsubsubsection}%
  \fi
\fi
}}

\begin{document}
\section{test}
\frame{test}

\subsection{A long frametitle that produces a linebreak line line line line line}

\begin{frame}
\frametitledef

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. 
\end{frame}

\end{document}

Here's an image of the second frame showing the indentation for the second line of the title:

enter image description here