Q:

On the relationship between shell initialization and desktop apps after a "graphic login"

I am very (zsh)/somewhat (bash) familiar with the shell's initialization sequence when the user logs in through a text interface.
But what about the case of a "graphic login", IOW, when the user logs in through a graphic interface (e.g. through a so-called "display manager" on Linux, or the standard OS X login)?
I am particularly interested in those files (.zprofile, .zlogin, .profile) that are supposed to be sourced only for "login shells".  When the login is via a text interface, this is more or less equivalent to being sourced "exactly once per session".
When the login happens through a graphic interface, it is not clear to me that there's ever a "login shell" to begin with.  And even if .zprofile et al. are somehow sourced at some point as part of the graphic login sequence, it is not clear to me how the settings (e.g. exported environment variables) resulting from the sourcing of these files affect the rest of the of the session.
For example, do these settings affect the environment seen by apps that are auto-started at the time of login?  Or by apps that the user starts later by clicking on desktop icons?
For that matter, what about the settings that happen in .zshenv, or in .zshrc/.bashrc1?  Do they have any impact on the environment seen by "auto-started" and/or "click-started" apps?
If the answers to either of the last two question is something like "not by default", the follow-up question would be: how can one ensure that the settings performed in (at least) .zprofile/.profile, and possibly also .zlogin, get transmitted to the environment seen by all the "auto-started" and "click-started" applications?
I'm interested in the answers to these question for two shells, zsh and bash, and two operating systems, Linux and OSX.

1 assuming that .zshrc/.bashrc are being sourced as part of the zsh/bash built-in initialization sequence for "interactive" shells, rather than being sourced explicitly by .zprofile/.profile.

A:

Shell configuration files come into play only when the shell is invoked.  There's nothing magical about them.  Any process can change its environment.  Most only read it, but any program that exec's another is apt to have cause to alter the environment first.   
It all starts with init, or whatever pid 1 is on your system.  It starts the X server, which starts the display manager, which provides the login prompt.  The sequence that gets X11 started need not include a login shell; for example, init could call fork(2) and exec(2) on /usr/bin/startx.  No login, no .profile.  The X server inherits only the environment exported by init.  
What does the X server's environment look like?  You can extract the environment of a process with ps(1).  Easier, but not definitive, is to use ssh hostname /usr/bin/env (where hostname is the name of the machine hosting the X11 server).  Similar to what usually happens with the X server, sshd executes env without creating a login shell.  
Then we come to whatever your display manager does when you log into it.  It forks a process, changes the uid from (probably) root to yours, and starts a session manager.  For details, I commend you to your friendly manual.  
From that point forward, the session manager has established its environment, by whatever means.  Processes that it creates -- command interpreters or other applications by "clicking" on them -- inherit its environment.  The session manager may provide a way to define additional environment variable values on a per-icon basis, and the process that the clicked-on-thing starts may (as a shell does) alter its environment at startup, perhaps by a configuration file.  
It's all there.  To understand how the environment comes to be what it is, you "just" have to follow the chain of processes that created it, and understand what each one did to the environment.  Unfortunately, not only does that chain vary by OS, distribution, and machine & user configuration, it's also not particularly well documented or tooled.  Good luck, for example, finding documentation that states what environment variables will be set before, say, sshd starts, or finding an X11 client that displays the session manager's environment.  

