Moblin2
Window Manager(Mutter)
Plugin
William.L
wiliwe@gmail.com
2009-07-10
2
• What is Mutter?
• When/Where does the window manager load plugin?
• Plugin common interfaces
• Where is the Clutter stage?
• How the window manager show Clutter stage?
• Where to add customized Clutter contents
• How the window manager choose plugins?
• Where is X-window client init script?
• How to add debug messages in codes?
Outline
3
What is Mutter?
Metacity Clutter
Metacity
A lightweight window manager written by Havoc
Pennington from Red Hat
Implemented with the GTK+ 2.x toolkit
Integrates well with the GNOME 2.x platform
Clutter
An open source (LGPL 2.1) software library for creating
portable and dynamic graphical user interfaces
Uses OpenGL for rendering (optional OpenGL|ES on
mobile and embedded platforms)
Wraps an easy to use API around GL’s complexity
4
When/Where does the Window Manager
load Plugin? (1/2)
Main Entry
MetacitySrc/src/core/ main.c
When it enter window manager main() and then
call meta_display_open()
Finally, meta_display_open() indirectly calls
mutter_plugin_manager_load() and loads
PluginName.so plugin
Use GModule to load plugin, PluginName.so
5
When/Where does the Window Manager
load Plugin? (2/2)
Store loaded plugin contents in a object of type of
GtypeModule (MutterModule class)
Default plugin file path is store in global variable
MUTTER_PLUGIN_DIR
The path to plugin files
/usr/lib/metacity/plugins/clutter/
Current available default plugin files are
default.so
moblin-netbook.so
6
Plugin common interfaces (1/2)
Defined in
MetacitySrc/src/include/ mutter-plugin.h
struct _MutterPluginClass
7
Plugin common interfaces (2/2)
Interfaces
minimize()
maximize()
unmaximize()
map()
destroy()
switch_workspace()
kill_effect()
xevent_filter()
plugin_info()
8
Where is the Clutter stage?
MetacitySrc/src/compositor/mutter/compositor-
mutter.c
struct _MetaCompScreen
The Clutter stage’s initialization is in
clutter_cmp_manage_screen()
9
How the window manager show Clutter
stage?
Put Clutter stage on Overlay window layer that
is between Normal window and Screen Saver
window(the most top layer)
MetacitySrc/src/compositor/mutter/compositor-
mutter.c
TheXwinOfStage = clutter_x11_get_stage_window(CLUTTER_STAGE
(ClutterStage));
OverlayWin = XCompositeGetOverlayWindow (XDisplay, XRootWindow);
XreparentWindow (XDisplay, TheXwinOfStage, OverlayWin, 0, 0);
10
Where to add customized Clutter contents?
In customized plugin class's constructed()
function
11
How to choose plugins?
One more plugins but only one could be used in
Gconf
key - “apps/metacity/general/clutter_plugins“
Where is X-window client init script?
/etc/X11/moblin/xinitrc
How to add debug messages in codes?
Using code:
g_debug("n [%]... n", G_STRLOC, ...);

Moblin2 - Window Manager(Mutter) Plugin

  • 1.
  • 2.
    2 • What isMutter? • When/Where does the window manager load plugin? • Plugin common interfaces • Where is the Clutter stage? • How the window manager show Clutter stage? • Where to add customized Clutter contents • How the window manager choose plugins? • Where is X-window client init script? • How to add debug messages in codes? Outline
  • 3.
    3 What is Mutter? MetacityClutter Metacity A lightweight window manager written by Havoc Pennington from Red Hat Implemented with the GTK+ 2.x toolkit Integrates well with the GNOME 2.x platform Clutter An open source (LGPL 2.1) software library for creating portable and dynamic graphical user interfaces Uses OpenGL for rendering (optional OpenGL|ES on mobile and embedded platforms) Wraps an easy to use API around GL’s complexity
  • 4.
    4 When/Where does theWindow Manager load Plugin? (1/2) Main Entry MetacitySrc/src/core/ main.c When it enter window manager main() and then call meta_display_open() Finally, meta_display_open() indirectly calls mutter_plugin_manager_load() and loads PluginName.so plugin Use GModule to load plugin, PluginName.so
  • 5.
    5 When/Where does theWindow Manager load Plugin? (2/2) Store loaded plugin contents in a object of type of GtypeModule (MutterModule class) Default plugin file path is store in global variable MUTTER_PLUGIN_DIR The path to plugin files /usr/lib/metacity/plugins/clutter/ Current available default plugin files are default.so moblin-netbook.so
  • 6.
    6 Plugin common interfaces(1/2) Defined in MetacitySrc/src/include/ mutter-plugin.h struct _MutterPluginClass
  • 7.
    7 Plugin common interfaces(2/2) Interfaces minimize() maximize() unmaximize() map() destroy() switch_workspace() kill_effect() xevent_filter() plugin_info()
  • 8.
    8 Where is theClutter stage? MetacitySrc/src/compositor/mutter/compositor- mutter.c struct _MetaCompScreen The Clutter stage’s initialization is in clutter_cmp_manage_screen()
  • 9.
    9 How the windowmanager show Clutter stage? Put Clutter stage on Overlay window layer that is between Normal window and Screen Saver window(the most top layer) MetacitySrc/src/compositor/mutter/compositor- mutter.c TheXwinOfStage = clutter_x11_get_stage_window(CLUTTER_STAGE (ClutterStage)); OverlayWin = XCompositeGetOverlayWindow (XDisplay, XRootWindow); XreparentWindow (XDisplay, TheXwinOfStage, OverlayWin, 0, 0);
  • 10.
    10 Where to addcustomized Clutter contents? In customized plugin class's constructed() function
  • 11.
    11 How to chooseplugins? One more plugins but only one could be used in Gconf key - “apps/metacity/general/clutter_plugins“
  • 12.
    Where is X-windowclient init script? /etc/X11/moblin/xinitrc
  • 13.
    How to adddebug messages in codes? Using code: g_debug("n [%]... n", G_STRLOC, ...);