Window Manager Startup

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (Category: -Technical, +System Developers)
(45gtkstylus)
Line 74: Line 74:
 
It makes no attempt to append this shared object to the end of an already existing GTK_MODULES environment variable.  Is this correct?
 
It makes no attempt to append this shared object to the end of an already existing GTK_MODULES environment variable.  Is this correct?
  
(Please elaborate about the purpose of this shared object)
+
This module provides a possibility to send a right click to applications by holding the stylus down for a while.
 +
This method works only in GTK applications.
  
 
=== 46gtkinput ===
 
=== 46gtkinput ===

Revision as of 15:31, 4 October 2008

Describes the scripts and programs used to bring up the X Windows Server and the Matchbox Window Manager. The series of events that occur when the window manager starts follows the order of the table of contents.

Contents

X Server Init Script

A standard init script:

/etc/init.d/xserver-nodm

To start the X Server:

/etc/init.d/xserver-nodm start

To stop the X Server

/etc/init.d/xserver-nodm stop

Using the stop parameter currently causes an error. ps is being called with an invalid parameter. (Bug #605)

When using the start parameter, it eventually calls Xserver.

X Server Environment Setup

A script at:

/etc/X11/Xserver

Called as:

/etc/X11/Xserver &

Configures system and sets up environment variables. Especially important are the environment variables XSERVER, DISPLAY, and ARGS. It finishes by calling and transferring control to xinit.

X Window System Initializer

A script at:

/usr/bin/xinit

Called as:

xinit /etc/X11/Xsession -- /usr/bin/Xfbdev :0 -br -pn -fp \
  built-ins,/usr/share/fonts/ttf,/usr/share/fonts/truetype \
  -screen 480x640x16

Executes Linux framebuffer generic X server (Xfbdev) and the scripts in /etc/X11/Xsession.d. The scripts are described in the next section of subtopics.

Screen Calibration

A script at:

/etc/X11/Xsession.d/30xTs_Calibrate

Checks to see if the pointer is calibrated (existence of /etc/pointercal). If not, then executes xtscal to calibrate it:

/usr/bin/xtscal

What program(s) eventually open and use the data in /etc/pointercal?

45gtkstylus

A script at:

/etc/X11/Xsession.d/45gtkstylus

This script sets the GTK_MODULES environment variable to point to a libgtksylus.so shared object with:

GTK_MODULES=libgtkstylus.so

It makes no attempt to append this shared object to the end of an already existing GTK_MODULES environment variable. Is this correct?

This module provides a possibility to send a right click to applications by holding the stylus down for a while. This method works only in GTK applications.

46gtkinput

A script at:

/etc/X11/Xsession.d/46gtkinput

This script appends a libgtkinput.so shared object to the end of the GTK_MODULES environment variable. This seems to be more correct than the above (and indeed, if this was not appended, you would lose the previous value).

It accomplishes this task with:

GTK_MODULES=${GTK_MODULES}:libgtkinput.so

(Please elaborate about the purpose of this shared object)

X Server Resource Database Load

A script at:

/etc/X11/Xsession.d/60xXDefaults

Loads the X server preferences from $HOME/.Xdefaults if it exists. The command is:

xdb -merge -nocpp < $HOME/.Xdefaults

There is currently not an .Xdefaults file in the Openmoko image, therefore this script does nothing.

Gnome Configuration Server

A script at:

/etc/X11/Xsession.d/69gconfd-dbus

This script executes:

/usr/libexec/gconfd-2 &

More information about gconfd can be found in the GConf Implementation Overview.

Settings Daemon

A script at:

/etc/X11/Xsession.d/70settings-daemon

This script executes:

/usr/bin/settings-daemon &

The current description in the Openmoko repository says that the "settings-daemon provides a bridge between gconf and xsettings".

Window Manager Startup

A script at:

/etc/X11/Xsession.d/90xXWindowManager

Calls the window manager with:

exec /usr/bin/x-window-manager

X Window Manager

A soft link at:

/usr/bin/x-window-manager

This soft link points to:

/usr/bin/matchbox-session

This script simply adds a level indirection so one can easily change the window manager being used.

Matchbox Session

A script at:

/usr/bin/matchbox-session

Test for the existence of:

/etc/matchbox/session

In the case of Openmoko, this test is positive and session is exec'ed.

Taking a quick look at the script shows that one can override the use of /etc/matchbox/session with their own $HOME/.matchbox/session if they wish to experiment without touching the rest of the system.

Matchbox Window Manager Setup

A script at:

/etc/matchbox/session

This is where the key ingredients of the Matchbox Window Manager are mixed together and executed. Because these elements are key to the user interface, this script is described in detail here.

It is interesting that after the setting of GTK_MODULES in the X Window System Initializer phase (scripts in /etc/X11/Xsession.d) that it is all overwritten by a single statement here:

export GTK_MODULES=libgtkstylus.so

This loses an old value for GTK_MODULES that also contained libgtkinput.so. Perhaps this was something that was overlooked?

Matchbox Top Panel

A binary at:

/usr/bin/matchbox-panel-2

Called as:

matchbox-panel-2 --start-applets=openmoko-panel-mainmenu,systray,startup \
  --end-applets=openmoko-panel-battery,openmoko-panel-gsm,\
  openmoko-panel-gps,openmoko-panel-usb,openmoko-panel-bt,\
  openmoko-panel-clock &

The Matchbox Top Panel dynamically links in a series of shared objects that are called applets. If any of these shared objects has a problem that causes abnormal termination, the whole Top Panel goes down. Many users have already observed this when using the GSM & GPRS Connection Status (openmoko-panel-gsm) applet. Turning it off and on repeatedly will eventually cause the code in the shared object to crash, bringing down the whole Top Panel.

The best methods for bring the Top Panel back up (besides rebooting) are to run the Top Panel from the command line, as above) or to restart the X Server:

/etc/init.d/xserver-nodm restart

Note that with the above, the X Server will fail to stop because of the bug described with the script above.

Because the Top Panel seems to be essential to normal operation of the phone, execution of the panel should be wrapped in a loop to restart it in the event of a failure. Take into account this program runs in the background and it may not be wise to keep restarting it in tight loop, using up CPU, etc.

Matchbox Input Manager

A binary at:

/usr/bin/mbinputmgr

Called as:

mbinputmgr &

This program is described as "A tray application for managing software input methods". It seems to be the white Matchbox Panel applet that brings up the software keyboard. This needs to be verified.

ALSA Control

A binary at:

/usr/sbin/alsactl

Called as:

alsactl restore 0 -f /etc/alsa/stereoout.state

Initializes the audio system state. More information for ALSA can be found on the ALSA Project home page.

Openmoko Footer

A binary at:

/usr/bin/openmoko-footer

Called as:

openmoko-footer &

More about Footer.

Openmoko Today

A binary at:

/usr/bin/openmoko-today

Called as:

openmoko-today --desktop &

More about Today.

Openmoko Dialer

A binary at:

/usr/bin/openmoko-dialer

Called as:

openmoko-dialer &

More about Dialer.

Matchbox Window Manager

An binary at:

/usr/bin/matchbox-window-manager

Called as:

matchbox-window-manager -use_titlebar no -use_cursor no

The Matchbox Window Manager home page.

Final

At this point, the user interface is up and ready for service.

Personal tools

Describes the scripts and programs used to bring up the X Windows Server and the Matchbox Window Manager. The series of events that occur when the window manager starts follows the order of the table of contents.

X Server Init Script

A standard init script:

/etc/init.d/xserver-nodm

To start the X Server:

/etc/init.d/xserver-nodm start

To stop the X Server

/etc/init.d/xserver-nodm stop

Using the stop parameter currently causes an error. ps is being called with an invalid parameter. (Bug #605)

When using the start parameter, it eventually calls Xserver.

X Server Environment Setup

A script at:

/etc/X11/Xserver

Called as:

/etc/X11/Xserver &

Configures system and sets up environment variables. Especially important are the environment variables XSERVER, DISPLAY, and ARGS. It finishes by calling and transferring control to xinit.

X Window System Initializer

A script at:

/usr/bin/xinit

Called as:

xinit /etc/X11/Xsession -- /usr/bin/Xfbdev :0 -br -pn -fp \
  built-ins,/usr/share/fonts/ttf,/usr/share/fonts/truetype \
  -screen 480x640x16

Executes Linux framebuffer generic X server (Xfbdev) and the scripts in /etc/X11/Xsession.d. The scripts are described in the next section of subtopics.

Screen Calibration

A script at:

/etc/X11/Xsession.d/30xTs_Calibrate

Checks to see if the pointer is calibrated (existence of /etc/pointercal). If not, then executes xtscal to calibrate it:

/usr/bin/xtscal

What program(s) eventually open and use the data in /etc/pointercal?

45gtkstylus

A script at:

/etc/X11/Xsession.d/45gtkstylus

This script sets the GTK_MODULES environment variable to point to a libgtksylus.so shared object with:

GTK_MODULES=libgtkstylus.so

It makes no attempt to append this shared object to the end of an already existing GTK_MODULES environment variable. Is this correct?

This module provides a possibility to send a right click to applications by holding the stylus down for a while. This method works only in GTK applications.

46gtkinput

A script at:

/etc/X11/Xsession.d/46gtkinput

This script appends a libgtkinput.so shared object to the end of the GTK_MODULES environment variable. This seems to be more correct than the above (and indeed, if this was not appended, you would lose the previous value).

It accomplishes this task with:

GTK_MODULES=${GTK_MODULES}:libgtkinput.so

(Please elaborate about the purpose of this shared object)

X Server Resource Database Load

A script at:

/etc/X11/Xsession.d/60xXDefaults

Loads the X server preferences from $HOME/.Xdefaults if it exists. The command is:

xdb -merge -nocpp < $HOME/.Xdefaults

There is currently not an .Xdefaults file in the Openmoko image, therefore this script does nothing.

Gnome Configuration Server

A script at:

/etc/X11/Xsession.d/69gconfd-dbus

This script executes:

/usr/libexec/gconfd-2 &

More information about gconfd can be found in the GConf Implementation Overview.

Settings Daemon

A script at:

/etc/X11/Xsession.d/70settings-daemon

This script executes:

/usr/bin/settings-daemon &

The current description in the Openmoko repository says that the "settings-daemon provides a bridge between gconf and xsettings".

Window Manager Startup

A script at:

/etc/X11/Xsession.d/90xXWindowManager

Calls the window manager with:

exec /usr/bin/x-window-manager

X Window Manager

A soft link at:

/usr/bin/x-window-manager

This soft link points to:

/usr/bin/matchbox-session

This script simply adds a level indirection so one can easily change the window manager being used.

Matchbox Session

A script at:

/usr/bin/matchbox-session

Test for the existence of:

/etc/matchbox/session

In the case of Openmoko, this test is positive and session is exec'ed.

Taking a quick look at the script shows that one can override the use of /etc/matchbox/session with their own $HOME/.matchbox/session if they wish to experiment without touching the rest of the system.

Matchbox Window Manager Setup

A script at:

/etc/matchbox/session

This is where the key ingredients of the Matchbox Window Manager are mixed together and executed. Because these elements are key to the user interface, this script is described in detail here.

It is interesting that after the setting of GTK_MODULES in the X Window System Initializer phase (scripts in /etc/X11/Xsession.d) that it is all overwritten by a single statement here:

export GTK_MODULES=libgtkstylus.so

This loses an old value for GTK_MODULES that also contained libgtkinput.so. Perhaps this was something that was overlooked?

Matchbox Top Panel

A binary at:

/usr/bin/matchbox-panel-2

Called as:

matchbox-panel-2 --start-applets=openmoko-panel-mainmenu,systray,startup \
  --end-applets=openmoko-panel-battery,openmoko-panel-gsm,\
  openmoko-panel-gps,openmoko-panel-usb,openmoko-panel-bt,\
  openmoko-panel-clock &

The Matchbox Top Panel dynamically links in a series of shared objects that are called applets. If any of these shared objects has a problem that causes abnormal termination, the whole Top Panel goes down. Many users have already observed this when using the GSM & GPRS Connection Status (openmoko-panel-gsm) applet. Turning it off and on repeatedly will eventually cause the code in the shared object to crash, bringing down the whole Top Panel.

The best methods for bring the Top Panel back up (besides rebooting) are to run the Top Panel from the command line, as above) or to restart the X Server:

/etc/init.d/xserver-nodm restart

Note that with the above, the X Server will fail to stop because of the bug described with the script above.

Because the Top Panel seems to be essential to normal operation of the phone, execution of the panel should be wrapped in a loop to restart it in the event of a failure. Take into account this program runs in the background and it may not be wise to keep restarting it in tight loop, using up CPU, etc.

Matchbox Input Manager

A binary at:

/usr/bin/mbinputmgr

Called as:

mbinputmgr &

This program is described as "A tray application for managing software input methods". It seems to be the white Matchbox Panel applet that brings up the software keyboard. This needs to be verified.

ALSA Control

A binary at:

/usr/sbin/alsactl

Called as:

alsactl restore 0 -f /etc/alsa/stereoout.state

Initializes the audio system state. More information for ALSA can be found on the ALSA Project home page.

Openmoko Footer

A binary at:

/usr/bin/openmoko-footer

Called as:

openmoko-footer &

More about Footer.

Openmoko Today

A binary at:

/usr/bin/openmoko-today

Called as:

openmoko-today --desktop &

More about Today.

Openmoko Dialer

A binary at:

/usr/bin/openmoko-dialer

Called as:

openmoko-dialer &

More about Dialer.

Matchbox Window Manager

An binary at:

/usr/bin/matchbox-window-manager

Called as:

matchbox-window-manager -use_titlebar no -use_cursor no

The Matchbox Window Manager home page.

Final

At this point, the user interface is up and ready for service.