← Back to team overview

compiz team mailing list archive

[Merge] lp:~smspillaz/compiz/compiz-xterm-fix into lp:~unity-team/compiz/trunk

 

Sam "SmSpillaz" Spilsbury has proposed merging lp:~smspillaz/compiz/compiz-xterm-fix into lp:~unity-team/compiz/trunk.

Requested reviews:
  compiz packagers (compiz)

For more details, see:
https://code.launchpad.net/~smspillaz/compiz/compiz-xterm-fix/+merge/56141

Fixes broken xterms
-- 
https://code.launchpad.net/~smspillaz/compiz/compiz-xterm-fix/+merge/56141
Your team compiz packagers is requested to review the proposed merge of lp:~smspillaz/compiz/compiz-xterm-fix into lp:~unity-team/compiz/trunk.
=== added directory '.bzr-builddeb'
=== added file '.bzr-builddeb/default.conf'
--- .bzr-builddeb/default.conf	1970-01-01 00:00:00 +0000
+++ .bzr-builddeb/default.conf	2011-04-04 12:01:15 +0000
@@ -0,0 +1,3 @@
+[BUILDDEB]
+merge = True
+ignore-unknowns = true

=== added directory 'debian'
=== added file 'debian/65compiz_profile-on-session'
--- debian/65compiz_profile-on-session	1970-01-01 00:00:00 +0000
+++ debian/65compiz_profile-on-session	2011-04-04 12:01:15 +0000
@@ -0,0 +1,9 @@
+# This file is sourced by Xsession(5), not executed.
+# Select unity profile if we are in the default session.
+# The default profile is used otherwise.
+
+if [ "x$GDMSESSION" = "xgnome" ]; then
+    COMPIZ_CONFIG_PROFILE="ubuntu"
+    export COMPIZ_CONFIG_PROFILE
+fi
+

=== added file 'debian/changelog'
--- debian/changelog	1970-01-01 00:00:00 +0000
+++ debian/changelog	2011-04-04 12:01:15 +0000
@@ -0,0 +1,1347 @@
+compiz (1:0.9.4git20110322-0ubuntu5) natty; urgency=low
+
+  * debian/patches/080_fix_session_handling.patch:
+    reverted, seems to break more people that it fixes it. Not commited to
+    compiz trunk as well
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 24 Mar 2011 12:03:47 +0100
+
+compiz (1:0.9.4git20110322-0ubuntu4) natty; urgency=low
+
+  * 080_fix_session_handling.patch:
+    - fix respawn on crash (LP: #716462)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Wed, 23 Mar 2011 23:38:35 +0100
+
+compiz (1:0.9.4git20110322-0ubuntu3) natty; urgency=low
+
+  * 90_git_fix_new_invisible_windows.patch:
+    from git, fix a case with new invisible windows (LP: #741072)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Wed, 23 Mar 2011 17:36:06 +0100
+
+compiz (1:0.9.4git20110322-0ubuntu2) natty; urgency=low
+
+  * debian/patches/01_unity_window_decorator.patch:
+    - fix frequent crash (LP: #740480)
+  * debian/compiz-decorator:
+    - reset the unity window decorator by default 
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Wed, 23 Mar 2011 08:55:46 +0100
+
+compiz (1:0.9.4git20110322-0ubuntu1) natty; urgency=low
+
+  * New upstream bug fix snapshot:
+    - Application windows can sometimes fail to display and will
+      mask regions of the screen (LP: #709461)
+    - Compiz switcher Alt-Tab order is not predictable - should
+      maintain LIFO ordering in application switcher (LP: #175874)
+    - after compiz crashed, gnome-panel isn't mapped again (LP: #711378)
+    - invisible windows border problem (LP: #710271)
+    - Compiz thinks you are clicking in an edge window when you
+      are not (LP: #734250)
+    - Add test case for invisible window regressions (LP: #736876)
+    - often can't alt-click-dnd to move the focussed dialog (LP: #711911)
+    - When windows open for the first time they should not hide (LP: #723878)
+    - Unity Grid is broken for multi-monitor setups (LP: #709221)
+    - Pixmaps trashed during animations when window is unmapped (LP: #733331)
+    - Windows have blank decorations when rapidly closing and
+      reopening (LP: #733328)
+    - Unity is not restored on unity/compiz crash: compiz doesn't register
+      properly with gnome-session (LP: #716462)
+  * remove the patch taken from upstream
+  * refresh u-w-d patch with latest upstream work
+  * debian/compiz-core.install:
+    - image move to the final destination
+  * debian/patches/100_bump_core.h.patch:
+    - bump for ABI breakage
+  * debian/compiz-decorator:
+    - use gtk-window-decorator and not unity-window-decorator as it's really
+      crashy for now (will probably redo an upload tomorrow with a fixed
+      decorator)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Tue, 22 Mar 2011 21:45:34 +0100
+
+compiz (1:0.9.4-0ubuntu7) natty; urgency=low
+
+  * debian/control:
+    - breaks on old simple-ccsm until a new one for 0.9 is available
+  * debian/patches/029_default_options.patch: 
+    - don't enable showing desktop while scale is triggered (LP: #736947)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 17 Mar 2011 17:13:32 +0100
+
+compiz (1:0.9.4-0ubuntu5) natty; urgency=low
+
+  * debian/patches/029_default_options.patch: (LP: #723273)
+    - remove Super W change for the "Initiate Window Picker for current
+       workspace". The default is now compiz default: Shift + Alt + Up
+    - transforming the Super A change to Super W for "Initiate Window Picker
+      For All Windows"
+  * debian/compiz-gnome.gconf-defaults:
+    - disable Alt + F1/F2 in the gnome-compat plugin for the unity profile only
+      (those keys are handled by unity itself now)
+  * debian/source_compiz.py:
+    - add xorg info in case of crash
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Wed, 16 Mar 2011 19:28:01 +0100
+
+compiz (1:0.9.4-0ubuntu4) natty; urgency=low
+
+  * Fix crashes in unity-window-decorator
+    (LP: #724874, #728563, #728383)
+  * Fix grid plugin not working with snap (LP: #716313)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Mon, 07 Mar 2011 16:31:04 +0100
+
+compiz (1:0.9.4-0ubuntu3) natty; urgency=low
+
+  * debian/rules:
+    - don't run unitymtgrabhandles and unityshell by default
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Tue, 01 Mar 2011 13:31:32 +0100
+
+compiz (1:0.9.4-0ubuntu2) natty; urgency=low
+
+  * Force libdecoration0 to have the same version than compiz-plugins
+  * debian/patches/01_unity_window_decorator.patch
+    - fix a crash in unity-window-decorator (LP: #726063, #725284, #726101)
+  * Backport some patches from upstream to fix other crashes and bring
+    support to the unity plugin (LP: #726702)
+  * debian/compiz-core.install:
+    png are now installed in /usr/share/compiz
+  * add the future unity mt plugin by default
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Mon, 28 Feb 2011 20:51:00 +0100
+
+compiz (1:0.9.4-0ubuntu1) natty; urgency=low
+
+  * New upstream release:
+    - Fix no windows receiving the focus if someone got the focus then was
+      destroyed
+    - Fix crash when resizing using keybindings
+    - Fix unresponsive inactive decorations (LP: #703755) 
+    - Fix the long awaited gconf crash (LP: #691561)
+    - gtk-window-decorator doesn't respect special decoration styles
+      (LP: #290835)
+  * debian/compiz-core.links,
+    debian/source_compiz.py,
+    debian/compiz-core.install:
+    - install again a richer apport hook to redirect nux/libunity/unityshell
+      crash. It also asks the user to redirect unity issues against unity (still
+      incuding xorg info when needed)
+  * Removed a bunch of patches either cherry-picked or pushed upstream. With the
+    other fixes, the gconf workaround is hopefully not needed anymore.
+  * refresh existing patches to still apply
+  * debian/control:
+    - rename dep on compiz-fusion* to compiz*
+  * debian/patches/085_add_grid_plugin.patch:
+    - refresh the grid plugin from new release
+  * debian/patches/086_new_grid_defaults.patch
+    - separate tweaking the default settings to only have the effect that were
+      specified:
+      top -> maximize, left (top or bottom left) -> window half left of the
+      screen, right (top or bottom right) -> window half right of the screen,
+      bottom -> do nothing
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 24 Feb 2011 17:31:29 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu11) natty; urgency=low
+
+  * debian/patches/18_really_fix_stacking_issues.patch:
+    - hopefully, this time, the invisible window is dead (LP: #709461)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Fri, 11 Feb 2011 13:00:01 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu10) natty; urgency=low
+
+  * debian/patches/080_migrate_gconf_from_alpha1.patch
+    debian/reset-compiz-gconf, debian/compiz-gnome.install:
+    - remove the additional python wrapper now that people who installed
+      alpha1 are considerated to be transitionned to the new schema.
+  * debian/patches/17_fix_stacking_issue.patch:
+    - backport from upstream. This seems to fix the random invisible window
+      (LP: #709461)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Tue, 08 Feb 2011 10:31:06 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu9) natty; urgency=low
+
+  * debian/patches/086_fix_unreachable_options_crash.patch:
+    getOptions is broken at start as some initialized options aren't map when
+    calling from the core. Use direct call instead (LP: #708812).
+    Fixes crashes at start.
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Wed, 02 Feb 2011 15:17:02 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu8) natty; urgency=low
+
+  * debian/patches/14_fix_empathy_list_vanish.patch:
+    - fix the buddy list disappearing (LP: #682781)
+  * debian/patchs/15_hidden_maximized_decoration.patch:
+    - fix sometimes invisible decoration on maximized window still decorated
+  * 16_display_unfocused_state.patch:
+    - fix unfocused state not being displayed properly in the decoration
+      (LP: #704413)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Mon, 31 Jan 2011 15:50:17 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu7) natty; urgency=low
+
+  * debian/patches/000_workaround_gconfbackend_init_hang.patch:
+    - readd the workaround. Seems that slow machines really have a problem with
+      the new init order
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Fri, 28 Jan 2011 19:07:35 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu6) natty; urgency=low
+
+  * debian/control:
+    - compiz-gnome replaces compiz-fusion-plugins-extra (grid gconf schema file
+      is hosted there) (LP: #708835)
+  * debian/patches/029_default_options.patch:
+    - set the spacing to 68 temporary as a workaround to avoid the spread mode
+      to overlap the launcher (LP: #702822)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Fri, 28 Jan 2011 15:46:20 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu5) natty; urgency=low
+
+  * debian/patches/000_workaround_gconfbackend_init_hang.patch:
+    - remove the workaround (commented in debian/patches/series). It seems to
+      work for others without it, I still have it hanging there, but maybe
+      that's a system issue, let's see if people reports hangs at start.
+  * debian/patches/060_move_checks_to_compiz.patch:
+    - adapt to new version
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 27 Jan 2011 17:42:04 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu4) natty; urgency=low
+
+  * debian/patches/000_fix_stacking.patch:
+    - so awaited patch to fix menu stacking issue
+      (LP: #693073, #695638, #690461) (congrats smspillaz)
+  * debian/patches/065_add_bailer_and_detection_plugins.patch:
+    - remove zenity message, now handled in the session level
+  * debian/patches/029_default_options.patch:
+    - set back to opacity to 100 when dragging windows, seems to have a lot of
+      perf issues on some graphic card. (LP: #703458)
+  * debian/patches/03_git_fix_maprequest.patch
+    debian/patches/04_git_fix_override_redirect_window.patch
+    debian/patches/06_git_fix_unmapped_then_remapped_window.patch
+    debian/patches/07_git_fix_click_to_focus_issue.patch
+    debian/patches/08_make_qt_wine_appearing.patch
+    debian/patches/09_git_valgrind_cleanage.patch
+    debian/patches/10_git_set_vp_before_window_initialization.patch:
+    - misc fixes backported from upstream git head. Fixing flash and gnome-panel
+      crash (LP: #683100, #690461)
+  * debian/patches/000_workaround_gconfbackend_init_hang.patch:
+    - adapt to new version
+  * debian/patches/029_default_options.patch:
+    - disable ligthning by default on the opengl plugin as it's not really used
+      and conflict with unity (LP: #703140)
+  * debian/patches/11_git_fix_windows_jumping.patch
+    debian/patches/12_fix_warning.patch
+    debian/patches/13_fix_window_geometries_and_properties.patch:
+    - last minute fix due to regression introduced by the patch above, fix wrong
+      geometry and wrong startup position (LP: #707853, #707852)
+  * debian/patches/085_add_grid_plugin.patch,
+    debian/rules, debian/control, debian/unity.ini,
+    debian/compiz-gnome.gconf-defaults
+    - add to main (as upstream is doing in the git repository) the grid plugin
+      and activate it by default. Replaces the -extra package with a previous
+      version
+    - tweak the default settings to only have the effect that were specified:
+      top -> maximize, left (top or bottom left) -> window half left of the
+      screen, right (top or bottom right) -> window half right of the screen
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 27 Jan 2011 13:05:18 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu3) natty; urgency=low
+
+  * debian/patches/01_unity_window_decorator.patch:
+    - dont dep on system libdecoration but on built one
+  * debian/control:
+    - remove circular build-dep on libdecoration0-dev
+    - build against new libmetacity ABI
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Wed, 19 Jan 2011 17:52:09 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu2) natty; urgency=low
+
+  * debian/control:
+    - temporary depends on libdecoration0-dev as the unity-window-decorator
+      needs it. The correct fix will need to shuffle the order of build around
+      and take the current library.
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Fri, 14 Jan 2011 03:17:38 +0100
+
+compiz (1:0.9.2.1+glibmainloop4-0ubuntu1) natty; urgency=low
+
+  [ Didier Roche ]
+  * New upstream release:
+    - Fixed a high number of wakeups (LP: #681696)
+    - Fixed links not working in some gtk windows
+    - Raise the window when it is moved if raise on click is enabled
+    - Fix crash when loading plugins on the command line
+    - Fix focus issues on window close and reopen rapidly
+    - Fix focus issues with multiple X screens
+    - Glib plugin removed
+    - Fix bug where not moving the mouse and clicking button 2 or 3 in
+      scale addon would close the current active window, not the window the
+      mouse hovers over
+    - Add unity-window-decorator
+    - Move window doesn't raise window (LP: #695570)
+    - gtk.Label <a href> link-activate signal broken with compiz in natty
+      (LP: #687732)
+  * debian/patches/060_move_checks_to_compiz.patch:
+    - remove GNOME failsafe detection as now handled as a session type in
+      gnome-session
+  * Remove deprecated or now merge upstream patches:
+    - 01_backport_trunk_fix.patch
+    - 002_ship_splited_gconf_cmakeext_files.patch
+    - 004_packagemode_is_release_debug_for_plugins.patch
+    - 005_no_glib_plugin.patch
+    - 017_always_unredirect_screensaver_on_nvidia.patch
+    - 080_migrate_gconf_from_alpha1.patch
+  * debian/compiz-gnome.gconf-defaults,
+    debian/patches/029_default_options.patch:
+    - new settings for natty. Also set the 2x2 layout by default
+  * unity-decorator:
+    - debian/compiz-decorator:
+      launch unity-compiz-decorator in gnome sessions
+    - debian/compiz-gnome.install:
+      install it
+    - debian/control:
+      depends on latest metacity having the right extension
+    - debian/patches/01_unity_window_decorator.patch:
+      add unity-window-decorator
+  * debian/patches/02_add_debug_spewer_for_apport.patch:
+    - new plugin (not activated for now) to get additional info for apport
+
+  [ Bryce Harrington ]
+  * compiz-core.install, compiz-core.links, source_compiz.py:
+    Replace the compiz apport hook with a link to xorg's apport script.
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 13 Jan 2011 21:50:27 +0100
+
+compiz (1:0.9.2.1+glibmainloop3-0ubuntu5) natty; urgency=low
+
+  * Restore the workaround to avoid crashes (lp: #691561)
+
+ -- Sebastien Bacher <seb128@xxxxxxxxxx>  Fri, 17 Dec 2010 21:08:43 +0100
+
+compiz (1:0.9.2.1+glibmainloop3-0ubuntu4) natty; urgency=low
+
+  * debian/patches/000_workaround_gconfbackend_init_hang.patch:
+    - drop the workaround, the issue has not been confirmed but the update
+      broke the menus in unity (lp: #690461)
+  * debian/patches/060_move_checks_to_compiz.patch:
+    - adapted regarding previous patch
+
+ -- Sebastien Bacher <seb128@xxxxxxxxxx>  Thu, 16 Dec 2010 22:19:50 +0100
+
+compiz (1:0.9.2.1+glibmainloop3-0ubuntu3) natty; urgency=low
+
+  * debian/patches/080_migrate_gconf_from_alpha1.patch,
+  debian/reset-compiz-gconf,
+  debian/compiz-gnome.install:
+  - temporary wrapper from new gconf path not transitionned from alpha1
+    (allscreens became screen0). This will reset the current compiz profiles
+    (LP: #690011)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Tue, 14 Dec 2010 19:25:03 +0100
+
+compiz (1:0.9.2.1+glibmainloop3-0ubuntu2) natty; urgency=low
+
+  * debian/patches/000_workaround_gconfbackend_init_hang.patch:
+    - workaround in delaying the plugin init as the gconf backend hangs when
+      trying to contact/launch the gconf daemon. This only happens when you
+      don't change your current profile, at session start.
+  * debian/patches/060_move_checks_to_compiz.patch:
+    - adapted regarding previous patch
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Tue, 14 Dec 2010 02:57:50 +0100
+
+compiz (1:0.9.2.1+glibmainloop3-0ubuntu1) natty; urgency=low
+
+  * new glibmainloop branch snapshot:
+    - fix launching an application set it to the wrong place (LP: #683273)
+    - Can't resize windows to be displayed on several monitors (LP: #455378)
+    - Scale All Windows gets its suffixes wrong for a 3x3 layout (LP: #683063)
+    - Compiz sometimes loses focus when closing some windows (LP: #671459)
+    - Fix hanging when session exit (LP: #683121)
+  * debian/patches/000_fix_OOo_crash1.patch
+    debian/patches/000_fix_OOo_crash2.patch
+    debian/patches/001_fix_gconf_path.patch
+    debian/patches/003_more_gconf_parser_fix.patch:
+   - remove, upstreamed.
+  * debian/patches/060_move_checks_to_compiz.patch:
+    - adapt to new version
+  * debian/patches/01_backport_trunk_fix.patch:
+    - backport some additional fixes from trunk, otherwise compiz crash at start
+  * debian/source_compiz.py:
+    - fix gconf path
+  * debian/compiz-gnome.gconf-defaults, debian/rules, debian/unity.ini,
+    debian/patches/030_no_fade_in_staticswicher.patch:
+    - change order to load fade before staticswichter to avoid the fade effect
+      when alt + tabbing (LP: #683635)
+    - add snap and workarounds by default as well
+  * debian/compiz-gnome.gconf-defaults,
+    debian/compiz-keybindings.sed,
+    debian/patches/021_hide_tooltip_on_decorator.patch,
+    debian/patches/057_update_gnome_bindings.patch:
+    - update the gconf path from allscreens to screen0 as new gconf path in the
+      gconf backend
+  * debian/control:
+    - handle the ABI breakage with other compiz components
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Mon, 13 Dec 2010 16:38:10 +0100
+
+compiz (1:0.9.2.1+glibmainloop2-0ubuntu4) natty; urgency=low
+
+  * debian/patches/065_add_bailer_and_detection_plugins.patch:
+    - fix the fallback not launching gnome-panel when no 3D support
+      (LP: #683356, #683531)
+  * debian/patches/000_fix_OOo_crash{1,2].patch:
+    - cherry-pick fix crashes with random applications (LP: #675506)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Wed, 01 Dec 2010 13:10:41 +0100
+
+compiz (1:0.9.2.1+glibmainloop2-0ubuntu3) natty; urgency=low
+
+  * debian/rules:
+    - use our own keybindings with new Compiz wm_name
+      (note, upstream one faily try to install them ignoring DESTDIR, keep in
+       mind when fixed to keep ours)
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Mon, 29 Nov 2010 19:37:41 +0100
+
+compiz (1:0.9.2.1+glibmainloop2-0ubuntu2) natty; urgency=low
+
+  * debian/rules:
+    - build with RelWithDebInfo cmake flag to get debug info and release
+      optimisation
+  * debian/patches/004_packagemode_is_release_debug_for_plugins.patch:
+    - when compiz plugin built in "Package" mode, add optimization + debug
+      symbols for stripping in dbgsym. Thanks RAOF for pointing at it
+      (LP: #682574)
+  * debian/patches/005_no_glib_plugin.patch:
+    - remove glib plugin as conflicting with the glibmainloop branch
+  * debian/source_compiz.py:
+    - grab new gconf path in apport bug report
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Mon, 29 Nov 2010 12:23:15 +0100
+
+compiz (1:0.9.2.1+glibmainloop2-0ubuntu1) natty; urgency=low
+
+  * new upstream snapshot with glibmm experimental branch:
+    - Compiz crashes when scrolling in Openoffice (LP: #675506)
+    - Compiz sometimes loses focus when closing some windows (LP: #671459)
+    - Fix --replace hang (LP: #680165)
+  * debian/65compiz_profile-on-session:
+    - add unity profile to default session
+  * debian/rules:
+    - add bailer, detection, regex and animation and fade plugin to both
+      profiles
+    - get an optimized plugin default order
+  * debian/patches/060_move_checks_to_compiz.patch:
+    - start stripping it down as now we have a detection and bailer plugins
+      for that. The failsafe session should be moved in the detection plugin.
+  * debian/patches/055_fix_COMPIZ_DEFAULT_PLUGINS.patch,
+    debian/patches/056_Preserve-DESTDIR-if-no-override-in-COMPIZ_DESTDIR.patch
+    debian/patches/057_update_gnome_bindings.patch:
+    - removed, upstreamed
+  * debian/patches/065_add_bailer_and_detection_plugins.patch:
+    - add bailer and detection plugins to fallback to 2D session or run in
+      degraded mode.
+  * debian/compiz-gnome.install, debian/unity.ini,
+    debian/compiz-gnome.gconf-defaults:
+    - add the unity profile to ini and gconf backend
+  * debian/patches/001_fix_gconf_path.patch:
+    - fix the path when generating the gconf keys (compiz-1)
+  * debian/patches/002_ship_splited_gconf_cmakeext_files.patch:
+    - ship and link the splited gconf extension schema builder
+  * debian/control:
+    - add libglibmm-2.4-dev build-dep and to -dev dep
+  * debian/patches/003_more_gconf_parser_fix.patch:
+    - fix parser breakage with some plugins
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Fri, 26 Nov 2010 20:30:56 +0100
+
+compiz (1:0.9.2.1+glibmainloop-0ubuntu3) natty; urgency=low
+
+  * debian/rules:
+    - add gnomecompat as a default plugin (LP: #675774)
+    - add vpswitch too
+  * debian/libdecoration0.symbols:
+    - add a symbol file
+  * debian/patches/057_update_gnome_bindings.patch:
+    - update wmname to get the keybindings shown in GNOME capplet
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 18 Nov 2010 14:35:04 +0100
+
+compiz (1:0.9.2.1+glibmainloop-0ubuntu2) natty; urgency=low
+
+  * debian/patches/065_glib_mainloop.patch:
+    - removed as part of make dist
+  * debian/control:
+    - make compiz-dev dep on libglib2.0-dev
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 11 Nov 2010 21:52:26 +0100
+
+compiz (1:0.9.2.1+glibmainloop-0ubuntu1) natty; urgency=low
+
+  * New upstream snapshot with glib mainloop support needed for unity compiz
+  * debian/rules:
+    - use the ezoom plugin rather than the zoom one
+  * debian/patches/055_fix_COMPIZ_DEFAULT_PLUGINS.patch,
+    debian/patches/056_Preserve-DESTDIR-if-no-override-in-COMPIZ_DESTDIR.patch:
+    - refresh to new upstream snapshot
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Thu, 11 Nov 2010 18:20:59 +0100
+
+compiz (1:0.9.2.1-0ubuntu2) natty; urgency=low
+
+  * debian/control:
+    - add missing replaces with latest natty version
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Wed, 10 Nov 2010 10:40:29 +0100
+
+compiz (1:0.9.2.1-0ubuntu1) natty; urgency=low
+
+  [ Travis Watkins ]
+  * debian/patches/010-disable-child-window-clipping.patch,
+    debian/patches/013-add-cursor-theme-support.patch,
+    debian/patches/016_call_glxwaitx_before_drawing.patch,
+    debian/patches/035_ignore_workspaces,
+    debian/patches/037_fullscreen_stacking_fixes.patch,
+    debian/patches/061_KWD_stubs.patch,
+    debian/patches/090_profiling,
+    - removed as they are applied upstream or obsolete
+  * debian/patches/017_always_unredirect_screensaver_on_nvidia.patch
+    debian/patches/018_use_metacity_settings.patch
+    debian/patches/021_hide_tooltip_on_decorator.patch
+    debian/patches/029_default_options
+    debian/patches/060_move_checks_to_compiz.patch
+    - updated for 0.9 and added DEP-3 comments
+  * comment debian/patches/014_fix-no-border-window-shadow.patch
+  * debian/kde4-window-decorator.1:
+    - renamed kde-window-decorator.1 with name fixups
+  * debian/compiz-decorator.1,
+    debian/compiz-core.manpages:
+    - add compiz-decorator manpage
+  * debian/compiz.1,
+    debian/kde4-window-decorator.1:
+    - refreshed
+  * debian/compiz-decorator:
+    - remove support for kde-window-decorator as it no longer exists
+  * debian/compiz-gnome.gconf-defaults:
+    - strip down to just gtk-window-decorator defaults, we set the rest in
+      other places already
+  * debian/rules:
+    - switch to debhelper 7 style rules, much easier to understand
+  * debian/control:
+    - add cmake and boost build-depends, remove automake
+
+  [ Didier Roche ]
+  * new upstream release
+  * remerge and adapt travis' work to latest release in natty
+  * debian/patches/029_default_options.patch:
+    - retake latest patch and refresh to new version
+  * debian/patches/060_move_checks_to_compiz.patch:
+    - remove all plugins and not use the DEFAULT plugin list (just load cpp)
+  * debian/compiz-gnome.gconf-defaults:
+    - keep some needed value. With gsetting port, we should only push default,
+      don't be evil and avoid patching the schema
+  * debian/control:
+     - bump all dep to 0.9 for compiz components
+     - add libboost-serialization1.42-dev build-dep
+     - add some sanity check as well (lintian warnings)
+     - additional dependency on compiz-plugins from compiz-dev
+  * debian/patches/015_optional-fbo.patch:
+    - removed as the new version doesn't seem to handle that natively
+  * debian/patches/014-fix-gtk-window-decorator-no-argb-crash.patch:
+    - removed as seems to be upstreamed
+  * debian/patches/015_draw_dock_shadows_on_desktop.patch:
+    - removed from now, let's revert to upstream behavior
+  * debian/patches/020_disable_gdk_gtk_disable_deprecated:
+    - removed, upstream
+  * disable debian/patches/021_hide_tooltip_on_decorator.patch for now
+  * debian/compiz-core.install,debian/compiz-dev.install,
+    debian/compiz-gnome.install:
+    - changed the path according to new upstream layout and remove some
+      libraries and re-ad /usr/share/gnome/wm-properties/compiz.desktop to
+      make the gnome-window-properties work again (LP: #269805)
+    - compiz-gnome install gconf schemas, not compiz-plugins
+    - also some cleanage to make things easier to read
+  * debian/compiz-kde.manpages:
+    - adapt to kde4 new manpage
+  * convert to quilt format
+  * remove debian/patches/562027-fix-gconf-ftbfs.patch,
+     debian/patches/635258-fix-pixmap-size-calculations.patch,
+     debian/patches/111_link-kde-window-decorator-with-x11:
+    - not relevant in the context
+  * debian/compiz-kde.install, debian/compiz-plugins.install:
+    - put likde in compiz-kde package
+  * debian/rules:
+    - a lot of cleanage, try to make the rule easy to read
+    - force to build in release mode
+    - compile the default plugins list
+    - force copying to cmake install dir. Don't use findcompiz_install which is
+      broken upstream when using DESTDIR and COMPIZ_DESTDIR
+    - add some switch to ensure we build in package mode not in debug one
+  * add debian/patches/055_fix_COMPIZ_DEFAULT_PLUGINS.patch:
+    - use COMPIZ_DEFAULT_PLUGINS from debian/rules
+  * debian/patches/056_Preserve-DESTDIR-if-no-override-in-COMPIZ_DESTDIR.patch:
+    - make compiz respect env variable
+  * debian/patches/065_glib_mainloop.patch:
+    - added but not activated yet: need some work with tip of compiz 0.9.2.1
+
+ -- Didier Roche <didrocks@xxxxxxxxxx>  Tue, 19 Oct 2010 12:23:51 +0200
+
+compiz (1:0.8.6-0ubuntu12) natty; urgency=low
+
+  * Merge patch 110_link-gtk-windows-decorator-with-xcursor into
+    013-add-cursor-theme-support as that's where the bug was introduced.
+  * Remove bogus dh_install -pcompiz-wrapper call in rules leaving a
+    debhelper.log over; presumably left over from the removal of this package.
+
+ -- Loïc Minier <loic.minier@xxxxxxxxxx>  Mon, 18 Oct 2010 00:13:28 +0200
+
+compiz (1:0.8.6-0ubuntu11) natty; urgency=low
+
+  * New patch, 110_link-gtk-windows-decorator-with-xcursor, fix configure.ac
+    to require the xcursor pkg-config file/libs etc. for gtk/window-decorator
+    which calls XcursorSetTheme(); fixes FTBFS.
+  * New patch, 111_link-kde-window-decorator-with-x11, fix configure.ac to
+    require the x11 pkg-config file/libs etc. for kde/window-decorator which
+    calls XGetWMProtocols(); fixes FTBFS.
+
+ -- Loïc Minier <loic.minier@xxxxxxxxxx>  Sun, 17 Oct 2010 23:19:57 +0200
+
+compiz (1:0.8.6-0ubuntu10) natty; urgency=low
+
+  * New patch, 635258-fix-pixmap-size-calculations, from commit
+    0f95c41a0aa175ddf7947ba18b01f746c95594a9 in the 0.8 branch; thanks
+    Paul Donohue; LP: #635258.
+
+ -- Loïc Minier <loic.minier@xxxxxxxxxx>  Sun, 17 Oct 2010 22:02:58 +0200
+
+compiz (1:0.8.6-0ubuntu9) maverick; urgency=low
+
+  * debian/compiz-gnome.gconf-defaults: /apps/gwd/metacity_theme_opacity
+    is a float (1.0), not int (1).
+
+ -- Anders Kaseorg <andersk@xxxxxxx>  Fri, 24 Sep 2010 21:09:32 -0400
+
+compiz (1:0.8.6-0ubuntu8) maverick; urgency=low
+
+  * debian/compiz-gnome.gconf-defaults
+    - move the shadow 4 pixels down, in order to reduce the shadow between 
+      menubaritems and the menu frame (LP: #634417)
+
+  * debian/patches/029_default_options.patch
+    - get rid of the transparency on the unfocused window frame. (LP: #634417)
+
+ -- Ken VanDine <ken.vandine@xxxxxxxxxxxxx>  Tue, 21 Sep 2010 16:59:27 -0400
+
+compiz (1:0.8.6-0ubuntu7) maverick; urgency=low
+
+  * 060_move_checks_to_compiz.patch: Remove Sandybridge bridge devices from
+    the blacklist, they were preventing compiz from loading on machines
+    with discreet GPU's as well. (LP: #644372)
+
+ -- Robert Hooker <robert.hooker@xxxxxxxxxxxxx>  Tue, 21 Sep 2010 09:46:36 -0400
+
+compiz (1:0.8.6-0ubuntu6) maverick; urgency=low
+
+  * Update 060_move_checks_to_compiz.patch to add Intel Sandybridge pci id's
+    to the blacklist, the mesa dri driver claims it instead of swrast so 
+    compiz tries to use it but does not work currently. (LP: #633376)
+
+ -- Robert Hooker <robert.hooker@xxxxxxxxxxxxx>  Wed, 08 Sep 2010 13:10:11 -0400
+
+compiz (1:0.8.6-0ubuntu5) maverick; urgency=low
+
+  * Fix LP: #622195 - dh_install can't rename files. In trying to do so,
+    compiz-wm.desktop is installed one folder too deep, breaking
+    gnome-{appearance,window}-properties
+    - update debian/compiz-gnome.install
+
+ -- Chris Coulson <chris.coulson@xxxxxxxxxxxxx>  Thu, 26 Aug 2010 21:33:53 +0100
+
+compiz (1:0.8.6-0ubuntu4) maverick; urgency=low
+
+  * debian/control: Argh, also reduce the libcompizconfig0 dependency to the
+    version that actually rebuilt against 0.8.6.
+
+ -- Martin Pitt <martin.pitt@xxxxxxxxxx>  Tue, 03 Aug 2010 10:40:30 +0200
+
+compiz (1:0.8.6-0ubuntu3) maverick; urgency=low
+
+  * debian/control: Reduce libcompizconfig0 breaks to << the version that
+    actually rebuilt against 0.8.6.
+
+ -- Martin Pitt <martin.pitt@xxxxxxxxxx>  Tue, 03 Aug 2010 00:13:46 +0200
+
+compiz (1:0.8.6-0ubuntu2) maverick; urgency=low
+
+  * control: Don't build-depends on libdbus-qt-1-dev, it's deprecated
+
+ -- Sebastien Bacher <seb128@xxxxxxxxxx>  Mon, 02 Aug 2010 17:49:08 +0200
+
+compiz (1:0.8.6-0ubuntu1) maverick; urgency=low
+
+  * New upstream release:
+    - Maintenance release.
+    - Various focus and window placement fixes.
+    - Fixed handling of windows that have a (server-drawn) border.
+    - Fixed handling of window icons that have a colour depth of 1 bit.
+    - Added KDE 4.4 support to KDE4 window decorator.
+  * debian/control:
+    - Build-depend on libx11-dev, libxext-dev
+  * debian/patches/020_fix_focus.patch:
+  * debian/patches/030_from_git_crash_fix_multiscreen.patch:
+  * debian/patches/031_from_git_fix_gnome_keybindings.patch:
+  * debian/patches/070_remove_deprecated_gtk_symbol.patch:
+    - Applied upstream
+
+ -- Robert Ancell <robert.ancell@xxxxxxxxxxxxx>  Tue, 27 Jul 2010 17:23:05 +0200
+
+compiz (1:0.8.4-4ubuntu1) maverick; urgency=low
+
+  * Merge with Debian unstable, remaining Ubuntu changes:
+  * debian/control:
+    - Build-depend on cdbs for strip-schemas
+    - Add version on libmetacity-dev build-depend
+    - Add KDE build-depends
+    - Add metacity-common build-depends (for getting keybindings)
+    - Add gnome-control-center-dev build-depends (may not be required)
+    - Add libx11-xcb-dev build-depend
+    - Add Vcs-Bzr link
+    - compiz provides x-window-manager
+    - compiz-core does not provide mesa-utils
+    - compiz-core breaks old version of compiz-fusion-plugins-main and
+      compiz-fusion-plugins-extra
+    - compiz-core replaces old compiz-wrapper
+    - compiz-dev depends on libx11-xcb-dev
+    - compiz-gnome and compiz-kde depend on compiz-plugins and their backends
+  * debian/rules:
+    - Compile a subset of the plugins
+    - Do not build the kconfig plugin (in favior of libcompizconfig)
+    - Build with --enable-gconf
+    - Build translations/language packs
+    - Install compiz-decorator wrapper
+    - Install apport hook
+    - Copy keybindings from metacity
+    - Exclude some files from compiz-plugins
+  * debian/compiz-core.install:
+    - Don't install plugin files
+    - Install apport hooks
+  * debian/compiz-decorator:
+    - Script to run the appropriate decorator for the current session
+  * debian/compiz-dev.install:
+    - Install XSLT file
+  * debian/compiz-gtk.*:
+    - Not required, merged into compiz-gnome
+  * debian/compiz-gnome.gconf-defaults:
+    - Set Ubuntu defaults
+  * debian/compiz-gnome.install:
+    - Rename wm-properties desktop file, don't know why
+    - Install gnome-control-center keybindings files
+    - Add files from compiz-gtk
+  * debian/compiz-gnome.manpages:
+    - Add files from compiz-gtk
+  * debian/compiz-keybindings.sed:
+    - Script to add keybindings
+  * debian/compiz-plugins.install:
+    - Install XML files for the plugins
+  * debian/source_compiz.py:
+    - Apport hook
+  * debian/patches/012_snap-by-default.patch:
+    - Not enabled, not sure if we want this in Ubuntu
+  * debian/patches/021_hide_tooltip_on_decorator.patch:
+    - Make decorator tooltips optional
+  * debian/patches/029_default_options.patch:
+    - Updated with additional changes over Debian
+  * debian/patches/090_profiling.patch:
+    - Timing profiling patch (disabled)
+  * debian/watch:
+    - Update download location
+
+ -- Robert Ancell <robert.ancell@xxxxxxxxxxxxx>  Thu, 17 Jun 2010 10:12:18 +1000
+
+compiz (0.8.4-4) unstable; urgency=low
+
+  * Drop libdbus-qt-1-dev from Build-Depends, as kindly requested by
+    Michael Biebl (Closes: #581788). Qt3 is going away, we already use
+    --disable-kde and --enable-kde4 to that effect, so libdbus-qt-1-dev
+    can be kicked away.
+  * Add libglu1-mesa-dev, needed for <GL/glu.h>.
+
+ -- Cyril Brulebois <kibi@xxxxxxxxxx>  Sun, 16 May 2010 20:44:51 +0200
+
+compiz (0.8.4-3) unstable; urgency=high
+
+  [ Brice Goglin ]
+  * Remove Thierry Reding from Uploaders, closes: #572540.
+
+  [ Cyril Brulebois ]
+  * Add patch to prevent FTBFS due to deprecated GDK/GTK stuff:
+    * 020_disable_gdk_gtk_disable_deprecated (Closes: #577352).
+  * Add myself to Uploaders.
+  * Set urgency to high due to RC bugfix.
+
+ -- Cyril Brulebois <kibi@xxxxxxxxxx>  Thu, 15 Apr 2010 03:29:29 +0200
+
+compiz (0.8.4-2) unstable; urgency=low
+
+  * Bump the dh_makeshlibs call to (>= 0.8.4)
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Thu, 11 Feb 2010 23:08:16 +0100
+
+compiz (0.8.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+  [ Sean Finney ]
+  * Fix FTBFS: "gconf/gconf-client.h: No such file or directory"
+    - thanks to Sebastian Harl <tokkee@xxxxxxxxxx> (Closes: #562027, #562438) 
+  * Add compiz-decorator symlink for compatibility with ubuntu systems.
+  * Make all patches DEP-3 formatted.
+  * No longer keep the ubuntu patches logically separated from ours
+  * Enable 010-disable-child-window-clipping.patch, as there's an ABI bump.
+    Also, massage the patch a little so that it applies cleanly.
+  * Synchronize ubuntu patches from 0.8.4-0ubuntu10
+    * 015_draw_dock_shadows_on_desktop.patch:
+      - change decoration plugin to draw dock shadows only on the
+        desktop window instead of on top of all other windows
+    * 016_call_glxwaitx_before_drawing.patch:
+      - Call glXWaitX before we start drawing to make sure X is done
+        handling rendering calls. Suggested by Michel Dänzer to ensure
+        we don't have any rendering glitches.
+    * 017_always_unredirect_screensaver_on_nvidia.patch:
+      - always unredirect gnome-screensaver when using nvidia, workaround
+        for LP #160264 while still disabling unredirect fullscreen
+        windows for nvidia users
+    * 020_fix_focus.patch:
+      - give back the focus to the previous focused window (LP: #455900)
+    * 030_from_git_crash_fix_multiscreen.patch:
+      - merge commit 24dea72a395071b533dcf66b2eef37b20522cbba to fix
+        crash with wobbly windows in a multi screen setup
+    * 031_from_git_fix_gnome_keybindings.patch:
+      - fix gnome keybindings (terminal key)
+    * 060_move_checks_to_compiz.patch:
+      - add all relevant checks from compiz-manager to compiz itself
+        Compiz already checks for almost everything it needs so there is no
+        need to check twice.
+    * 061_KWD_stubs.patch (updated locally to remove fuzz):
+      - Horrible hack to define empty stubs for some new pure virtual
+        functions in KWD::Window, to fix FTBFS.
+  * The following patches have been updated to cleanly apply:
+    * 014-fix-gtk-window-decorator-no-argb-crash.patch
+    * 015_optional-fbo.patch
+    * ubuntu/010-disable-child-window-clipping.patch
+    * ubuntu/013-add-cursor-theme-support.patch
+    * ubuntu/018_use_metacity_settings.patch
+    * ubuntu/029_default_options
+    * ubuntu/035_ignore_workspaces
+    * ubuntu/037_fullscreen_stacking_fixes.patch
+    * ubuntu/049-damage-report-non-empty.patch
+    * ubuntu/050_stacking.patch
+  * Transition from compiz-manager to compiz binary for /usr/bin/compiz
+  * Remove all patches to the embedded compiz-manager script
+    * 028_compiz_manager_blacklist
+    * 029_compiz_manager_decoration.patch
+    * 029_compiz_manager_nvidia_settings.patch
+    * 030_compiz_manager_multi_display
+    * 031_compiz_manager_extra_blacklist_support
+    * 032_compiz_manager_add_gnomecompat
+    * 033_compiz_manager_xdg_dirs
+    * 042-compiz-manager-default-plugin
+    * 046_compiz_manager_second_screen.patch
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Thu, 11 Feb 2010 20:17:39 +0100
+
+compiz (0.8.2-6) unstable; urgency=low
+
+  * Add libxcursor-dev build-dep as required by patch
+    ubuntu/013-add-cursor-theme-support; also let compiz-dev pull it as it's
+    referenced in the .pc file; closes: #525240, #524943.
+  * Add a virtual compiz-core-abiversion-2009xxyy provides to compiz-core to
+    allow for strict dependencies of plugins on the compiz-core
+    CORE_ABIVERSION they were built with, as read from include/compiz-core.h.
+  * Use the new Breaks feature for the compiz-core -> libcompizconfig0 dep.
+    This makes upgrades smoother than Conflicts.
+  * Bump the compiz-core Breaks on libcompizconfig0 to 0.8.0 as the last
+    CORE_ABIVERSION bump happened between 0.7.8 and 0.8.0; closes: #523514.
+  * Add a missing libxml2-dev build-dep and update the compiz-dev deps to
+    match what compiz.pc requires and use the same versions as the build-deps.
+  * Build-dep on libcairo2-dev instead of libcairo-dev.
+  * Add missing libstartup-notification0-dev (>= 0.7) bdep and version the
+    compiz-dev dep to match.
+  * Use the same version in the libdecoration0-dev dep on libxrender-dev as
+    in the libxrender-dev bdep.
+
+ -- Loic Minier <lool@xxxxxxxx>  Fri, 24 Apr 2009 15:15:24 +0200
+
+compiz (0.8.2-5) unstable; urgency=low
+
+  * remove obsolete --enable-gconf-dump configure option
+  * add build-dependency on libgnomeui-dev to fix new FTBFS (Closes: #524446)
+  * add Vcs-Git and Vcs-Browser headers to debian/control
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sun, 19 Apr 2009 18:45:39 +0200
+
+compiz (0.8.2-4) unstable; urgency=low
+
+  * disable child window clipping patch: it breaks the abi
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sat, 11 Apr 2009 18:55:35 +0200
+
+compiz (0.8.2-3) unstable; urgency=low
+
+  * import of some ubuntu patches for 0.8.2 with some modifications
+    - see debian/patches/ubuntu for patches
+    - see debian/patches/series for which patches are used and which
+      are not.
+    - includes patch to copy gnome/metacity keyboard shortcuts
+      (Closes: #503442, #454922).
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sat, 11 Apr 2009 14:26:06 +0200
+
+compiz (0.8.2-2) unstable; urgency=low
+
+  * upgrading compiz-manager backed out some locally modified but not
+    quilt-using changes in paths.  so, new patch compiz-debian-paths.patch
+    should fix this (closes: #522985).
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Wed, 08 Apr 2009 23:13:19 +0200
+
+compiz (0.8.2-1) unstable; urgency=low
+
+  * new upstream release.
+  * update location of compiz-gnome desktop file
+  * add new app desktop file for compiz to compiz-core
+  * update build-deps to use kdebase-workspace-dev
+  * add build-dep on libxslt1-dev
+  * disable kde3 decorator and enable kde4 decorator
+  * include a gbp.conf for use with git-buildpackage
+  * bump the libdecoration0 shlibs version to 0.8.2
+  * update compiz-manager to upstream's 223180bf
+  * Obsolete patches now removed:
+    - disable-libx11-xcb-support.patch
+    - xscreensaver-damage-fix.patch
+    - compiz-manager-posixly-correct.patch
+  * Lintian fixes: 
+    - update Standards-Version to 3.8.1
+    - add misc:Depends to compiz
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Wed, 01 Apr 2009 00:00:10 +0200
+
+compiz (0.7.6-8) unstable; urgency=low
+
+  * Don't run glib-gettextize, to fix FTBFS caused by intltoolize changes
+    (closes: #518909).
+  * Rebuild against new metacity (closes: #518910).
+
+ -- Julien Cristau <jcristau@xxxxxxxxxx>  Mon, 09 Mar 2009 18:44:13 +0100
+
+compiz (0.7.6-7) unstable; urgency=medium
+
+  * refresh quilt patches to apply with no fuzz/offsets. 
+  * add fglrx driver to compiz-manager whitelist (closes: #495539).
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Mon, 01 Sep 2008 08:00:56 +0200
+
+compiz (0.7.6-6) unstable; urgency=high
+
+  * backport commit aed97c441881d9c382c7865d0305fc8f884c10ac to fix the 
+    problems that seem to come up with certain xscreensavers the Right Way.
+    (closes: #483170).
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sat, 30 Aug 2008 11:39:17 +0200
+
+compiz (0.7.6-5) unstable; urgency=high
+
+  * Brown paper bag: remove shlibs.local and libdecoration0.shlibs, call
+    dh_makeshlibs with the proper flags to actually fix dependencies on
+    libdecoration0.
+
+ -- Julien Cristau <jcristau@xxxxxxxxxx>  Fri, 01 Aug 2008 18:57:30 +0200
+
+compiz (0.7.6-4) unstable; urgency=low
+
+  [ Julien Cristau ]
+  * Bump libdecoration0 shlibs to >= 0.7.6 (closes: #485775).
+
+  [ Sean Finney ]
+  * Include fix for posixly-incorrect usage of ENV (closes: #484225).
+
+ -- Julien Cristau <jcristau@xxxxxxxxxx>  Sat, 26 Jul 2008 21:44:51 +0200
+
+compiz (0.7.6-3) unstable; urgency=high
+
+  * Add a versioned Replaces on older compiz-plugins to compiz-gtk, to prevent
+    file conflicts.  Thanks to Daniel Burrows for the report (closes: #485436).
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Mon, 09 Jun 2008 18:39:57 +0200
+
+compiz (0.7.6-2) unstable; urgency=low
+
+  * Add Conflicts against xscreensaver-data-extra as an unfortunately
+    heavy handed workaround to prevent graphical lockups with an as-of-yet
+    unknown bug somewhere in the screensaver-compiz-driver-xserver chain.
+    (See: #483170, and other bugs/urls referenced in that report)
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sat, 07 Jun 2008 14:22:15 +0200
+
+compiz (0.7.6-1) unstable; urgency=low
+
+  * New upstream release
+
+  [ Sean Finney ]
+  * Special-case the gconf and kconfig plugins to go into the -gtk and -kde
+    packages respectively, as they are semi-obsoleted by the ccp plugin anyway
+    and cause potentially problematic dependencies.  Thanks to Fabiano 
+    Manoel de Andrade for the report (closes: #482150).
+  * Add versioned Conflicts on libcompizconfig0 to compiz-core, to reflect
+    ABI breakage without introducing a circular dependency.  Thanks
+    to Mike Hommey for the report (closes: #482646).
+  * Make debian/rules stricter about catching uninstalled files.
+  * Make debian/rules able to build/clean/build again.
+  * Misc cleanups in debian/rules.
+  * Lintian fixes:
+    - Spelling correction in debian/control
+    - Fix for build-depends-on-1-revision for x11proto-gl-dev
+
+  [ Julien Cristau ]
+  * Add Depends: libxslt1-dev, libxml2-dev to compiz-dev, as they are required
+    by compiz.pc (closes: #482192).
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Mon, 26 May 2008 23:04:24 +0200
+
+compiz (0.7.4-1) unstable; urgency=low
+
+  * New upstream release
+  * Incorporate xcb-disabling patch from
+    http://gitweb.opencompositing.org/?p=users/3v1n0/compiz-patches
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sun, 18 May 2008 19:15:13 +0200
+
+compiz (0.6.3~git20080115.0ea58487-1) unstable; urgency=low
+
+  * New upstream (git snapshot) release.  Refreshed quilt patches.
+  * Contains upstream fix for kde-window-decorator problems with not properly
+    mapping/rendering titlebars.  closes: #458464, #460186.
+  * Remove timestamps from quilt patches (package maintainers, you 
+    should put QUILT_NO_DIFF_TIMESTAMPS=1 in your ~/.quiltrc).
+  * add compizconfig-settings-manager to Suggests field for compiz.
+  * don't blindly assume that the nvidia-settings program is present.
+    patch: compiz-manager-nvidia-settings-optional.patch.  closes: #463645.
+
+ -- sean finney <seanius@xxxxxxxxxx>  Tue, 26 Feb 2008 20:08:31 +0100
+
+compiz (0.6.3~git20071222.061ff159-1) unstable; urgency=low
+
+  * New upstream (git snapshot) release.  Refreshed quilt patches.
+  * Remove build-dependency on libfuse-dev, since we explicitly disable the
+    fuse plugin and it causes FTBFS on non-linux arches.  It should also make
+    backporting easier (closes: #451149, #455516).
+  * compiz-manager-posixly-correct.patch: fix from Brian Carlson to get
+    compiz-manager to run when POSIXLY_CORRECT is set (always pass
+    options before arguments closes: #456628).
+  * Remove libmetacity entry from shlibs override (closes: #455515) Thanks to
+    Rober Millan for noticing this.
+  * Remove outdated info in README.Debian for compiz-core (closes: #454340).
+  * lintian:
+    - Standards-Version to 3.7.3
+    - libdecoration0-dev to section libdevel
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sat, 22 Dec 2007 12:01:54 +0100
+
+compiz (0.6.3~git20071208.25941d14-1) unstable; urgency=low
+
+  [Sean Finney]
+  * New upstream (git snapshot) release.
+  * Remove autofoo generated content and create/remove it as part of the
+    standard build process instead.
+  * Similarly, add Build-Deps on autoconf and similar stuff.
+  * Remove the old/buggy compiz.wrapper script and now use Kristian Lyngstol's
+    compiz-manager script as a drop-in replacement for it.  This should fix
+    numerous problems with plugin settings and window decorators not behaving
+    properly.  specifically, it closes: #449389, #390929, #400583, #440095.
+    it also closes: #446901, #447345 closes: #393501, #445026.  
+  * Update copyright file accordingly.
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sun, 16 Dec 2007 17:29:03 +0100
+
+compiz (0.6.3~git20071104.c9009efd-1) unstable; urgency=low
+
+  [Sean Finney]
+  * New upstream (git snapshot) release.
+  * Disable the (unused?) fuse plugin, explicitly enable the gconf plugin
+  * lintian: update FSF address
+
+  [Brice Goglin]
+  * Make compiz dependencies on compiz-* packages versioned,
+    closes: #440494.
+  * Make the build-dependency on libfuse-dev require >= 2.7.0.
+
+ -- Sean Finney <seanius@xxxxxxxxxx>  Sun, 04 Nov 2007 21:20:17 +0100
+
+compiz (0.5.2-2) unstable; urgency=low
+
+  * oops, shipping copies of a few .h and .pc files in both compiz-dev
+    and libdecoration0-dev.  fixed.
+
+ -- sean finney <seanius@xxxxxxxxxx>  Wed, 29 Aug 2007 21:06:29 +0200
+
+compiz (0.5.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * updated/massaged various quilt patches
+  * make sure configure is executable at build time.  seems that this
+    causes problems in a pbuilder environment
+  * new build-dependencies on libxml-parser-perl and xsltproc
+  * modify compiz-dev.install to install all the extra .h/.pc files
+    being generated in this new version.
+
+ -- sean finney <seanius@xxxxxxxxxx>  Wed, 22 Aug 2007 22:58:09 -0700
+
+compiz (0.5.0.dfsg-3) UNRELEASED; urgency=low
+
+  * Restore all ${misc:Depends} in debian/control so that for instance
+    compiz-gtk and compiz-plugins gets the required dependency on gconf2
+    (for gconf-schemas in postinst), closes: #436432.
+
+ -- Brice Goglin <bgoglin@xxxxxxxxxx>  Tue, 07 Aug 2007 15:10:49 +0200
+
+compiz (0.5.0.dfsg-2) unstable; urgency=low
+
+  * Drop the now obsolete Source-Version in favour of binary:Version in
+    debian/control.
+  * Replace --strict-binding and --use-cow documentation by --loose-binding
+    and --use-root-window respectively in the compiz.real manpage. Thanks
+    Michael Gilbert. (Closes: 432920)
+  * Rearrange and add missing command-line options in the compiz.real manpage.
+  * compiz-gtk needs to conflict with libmetacity0 (<< 1:2.15.21) because of
+    an incompatible ABI change. This should really be fixed in libmetacity. A
+    shlibs bump should do the trick. (Closes: 425631)
+  * Add upstream patch that fixes non-tfp textures (icons, cube top image
+    etc.) on big endian platforms. Thanks Michel Dänzer.
+  * Run dh_makeshlibs with -V. (Closes: 425463)
+  * Use package-local shlibs override file to depend on libmetacity0 (>=
+    1:2.15.21) and libdecoration0 (>= 0.5.0). Thanks Sune Vuorela.
+
+ -- Thierry Reding <thierry@xxxxxxxx>  Fri, 13 Jul 2007 11:25:13 +0200
+
+compiz (0.5.0.dfsg-1) unstable; urgency=low
+
+  [ Thierry Reding ]
+  * New upstream development release:
+    - Remove stencil buffer requirement.
+    - Focus stealing prevention support.
+    - Better occlusion detection and more efficient rendering.
+    - Added plugins:
+      + blur: blur windows and contents behind translucent windows
+      + fuse: map compiz options to a file-system
+      + ini: flat file configuration backend
+      + inotify: file change notification
+      + video: composited video interface for efficient playback
+  * Forward-port patches:
+    - Dropped 012_debian-kde-includes-dir.patch, no longer needed.
+    - Dropped 013_set-qtdir-fallback.patch, no longer needed.
+    - Refresh other patches.
+  * Use compiz' default set of plugins.
+  * Add build-dependency on libfuse-dev needed by the fuse plugin.
+  * No longer conflict with metacity >= 2.15.21, now that metacity 2.18 is in
+    unstable. (Closes: #411012)
+  * Add symlink to the compiz-core README to the compiz package.
+    (Closes: #408605)
+  * Drop po/*.gmo and kde/window-decorator/*.moc.cpp from the original
+    tarball. Add a note to debian/copyright.
+  * Pass QTDIR=/usr to the configure script so that the moc can be found.
+  * shlibs bump for libdecoration because it contains added symbols.
+    Thanks Julien Cristau.
+
+  [ Julien Cristau ]
+  * Don't remove .cvsignore files and autogen.sh in clean.
+
+ -- Thierry Reding <thierry@xxxxxxxx>  Sat, 19 May 2007 17:34:51 +0200
+
+compiz (0.3.6-1) experimental; urgency=low
+
+  [ Thierry Reding ]
+  * New upstream release:
+    + Drop 002_tfp-server-extension.patch, obsolete.
+    + Drop 005_glfinish.patch, fixed upstream.
+    + Refresh 011_snap-by-default.patch.
+  * Replace build-dependency on libdbus-1-dev by libdbus-glib-1-dev.
+  * Add build-dependency on kdebase-dev and libdbus-qt-1-dev for the KDE
+    window decorator.
+  * Add patch 012_debian-kde-includes-dir to correctly detect the KDE include
+    directory on Debian systems.
+  * Add patch 013_set-qtdir-fallback to set the QTDIR variable to /usr if it
+    has not explicitly been set before. This allows the configure script to
+    correctly detect the moc compiler.
+  * Add the compiz-kde package which provides a window decorator for KDE.
+    Closes: #390338.
+  * Add the libdecoration0 and libdecoration0-dev packages. libdecoration0 is
+    needed by both Gtk and KDE window decorators while libdecoration0-dev can
+    be used to write additional decorators.
+  * Add patch 015_optional-fbo which adds a command-line option for disabling
+    the use of FBOs (work around buggy drivers). Add the --no-fbo option to
+    command-line in the compiz wrapper.
+  * Remove the --strict-binding and --use-cow options from the command-line in
+    the compiz wrapper. These are now the defaults.
+  * Add png and svg to the list of default plugins. They are needed to load
+    PNG and SVG images (e.g. for the cube's top face).
+  * Check whether the GLX_EXT_texture_from_pixmap extension is available in
+    direct or indirect rendering contexts. If it is available only in indirect
+    rendering contexts, force compiz to use indirect rendering.
+
+ -- David Nusinow <dnusinow@xxxxxxxxxx>  Wed, 17 Jan 2007 23:46:34 -0500
+
+compiz (0.3.4-1) experimental; urgency=low
+
+  * New upstream release:
+    + Drop 012_metacity-theme-support.patch, fixed upstream.
+    + Drop 013_fix-default-plugins.patch, fixed upstream.
+    + Refresh all other patches.
+  * Don't use xsfbs anymore until there's an easy way to keep it up-to-date
+    in git repositories. For now using quilt works just fine.
+  * Drop build-dependencies on automake1.9 and libtool because we don't run
+    the complete autotools stack anymore.
+  * Add missing dependencies to the compiz-dev package. It needs to pull in
+    all packages required by its pkgconfig file.
+  * Add a dependency on libgl1-mesa-dev | libgl-dev to compiz-dev because
+    compiz.h includes files provided in that package.
+
+ -- Thierry Reding <thierry@xxxxxxxx>  Sun, 26 Nov 2006 00:36:39 +0100
+
+
+compiz (0.3.2-1) experimental; urgency=low
+
+  * New upstream release. Closes: #396770.
+    + Remove 010_snap-inverted.patch, applied upstream.
+    + Refreshed other patches to apply cleanly again.
+    + Remove gtk-window-decorator.schemas and use the one provided by
+      upstream (gtk/window-decorator/gwd.schemas).
+  * Targetted at experimental until the release of etch.
+
+ -- Thierry Reding <thierry@xxxxxxxx>  Tue, 14 Nov 2006 02:36:40 +0100
+
+compiz (0.2.2-1) unstable; urgency=low
+
+  [ Thierry Reding ]
+  * New upstream release:
+    + Drop 013_dont-fail-if-theme-not-found.patch, applied upstream.
+  * Make 012_metacity-theme-support also patch the configure script, not only
+    configure.ac.
+  * Add 013_fix-default-plugins.patch which fixes upstream's handling of the
+    default plugins configuration variable.
+  * Make all plugins that were enabled in previous versions default plugins so
+    compiz' behaviour doesn't change. Drop the 'water' plugin because our X
+    server does not support it yet.
+  * Drop --disable-kde from the configure flags because it is now disabled by
+    default.
+  * Add a dependency on mesa-utils to compiz-core to provide glxinfo that is
+    needed by the compiz wrapper. Thanks Per Bojsen.
+    Closes: #393113.
+  * Conflict with libmetacity0 (>= 1:2.15.21) because it would currently make
+    gtk-window-decorator segfault.
+
+  [ David Nusinow ]
+  * Add myself to uploaders. Thierry is still the primary maintainer.
+
+ -- David Nusinow <dnusinow@xxxxxxxxxx>  Mon,  6 Nov 2006 23:13:41 -0500
+
+compiz (0.2.0-1) unstable; urgency=low
+
+  [ Thierry Reding ]
+  * New upstream release.
+    + Drop 011_plane-plugin-schema.patch, applied upstream.
+    + Drop 012_freedesktop-schema.patch, applied upstream.
+  * Replace 010_snap-by-default by the upstream patch 010_snap-inverted and
+    add 011_snap-by-default to enable snapping by default.
+  * Add 012_metacity-theme-support.patch which uses an older version of the
+    metacity library for theme support so that compiz can be built for Debian
+    unstable.
+  * Install a schemas file for the Gtk window decorator which is used to
+    enable the use of metacity themes.
+  * Suggest nvidia-glx (>= 1.0.9625-1). (Closes: #390326).
+  * Add code to the compiz wrapper to handle the NVIDIA GLX implementation
+    Closes: #390814.
+  * No longer build static versions of the plugins.
+  * Remove .la files manually because they are not needed.
+  * Clean up build-dependencies:
+    + Remove unnecessarily versioned build-dependencies.
+    + Tighten the build-dependency on libxcomposite-dev to (>= 1:0.3-2).
+      Closes: 390304, 390416.
+  * Add a manpage documenting the compiz wrapper.
+  * Check if the gconf plugin is installed before trying to load it in the
+    wrapper.
+  * Enable building the gconf-dump plugin.
+  * Add a README file to the compiz-core package.
+  * List copyright holders and contributors in the copyright file.
+    Closes: #392422.
+  * Add 013_dont-fail-if-theme-not-found.patch which will make compiz use its
+    default theme if the metacity theme cannot be found.
+  * Make compiz-gtk suggest gnome-themes so people can take advantage of the
+    metacity theme support.
+
+  [ David Nusinow ]
+  * Tighten up all the X library build-depends by explicitly using current
+    versions. Thanks aj.
+
+ -- David Nusinow <dnusinow@xxxxxxxxxx>  Fri, 13 Oct 2006 16:22:17 -0400
+
+compiz (0.0.13+git20060928-2) unstable; urgency=low
+
+  * Change the maintainer field to the Debian X Strike Force.
+  * Add myself to the uploaders field.
+  * Move compiz.{docs,install,manpages} to compiz-core.{docs,install,manpages}
+    so the installed files end up in the correct package.
+  * Rename compiz.1 to compiz.real.1, because it's actually documenting the
+    real compiz binary.
+
+ -- Thierry Reding <thierry@xxxxxxxx>  Fri, 29 Sep 2006 09:24:30 +0200
+
+compiz (0.0.13+git20060928-1) unstable; urgency=low
+
+  * Initial release. (Closes: #352151)
+  * Install the compiz schema during postinst and removes it during prerm
+    (using dh_gconf).
+  * Add patches by Kristian Høgsberg to make compiz work on AIGLX:
+    + 002_tfp-server-extension.patch
+    + 005_glfinish.patch
+  * No longer build the compiz-kde package, because it is unusable.
+  * Add gtk-window-decorator.1 manpage.
+  * Install the window settings configuration plugin into the right location
+    (/usr/lib/libgnome-window-settings1/libcompiz.so).
+  * Bump build-dependency on libxcomposite-dev (>= 0.3) because it provides
+    the XComposite{Get,Release}OverlayWindow functions.
+  * Install a compiz wrapper as /usr/bin/compiz to call compiz.real with
+    required arguments (load gconf plugin).
+  * Add 010_snap-by-default.patch to turn snapping on by default.
+  * Add a versioned build-dependency on x11proto-gl-dev (>= 1.4.8-1) to make
+    sure compiz gets built with the correct opcodes for the GLX_EXT_tfp
+    extension.
+  * Add build-dependency on libmetacity-dev, which is needed for metacity
+    theme support.
+  * Add the compiz-gtk package containing the former gnome-window-decorator.
+    The compiz-gnome package provides the files necessary to integrate compiz
+    and compiz-gtk with the GNOME desktop environment.
+  * Add a build-dependency on libxinerama-dev, needed to build compiz with
+    support for the xinerama extension.
+  * Revise the compiz.1 manpage.
+  * Rename the compiz package to compiz-core and make compiz a meta-package
+    pulling in everything necessary to run compiz from within GNOME.
+  * Add 011_plane-plugin-schema.patch by Eugene Konev      gconf settings
+    for the plane plugin.
+  * Add 012_freedesktop-schema.patch that fixes a typo in compiz.schema.in.
+
+ -- Thierry Reding <thierry@xxxxxxxx>  Fri, 29 Sep 2006 07:56:05 +0200
+

=== added file 'debian/compat'
--- debian/compat	1970-01-01 00:00:00 +0000
+++ debian/compat	2011-04-04 12:01:15 +0000
@@ -0,0 +1,1 @@
+5

=== added file 'debian/compiz-core.README.Debian'
--- debian/compiz-core.README.Debian	1970-01-01 00:00:00 +0000
+++ debian/compiz-core.README.Debian	2011-04-04 12:01:15 +0000
@@ -0,0 +1,36 @@
+Xorg Server Configuration
+=========================
+
+In order for compiz to work you need to add the following to you server
+configuration file (/etc/X11/xorg.conf):
+
+  + Enable the composite extension: locate the section named "Extensions" and
+    add the following line:
+
+        Option "Composite" "enable"
+
+    If there is no section "Extensions" yet, you should add one that looks
+    like this:
+
+        Section "Extensions"
+            Option "Composite" "enable"
+        EndSection
+
+  + Make XAA not hold any pixmaps in offscreen memory. This slows down compiz
+    in many configurations. You can disable this by adding the following line
+    to your "Device" section:
+
+        Option "XAANoOffscreenPixmaps" "true"
+
+Now restart your X server and login to your favorite session. After the
+session has loaded completely, open a terminal window and type the following
+command:
+
+    $ compiz --replace &
+
+Which will start compiz, make it replace the current window manager and
+background the process so you can safely close the terminal again. If all went
+well, compiz should start up and enable a whole bunch of desktop effects.
+
+ -- Thierry Reding <thierry@xxxxxxxx>  Tue,  3 Oct 2006 14:12:26 +0200
+

=== added file 'debian/compiz-core.docs'
--- debian/compiz-core.docs	1970-01-01 00:00:00 +0000
+++ debian/compiz-core.docs	2011-04-04 12:01:15 +0000
@@ -0,0 +1,4 @@
+AUTHORS
+NEWS
+README
+TODO

=== added file 'debian/compiz-core.install'
--- debian/compiz-core.install	1970-01-01 00:00:00 +0000
+++ debian/compiz-core.install	2011-04-04 12:01:15 +0000
@@ -0,0 +1,8 @@
+debian/tmp/usr/bin/compiz*
+debian/compiz-decorator usr/bin/
+debian/tmp/usr/share/compiz/cube/images/*.png
+debian/tmp/usr/share/compiz/*.png
+debian/tmp/usr/share/compiz/core.xml
+debian/tmp/usr/share/locale
+debian/tmp/usr/share/applications/compiz.desktop
+debian/source_compiz.py usr/share/apport/package-hooks

=== added file 'debian/compiz-core.manpages'
--- debian/compiz-core.manpages	1970-01-01 00:00:00 +0000
+++ debian/compiz-core.manpages	2011-04-04 12:01:15 +0000
@@ -0,0 +1,2 @@
+debian/compiz.1
+debian/compiz-decorator.1

=== added file 'debian/compiz-decorator'
--- debian/compiz-decorator	1970-01-01 00:00:00 +0000
+++ debian/compiz-decorator	2011-04-04 12:01:15 +0000
@@ -0,0 +1,97 @@
+#!/bin/sh
+# Starts Compiz Decorator depending on the DE
+# 
+# Copyright (c) 2007 CyberOrg <cyberorg@xxxxxxxxxxxxx>
+# Based on compiz-manager script by Kristian Lyngstøl <kristian@xxxxxxxxxxxxx>
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+# Contributions by: crdlb
+#
+COMPIZ_BIN_PATH=/usr/bin/
+KWIN=`which kwin`
+METACITY="/usr/bin/metacity"
+
+#
+# Default to gtk/kde4-window-decorator
+#
+USE_EMERALD="no"
+DECORATOR=""
+
+#Do not leave users without decoration if decorator fails
+if [ "$DESKTOP_SESSION" = "kde" ]; then
+    FALLBACKWM="${KWIN}"
+else
+    FALLBACKWM="${METACITY}"
+fi
+FALLBACKWM_OPTIONS=" --replace"
+
+#
+# Set to yes to enable verbose
+#
+VERBOSE="yes"
+ 
+#
+# Echos the arguments if verbose
+#
+verbose()
+{
+    if [ "x$VERBOSE" = "xyes" ]; then
+        printf "$*"
+    fi
+}
+
+# Read configuration from XDG paths
+if [ -z "$XDG_CONFIG_DIRS" ]; then
+    test -f /etc/xdg/compiz/compiz-manager && . /etc/xdg/compiz/compiz-manager
+else
+    test -f $XDG_CONFIG_DIRS/compiz/compiz-manager && . $XDG_CONFIG_DIRS/compiz/compiz-manager
+fi
+
+if [ -z "$XDG_CONFIG_HOME" ]; then
+    test -f $HOME/.config/compiz/compiz-manager && . $HOME/.config/compiz/compiz-manager
+else
+    test -f $XDG_CONFIG_HOME/compiz/compiz-manager && .  $XDG_CONFIG_HOME/compiz/compiz-manager
+fi
+
+# start a decorator
+if [ -x ${COMPIZ_BIN_PATH}emerald ] && [ "$USE_EMERALD" = "yes" ]; then
+    DECORATOR=emerald
+elif [ -x ${COMPIZ_BIN_PATH}unity-window-decorator ] && [ -n "$GNOME_DESKTOP_SESSION_ID" ]; then
+    DECORATOR=unity-window-decorator
+elif [ -x ${COMPIZ_BIN_PATH}kde4-window-decorator ] && [ x$KDE_SESSION_VERSION = x"4" ]; then
+    DECORATOR=kde4-window-decorator
+fi
+
+# fall back to any decorator that is installed
+if [ -z "$DECORATOR" ]; then
+    verbose "Couldn't find a perfect decorator match; trying all decorators\n"
+    if [ -x ${COMPIZ_BIN_PATH}emerald ]; then
+        DECORATOR=emerald
+    elif [ -x ${COMPIZ_BIN_PATH}unity-window-decorator ]; then
+	DECORATOR=unity-window-decorator
+    elif [ -x ${COMPIZ_BIN_PATH}kde4-window-decorator ]; then
+	DECORATOR=kde4-window-decorator
+    fi
+fi
+
+if [ -n "$DECORATOR" ]; then
+    verbose "Starting ${DECORATOR}\n"
+    exec ${COMPIZ_BIN_PATH}$DECORATOR "$@"
+else
+    verbose "Found no decorator to start\n"
+    exec $FALLBACKWM $FALLBACKWM_OPTIONS
+fi
+

=== added file 'debian/compiz-decorator.1'
--- debian/compiz-decorator.1	1970-01-01 00:00:00 +0000
+++ debian/compiz-decorator.1	2011-04-04 12:01:15 +0000
@@ -0,0 +1,15 @@
+.TH COMPIZ-DECORATOR 1 "May 18, 2010"
+.SH NAME
+compiz-decorator \- Automatic decorator loader
+.SH SYNOPSIS
+.B compiz-decorator
+.SH DESCRIPTION
+.B compiz-decorator
+is a program that automatically launches the best decorator based on your
+environment and what decorators are available.
+.SH AUTHOR
+compiz-decorator was written by CyberOrg <cyberorg@xxxxxxxxxxxxx> and
+others.
+.PP
+This manual page was written by Travis Watkins <amaranth@xxxxxxxxxx>,
+for the Ubuntu project (but may be used by others).

=== added file 'debian/compiz-dev.docs'
--- debian/compiz-dev.docs	1970-01-01 00:00:00 +0000
+++ debian/compiz-dev.docs	2011-04-04 12:01:15 +0000
@@ -0,0 +1,4 @@
+AUTHORS
+NEWS
+README
+TODO

=== added file 'debian/compiz-dev.install'
--- debian/compiz-dev.install	1970-01-01 00:00:00 +0000
+++ debian/compiz-dev.install	2011-04-04 12:01:15 +0000
@@ -0,0 +1,5 @@
+debian/tmp/usr/include/compiz/[!d]*
+debian/tmp/usr/lib/pkgconfig/[!l]*
+debian/tmp/usr/share/compiz/xslt
+debian/tmp/usr/share/cmake*
+debian/tmp/usr/share/compiz/cmake

=== added file 'debian/compiz-gnome.docs'
--- debian/compiz-gnome.docs	1970-01-01 00:00:00 +0000
+++ debian/compiz-gnome.docs	2011-04-04 12:01:15 +0000
@@ -0,0 +1,4 @@
+AUTHORS
+NEWS
+README
+TODO

=== added file 'debian/compiz-gnome.gconf-defaults'
--- debian/compiz-gnome.gconf-defaults	1970-01-01 00:00:00 +0000
+++ debian/compiz-gnome.gconf-defaults	2011-04-04 12:01:15 +0000
@@ -0,0 +1,9 @@
+/apps/compiz-1/plugins/move/screen0/options/constrain_y                true
+/apps/compiz-1/general/screen0/options/hsize				2
+/apps/compiz-1/general/screen0/options/vsize				2
+/apps/gwd/blur_type							all
+/apps/gwd/metacity_theme_opacity					1.0
+/apps/gwd/metacity_theme_shade_opacity					true
+/apps/compizconfig-1/profiles/unity/general/screen0/options/active_plugins [core,bailer,detection,composite,opengl,decor,mousepoll,vpswitch,regex,animation,snap,expo,move,compiztoolbox,place,grid,imgpng,gnomecompat,wall,ezoom,workarounds,staticswitcher,resize,fade,unitymtgrabhandles,scale,session,unityshell]
+/apps/compizconfig-1/profiles/unity/plugins/gnomecompat/screen0/options/main_menu_key ""
+/apps/compizconfig-1/profiles/unity/plugins/gnomecompat/screen0/options/run_key ""

=== added file 'debian/compiz-gnome.install'
--- debian/compiz-gnome.install	1970-01-01 00:00:00 +0000
+++ debian/compiz-gnome.install	2011-04-04 12:01:15 +0000
@@ -0,0 +1,7 @@
+debian/tmp/usr/share/applications/compiz.desktop usr/share/gnome/wm-properties/
+debian/tmp/usr/share/gnome-control-center
+debian/tmp/usr/share/gconf/schemas/*.schemas
+debian/tmp/usr/bin/gtk-window-decorator
+debian/tmp/usr/bin/unity-window-decorator
+debian/65compiz_profile-on-session /etc/X11/Xsession.d
+debian/unity.ini /etc/compizconfig/

=== added file 'debian/compiz-gnome.manpages'
--- debian/compiz-gnome.manpages	1970-01-01 00:00:00 +0000
+++ debian/compiz-gnome.manpages	2011-04-04 12:01:15 +0000
@@ -0,0 +1,1 @@
+debian/gtk-window-decorator.1

=== added file 'debian/compiz-kde.docs'
--- debian/compiz-kde.docs	1970-01-01 00:00:00 +0000
+++ debian/compiz-kde.docs	2011-04-04 12:01:15 +0000
@@ -0,0 +1,4 @@
+AUTHORS
+NEWS
+README
+TODO

=== added file 'debian/compiz-kde.install'
--- debian/compiz-kde.install	1970-01-01 00:00:00 +0000
+++ debian/compiz-kde.install	2011-04-04 12:01:15 +0000
@@ -0,0 +1,2 @@
+debian/tmp/usr/bin/kde4-window-decorator
+debian/tmp/usr/lib/compiz/libkde.so

=== added file 'debian/compiz-kde.manpages'
--- debian/compiz-kde.manpages	1970-01-01 00:00:00 +0000
+++ debian/compiz-kde.manpages	2011-04-04 12:01:15 +0000
@@ -0,0 +1,1 @@
+debian/kde4-window-decorator.1

=== added file 'debian/compiz-keybindings.sed'
--- debian/compiz-keybindings.sed	1970-01-01 00:00:00 +0000
+++ debian/compiz-keybindings.sed	2011-04-04 12:01:15 +0000
@@ -0,0 +1,4 @@
+s/<\/KeyListEntries>/        <KeyListEntry name="\/apps\/compiz\/plugins\/scale\/screen0\/options\/initiate_key"\/>\n\n<\/KeyListEntries>/
+s/<\/KeyListEntries>/        <KeyListEntry name="\/apps\/compiz\/plugins\/ezoom\/screen0\/options\/zoom_in_key"\/>\n\n<\/KeyListEntries>/
+s/<\/KeyListEntries>/        <KeyListEntry name="\/apps\/compiz\/plugins\/ezoom\/screen0\/options\/zoom_out_key"\/>\n\n<\/KeyListEntries>/
+s/<\/KeyListEntries>/        <KeyListEntry name="\/apps\/compiz\/plugins\/expo\/screen0\/options\/expo_key"\/>\n\n<\/KeyListEntries>/

=== added file 'debian/compiz-plugins.docs'
--- debian/compiz-plugins.docs	1970-01-01 00:00:00 +0000
+++ debian/compiz-plugins.docs	2011-04-04 12:01:15 +0000
@@ -0,0 +1,4 @@
+AUTHORS
+NEWS
+README
+TODO

=== added file 'debian/compiz-plugins.install'
--- debian/compiz-plugins.install	1970-01-01 00:00:00 +0000
+++ debian/compiz-plugins.install	2011-04-04 12:01:15 +0000
@@ -0,0 +1,2 @@
+debian/tmp/usr/lib/compiz/lib[!k]*.so
+debian/tmp/usr/share/compiz/*xml

=== added file 'debian/compiz.1'
--- debian/compiz.1	1970-01-01 00:00:00 +0000
+++ debian/compiz.1	2011-04-04 12:01:15 +0000
@@ -0,0 +1,64 @@
+.TH COMPIZ 1 "September 29, 2006"
+
+.SH NAME
+compiz \- OpenGL window and compositing manager
+
+.SH SYNOPSIS
+.B compiz
+.RI [ options ]
+.RI [ plugins ]
+.SH DESCRIPTION
+.B compiz
+is a compositing window-manager using OpenGL for rendering.
+
+.SH OPTIONS
+.TP
+.B \-\-help
+Show summary of options.
+.TP
+.B \-v, \-\-version
+Show version of program.
+.TP
+.BI "\-\-display " DISPLAY
+Manage the display called
+.I DISPLAY
+instead of the name obtained from the
+.I $DISPLAY
+environment variable.
+.TP
+.BI "\-\-refresh\-rate " RATE
+Set the default refresh rate.
+.TP
+.BI \-\-fast\-filter
+Use a fast texture filter.
+.TP
+.BI \-\-indirect\-rendering
+Force an indirect rendering context. Use this when running compiz on AIGLX.
+.TP
+.BI \-\-strict\-binding
+Enable strict binding of textures. Use this when running compiz on AIGLX.
+.TP
+.BI \-\-use\-cow
+Make use of the composite overlay window.
+.TP
+.BI \-\-replace
+Replace any existing window managers on the given X display.
+.TP
+.BI \-\-sm\-disable
+Disable the session management.
+.TP
+.BI "\-\-sm\-client\-id " ID
+Use the given
+.I ID
+as the client ID for session management.
+.TP
+.BI "\-\-bg\-image " IMAGE
+Use
+.I IMAGE
+as background image.
+
+.SH AUTHOR
+compiz was written by David Reveman <davidr@xxxxxxxxxx> and others.
+.PP
+This manual page was written by Thierry Reding <thierry@xxxxxxxx>,
+for the Debian project (but may be used by others).

=== added file 'debian/control'
--- debian/control	1970-01-01 00:00:00 +0000
+++ debian/control	2011-04-04 12:01:15 +0000
@@ -0,0 +1,150 @@
+Source: compiz
+Section: x11
+Priority: optional
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@xxxxxxxxxxxxxxxx>
+XSBC-Original-Maintainer: Debian X Strike Force <debian-x@xxxxxxxxxxxxxxxx>
+Uploaders: David Nusinow <dnusinow@xxxxxxxxxx>, Sean Finney <seanius@xxxxxxxxxx>, Cyril Brulebois <kibi@xxxxxxxxxx>
+Build-Depends: cmake (>= 2.6),
+ cdbs,
+ debhelper (>= 7.0.50~), intltool, 
+ kdebase-workspace-dev,
+ libcairo2-dev,
+ libdbus-glib-1-dev, libgconf2-dev, 
+ libgl1-mesa-dev (>= 6.5.1) | libgl-dev, libglib2.0-dev, libgnome-desktop-dev, 
+ libgnomeui-dev, libboost1.42-dev, libboost-serialization1.42-dev,
+ libgnome-window-settings-dev, libgtk2.0-dev, libice-dev (>= 1:1.0.1), 
+ libmetacity-dev (>= 1:2.30.3-0ubuntu3), libpango1.0-dev, libpng12-dev | libpng-dev, librsvg2-dev, 
+ libsm-dev (>= 1:1.0.1), libtool, libwnck-dev, libx11-dev, libxcomposite-dev (>= 1:0.3-2), libxext-dev,
+ libxdamage-dev (>=1:1.0.3), libxfixes-dev (>= 1:4.0.1), libxinerama-dev, 
+ libxml-parser-perl, libxrandr-dev (>= 2:1.1.0.2), libxrender-dev (>= 1:0.9.1), 
+ libxcursor-dev,
+ libxml2-dev, libxslt1-dev,
+ libstartup-notification0-dev (>= 0.7),
+ quilt (>= 0.40), x11proto-gl-dev (>= 1.4.8), xsltproc,
+ libglu1-mesa-dev,
+ libglib2.0-dev,
+ libglibmm-2.4-dev,
+ kdebase-workspace-dev, kdelibs5-dev (>= 4:4.2.2),
+ metacity-common, libx11-xcb-dev,
+ gnome-control-center-dev,
+Standards-Version: 3.8.1
+Vcs-Bzr: https://code.launchpad.net/~compiz/compiz/ubuntu
+
+Package: compiz
+Architecture: all
+Provides: x-window-manager
+Depends: compiz-core (>= ${source:Version}), compiz-plugins (>= ${source:Version}), compiz-gnome | compiz-kde, compiz-plugins-main (>= 0.9), libcompizconfig0 (>= 0.9), ${misc:Depends}
+Suggests: compizconfig-settings-manager
+Description: OpenGL window and compositing manager
+ Compiz brings to life a variety of visual effects that make the Linux desktop
+ easier to use, more powerful and intuitive, and more accessible for users
+ with special needs.
+ .
+ This metapackage provides the components necessary for running compiz. It
+ provides the compiz core, a set of standard plugins, a window decorator using
+ the Gtk toolkit and the files necessary to integrate compiz with the GNOME
+ desktop environment.
+
+Package: compiz-core
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Breaks: libcompizconfig0 (<< 0.9.2.1git101125-0ubuntu3),
+ compiz-fusion-plugins-main (<< 0.9.2.1-0ubuntu6), 
+ unity (<< 3.2.6-0ubuntu2), 
+ compiz-fusion-plugins-extra (<< 0.9),
+ simple-ccsm (<< 0.9)
+Recommends: compiz-plugins (= ${binary:Version})
+Suggests: nvidia-glx (>= 1.0.9625-1)
+Provides: compiz-core-abiversion-${coreabiversion}
+Conflicts: compiz-wrapper (<< 1:0.8.4-0ubuntu4)
+Replaces: compiz-wrapper (<< 1:0.8.4-0ubuntu4),
+          compiz-gnome (<< 1:0.8.4-4ubuntu1)
+Description: OpenGL window and compositing manager
+ Compiz brings to life a variety of visual effects that make the Linux desktop
+ easier to use, more powerful and intuitive, and more accessible for users
+ with special needs.
+ .
+ Compiz combines together a window manager and a composite manager using
+ OpenGL for rendering. A "window manager" allows the manipulation of the
+ multiple applications and dialog windows that are presented on the screen. A
+ "composite manager" allows windows and other graphics to be combined together
+ to create composite images. Compiz achieves its stunning effects by doing
+ both of these functions.
+
+Package: compiz-dev
+Architecture: any
+Depends: compiz-core (= ${binary:Version}), ${misc:Depends}, libgl1-mesa-dev | libgl-dev, libpng-dev, libxcomposite-dev (>= 1:0.3-2), libxfixes-dev (>=1:4.0.1), libxdamage-dev (>= 1:1.0.3), libxinerama-dev, libxrandr-dev (>=2:1.1.0.2), libxcursor-dev, libice-dev (>= 1:1.0.1), libsm-dev (>= 1:1.0.1), libstartup-notification0-dev (>= 0.7), libxslt1-dev, libxml2-dev, libx11-xcb-dev, libglib2.0-dev, libglibmm-2.4-dev, compiz-plugins (= ${binary:Version})
+Description: OpenGL window and compositing manager - development files
+ Compiz brings to life a variety of visual effects that make the Linux desktop
+ easier to use, more powerful and intuitive, and more accessible for users
+ with special needs.
+ .
+ This package contains the headers and libraries needed to compile compiz
+ plugins.
+
+Package: compiz-kde
+Architecture: any
+Depends: compiz-core (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends},
+         compiz-plugins (= ${binary:Version}),
+         compizconfig-backend-kconfig
+Description: OpenGL window and compositing manager - KDE window decorator
+ Compiz brings to life a variety of visual effects that make the Linux desktop
+ easier to use, more powerful and intuitive, and more accessible for users
+ with special needs.
+ .
+ This package contains a window decorator that uses KDE to provide a look and
+ feel similar to that of the default KDE window manager.
+
+Package: compiz-gnome
+Architecture: any
+Suggests: gnome-themes
+Depends: ${shlibs:Depends}, ${misc:Depends},
+         compiz-plugins (= ${binary:Version}),
+         compizconfig-backend-gconf (>= 0.9.2.1git101213)
+Replaces: compiz-plugins (<= 1:0.8.6-0ubuntu12),
+          compiz-fusion-plugins-extra (<< 0.9.2.1-0ubuntu3),
+Description: OpenGL window and compositing manager - GNOME window decorator
+ Compiz brings to life a variety of visual effects that make the Linux desktop
+ easier to use, more powerful and intuitive, and more accessible for users
+ with special needs.
+ .
+ This package contains files needed to integrate compiz with the GNOME desktop
+ environment.
+
+Package: compiz-plugins
+Architecture: any
+Depends: compiz-core (= ${binary:Version}),
+         libdecoration0 (= ${binary:Version}),
+         ${shlibs:Depends},
+         ${misc:Depends}
+Replaces: compiz-gnome (<< 1:0.8.4-4ubuntu1),
+          compiz-fusion-plugins-extra (<< 0.9.2.1-0ubuntu3)
+Description: OpenGL window and compositing manager - plugins
+ Compiz brings to life a variety of visual effects that make the Linux desktop
+ easier to use, more powerful and intuitive, and more accessible for users
+ with special needs.
+ .
+ This package contains the standard plugins that come with compiz. Compiz
+ without these plugins is not very useful.
+
+Package: libdecoration0
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Compiz window decoration library
+ The window decoration library is responsible for drawing the window borders
+ and title bar of windows managed by Compiz. It is used by window decorators
+ like gtk-window-decorator and kde-window-decorator.
+
+Package: libdecoration0-dev
+Section: libdevel
+Architecture: any
+Depends: libdecoration0 (= ${binary:Version}), ${misc:Depends}, libx11-dev, libxrender-dev (>= 1:0.9.1)
+Description: Compiz window decoration library - development files
+ The window decoration library is responsible for drawing the window borders
+ and title bar of windows managed by Compiz. It is used by window decorators
+ like gtk-window-decorator and kde-window-decorator.
+ .
+ This package contains files required for developing window decorators
+ compatible with Compiz.
+
+# vim: tw=0

=== added file 'debian/copyright'
--- debian/copyright	1970-01-01 00:00:00 +0000
+++ debian/copyright	2011-04-04 12:01:15 +0000
@@ -0,0 +1,131 @@
+This package was debianized by Thierry Reding <thierry@xxxxxxxx> on
+Fri, 18 Aug 2006 09:46:24 +0200.
+
+It was downloaded from http://xorg.freedesktop.org/releases/individual/app.
+
+Upstream author: David Reveman <davidr@xxxxxxxxxx>
+Contributors:
+    Radek Doulik <rodo@xxxxxxxxxx>
+    Jeremy C. Reed <reed@xxxxxxxxxxxxx>
+    Dan Winship <danw@xxxxxxxxxx>
+    Kristian Høgsberg <krh@xxxxxxxxxx>
+
+------------------------------------------------------------------------------
+
+The original source tarball was repackaged to remove the following generated
+and/or unused files:
+
+	kde/window-decorator/*.moc.cpp
+	kde/window-decorator/KWinInterface_skel.cpp
+	po/*.gmo
+
+------------------------------------------------------------------------------
+
+Copyright:
+
+This software is copyright © 2005, 2006 Novell, Inc.
+
+You can redistribute this software and/or modify it under the terms of the GNU
+General Public License as published by the Free Software Foundation; version 2
+dated June, 1991.
+
+This program is distributed in the hope that it will be useful, but-
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU-
+General Public License for more details.
+
+------------------------------------------------------------------------------
+
+The convertProperty / convert_property and handleSelectionRequest /
+handle_selection_request functions in 'src/display.c' and
+'gtk/window-decorator/gtk-window-decorator.c' are taken from the source code
+of fvwm2 and copyright © Matthias Clasen and Dominik Vogt.
+
+Parts of the code in 'src/window.c':
+
+    /* Ater gdk_window_constrain_size(), which is partially borrowed from fvwm.
+     *
+     * Copyright 1993, Robert Nation
+     *     You may use this code for any purpose, as long as the original
+     *     copyright remains in the source code and all documentation
+     *
+     * which in turn borrows parts of the algorithm from uwm
+     */
+
+------------------------------------------------------------------------------
+-- Plugins: --
+--------------
+
+Skydome support for the 'cube' plugin was written by Mirco Müller
+<macslow@xxxxxxxxxx>.
+
+For the 'place' plugin:
+
+    /*
+     * Copyright (C) 2001 Havoc Pennington
+     * Copyright (C) 2002, 2003 Red Hat, Inc.
+     * Copyright (C) 2003 Rob Adams
+     * Copyright (C) 2005 Novell, Inc.
+     *
+     * This program is free software; you can redistribute it and/or
+     * modify it under the terms of the GNU General Public License as
+     * published by the Free Software Foundation; either version 2 of the
+     * License, or (at your option) any later version.
+     *
+     * This program is distributed in the hope that it will be useful, but
+     * WITHOUT ANY WARRANTY; without even the implied warranty of
+     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     * General Public License for more details.
+     *
+     * You should have received a copy of the GNU General Public License
+     * along with this program; if not, write to the Free Software
+     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+     * 02110-1301, USA.
+     */
+
+The 'plane' plugin was written by Søren Sandmann <sandmann@xxxxxxxxxx>:
+
+    /*
+     * Copyright © 2006 Red Hat, Inc.
+     *
+     * Permission to use, copy, modify, distribute, and sell this software
+     * and its documentation for any purpose is hereby granted without
+     * fee, provided that the above copyright notice appear in all copies
+     * and that both that copyright notice and this permission notice
+     * appear in supporting documentation, and that the name of
+     * Red Hat, Inc. not be used in advertising or publicity pertaining to
+     * distribution of the software without specific, written prior permission.
+     * Red Hat, Inc. makes no representations about the suitability of this
+     * software for any purpose. It is provided "as is" without express or
+     * implied warranty.
+     *
+     * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+     * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+     * NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+     * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+     * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+     * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+     * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+     *
+     * Author: Søren Sandmann <sandmann@xxxxxxxxxx>
+     */
+
+------------------------------------------------------------------------------
+-- Translations: --
+-------------------
+
+The Finnish translation in 'po/fi.po' is copyright © 2003 SuSE Linux AG and ©
+2005 SUSE Linux Products GmbH.
+
+The Polish translation in 'po/pl.po' are copyright © 2005 SUSE Linux Products
+GmbH.
+
+The makefile 'po/Makefile.in.in' is copyright © 1995, 1996, 1997 by Ulrich
+Drepper <drepper@xxxxxxxxxxxxxx>.
+
+------------------------------------------------------------------------------
+
+The Debian packaging is copyright © 2006, 2007 by Thierry Reding
+<thierry@xxxxxxxx> and is licensed under the GPL, see
+`/usr/share/common-licenses/GPL'.
+

=== added file 'debian/gbp.conf'
--- debian/gbp.conf	1970-01-01 00:00:00 +0000
+++ debian/gbp.conf	2011-04-04 12:01:15 +0000
@@ -0,0 +1,8 @@
+[DEFAULT]
+debian-branch = debian-unstable
+debian-tag = compiz-%(version)s
+upstream-branch = upstream-unstable
+upstream-tag = compiz-%(version)s
+
+[git-dch]
+meta = 1

=== added file 'debian/gtk-window-decorator.1'
--- debian/gtk-window-decorator.1	1970-01-01 00:00:00 +0000
+++ debian/gtk-window-decorator.1	2011-04-04 12:01:15 +0000
@@ -0,0 +1,30 @@
+.TH GTK-WINDOW-DECORATOR 1 "September 25, 2006"
+.SH NAME
+gtk-window-decorator \- Compiz window decorator using the Gtk toolkit
+.SH SYNOPSIS
+.B gtk-window-decorator
+.RI [ options ]
+.SH DESCRIPTION
+.B gtk-window-decorator
+is a window decorator for
+.B compiz
+that uses the Gtk toolkit to provide a look and feel similar to that of the
+metacity window manager.
+.SH OPTIONS
+.B gtk-window-decorator
+accepts the following options:
+.TP
+.BI \-\-minimal
+Runs only with minimal window decorations.
+.TP
+.BI \-\-replace
+Replaces any running window decorator.
+.TP
+.BI \-\-help
+Prints the list of accepted options.
+.SH AUTHOR
+gtk-window-decorator was written by David Reveman <davidr@xxxxxxxxxx> and
+others.
+.PP
+This manual page was written by Thierry Reding <thierry@xxxxxxxx>,
+for the Debian project (but may be used by others).

=== added file 'debian/kde4-window-decorator.1'
--- debian/kde4-window-decorator.1	1970-01-01 00:00:00 +0000
+++ debian/kde4-window-decorator.1	2011-04-04 12:01:15 +0000
@@ -0,0 +1,40 @@
+.TH KDE4-WINDOW-DECORATOR 1 "January 3, 2007"
+.SH NAME
+kde4-window-decorator \- Compiz window decorator for the KDE desktop
+environment
+.SH SYNOPSIS
+.B kde4-window-decorator
+.RI [ options ]
+.SH DESCRIPTION
+.B kde4-window-decorator
+is a window decorator for
+.B compiz
+that provides a look and feel similar to that of the default KDE window
+manager.
+.SH OPTIONS
+.B kde4-window-decorator
+accepts the following options:
+.TP
+.BI \-\-replace
+Replaces any running window decorator.
+.TP
+.BI \-\-opacity " float"
+Sets the decoration opacity (range: 0.0\-1.0, default: 0.75).
+.TP
+.BI \-\-no-opacity-shade
+Disables opacity shading for decorations.
+.TP
+.BI \-\-active-opacity " float"
+Sets the opacity for active decorations (range: 0.0\-1.0, default: 1.0).
+.TP
+.BI \-\-no-active-opacity-shade
+Disables opacity shading for active decorations.
+.TP
+.BI \-\-help
+Prints the list of accepted options.
+.SH AUTHOR
+kde4-window-decorator was written by David Reveman <davidr@xxxxxxxxxx> and
+others.
+.PP
+This manual page was written by Thierry Reding <thierry@xxxxxxxx>,
+for the Debian project (but may be used by others).

=== added file 'debian/libdecoration0-dev.docs'
--- debian/libdecoration0-dev.docs	1970-01-01 00:00:00 +0000
+++ debian/libdecoration0-dev.docs	2011-04-04 12:01:15 +0000
@@ -0,0 +1,4 @@
+AUTHORS
+NEWS
+README
+TODO

=== added file 'debian/libdecoration0-dev.install'
--- debian/libdecoration0-dev.install	1970-01-01 00:00:00 +0000
+++ debian/libdecoration0-dev.install	2011-04-04 12:01:15 +0000
@@ -0,0 +1,3 @@
+debian/tmp/usr/include/compiz/decoration.h
+debian/tmp/usr/lib/libdecoration.so
+debian/tmp/usr/lib/pkgconfig/libdecoration.pc

=== added file 'debian/libdecoration0.docs'
--- debian/libdecoration0.docs	1970-01-01 00:00:00 +0000
+++ debian/libdecoration0.docs	2011-04-04 12:01:15 +0000
@@ -0,0 +1,4 @@
+AUTHORS
+NEWS
+README
+TODO

=== added file 'debian/libdecoration0.install'
--- debian/libdecoration0.install	1970-01-01 00:00:00 +0000
+++ debian/libdecoration0.install	2011-04-04 12:01:15 +0000
@@ -0,0 +1,1 @@
+debian/tmp/usr/lib/libdecoration*.so.*

=== added file 'debian/libdecoration0.symbols'
--- debian/libdecoration0.symbols	1970-01-01 00:00:00 +0000
+++ debian/libdecoration0.symbols	2011-04-04 12:01:15 +0000
@@ -0,0 +1,29 @@
+libdecoration.so.0 libdecoration0 #MINVER#
+ decor_acquire_dm_session@Base 1:0.9.2.1
+ decor_apply_gravity@Base 1:0.9.2.1
+ decor_blend_border_picture@Base 1:0.9.2.1
+ decor_draw_simple@Base 1:0.9.2.1
+ decor_fill_picture_extents_with_shadow@Base 1:0.9.2.1
+ decor_gen_window_property@Base 1:0.9.2.1
+ decor_get_best_layout@Base 1:0.9.2.1
+ decor_get_default_layout@Base 1:0.9.2.1
+ decor_handle_selection_clear@Base 1:0.9.2.1
+ decor_handle_selection_request@Base 1:0.9.2.1
+ decor_pixmap_property_to_quads@Base 1:0.9.2.1
+ decor_property_get_type@Base 1:0.9.2.1
+ decor_property_get_version@Base 1:0.9.2.1
+ decor_quads_to_property@Base 1:0.9.2.1
+ decor_region_to_blur_property@Base 1:0.9.2.1
+ decor_set_dm_check_hint@Base 1:0.9.2.1
+ decor_set_horz_quad_line@Base 1:0.9.2.1
+ decor_set_lSrS_window_quads@Base 1:0.9.2.1
+ decor_set_lSrStSbS_window_quads@Base 1:0.9.2.1
+ decor_set_lSrStSbX_window_quads@Base 1:0.9.2.1
+ decor_set_lSrStXbS_window_quads@Base 1:0.9.2.1
+ decor_set_lXrXtXbX_window_quads@Base 1:0.9.2.1
+ decor_set_vert_quad_row@Base 1:0.9.2.1
+ decor_shadow_create@Base 1:0.9.2.1
+ decor_shadow_destroy@Base 1:0.9.2.1
+ decor_shadow_reference@Base 1:0.9.2.1
+ decor_version@Base 1:0.9.2.1
+ decor_window_property@Base 1:0.9.2.1

=== added directory 'debian/patches'
=== added file 'debian/patches/018_use_metacity_settings.patch'
--- debian/patches/018_use_metacity_settings.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/018_use_metacity_settings.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,18 @@
+# Description: Use metacity control center applet instead of compiz one
+#  The rationale is that the ccp backend will transparently
+#  work with the metacity options under gnome.
+# Forwarded: not-needed
+# Origin: Ubuntu
+# Author: Michael Vogt <michael.vogt@xxxxxxxxxx>
+
+--- a/gtk/gnome/compiz.desktop.in
++++ b/gtk/gnome/compiz.desktop.in
+@@ -5,7 +5,7 @@
+ Exec=compiz
+ NoDisplay=true
+ # name of loadable control center module
+-X-GNOME-WMSettingsModule=compiz
++X-GNOME-WMSettingsModule=metacity
+ # autostart phase
+ X-GNOME-Autostart-Phase=WindowManager
+ X-GNOME-Provides=windowmanager

=== added file 'debian/patches/01_unity_window_decorator.patch'
--- debian/patches/01_unity_window_decorator.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/01_unity_window_decorator.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,9999 @@
+From e6adb283672c00dbaaeeb70d28f73eb74d1dfadf Mon Sep 17 00:00:00 2001
+From: Sam Spilsbury <smspillaz@xxxxxxxxx>
+Date: Thu, 13 Jan 2011 12:05:32 +0800
+Subject: [PATCH] Add UXD unity window decorator with improved borders and shadows
+
+---
+ CMakeLists.txt                                     |    1 +
+ unity/unity_window_decorator/.gitignore            |    1 +
+ unity/unity_window_decorator/AUTHORS               |   29 +
+ unity/unity_window_decorator/CMakeLists.txt        |   38 +
+ unity/unity_window_decorator/COPYING               |    6 +
+ unity/unity_window_decorator/COPYING.GPL           |  340 ++++
+ unity/unity_window_decorator/INSTALL               |   14 +
+ unity/unity_window_decorator/README                |    8 +
+ unity/unity_window_decorator/src/CMakeLists.txt    |  161 ++
+ unity/unity_window_decorator/src/TODO              |    6 +
+ unity/unity_window_decorator/src/actionmenu.c      |  109 ++
+ unity/unity_window_decorator/src/blurprops.c       |   68 +
+ unity/unity_window_decorator/src/cairo.c           | 1001 +++++++++++
+ unity/unity_window_decorator/src/config.h.gtk.in   |   25 +
+ unity/unity_window_decorator/src/decorator.c       |  882 +++++++++
+ unity/unity_window_decorator/src/decorprops.c      |  134 ++
+ unity/unity_window_decorator/src/events.c          | 1130 ++++++++++++
+ unity/unity_window_decorator/src/forcequit.c       |  176 ++
+ unity/unity_window_decorator/src/gdk.c             |   87 +
+ .../src/gtk-window-decorator.c                     |  414 +++++
+ .../src/gtk-window-decorator.h                     |  969 ++++++++++
+ unity/unity_window_decorator/src/gwd.schemas.in    |   81 +
+ unity/unity_window_decorator/src/metacity.c        | 1898 ++++++++++++++++++++
+ unity/unity_window_decorator/src/settings.c        |  564 ++++++
+ unity/unity_window_decorator/src/style.c           |   42 +
+ unity/unity_window_decorator/src/switcher.c        |  427 +++++
+ unity/unity_window_decorator/src/util.c            |  278 +++
+ unity/unity_window_decorator/src/wnck.c            |  687 +++++++
+ 28 files changed, 9576 insertions(+), 0 deletions(-)
+ create mode 100644 unity/unity_window_decorator/.gitignore
+ create mode 100644 unity/unity_window_decorator/AUTHORS
+ create mode 100644 unity/unity_window_decorator/CMakeLists.txt
+ create mode 100644 unity/unity_window_decorator/COPYING
+ create mode 100644 unity/unity_window_decorator/COPYING.GPL
+ create mode 100644 unity/unity_window_decorator/INSTALL
+ create mode 100644 unity/unity_window_decorator/NEWS
+ create mode 100644 unity/unity_window_decorator/README
+ create mode 100644 unity/unity_window_decorator/src/CMakeLists.txt
+ create mode 100644 unity/unity_window_decorator/src/TODO
+ create mode 100644 unity/unity_window_decorator/src/actionmenu.c
+ create mode 100644 unity/unity_window_decorator/src/blurprops.c
+ create mode 100644 unity/unity_window_decorator/src/cairo.c
+ create mode 100644 unity/unity_window_decorator/src/config.h.gtk.in
+ create mode 100644 unity/unity_window_decorator/src/decorator.c
+ create mode 100644 unity/unity_window_decorator/src/decorprops.c
+ create mode 100644 unity/unity_window_decorator/src/events.c
+ create mode 100644 unity/unity_window_decorator/src/forcequit.c
+ create mode 100644 unity/unity_window_decorator/src/gdk.c
+ create mode 100644 unity/unity_window_decorator/src/gtk-window-decorator.c
+ create mode 100644 unity/unity_window_decorator/src/gtk-window-decorator.h
+ create mode 100644 unity/unity_window_decorator/src/gwd.schemas.in
+ create mode 100644 unity/unity_window_decorator/src/metacity.c
+ create mode 100644 unity/unity_window_decorator/src/settings.c
+ create mode 100644 unity/unity_window_decorator/src/style.c
+ create mode 100644 unity/unity_window_decorator/src/switcher.c
+ create mode 100644 unity/unity_window_decorator/src/util.c
+ create mode 100644 unity/unity_window_decorator/src/wnck.c
+
+Index: compiz-0.9.4git20110322/CMakeLists.txt
+===================================================================
+--- compiz-0.9.4git20110322.orig/CMakeLists.txt	2011-03-22 16:46:56.000000000 +0800
++++ compiz-0.9.4git20110322/CMakeLists.txt	2011-03-23 11:45:03.602056472 +0800
+@@ -112,6 +112,7 @@
+ add_subdirectory (libdecoration)
+ add_subdirectory (gtk)
+ add_subdirectory (kde)
++add_subdirectory (unity/unity_window_decorator)
+ add_subdirectory (po)
+ add_subdirectory (metadata)
+ add_subdirectory (src)
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/.gitignore
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/.gitignore	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1 @@
++po/compiz.pot
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/AUTHORS
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/AUTHORS	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,29 @@
++compiz and the standard set of plugins are designed and written by
++
++David Reveman <davidr@xxxxxxxxxx>
++
++with additional functionality by
++
++Radek Doulik <rodo@xxxxxxxxxx> IO multiplexing
++Mirco Müller <macslow@xxxxxxxxxx> Skydome support in cube plugin
++Søren Sandmann <sandmann@xxxxxxxxxx> plane plugin
++Dan Winship <danw@xxxxxxxxxx> gconf-dump plugin
++Brian Paul <brian.paul@xxxxxxxxxxxxxxxxxxxx> Matrix functions
++
++and other contributions by
++
++Mike Cook <mcook@xxxxxxxxxx>
++Mike Dransfield <mike@xxxxxxxxxxxxxx>
++Diogo Ferreira <diogo@xxxxxxxxxxxx>
++gandalfn <gandalfn@xxxxxxxxxxxxxxxx>
++Guillaume <ixcemix@xxxxxxxxx>
++Kristian Høgsberg <krh@xxxxxxxxxx>
++Dennis Kasprzyk <onestone@xxxxxxxxxxxxxxxxx>
++Gerd Kohlberger <lowfi@xxxxxxxxx>
++Volker Krause <vkrause@xxxxxxx>
++moppsy <moppsy@xxxxxxxxxxx>
++Jeremy C. Reed <reed@xxxxxxxxxxxxx>
++Thierry Reding <thierry@xxxxxxxx>
++Julian Sikorski <lordzanon@xxxxxxxxxxxxxx>
++Quinn Storm <livinglatexkali@xxxxxxxxx>
++Erkin Bahceci <erkinbah@xxxxxxxxx>
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/CMakeLists.txt	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,38 @@
++project (unity-window-decorator)
++
++find_package (Compiz REQUIRED)
++
++include (CompizCommon)
++include (CompizPackage)
++
++set (CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRe" CACHE INTERNAL "" FORCE)
++if (NOT CMAKE_BUILD_TYPE)
++    set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE)
++endif (NOT CMAKE_BUILD_TYPE)
++
++# compiz package version number
++# An odd micro number indicates in-progress development.
++# An even micro number indicates a released version.
++set (COMPIZ_VERSION_MAJOR 0)
++set (COMPIZ_VERSION_MINOR 9)
++set (COMPIZ_VERSION_MICRO 2)
++set (COMPIZ_VERSION_MACRO 1)
++set (VERSION ${COMPIZ_VERSION_MAJOR}.${COMPIZ_VERSION_MINOR}.${COMPIZ_VERSION_MICRO}.${COMPIZ_VERSION_MACRO})
++
++option (BUILD_UNITY "Build Unity window decorator" 1)
++option (BUILD_METACITY "Unity-window-decorator metacity theme support" 1)
++
++compiz_set (USE_METACITY ${BUILD_METACITY})
++
++add_subdirectory (src)
++
++compiz_print_configure_header ("Compiz Unity Window Decorator")
++compiz_color_message ("\n${_escape}[4mFeatures:${_escape}[0m\n")
++
++compiz_print_result_message ("Metacity Theme Support" USE_METACITY)
++compiz_print_configure_footer ()
++
++compiz_add_uninstall ()
++compiz_package_generation ("Compiz Unity Window Decorator")
++
++
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/COPYING
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/COPYING	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,6 @@
++Most of the code is MIT licensed, some code is instead licensed
++under the LGPL and some under the GPL. Each source code file
++contain a header that describes the license for the code in that
++specific file.
++
++For More information see COPYING.GPL, COPYING.LGPL and COPYING.MIT.
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/COPYING.GPL
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/COPYING.GPL	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,340 @@
++		    GNU GENERAL PUBLIC LICENSE
++		       Version 2, June 1991
++
++ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
++     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ Everyone is permitted to copy and distribute verbatim copies
++ of this license document, but changing it is not allowed.
++
++			    Preamble
++
++  The licenses for most software are designed to take away your
++freedom to share and change it.  By contrast, the GNU General Public
++License is intended to guarantee your freedom to share and change free
++software--to make sure the software is free for all its users.  This
++General Public License applies to most of the Free Software
++Foundation's software and to any other program whose authors commit to
++using it.  (Some other Free Software Foundation software is covered by
++the GNU Library General Public License instead.)  You can apply it to
++your programs, too.
++
++  When we speak of free software, we are referring to freedom, not
++price.  Our General Public Licenses are designed to make sure that you
++have the freedom to distribute copies of free software (and charge for
++this service if you wish), that you receive source code or can get it
++if you want it, that you can change the software or use pieces of it
++in new free programs; and that you know you can do these things.
++
++  To protect your rights, we need to make restrictions that forbid
++anyone to deny you these rights or to ask you to surrender the rights.
++These restrictions translate to certain responsibilities for you if you
++distribute copies of the software, or if you modify it.
++
++  For example, if you distribute copies of such a program, whether
++gratis or for a fee, you must give the recipients all the rights that
++you have.  You must make sure that they, too, receive or can get the
++source code.  And you must show them these terms so they know their
++rights.
++
++  We protect your rights with two steps: (1) copyright the software, and
++(2) offer you this license which gives you legal permission to copy,
++distribute and/or modify the software.
++
++  Also, for each author's protection and ours, we want to make certain
++that everyone understands that there is no warranty for this free
++software.  If the software is modified by someone else and passed on, we
++want its recipients to know that what they have is not the original, so
++that any problems introduced by others will not reflect on the original
++authors' reputations.
++
++  Finally, any free program is threatened constantly by software
++patents.  We wish to avoid the danger that redistributors of a free
++program will individually obtain patent licenses, in effect making the
++program proprietary.  To prevent this, we have made it clear that any
++patent must be licensed for everyone's free use or not licensed at all.
++
++  The precise terms and conditions for copying, distribution and
++modification follow.
++
++		    GNU GENERAL PUBLIC LICENSE
++   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
++
++  0. This License applies to any program or other work which contains
++a notice placed by the copyright holder saying it may be distributed
++under the terms of this General Public License.  The "Program", below,
++refers to any such program or work, and a "work based on the Program"
++means either the Program or any derivative work under copyright law:
++that is to say, a work containing the Program or a portion of it,
++either verbatim or with modifications and/or translated into another
++language.  (Hereinafter, translation is included without limitation in
++the term "modification".)  Each licensee is addressed as "you".
++
++Activities other than copying, distribution and modification are not
++covered by this License; they are outside its scope.  The act of
++running the Program is not restricted, and the output from the Program
++is covered only if its contents constitute a work based on the
++Program (independent of having been made by running the Program).
++Whether that is true depends on what the Program does.
++
++  1. You may copy and distribute verbatim copies of the Program's
++source code as you receive it, in any medium, provided that you
++conspicuously and appropriately publish on each copy an appropriate
++copyright notice and disclaimer of warranty; keep intact all the
++notices that refer to this License and to the absence of any warranty;
++and give any other recipients of the Program a copy of this License
++along with the Program.
++
++You may charge a fee for the physical act of transferring a copy, and
++you may at your option offer warranty protection in exchange for a fee.
++
++  2. You may modify your copy or copies of the Program or any portion
++of it, thus forming a work based on the Program, and copy and
++distribute such modifications or work under the terms of Section 1
++above, provided that you also meet all of these conditions:
++
++    a) You must cause the modified files to carry prominent notices
++    stating that you changed the files and the date of any change.
++
++    b) You must cause any work that you distribute or publish, that in
++    whole or in part contains or is derived from the Program or any
++    part thereof, to be licensed as a whole at no charge to all third
++    parties under the terms of this License.
++
++    c) If the modified program normally reads commands interactively
++    when run, you must cause it, when started running for such
++    interactive use in the most ordinary way, to print or display an
++    announcement including an appropriate copyright notice and a
++    notice that there is no warranty (or else, saying that you provide
++    a warranty) and that users may redistribute the program under
++    these conditions, and telling the user how to view a copy of this
++    License.  (Exception: if the Program itself is interactive but
++    does not normally print such an announcement, your work based on
++    the Program is not required to print an announcement.)
++
++These requirements apply to the modified work as a whole.  If
++identifiable sections of that work are not derived from the Program,
++and can be reasonably considered independent and separate works in
++themselves, then this License, and its terms, do not apply to those
++sections when you distribute them as separate works.  But when you
++distribute the same sections as part of a whole which is a work based
++on the Program, the distribution of the whole must be on the terms of
++this License, whose permissions for other licensees extend to the
++entire whole, and thus to each and every part regardless of who wrote it.
++
++Thus, it is not the intent of this section to claim rights or contest
++your rights to work written entirely by you; rather, the intent is to
++exercise the right to control the distribution of derivative or
++collective works based on the Program.
++
++In addition, mere aggregation of another work not based on the Program
++with the Program (or with a work based on the Program) on a volume of
++a storage or distribution medium does not bring the other work under
++the scope of this License.
++
++  3. You may copy and distribute the Program (or a work based on it,
++under Section 2) in object code or executable form under the terms of
++Sections 1 and 2 above provided that you also do one of the following:
++
++    a) Accompany it with the complete corresponding machine-readable
++    source code, which must be distributed under the terms of Sections
++    1 and 2 above on a medium customarily used for software interchange; or,
++
++    b) Accompany it with a written offer, valid for at least three
++    years, to give any third party, for a charge no more than your
++    cost of physically performing source distribution, a complete
++    machine-readable copy of the corresponding source code, to be
++    distributed under the terms of Sections 1 and 2 above on a medium
++    customarily used for software interchange; or,
++
++    c) Accompany it with the information you received as to the offer
++    to distribute corresponding source code.  (This alternative is
++    allowed only for noncommercial distribution and only if you
++    received the program in object code or executable form with such
++    an offer, in accord with Subsection b above.)
++
++The source code for a work means the preferred form of the work for
++making modifications to it.  For an executable work, complete source
++code means all the source code for all modules it contains, plus any
++associated interface definition files, plus the scripts used to
++control compilation and installation of the executable.  However, as a
++special exception, the source code distributed need not include
++anything that is normally distributed (in either source or binary
++form) with the major components (compiler, kernel, and so on) of the
++operating system on which the executable runs, unless that component
++itself accompanies the executable.
++
++If distribution of executable or object code is made by offering
++access to copy from a designated place, then offering equivalent
++access to copy the source code from the same place counts as
++distribution of the source code, even though third parties are not
++compelled to copy the source along with the object code.
++
++  4. You may not copy, modify, sublicense, or distribute the Program
++except as expressly provided under this License.  Any attempt
++otherwise to copy, modify, sublicense or distribute the Program is
++void, and will automatically terminate your rights under this License.
++However, parties who have received copies, or rights, from you under
++this License will not have their licenses terminated so long as such
++parties remain in full compliance.
++
++  5. You are not required to accept this License, since you have not
++signed it.  However, nothing else grants you permission to modify or
++distribute the Program or its derivative works.  These actions are
++prohibited by law if you do not accept this License.  Therefore, by
++modifying or distributing the Program (or any work based on the
++Program), you indicate your acceptance of this License to do so, and
++all its terms and conditions for copying, distributing or modifying
++the Program or works based on it.
++
++  6. Each time you redistribute the Program (or any work based on the
++Program), the recipient automatically receives a license from the
++original licensor to copy, distribute or modify the Program subject to
++these terms and conditions.  You may not impose any further
++restrictions on the recipients' exercise of the rights granted herein.
++You are not responsible for enforcing compliance by third parties to
++this License.
++
++  7. If, as a consequence of a court judgment or allegation of patent
++infringement or for any other reason (not limited to patent issues),
++conditions are imposed on you (whether by court order, agreement or
++otherwise) that contradict the conditions of this License, they do not
++excuse you from the conditions of this License.  If you cannot
++distribute so as to satisfy simultaneously your obligations under this
++License and any other pertinent obligations, then as a consequence you
++may not distribute the Program at all.  For example, if a patent
++license would not permit royalty-free redistribution of the Program by
++all those who receive copies directly or indirectly through you, then
++the only way you could satisfy both it and this License would be to
++refrain entirely from distribution of the Program.
++
++If any portion of this section is held invalid or unenforceable under
++any particular circumstance, the balance of the section is intended to
++apply and the section as a whole is intended to apply in other
++circumstances.
++
++It is not the purpose of this section to induce you to infringe any
++patents or other property right claims or to contest validity of any
++such claims; this section has the sole purpose of protecting the
++integrity of the free software distribution system, which is
++implemented by public license practices.  Many people have made
++generous contributions to the wide range of software distributed
++through that system in reliance on consistent application of that
++system; it is up to the author/donor to decide if he or she is willing
++to distribute software through any other system and a licensee cannot
++impose that choice.
++
++This section is intended to make thoroughly clear what is believed to
++be a consequence of the rest of this License.
++
++  8. If the distribution and/or use of the Program is restricted in
++certain countries either by patents or by copyrighted interfaces, the
++original copyright holder who places the Program under this License
++may add an explicit geographical distribution limitation excluding
++those countries, so that distribution is permitted only in or among
++countries not thus excluded.  In such case, this License incorporates
++the limitation as if written in the body of this License.
++
++  9. The Free Software Foundation may publish revised and/or new versions
++of the General Public License from time to time.  Such new versions will
++be similar in spirit to the present version, but may differ in detail to
++address new problems or concerns.
++
++Each version is given a distinguishing version number.  If the Program
++specifies a version number of this License which applies to it and "any
++later version", you have the option of following the terms and conditions
++either of that version or of any later version published by the Free
++Software Foundation.  If the Program does not specify a version number of
++this License, you may choose any version ever published by the Free Software
++Foundation.
++
++  10. If you wish to incorporate parts of the Program into other free
++programs whose distribution conditions are different, write to the author
++to ask for permission.  For software which is copyrighted by the Free
++Software Foundation, write to the Free Software Foundation; we sometimes
++make exceptions for this.  Our decision will be guided by the two goals
++of preserving the free status of all derivatives of our free software and
++of promoting the sharing and reuse of software generally.
++
++			    NO WARRANTY
++
++  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
++FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
++OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
++PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
++OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
++MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
++TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
++PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
++REPAIR OR CORRECTION.
++
++  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
++REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
++INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
++OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
++TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
++YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
++PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
++POSSIBILITY OF SUCH DAMAGES.
++
++		     END OF TERMS AND CONDITIONS
++
++	    How to Apply These Terms to Your New Programs
++
++  If you develop a new program, and you want it to be of the greatest
++possible use to the public, the best way to achieve this is to make it
++free software which everyone can redistribute and change under these terms.
++
++  To do so, attach the following notices to the program.  It is safest
++to attach them to the start of each source file to most effectively
++convey the exclusion of warranty; and each file should have at least
++the "copyright" line and a pointer to where the full notice is found.
++
++    <one line to give the program's name and a brief idea of what it does.>
++    Copyright (C) <year>  <name of author>
++
++    This program is free software; you can redistribute it and/or modify
++    it under the terms of the GNU General Public License as published by
++    the Free Software Foundation; either version 2 of the License, or
++    (at your option) any later version.
++
++    This program is distributed in the hope that it will be useful,
++    but WITHOUT ANY WARRANTY; without even the implied warranty of
++    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++    GNU General Public License for more details.
++
++    You should have received a copy of the GNU General Public License
++    along with this program; if not, write to the Free Software
++    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++
++
++Also add information on how to contact you by electronic and paper mail.
++
++If the program is interactive, make it output a short notice like this
++when it starts in an interactive mode:
++
++    Gnomovision version 69, Copyright (C) year  name of author
++    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
++    This is free software, and you are welcome to redistribute it
++    under certain conditions; type `show c' for details.
++
++The hypothetical commands `show w' and `show c' should show the appropriate
++parts of the General Public License.  Of course, the commands you use may
++be called something other than `show w' and `show c'; they could even be
++mouse-clicks or menu items--whatever suits your program.
++
++You should also get your employer (if you work as a programmer) or your
++school, if any, to sign a "copyright disclaimer" for the program, if
++necessary.  Here is a sample; alter the names:
++
++  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
++  `Gnomovision' (which makes passes at compilers) written by James Hacker.
++
++  <signature of Ty Coon>, 1 April 1989
++  Ty Coon, President of Vice
++
++This General Public License does not permit incorporating your program into
++proprietary programs.  If your program is a subroutine library, you may
++consider it more useful to permit linking proprietary applications with the
++library.  If this is what you want to do, use the GNU Library General
++Public License instead of this License.
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/INSTALL
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/INSTALL	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,14 @@
++compiz uses libstartup-notification which is available at
++ftp://ftp.gnome.org/pub/GNOME/sources/startup-notification/
++
++compiz uses out-of-tree builds with cmake, in order to generate the Makefiles for compiz use:
++
++	$ mkdir build
++	$ cd build
++	$ cmake ..
++
++After that, standard build procedures apply:
++
++	$ make
++	# make install
++
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/README
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/README	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,8 @@
++compiz - OpenGL window and compositing manager
++
++Compiz is an OpenGL compositing manager that use GLX_EXT_texture_from_pixmap
++for binding redirected top-level windows to texture objects. It has a flexible
++plug-in system and it is designed to run well on most graphics hardware. 
++
++David Reveman
++davidr@xxxxxxxxxx
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/CMakeLists.txt	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,161 @@
++function (compiz_install_gconf_schema _src _dst)
++    pkg_check_modules (GCONF gconf-2.0)
++    find_program (GCONFTOOL_EXECUTABLE gconftool-2)
++    mark_as_advanced (FORCE GCONFTOOL_EXECUTABLE)
++
++    if (GCONFTOOL_EXECUTABLE AND NOT COMPIZ_DISABLE_SCHEMAS_INSTALL)
++	install (CODE "
++		if (\"\$ENV{USER}\" STREQUAL \"root\")
++		    exec_program (${GCONFTOOL_EXECUTABLE}
++			ARGS \"--get-default-source\"
++			OUTPUT_VARIABLE ENV{GCONF_CONFIG_SOURCE})
++		    exec_program (${GCONFTOOL_EXECUTABLE}
++			ARGS \"--makefile-install-rule ${_src} > /dev/null\")
++		else (\"\$ENV{USER}\" STREQUAL \"root\")
++		    exec_program (${GCONFTOOL_EXECUTABLE}
++			ARGS \"--install-schema-file=${_src} > /dev/null\")
++		endif (\"\$ENV{USER}\" STREQUAL \"root\")
++		")
++    endif ()
++    install (
++	FILES "${_src}"
++	DESTINATION "${COMPIZ_DESTDIR}${_dst}"
++    )
++endfunction ()
++
++set (USE_GCONF_UNITY_WINDOW_DECORATOR 1 CACHE BOOL "Install GConf schemas for Unity Window Decorator")
++
++if (BUILD_UNITY)
++
++    pkg_check_modules (UNITY_WINDOW_DECORATOR
++	gconf-2.0
++	xrender>=0.8.4
++	gtk+-2.0>=2.18.0
++	libwnck-1.0
++	pangocairo
++    )
++    if (UNITY_WINDOW_DECORATOR_FOUND)
++	include (CheckFunctionExists)
++        set (CMAKE_REQUIRED_FLAGS ${UNITY_WINDOW_DECORATOR_CFLAGS})
++        set (CMAKE_REQUIRED_LIBRARIES ${UNITY_WINDOW_DECORATOR_LIBRARIES})
++        list (FIND CMAKE_REQUIRED_FLAGS "-D_REENTRANT" REENTRANT_INDEX)
++        if (REENTRANT_INDEX)
++          list (REMOVE_AT CMAKE_REQUIRED_FLAGS REENTRANT_INDEX)
++          list (APPEND CMAKE_REQUIRED_FLAGS "-D_REENTRANT=1")
++        endif (REENTRANT_INDEX)
++        check_function_exists (wnck_window_has_name HAVE_WNCK_WINDOW_HAS_NAME)
++        set (CMAKE_REQUIRED_FLAGS "")
++        set (CMAKE_REQUIRED_LIBRARIES "")
++
++        compiz_pkg_check_modules (HAVE_LIBWNCK_2_18_1 libwnck-1.0>=2.18.1)
++        compiz_pkg_check_modules (HAVE_LIBWNCK_2_19_4 libwnck-1.0>=2.19.4)
++
++        if (BUILD_METACITY)
++            pkg_check_modules (METACITY libmetacity-private)
++            if (METACITY_FOUND)
++		compiz_pkg_check_modules (HAVE_METACITY_2_15_21 libmetacity-private>=2.15.21)
++		compiz_pkg_check_modules (HAVE_METACITY_2_17_0 libmetacity-private>=2.17.0)
++		compiz_pkg_check_modules (HAVE_METACITY_2_23_2 libmetacity-private>=2.23.2)
++            else (METACITY_FOUND)
++		compiz_set (USE_METACITY 0)
++            endif (METACITY_FOUND)
++        endif (BUILD_METACITY)
++
++	if (COMPIZ_BUILD_WITH_RPATH)
++	    set (CMAKE_INSTALL_RPATH ${libdir})
++	endif (COMPIZ_BUILD_WITH_RPATH)
++
++	configure_file (
++	    ${CMAKE_CURRENT_SOURCE_DIR}/config.h.gtk.in
++	    ${CMAKE_CURRENT_BINARY_DIR}/config.h
++	)
++
++	include_directories (
++        ${compiz_SOURCE_DIR}/include
++	    ${CMAKE_CURRENT_BINARY_DIR}
++	    ${UNITY_WINDOW_DECORATOR_INCLUDE_DIRS}
++	    ${METACITY_INCLUDE_DIRS}
++	    ${GCONF_INCLUDE_DIRS}
++	    ${DBUS_GLIB_INCLUDE_DIRS}
++	)
++
++	add_definitions (
++	    -DHAVE_CONFIG_H
++	    -DALL_LINGUAS=\"${ALL_LINGUAS}\"
++	    -DLOCALEDIR=\\\"${datadir}/locale\\\"
++	)
++
++	link_directories (
++	    ${UNITY_WINDOW_DECORATOR_LIBRARY_DIRS}
++	    ${COMPIZ_LINK_DIRS}
++	)
++
++	if (USE_GCONF_UNITY_WINDOW_DECORATOR)
++
++	    if (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
++		set (SCHEMADIR "${CMAKE_INSTALL_PREFIX}/share/gconf/schemas")
++	    else (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
++		set (SCHEMADIR "${COMPIZ_INSTALL_GCONF_SCHEMA_DIR}")
++	    endif (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
++
++	    set (gwd_schema ${CMAKE_CURRENT_BINARY_DIR}/gwd.schemas)
++
++	    compiz_translate_xml (
++	        ${CMAKE_CURRENT_SOURCE_DIR}/gwd.schemas.in
++	        ${gwd_schema}
++	    )
++
++	    compiz_install_gconf_schema (${CMAKE_CURRENT_BINARY_DIR}/gwd.schemas ${SCHEMADIR})
++
++	endif (USE_GCONF_UNITY_WINDOW_DECORATOR)
++
++	add_executable (unity-window-decorator
++			gtk-window-decorator.c
++			blurprops.c
++			decorprops.c
++			cairo.c
++			gdk.c
++			switcher.c
++			metacity.c
++			events.c
++			forcequit.c
++			actionmenu.c
++			settings.c
++			util.c
++			style.c
++			wnck.c
++			decorator.c
++			${gwd_schema}
++	)
++
++	if (USE_METACITY)
++	    set (metacitylibs ${METACITY_LIBRARIES})
++	endif (USE_METACITY)
++
++	set_target_properties (
++	    unity-window-decorator PROPERTIES
++	    INSTALL_RPATH_USE_LINK_PATH 0
++	)
++
++	target_link_libraries (unity-window-decorator
++				decoration
++				${UNITY_WINDOW_DECORATOR_LIBRARIES}
++				${GCONF_LIBRARIES}
++				${DBUS_GLIB_LIBRARIES}
++				${metacitylibs}
++	)
++
++	install (
++	    TARGETS unity-window-decorator
++	    DESTINATION ${COMPIZ_DESTDIR}${exec_prefix}
++	    RUNTIME DESTINATION bin
++	)
++
++    else (UNITY_WINDOW_DECORATOR_FOUND)
++	set (USE_UNITY 0)
++    endif (UNITY_WINDOW_DECORATOR_FOUND)
++
++endif (BUILD_UNITY)
++
++
++
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/TODO
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/TODO	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,6 @@
++
++* Plugin interface
++
++* Plugin with SVG-based theme support
++
++* Plugin that supports old metacity themes
+\ No newline at end of file
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/actionmenu.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/actionmenu.c	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,109 @@
++#include "gtk-window-decorator.h"
++
++static void
++action_menu_unmap (GObject *object)
++{
++    action_menu_mapped = FALSE;
++}
++
++static void
++position_action_menu (GtkMenu  *menu,
++		      gint     *x,
++		      gint     *y,
++		      gboolean *push_in,
++		      gpointer user_data)
++{
++    WnckWindow *win = (WnckWindow *) user_data;
++    decor_t    *d = g_object_get_data (G_OBJECT (win), "decor");
++    gint       bx, by, width, height;
++
++    wnck_window_get_client_window_geometry (win, x, y, &width, &height);
++
++    if ((*theme_get_button_position) (d, BUTTON_MENU, width, height,
++				      &bx, &by, &width, &height))
++	*x = *x - _win_extents.left + bx;
++
++    if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
++    {
++	GtkRequisition req;
++
++	gtk_widget_size_request (GTK_WIDGET (menu), &req);
++	*x = MAX (0, *x - req.width + width);
++    }
++
++    *push_in = TRUE;
++}
++
++void
++action_menu_map (WnckWindow *win,
++		 long	     button,
++		 Time	     time)
++{
++    GdkDisplay *gdkdisplay;
++    GdkScreen  *screen;
++
++    gdkdisplay = gdk_display_get_default ();
++    screen     = gdk_display_get_default_screen (gdkdisplay);
++
++    if (action_menu)
++    {
++	if (action_menu_mapped)
++	{
++	    gtk_widget_destroy (action_menu);
++	    action_menu_mapped = FALSE;
++	    action_menu = NULL;
++	    return;
++	}
++	else
++	    gtk_widget_destroy (action_menu);
++    }
++
++    switch (wnck_window_get_window_type (win)) {
++    case WNCK_WINDOW_DESKTOP:
++    case WNCK_WINDOW_DOCK:
++	/* don't allow window action */
++	return;
++    case WNCK_WINDOW_NORMAL:
++    case WNCK_WINDOW_DIALOG:
++
++#ifndef HAVE_LIBWNCK_2_19_4
++    case WNCK_WINDOW_MODAL_DIALOG:
++#endif
++
++    case WNCK_WINDOW_TOOLBAR:
++    case WNCK_WINDOW_MENU:
++    case WNCK_WINDOW_UTILITY:
++    case WNCK_WINDOW_SPLASHSCREEN:
++	/* allow window action menu */
++	break;
++    }
++
++    action_menu = wnck_create_window_action_menu (win);
++
++    gtk_menu_set_screen (GTK_MENU (action_menu), screen);
++
++    g_signal_connect_object (G_OBJECT (action_menu), "unmap",
++			     G_CALLBACK (action_menu_unmap),
++			     0, 0);
++
++    gtk_widget_show (action_menu);
++
++    if (!button || button == 1)
++    {
++	gtk_menu_popup (GTK_MENU (action_menu),
++			NULL, NULL,
++			position_action_menu, (gpointer) win,
++			button,
++			time);
++    }
++    else
++    {
++	gtk_menu_popup (GTK_MENU (action_menu),
++			NULL, NULL,
++			NULL, NULL,
++			button,
++			time);
++    }
++
++    action_menu_mapped = TRUE;
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/blurprops.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/blurprops.c	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,68 @@
++#include "gtk-window-decorator.h"
++
++void
++decor_update_blur_property (decor_t *d,
++			    int     width,
++			    int     height,
++			    Region  top_region,
++			    int     top_offset,
++			    Region  bottom_region,
++			    int     bottom_offset,
++			    Region  left_region,
++			    int     left_offset,
++			    Region  right_region,
++			    int     right_offset)
++{
++    Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    long    *data = NULL;
++    int     size = 0;
++    
++    if (blur_type != BLUR_TYPE_ALL)
++    {
++	bottom_region = NULL;
++	left_region   = NULL;
++	right_region  = NULL;
++	
++	if (blur_type != BLUR_TYPE_TITLEBAR)
++	    top_region = NULL;
++    }
++
++    if (top_region)
++	size += top_region->numRects;
++    if (bottom_region)
++	size += bottom_region->numRects;
++    if (left_region)
++	size += left_region->numRects;
++    if (right_region)
++	size += right_region->numRects;
++
++    if (size)
++	data = (long *) malloc (sizeof (long) * (2 + size * 6));
++
++    if (data)
++    {
++	decor_region_to_blur_property (data, 4, 0, width, height,
++				       top_region, top_offset,
++				       bottom_region, bottom_offset,
++				       left_region, left_offset,
++				       right_region, right_offset);
++
++	gdk_error_trap_push ();
++	XChangeProperty (xdisplay, d->prop_xid,
++			 win_blur_decor_atom,
++			 XA_INTEGER,
++			 32, PropModeReplace, (guchar *) data,
++			 2 + size * 6);
++	gdk_display_sync (gdk_display_get_default ());
++	gdk_error_trap_pop ();
++
++	free (data);
++    }
++    else
++    {
++	gdk_error_trap_push ();
++	XDeleteProperty (xdisplay, d->prop_xid, win_blur_decor_atom);
++	gdk_display_sync (gdk_display_get_default ());
++	gdk_error_trap_pop ();
++    }
++}
+\ No newline at end of file
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/cairo.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/cairo.c	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,1001 @@
++#include "gtk-window-decorator.h"
++
++void
++rounded_rectangle (cairo_t *cr,
++		   double  x,
++		   double  y,
++		   double  w,
++		   double  h,
++		   double  radius,
++		   int	   corner)
++{
++    if (corner & CORNER_TOPLEFT)
++	cairo_move_to (cr, x + radius, y);
++    else
++	cairo_move_to (cr, x, y);
++
++    if (corner & CORNER_TOPRIGHT)
++	cairo_arc (cr, x + w - radius, y + radius, radius,
++		   M_PI * 1.5, M_PI * 2.0);
++    else
++	cairo_line_to (cr, x + w, y);
++
++    if (corner & CORNER_BOTTOMRIGHT)
++	cairo_arc (cr, x + w - radius, y + h - radius, radius,
++		   0.0, M_PI * 0.5);
++    else
++	cairo_line_to (cr, x + w, y + h);
++
++    if (corner & CORNER_BOTTOMLEFT)
++	cairo_arc (cr, x + radius, y + h - radius, radius,
++		   M_PI * 0.5, M_PI);
++    else
++	cairo_line_to (cr, x, y + h);
++
++    if (corner & CORNER_TOPLEFT)
++	cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
++    else
++	cairo_line_to (cr, x, y);
++}
++
++void
++fill_rounded_rectangle (cairo_t       *cr,
++			double        x,
++			double        y,
++			double        w,
++			double        h,
++			double	      radius,
++			int	      corner,
++			decor_color_t *c0,
++			double        alpha0,
++			decor_color_t *c1,
++			double	      alpha1,
++			int	      gravity)
++{
++    cairo_pattern_t *pattern;
++
++    rounded_rectangle (cr, x, y, w, h, radius, corner);
++
++    if (gravity & SHADE_RIGHT)
++    {
++	x = x + w;
++	w = -w;
++    }
++    else if (!(gravity & SHADE_LEFT))
++    {
++	x = w = 0;
++    }
++
++    if (gravity & SHADE_BOTTOM)
++    {
++	y = y + h;
++	h = -h;
++    }
++    else if (!(gravity & SHADE_TOP))
++    {
++	y = h = 0;
++    }
++
++    if (w && h)
++    {
++	cairo_matrix_t matrix;
++
++	pattern = cairo_pattern_create_radial (0.0, 0.0, 0.0, 0.0, 0.0, w);
++
++	cairo_matrix_init_scale (&matrix, 1.0, w / h);
++	cairo_matrix_translate (&matrix, -(x + w), -(y + h));
++
++	cairo_pattern_set_matrix (pattern, &matrix);
++    }
++    else
++    {
++	pattern = cairo_pattern_create_linear (x + w, y + h, x, y);
++    }
++
++    cairo_pattern_add_color_stop_rgba (pattern, 0.0, c0->r, c0->g, c0->b,
++				       alpha0);
++
++    cairo_pattern_add_color_stop_rgba (pattern, 1.0, c1->r, c1->g, c1->b,
++				       alpha1);
++
++    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
++
++    cairo_set_source (cr, pattern);
++    cairo_fill (cr);
++    cairo_pattern_destroy (pattern);
++}
++
++void
++draw_shadow_background (decor_t		*d,
++			cairo_t		*cr,
++			decor_shadow_t  *s,
++			decor_context_t *c)
++{
++    Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++
++    if (!s || !s->picture ||!d->picture)
++    {
++	cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0);
++	cairo_paint (cr);
++    }
++    else
++    {
++	decor_fill_picture_extents_with_shadow (xdisplay,
++						s, c,
++						d->picture,
++						&d->border_layout);
++    }
++}
++
++static void
++draw_close_button (decor_t *d,
++		   cairo_t *cr,
++		   double  s)
++{
++    cairo_rel_move_to (cr, 0.0, s);
++
++    cairo_rel_line_to (cr, s, -s);
++    cairo_rel_line_to (cr, s, s);
++    cairo_rel_line_to (cr, s, -s);
++    cairo_rel_line_to (cr, s, s);
++
++    cairo_rel_line_to (cr, -s, s);
++    cairo_rel_line_to (cr, s, s);
++    cairo_rel_line_to (cr, -s, s);
++    cairo_rel_line_to (cr, -s, -s);
++
++    cairo_rel_line_to (cr, -s, s);
++    cairo_rel_line_to (cr, -s, -s);
++    cairo_rel_line_to (cr, s, -s);
++
++    cairo_close_path (cr);
++}
++
++static void
++draw_max_button (decor_t *d,
++		 cairo_t *cr,
++		 double  s)
++{
++    cairo_rel_line_to (cr, 12.0, 0.0);
++    cairo_rel_line_to (cr, 0.0, 12.0);
++    cairo_rel_line_to (cr, -12.0, 0.0);
++
++    cairo_close_path (cr);
++
++    cairo_rel_move_to (cr, 2.0, s);
++
++    cairo_rel_line_to (cr, 12.0 - 4.0, 0.0);
++    cairo_rel_line_to (cr, 0.0, 12.0 - s - 2.0);
++    cairo_rel_line_to (cr, -(12.0 - 4.0), 0.0);
++
++    cairo_close_path (cr);
++}
++
++static void
++draw_unmax_button (decor_t *d,
++		   cairo_t *cr,
++		   double  s)
++{
++    cairo_rel_move_to (cr, 1.0, 1.0);
++
++    cairo_rel_line_to (cr, 10.0, 0.0);
++    cairo_rel_line_to (cr, 0.0, 10.0);
++    cairo_rel_line_to (cr, -10.0, 0.0);
++
++    cairo_close_path (cr);
++
++    cairo_rel_move_to (cr, 2.0, s);
++
++    cairo_rel_line_to (cr, 10.0 - 4.0, 0.0);
++    cairo_rel_line_to (cr, 0.0, 10.0 - s - 2.0);
++    cairo_rel_line_to (cr, -(10.0 - 4.0), 0.0);
++
++    cairo_close_path (cr);
++}
++
++static void
++draw_min_button (decor_t *d,
++		 cairo_t *cr,
++		 double  s)
++{
++    cairo_rel_move_to (cr, 0.0, 8.0);
++
++    cairo_rel_line_to (cr, 12.0, 0.0);
++    cairo_rel_line_to (cr, 0.0, s);
++    cairo_rel_line_to (cr, -12.0, 0.0);
++
++    cairo_close_path (cr);
++}
++
++typedef void (*draw_proc) (cairo_t *cr);
++
++static void
++button_state_offsets (gdouble x,
++		      gdouble y,
++		      guint   state,
++		      gdouble *return_x,
++		      gdouble *return_y)
++{
++    static double off[]	= { 0.0, 0.0, 0.0, 0.5 };
++
++    *return_x  = x + off[state];
++    *return_y  = y + off[state];
++}
++
++static void
++button_state_paint (cairo_t	  *cr,
++		    GtkStyle	  *style,
++		    decor_color_t *color,
++		    guint	  state)
++{
++
++#define IN_STATE (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW)
++
++    if ((state & IN_STATE) == IN_STATE)
++    {
++	if (state & IN_EVENT_WINDOW)
++	    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
++	else
++	    cairo_set_source_rgba (cr, color->r, color->g, color->b, 0.95);
++
++	cairo_fill_preserve (cr);
++
++	gdk_cairo_set_source_color_alpha (cr,
++					  &style->fg[GTK_STATE_NORMAL],
++					  STROKE_ALPHA);
++
++	cairo_set_line_width (cr, 1.0);
++	cairo_stroke (cr);
++	cairo_set_line_width (cr, 2.0);
++    }
++    else
++    {
++	gdk_cairo_set_source_color_alpha (cr,
++					  &style->fg[GTK_STATE_NORMAL],
++					  STROKE_ALPHA);
++	cairo_stroke_preserve (cr);
++
++	if (state & IN_EVENT_WINDOW)
++	    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
++	else
++	    cairo_set_source_rgba (cr, color->r, color->g, color->b, 0.95);
++
++	cairo_fill (cr);
++    }
++}
++
++void
++draw_window_decoration (decor_t *d)
++{
++    cairo_t       *cr;
++    GtkStyle	  *style;
++    GdkDrawable   *drawable;
++    decor_color_t color;
++    double        alpha;
++    double        x1, y1, x2, y2, x, y, h;
++    int		  corners = SHADE_LEFT | SHADE_RIGHT | SHADE_TOP | SHADE_BOTTOM;
++    int		  top;
++    int		  button_x;
++
++    if (!d->pixmap)
++	return;
++
++    style = gtk_widget_get_style (style_window_rgba);
++
++    if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
++		    WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
++	corners = 0;
++
++    color.r = style->bg[GTK_STATE_NORMAL].red   / 65535.0;
++    color.g = style->bg[GTK_STATE_NORMAL].green / 65535.0;
++    color.b = style->bg[GTK_STATE_NORMAL].blue  / 65535.0;
++
++    if (d->frame_window)
++    {
++	GdkColormap *cmap;
++
++	cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap));
++	gdk_drawable_set_colormap (GDK_DRAWABLE (d->pixmap), cmap);
++	gdk_drawable_set_colormap (GDK_DRAWABLE (d->buffer_pixmap), cmap);
++	drawable = GDK_DRAWABLE (d->buffer_pixmap);
++    }
++    else if (d->buffer_pixmap)
++	drawable = GDK_DRAWABLE (d->buffer_pixmap);
++    else
++	drawable = GDK_DRAWABLE (d->pixmap);
++
++    cr = gdk_cairo_create (GDK_DRAWABLE (drawable));
++    if (!cr)
++	return;
++
++    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++
++    top = _win_extents.top + titlebar_height;
++
++    x1 = d->context->left_space - _win_extents.left;
++    y1 = d->context->top_space - _win_extents.top - titlebar_height;
++    x2 = d->width - d->context->right_space + _win_extents.right;
++    y2 = d->height - d->context->bottom_space + _win_extents.bottom;
++
++    h = d->height - d->context->top_space - d->context->bottom_space;
++
++    cairo_set_line_width (cr, 1.0);
++
++    if (!d->frame_window)
++	draw_shadow_background (d, cr, d->shadow, d->context);
++
++    if (d->active)
++    {
++	decor_color_t *title_color = _title_color;
++
++	alpha = decoration_alpha + 0.3;
++
++	fill_rounded_rectangle (cr,
++				x1 + 0.5,
++				y1 + 0.5,
++				_win_extents.left - 0.5,
++				top - 0.5,
++				5.0, CORNER_TOPLEFT & corners,
++				&title_color[0], 1.0, &title_color[1], alpha,
++				SHADE_TOP | SHADE_LEFT);
++
++	fill_rounded_rectangle (cr,
++				x1 + _win_extents.left,
++				y1 + 0.5,
++				x2 - x1 - _win_extents.left -
++				_win_extents.right,
++				top - 0.5,
++				5.0, 0,
++				&title_color[0], 1.0, &title_color[1], alpha,
++				SHADE_TOP);
++
++	fill_rounded_rectangle (cr,
++				x2 - _win_extents.right,
++				y1 + 0.5,
++				_win_extents.right - 0.5,
++				top - 0.5,
++				5.0, CORNER_TOPRIGHT & corners,
++				&title_color[0], 1.0, &title_color[1], alpha,
++				SHADE_TOP | SHADE_RIGHT);
++    }
++    else
++    {
++	alpha = decoration_alpha;
++
++	fill_rounded_rectangle (cr,
++				x1 + 0.5,
++				y1 + 0.5,
++				_win_extents.left - 0.5,
++				top - 0.5,
++				5.0, CORNER_TOPLEFT & corners,
++				&color, 1.0, &color, alpha,
++				SHADE_TOP | SHADE_LEFT);
++
++	fill_rounded_rectangle (cr,
++				x1 + _win_extents.left,
++				y1 + 0.5,
++				x2 - x1 - _win_extents.left -
++				_win_extents.right,
++				top - 0.5,
++				5.0, 0,
++				&color, 1.0, &color, alpha,
++				SHADE_TOP);
++
++	fill_rounded_rectangle (cr,
++				x2 - _win_extents.right,
++				y1 + 0.5,
++				_win_extents.right - 0.5,
++				top - 0.5,
++				5.0, CORNER_TOPRIGHT & corners,
++				&color, 1.0, &color, alpha,
++				SHADE_TOP | SHADE_RIGHT);
++    }
++
++    fill_rounded_rectangle (cr,
++			    x1 + 0.5,
++			    y1 + top,
++			    _win_extents.left - 0.5,
++			    h,
++			    5.0, 0,
++			    &color, 1.0, &color, alpha,
++			    SHADE_LEFT);
++
++    fill_rounded_rectangle (cr,
++			    x2 - _win_extents.right,
++			    y1 + top,
++			    _win_extents.right - 0.5,
++			    h,
++			    5.0, 0,
++			    &color, 1.0, &color, alpha,
++			    SHADE_RIGHT);
++
++
++    fill_rounded_rectangle (cr,
++			    x1 + 0.5,
++			    y2 - _win_extents.bottom,
++			    _win_extents.left - 0.5,
++			    _win_extents.bottom - 0.5,
++			    5.0, CORNER_BOTTOMLEFT & corners,
++			    &color, 1.0, &color, alpha,
++			    SHADE_BOTTOM | SHADE_LEFT);
++
++    fill_rounded_rectangle (cr,
++			    x1 + _win_extents.left,
++			    y2 - _win_extents.bottom,
++			    x2 - x1 - _win_extents.left -
++			    _win_extents.right,
++			    _win_extents.bottom - 0.5,
++			    5.0, 0,
++			    &color, 1.0, &color, alpha,
++			    SHADE_BOTTOM);
++
++    fill_rounded_rectangle (cr,
++			    x2 - _win_extents.right,
++			    y2 - _win_extents.bottom,
++			    _win_extents.right - 0.5,
++			    _win_extents.bottom - 0.5,
++			    5.0, CORNER_BOTTOMRIGHT & corners,
++			    &color, 1.0, &color, alpha,
++			    SHADE_BOTTOM | SHADE_RIGHT);
++
++    cairo_rectangle (cr,
++		     d->context->left_space,
++		     d->context->top_space,
++		     d->width - d->context->left_space -
++		     d->context->right_space,
++		     h);
++    gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
++    cairo_fill (cr);
++
++    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
++
++    if (d->active)
++    {
++	gdk_cairo_set_source_color_alpha (cr,
++					  &style->fg[GTK_STATE_NORMAL],
++					  0.7);
++
++	cairo_move_to (cr, x1 + 0.5, y1 + top - 0.5);
++	cairo_rel_line_to (cr, x2 - x1 - 1.0, 0.0);
++
++	cairo_stroke (cr);
++    }
++
++    rounded_rectangle (cr,
++		       x1 + 0.5, y1 + 0.5,
++		       x2 - x1 - 1.0, y2 - y1 - 1.0,
++		       5.0,
++		       (CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT |
++			CORNER_BOTTOMRIGHT) & corners);
++
++    cairo_clip (cr);
++
++    cairo_translate (cr, 1.0, 1.0);
++
++    rounded_rectangle (cr,
++		       x1 + 0.5, y1 + 0.5,
++		       x2 - x1 - 1.0, y2 - y1 - 1.0,
++		       5.0,
++		       (CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT |
++			CORNER_BOTTOMRIGHT) & corners);
++
++    cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.4);
++
++    cairo_stroke (cr);
++
++    cairo_translate (cr, -2.0, -2.0);
++
++    rounded_rectangle (cr,
++		       x1 + 0.5, y1 + 0.5,
++		       x2 - x1 - 1.0, y2 - y1 - 1.0,
++		       5.0,
++		       (CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT |
++			CORNER_BOTTOMRIGHT) & corners);
++
++    cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.1);
++
++    cairo_stroke (cr);
++
++    cairo_translate (cr, 1.0, 1.0);
++
++    cairo_reset_clip (cr);
++
++    rounded_rectangle (cr,
++		       x1 + 0.5, y1 + 0.5,
++		       x2 - x1 - 1.0, y2 - y1 - 1.0,
++		       5.0,
++		       (CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT |
++			CORNER_BOTTOMRIGHT) & corners);
++
++    gdk_cairo_set_source_color_alpha (cr,
++				      &style->fg[GTK_STATE_NORMAL],
++				      alpha);
++
++    cairo_stroke (cr);
++
++    cairo_set_line_width (cr, 2.0);
++
++    button_x = d->width - d->context->right_space - 13;
++
++    if (d->actions & WNCK_WINDOW_ACTION_CLOSE)
++    {
++	button_state_offsets (button_x,
++			      y1 - 3.0 + titlebar_height / 2,
++			      d->button_states[BUTTON_CLOSE], &x, &y);
++
++	button_x -= 17;
++
++	if (d->active)
++	{
++	    cairo_move_to (cr, x, y);
++	    draw_close_button (d, cr, 3.0);
++	    button_state_paint (cr, style, &color,
++				d->button_states[BUTTON_CLOSE]);
++	}
++	else
++	{
++	    gdk_cairo_set_source_color_alpha (cr,
++					      &style->fg[GTK_STATE_NORMAL],
++					      alpha * 0.75);
++
++	    cairo_move_to (cr, x, y);
++	    draw_close_button (d, cr, 3.0);
++	    cairo_fill (cr);
++	}
++    }
++
++    if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE)
++    {
++	button_state_offsets (button_x,
++			      y1 - 3.0 + titlebar_height / 2,
++			      d->button_states[BUTTON_MAX], &x, &y);
++
++	button_x -= 17;
++
++	cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
++
++	if (d->active)
++	{
++	    gdk_cairo_set_source_color_alpha (cr,
++					      &style->fg[GTK_STATE_NORMAL],
++					      STROKE_ALPHA);
++
++	    cairo_move_to (cr, x, y);
++
++	    if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
++			    WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
++		draw_unmax_button (d, cr, 4.0);
++	    else
++		draw_max_button (d, cr, 4.0);
++
++	    button_state_paint (cr, style, &color,
++				d->button_states[BUTTON_MAX]);
++	}
++	else
++	{
++	    gdk_cairo_set_source_color_alpha (cr,
++					      &style->fg[GTK_STATE_NORMAL],
++					      alpha * 0.75);
++
++	    cairo_move_to (cr, x, y);
++
++	    if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
++			    WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
++		draw_unmax_button (d, cr, 4.0);
++	    else
++		draw_max_button (d, cr, 4.0);
++
++	    cairo_fill (cr);
++	}
++    }
++
++    if (d->actions & WNCK_WINDOW_ACTION_MINIMIZE)
++    {
++	button_state_offsets (button_x,
++			      y1 - 3.0 + titlebar_height / 2,
++			      d->button_states[BUTTON_MIN], &x, &y);
++
++	button_x -= 17;
++
++	if (d->active)
++	{
++	    gdk_cairo_set_source_color_alpha (cr,
++					      &style->fg[GTK_STATE_NORMAL],
++					      STROKE_ALPHA);
++
++
++	    cairo_move_to (cr, x, y);
++	    draw_min_button (d, cr, 4.0);
++	    button_state_paint (cr, style, &color,
++				d->button_states[BUTTON_MIN]);
++	}
++	else
++	{
++	    gdk_cairo_set_source_color_alpha (cr,
++					      &style->fg[GTK_STATE_NORMAL],
++					      alpha * 0.75);
++
++	    cairo_move_to (cr, x, y);
++	    draw_min_button (d, cr, 4.0);
++	    cairo_fill (cr);
++	}
++    }
++
++    if (d->layout)
++    {
++	if (d->active)
++	{
++	    cairo_move_to (cr,
++			   d->context->left_space + 21.0,
++			   y1 + 2.0 + (titlebar_height - text_height) / 2.0);
++
++	    gdk_cairo_set_source_color_alpha (cr,
++					      &style->fg[GTK_STATE_NORMAL],
++					      STROKE_ALPHA);
++
++	    pango_cairo_layout_path (cr, d->layout);
++	    cairo_stroke (cr);
++
++	    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
++	}
++	else
++	{
++	    gdk_cairo_set_source_color_alpha (cr,
++					      &style->fg[GTK_STATE_NORMAL],
++					      alpha);
++	}
++
++	cairo_move_to (cr,
++		       d->context->left_space + 21.0,
++		       y1 + 2.0 + (titlebar_height - text_height) / 2.0);
++
++	pango_cairo_show_layout (cr, d->layout);
++    }
++
++    if (d->icon)
++    {
++	cairo_translate (cr, d->context->left_space + 1,
++			 y1 - 5.0 + titlebar_height / 2);
++	cairo_set_source (cr, d->icon);
++	cairo_rectangle (cr, 0.0, 0.0, 16.0, 16.0);
++	cairo_clip (cr);
++
++	if (d->active)
++	    cairo_paint (cr);
++	else
++	    cairo_paint_with_alpha (cr, alpha);
++    }
++
++    cairo_destroy (cr);
++
++    copy_to_front_buffer (d);
++
++    if (d->frame_window)
++    {
++	GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window);
++
++	gtk_image_set_from_pixmap (GTK_IMAGE (d->decor_image), d->pixmap, NULL);
++	gtk_window_resize (GTK_WINDOW (d->decor_window), d->width, d->height);
++	gdk_window_move (gdk_frame_window, 0, 0);
++	gdk_window_lower (gdk_frame_window);
++    }
++
++    if (d->prop_xid)
++    {
++	decor_update_window_property (d);
++	d->prop_xid = 0;
++    }
++}
++
++static void
++calc_button_size (decor_t *d)
++{
++    gint button_width;
++
++    button_width = 0;
++
++    if (d->actions & WNCK_WINDOW_ACTION_CLOSE)
++	button_width += 17;
++
++    if (d->actions & (WNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY   |
++		      WNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY     |
++		      WNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY |
++		      WNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY))
++	button_width += 17;
++
++    if (d->actions & (WNCK_WINDOW_ACTION_MINIMIZE |
++		      WNCK_WINDOW_ACTION_MINIMIZE))
++	button_width += 17;
++
++    if (button_width)
++	button_width++;
++
++    d->button_width = button_width;
++}
++
++gboolean
++calc_decoration_size (decor_t *d,
++		      gint    w,
++		      gint    h,
++		      gint    name_width,
++		      gint    *width,
++		      gint    *height)
++{
++    decor_layout_t layout;
++    int		   top_width;
++
++    /* To avoid wasting texture memory, we only calculate the minimal
++     * required decoration size then clip and stretch the texture where
++     * appropriate
++     */
++
++    if (!d->frame_window)
++    {
++	calc_button_size (d);
++
++	if (w < ICON_SPACE + d->button_width)
++	    return FALSE;
++
++	top_width = name_width + d->button_width + ICON_SPACE;
++	if (w < top_width)
++	    top_width = MAX (ICON_SPACE + d->button_width, w);
++
++	if (d->active)
++	    decor_get_default_layout (&window_active_context, top_width, 1, &layout);
++	else
++	    decor_get_default_layout (&window_inactive_context, top_width, 1, &layout);
++
++	if (!d->context || memcmp (&layout, &d->border_layout, sizeof (layout)))
++	{
++	    *width  = layout.width;
++	    *height = layout.height;
++
++	    d->border_layout = layout;
++	    if (d->active)
++	    {
++		d->context	 = &window_active_context;
++		d->shadow        = border_active_shadow;
++	    }
++	    else
++	    {
++		d->context	 = &window_inactive_context;
++		d->shadow	 = border_inactive_shadow;
++	    }
++
++	    return TRUE;
++	}
++    }
++    else
++    {
++	calc_button_size (d);
++
++	/* _default_win_extents + top height */
++
++	top_width = name_width + d->button_width + ICON_SPACE;
++	if (w < top_width)
++	    top_width = MAX (ICON_SPACE + d->button_width, w);
++
++	decor_get_default_layout (&window_context_no_shadow,
++				  d->client_width, d->client_height, &layout);
++
++	*width = layout.width;
++	*height = layout.height;
++
++	d->border_layout = layout;
++	d->context = &window_context_no_shadow;
++	d->shadow = border_no_shadow;
++
++	return TRUE;
++    }
++
++    return FALSE;
++}
++
++gboolean
++get_button_position (decor_t *d,
++		     gint    i,
++		     gint    width,
++		     gint    height,
++		     gint    *x,
++		     gint    *y,
++		     gint    *w,
++		     gint    *h)
++{
++    if (i > BUTTON_MENU)
++	return FALSE;
++
++    if (d->frame_window)
++    {
++	*x = bpos[i].x + bpos[i].xw * width + _win_extents.left + 4;
++	*y = bpos[i].y + bpos[i].yh * height + bpos[i].yth *
++	    (titlebar_height - 17) + _win_extents.top + 2;
++    }
++    else
++    {
++	*x = bpos[i].x + bpos[i].xw * width;
++	*y = bpos[i].y + bpos[i].yh * height + bpos[i].yth *
++	    (titlebar_height - 17);
++    }
++
++    *w = bpos[i].w + bpos[i].ww * width;
++    *h = bpos[i].h + bpos[i].hh * height + bpos[i].hth +
++	(titlebar_height - 17);
++
++    /* hack to position multiple buttons on the right */
++    if (i != BUTTON_MENU)
++	*x -= 10 + 16 * i;
++
++    return TRUE;
++}
++
++void
++get_event_window_position (decor_t *d,
++			   gint    i,
++			   gint    j,
++			   gint    width,
++			   gint    height,
++			   gint    *x,
++			   gint    *y,
++			   gint    *w,
++			   gint    *h)
++{
++    if (d->frame_window)
++    {
++	*x = pos[i][j].x + pos[i][j].xw * width + _win_extents.left;
++	*y = pos[i][j].y + _win_extents.top +
++	     pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17);
++
++	if (i == 0 && (j == 0 || j == 2))
++	    *y -= titlebar_height;
++    }
++    else
++    {
++	*x = pos[i][j].x + pos[i][j].xw * width;
++	*y = pos[i][j].y +
++	     pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17);
++    }
++
++    if ((d->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY) &&
++	(j == 0 || j == 2))
++    {
++	*w = 0;
++    }
++    else
++    {
++	*w = pos[i][j].w + pos[i][j].ww * width;
++    }
++
++    if ((d->state & WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY) &&
++	(i == 0 || i == 2))
++    {
++	*h = 0;
++    }
++    else
++    {
++	*h = pos[i][j].h +
++	     pos[i][j].hh * height + pos[i][j].hth * (titlebar_height - 17);
++    }
++}
++
++void
++update_border_extents (gint text_height)
++{
++    _win_extents = _default_win_extents;
++    _max_win_extents = _default_win_extents;
++    max_titlebar_height = titlebar_height =
++	(text_height < 17) ? 17 : text_height;
++}
++
++decor_shadow_t *
++cairo_update_shadow (gint shadow_type)
++{
++    decor_shadow_options_t opt_active_shadow;
++    decor_shadow_options_t opt_inactive_shadow;
++    Display		   *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    GdkDisplay		   *display = gdk_display_get_default ();
++    GdkScreen		   *screen = gdk_display_get_default_screen (display);
++
++    opt_active_shadow.shadow_radius  = shadow_radius;
++    opt_active_shadow.shadow_opacity = shadow_opacity;
++
++    memcpy (opt_active_shadow.shadow_color, shadow_color, sizeof (shadow_color));
++
++    opt_active_shadow.shadow_offset_x = shadow_offset_x;
++    opt_active_shadow.shadow_offset_y = shadow_offset_y;
++
++    opt_inactive_shadow.shadow_radius  = shadow_radius;
++    opt_inactive_shadow.shadow_opacity = shadow_opacity;
++
++    opt_inactive_shadow.shadow_offset_x = shadow_offset_x;
++    opt_inactive_shadow.shadow_offset_y = shadow_offset_y;
++
++    memcpy (opt_inactive_shadow.shadow_color, shadow_color, sizeof (shadow_color));
++
++    switch (shadow_type)
++    {
++	case SHADOW_TYPE_ACTIVE_NORMAL:
++	    return decor_shadow_create (xdisplay,
++					gdk_x11_screen_get_xscreen (screen),
++					1, 1,
++					_win_extents.left,
++					_win_extents.right,
++					_win_extents.top + titlebar_height,
++					_win_extents.bottom,
++					_win_extents.left -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.right -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.top + titlebar_height -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.bottom -
++					TRANSLUCENT_CORNER_SIZE,
++					&opt_active_shadow,
++					&window_active_context,
++					draw_border_shape,
++					0);
++	    break;
++	case SHADOW_TYPE_INACTIVE_NORMAL:
++	    return decor_shadow_create (xdisplay,
++					gdk_x11_screen_get_xscreen (screen),
++					1, 1,
++					_win_extents.left,
++					_win_extents.right,
++					_win_extents.top + titlebar_height,
++					_win_extents.bottom,
++					_win_extents.left -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.right -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.top + titlebar_height -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.bottom -
++					TRANSLUCENT_CORNER_SIZE,
++					&opt_inactive_shadow,
++					&window_inactive_context,
++					draw_border_shape,
++					0);
++	case SHADOW_TYPE_ACTIVE_MAX:
++	    return decor_shadow_create (xdisplay,
++					gdk_x11_screen_get_xscreen (screen),
++					1, 1,
++					_max_win_extents.left,
++					_max_win_extents.right,
++					_max_win_extents.top + max_titlebar_height,
++					_max_win_extents.bottom,
++					_max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.top + max_titlebar_height -
++					TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
++					&opt_active_shadow,
++					&max_window_active_context,
++					draw_border_shape,
++					(void *) 1);
++	case SHADOW_TYPE_INACTIVE_MAX:
++	    return decor_shadow_create (xdisplay,
++					gdk_x11_screen_get_xscreen (screen),
++					1, 1,
++					_max_win_extents.left,
++					_max_win_extents.right,
++					_max_win_extents.top + max_titlebar_height,
++					_max_win_extents.bottom,
++					_max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.top + max_titlebar_height -
++					TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
++					&opt_inactive_shadow,
++					&max_window_inactive_context,
++					draw_border_shape,
++					(void *) 1);
++	default:
++	    return NULL;
++    }
++
++    return NULL;
++}
++
++void
++get_shadow (decor_t *d, gint shadow_type)
++{
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/config.h.gtk.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/config.h.gtk.in	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,25 @@
++/* Define to 1 if Metacity support is enabled */
++#cmakedefine USE_METACITY 1
++
++/* Define to 1 if Gconf support is enabled */
++#cmakedefine USE_GCONF_UNITY_WINDOW_DECORATOR 1
++
++/* Define to 1 if you have the `wnck_window_has_name' function. */
++#cmakedefine HAVE_WNCK_WINDOW_HAS_NAME 1
++
++/* Define to 1 if libwnck version >= 2_18_1 */
++#cmakedefine HAVE_LIBWNCK_2_18_1 1
++
++/* Define to 1 if libwnck version >= 2_19_4 */
++#cmakedefine HAVE_LIBWNCK_2_19_4 1
++
++/* Define to 1 if metacity version >= 2.15.21 */
++#cmakedefine HAVE_METACITY_2_15_21 1
++
++/* Define to 1 if metacity version >= 2.17.0 */
++#cmakedefine HAVE_METACITY_2_17_0 1
++
++/* Define to 1 if metacity version >= 2.23.2 */
++#cmakedefine HAVE_METACITY_2_23_2 1
++
++#define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}"
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/decorator.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/decorator.c	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,870 @@
++#include "gtk-window-decorator.h"
++
++static const PangoFontDescription *
++get_titlebar_font (void)
++{
++    if (use_system_font)
++    {
++	return NULL;
++    }
++    else
++	return titlebar_font;
++}
++
++void
++update_titlebar_font (void)
++{
++    const PangoFontDescription *font_desc;
++    PangoFontMetrics	       *metrics;
++    PangoLanguage	       *lang;
++
++    font_desc = get_titlebar_font ();
++    if (!font_desc)
++    {
++	GtkStyle *default_style;
++
++	default_style = gtk_widget_get_default_style ();
++	font_desc = default_style->font_desc;
++    }
++
++    pango_context_set_font_description (pango_context, font_desc);
++
++    lang    = pango_context_get_language (pango_context);
++    metrics = pango_context_get_metrics (pango_context, font_desc, lang);
++
++    text_height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
++				pango_font_metrics_get_descent (metrics));
++
++    pango_font_metrics_unref (metrics);
++}
++
++void
++update_event_windows (WnckWindow *win)
++{
++    Display *xdisplay;
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    gint    x0, y0, width, height, x, y, w, h;
++    gint    i, j, k, l;
++    gint    actions = d->actions;
++
++    xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++
++    wnck_window_get_client_window_geometry (win, &x0, &y0, &width, &height);
++
++    if (d->state & WNCK_WINDOW_STATE_SHADED)
++    {
++	height = 0;
++	k = l = 1;
++    }
++    else
++    {
++	k = 0;
++	l = 2;
++    }
++
++    gdk_error_trap_push ();
++
++    for (i = 0; i < 3; i++)
++    {
++	static guint event_window_actions[3][3] = {
++	    {
++		WNCK_WINDOW_ACTION_RESIZE,
++		WNCK_WINDOW_ACTION_RESIZE,
++		WNCK_WINDOW_ACTION_RESIZE
++	    }, {
++		WNCK_WINDOW_ACTION_RESIZE,
++		WNCK_WINDOW_ACTION_MOVE,
++		WNCK_WINDOW_ACTION_RESIZE
++	    }, {
++		WNCK_WINDOW_ACTION_RESIZE,
++		WNCK_WINDOW_ACTION_RESIZE,
++		WNCK_WINDOW_ACTION_RESIZE
++	    }
++	};
++
++	for (j = 0; j < 3; j++)
++	{
++	    w = 0;
++	    h = 0;
++
++	    if (actions & event_window_actions[i][j] && i >= k && i <= l)
++		(*theme_get_event_window_position) (d, i, j, width, height,
++						    &x, &y, &w, &h);
++
++	    if (d->frame_window)
++	    {
++		BoxPtr box = &d->event_windows[i][j].pos;
++		box->x1  = x;
++		box->x2 = x + w;
++		box->y1 = y;
++		box->y2 = y + h;
++	    }
++	    else if (!d->frame_window && w != 0 && h != 0)
++	    {
++		XMapWindow (xdisplay, d->event_windows[i][j].window);
++		XMoveResizeWindow (xdisplay, d->event_windows[i][j].window,
++				   x, y, w, h);
++	    }
++	    else if (!d->frame_window)
++	    {
++		XUnmapWindow (xdisplay, d->event_windows[i][j].window);
++	    }
++	}
++    }
++
++    /* no button event windows if width is less than minimum width */
++    if (width < ICON_SPACE + d->button_width)
++	actions = 0;
++
++    for (i = 0; i < BUTTON_NUM; i++)
++    {
++	static guint button_actions[BUTTON_NUM] = {
++	    WNCK_WINDOW_ACTION_CLOSE,
++	    WNCK_WINDOW_ACTION_MAXIMIZE,
++	    WNCK_WINDOW_ACTION_MINIMIZE,
++	    0,
++	    WNCK_WINDOW_ACTION_SHADE,
++
++#ifdef HAVE_LIBWNCK_2_18_1
++	    WNCK_WINDOW_ACTION_ABOVE,
++	    WNCK_WINDOW_ACTION_STICK,
++	    WNCK_WINDOW_ACTION_UNSHADE,
++	    WNCK_WINDOW_ACTION_ABOVE,
++	    WNCK_WINDOW_ACTION_UNSTICK
++#else
++	    0,
++	    0,
++	    0,
++	    0,
++	    0
++#endif
++
++	};
++
++	if (d->frame_window &&
++	    button_actions[i] && !(actions & button_actions[i]))
++	{
++	    memset (&d->button_windows[i].pos, 0, sizeof (Box));
++	}
++	else if (!d->frame_window &&
++		 button_actions[i] && !(actions & button_actions[i]))
++	{
++	    XUnmapWindow (xdisplay, d->button_windows[i].window);
++	    continue;
++	}
++
++	if (d->frame_window &&
++	    (*theme_get_button_position) (d, i, width, height, &x, &y, &w, &h))
++	{
++	    BoxPtr box = &d->button_windows[i].pos;
++	    box->x1 = x;
++	    box->y1 = y;
++	    box->x2 = x + w;
++	    box->y2 = y + h;
++	}
++	else if (!d->frame_window &&
++		 (*theme_get_button_position) (d, i, width, height,
++					       &x, &y, &w, &h))
++	{
++	    Window win = d->button_windows[i].window;
++	    XMapWindow (xdisplay, win);
++	    XMoveResizeWindow (xdisplay, win, x, y, w, h);
++	}
++	else if (!d->frame_window)
++	{
++	    XUnmapWindow (xdisplay, d->button_windows[i].window);
++	}
++    }
++
++    gdk_display_sync (gdk_display_get_default ());
++    gdk_error_trap_pop ();
++}
++
++#ifdef HAVE_WNCK_WINDOW_HAS_NAME
++static const char *
++wnck_window_get_real_name (WnckWindow *win)
++{
++    return wnck_window_has_name (win) ? wnck_window_get_name (win) : NULL;
++}
++#define wnck_window_get_name wnck_window_get_real_name
++#endif
++
++gint
++max_window_name_width (WnckWindow *win)
++{
++    decor_t     *d = g_object_get_data (G_OBJECT (win), "decor");
++    const gchar *name;
++    gint	w;
++
++    if (!d->layout)
++    {
++	d->layout = pango_layout_new (pango_context);
++	if (!d->layout)
++	    return 0;
++
++	pango_layout_set_wrap (d->layout, PANGO_WRAP_CHAR);
++    }
++
++    name = wnck_window_get_name (win);
++    if (!name)
++	return 0;
++
++    pango_layout_set_auto_dir (d->layout, FALSE);
++    pango_layout_set_width (d->layout, -1);
++    pango_layout_set_text (d->layout, name, strlen (name));
++    pango_layout_get_pixel_size (d->layout, &w, NULL);
++
++    if (d->name)
++	pango_layout_set_text (d->layout, d->name, strlen (d->name));
++
++    return w + 6;
++}
++
++void
++update_window_decoration_name (WnckWindow *win)
++{
++    decor_t	    *d = g_object_get_data (G_OBJECT (win), "decor");
++    const gchar	    *name;
++    glong	    name_length;
++    PangoLayoutLine *line;
++
++    if (d->name)
++    {
++	g_free (d->name);
++	d->name = NULL;
++    }
++
++    name = wnck_window_get_name (win);
++    if (name && (name_length = strlen (name)))
++    {
++	gint w;
++
++	if (theme_draw_window_decoration != draw_window_decoration)
++	{
++	    w = SHRT_MAX;
++	}
++	else
++	{
++	    gint width;
++
++	    wnck_window_get_client_window_geometry (win, NULL, NULL,
++						    &width, NULL);
++
++	    w = width - ICON_SPACE - 2 - d->button_width;
++	    if (w < 1)
++		w = 1;
++	}
++
++	pango_layout_set_auto_dir (d->layout, FALSE);
++	pango_layout_set_width (d->layout, w * PANGO_SCALE);
++	pango_layout_set_text (d->layout, name, name_length);
++
++	line = pango_layout_get_line (d->layout, 0);
++
++	name_length = line->length;
++	if (pango_layout_get_line_count (d->layout) > 1)
++	{
++	    if (name_length < 4)
++	    {
++		pango_layout_set_text (d->layout, NULL, 0);
++		return;
++	    }
++
++	    d->name = g_strndup (name, name_length);
++	    strcpy (d->name + name_length - 3, "...");
++	}
++	else
++	    d->name = g_strndup (name, name_length);
++
++	pango_layout_set_text (d->layout, d->name, name_length);
++    }
++}
++
++void
++update_window_decoration_icon (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->icon)
++    {
++	cairo_pattern_destroy (d->icon);
++	d->icon = NULL;
++    }
++
++    if (d->icon_pixmap)
++    {
++	g_object_unref (G_OBJECT (d->icon_pixmap));
++	d->icon_pixmap = NULL;
++    }
++
++    if (d->icon_pixbuf)
++	g_object_unref (G_OBJECT (d->icon_pixbuf));
++
++    d->icon_pixbuf = wnck_window_get_mini_icon (win);
++    if (d->icon_pixbuf)
++    {
++	cairo_t	*cr;
++
++	g_object_ref (G_OBJECT (d->icon_pixbuf));
++
++	if (d->frame_window)
++	    d->icon_pixmap = pixmap_new_from_pixbuf (d->icon_pixbuf,
++						     24);
++	else
++	    d->icon_pixmap = pixmap_new_from_pixbuf (d->icon_pixbuf,
++						     32);
++	cr = gdk_cairo_create (GDK_DRAWABLE (d->icon_pixmap));
++	d->icon = cairo_pattern_create_for_surface (cairo_get_target (cr));
++	cairo_destroy (cr);
++    }
++}
++
++gboolean
++update_window_decoration_size (WnckWindow *win)
++{
++    decor_t           *d = g_object_get_data (G_OBJECT (win), "decor");
++    GdkPixmap         *pixmap, *buffer_pixmap = NULL;
++    Picture           picture;
++    gint              width, height;
++    gint              x, y, w, h, name_width;
++    Display           *xdisplay;
++    XRenderPictFormat *format;
++    int               depth;
++
++    if (!d)
++	return FALSE;
++
++    xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++
++    wnck_window_get_client_window_geometry (win, &x, &y, &w, &h);
++
++    name_width = max_window_name_width (win);
++
++    if (!(*theme_calc_decoration_size) (d, w, h, name_width, &width, &height))
++    {
++	update_window_decoration_name (win);
++	return FALSE;
++    }
++
++    gdk_error_trap_push ();
++
++    if (d->frame_window)
++	depth = gdk_drawable_get_depth (GDK_DRAWABLE (d->frame_window));
++    else
++	depth = 32;
++
++    pixmap = create_pixmap (width, height, depth);
++
++    gdk_flush ();
++
++    if (!pixmap || gdk_error_trap_pop ())
++    {
++	memset (pixmap, 0, sizeof (pixmap));
++	return FALSE;
++    }
++
++    gdk_error_trap_push ();
++
++    buffer_pixmap = create_pixmap (width, height, depth);
++
++    gdk_flush ();
++
++    if (!buffer_pixmap || gdk_error_trap_pop ())
++    {
++	memset (buffer_pixmap, 0, sizeof (buffer_pixmap));
++	g_object_unref (G_OBJECT (pixmap));
++	return FALSE;
++    }
++
++    format = get_format_for_drawable (d, GDK_DRAWABLE (buffer_pixmap));
++    picture = XRenderCreatePicture (xdisplay, GDK_PIXMAP_XID (buffer_pixmap),
++				    format, 0, NULL);
++
++    if (d->pixmap)
++	g_object_unref (G_OBJECT (d->pixmap));
++
++    if (d->buffer_pixmap)
++	g_object_unref (G_OBJECT (d->buffer_pixmap));
++
++    if (d->picture)
++	XRenderFreePicture (xdisplay, d->picture);
++
++    if (d->cr)
++	cairo_destroy (d->cr);
++
++    d->pixmap	     = pixmap;
++    d->buffer_pixmap = buffer_pixmap;
++    d->cr	     = gdk_cairo_create (pixmap);
++
++    d->picture = picture;
++
++    d->width  = width;
++    d->height = height;
++
++    d->prop_xid = wnck_window_get_xid (win);
++
++    update_window_decoration_name (win);
++
++    queue_decor_draw (d);
++
++    return TRUE;
++}
++
++void
++draw_border_shape (Display	   *xdisplay,
++		   Pixmap	   pixmap,
++		   Picture	   picture,
++		   int		   width,
++		   int		   height,
++		   decor_context_t *c,
++		   void		   *closure)
++{
++    static XRenderColor white = { 0xffff, 0xffff, 0xffff, 0xffff };
++    GdkColormap		*colormap;
++    decor_t		d;
++    double		save_decoration_alpha;
++
++    memset (&d, 0, sizeof (d));
++
++    d.pixmap  = gdk_pixmap_foreign_new_for_display (gdk_display_get_default (),
++						    pixmap);
++    d.width   = width;
++    d.height  = height;
++    d.active  = TRUE;
++    d.draw    = theme_draw_window_decoration;
++    d.picture = picture;
++    d.context = c;
++
++    /* we use closure argument if maximized */
++    if (closure)
++	d.state |=
++	    WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
++	    WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY;
++
++    decor_get_default_layout (c, 1, 1, &d.border_layout);
++
++    colormap = get_colormap_for_drawable (GDK_DRAWABLE (d.pixmap));
++    gdk_drawable_set_colormap (d.pixmap, colormap);
++
++    /* create shadow from opaque decoration */
++    save_decoration_alpha = decoration_alpha;
++    decoration_alpha = 1.0;
++
++    (*d.draw) (&d);
++
++    decoration_alpha = save_decoration_alpha;
++
++    XRenderFillRectangle (xdisplay, PictOpSrc, picture, &white,
++			  c->left_space,
++			  c->top_space,
++			  width - c->left_space - c->right_space,
++			  height - c->top_space - c->bottom_space);
++
++    g_object_unref (G_OBJECT (d.pixmap));
++}
++
++int
++update_shadow (void)
++{
++    decor_shadow_options_t opt_active_shadow;
++    decor_shadow_options_t opt_inactive_shadow;
++    decor_shadow_options_t opt_no_shadow;
++    Display		   *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    GdkDisplay		   *display = gdk_display_get_default ();
++    GdkScreen		   *screen = gdk_display_get_default_screen (display);
++
++    opt_active_shadow.shadow_radius  = shadow_radius;
++    opt_active_shadow.shadow_opacity = shadow_opacity;
++
++    memcpy (opt_active_shadow.shadow_color, shadow_color, sizeof (shadow_color));
++
++    opt_active_shadow.shadow_offset_x = shadow_offset_x;
++    opt_active_shadow.shadow_offset_y = shadow_offset_y;
++
++    opt_inactive_shadow.shadow_radius  = shadow_radius;
++    opt_inactive_shadow.shadow_opacity = shadow_opacity;
++
++    memcpy (opt_inactive_shadow.shadow_color, shadow_color, sizeof (shadow_color));
++
++    opt_inactive_shadow.shadow_offset_x = shadow_offset_x;
++    opt_inactive_shadow.shadow_offset_y = shadow_offset_y;
++
++    opt_no_shadow.shadow_radius  = 0;
++    opt_no_shadow.shadow_opacity = 0;
++
++    opt_no_shadow.shadow_offset_x = 0;
++    opt_no_shadow.shadow_offset_y = 0;
++
++    if (no_border_shadow)
++    {
++	decor_shadow_destroy (xdisplay, no_border_shadow);
++	no_border_shadow = NULL;
++    }
++
++    no_border_shadow = decor_shadow_create (xdisplay,
++					    gdk_x11_screen_get_xscreen (screen),
++					    1, 1,
++					    0,
++					    0,
++					    0,
++					    0,
++					    0, 0, 0, 0,
++					    &opt_inactive_shadow,
++					    &shadow_context,
++					    decor_draw_simple,
++					    0);
++
++    if (border_active_shadow)
++    {
++	decor_shadow_destroy (xdisplay, border_active_shadow);
++	border_active_shadow = NULL;
++    }
++
++    border_active_shadow = (*theme_update_shadow) (SHADOW_TYPE_ACTIVE_NORMAL);
++
++    if (!border_active_shadow)
++	border_active_shadow = cairo_update_shadow (SHADOW_TYPE_ACTIVE_NORMAL);
++
++    if (border_inactive_shadow)
++    {
++	decor_shadow_destroy (xdisplay, border_inactive_shadow);
++	border_inactive_shadow = NULL;
++    }
++
++    border_inactive_shadow = (*theme_update_shadow) (SHADOW_TYPE_INACTIVE_NORMAL);
++
++    if (!border_inactive_shadow)
++	border_inactive_shadow = cairo_update_shadow (SHADOW_TYPE_INACTIVE_NORMAL);
++
++    if (border_no_shadow)
++    {
++	decor_shadow_destroy (xdisplay, border_no_shadow);
++	border_no_shadow = NULL;
++    }
++
++    border_no_shadow = decor_shadow_create (xdisplay,
++					 gdk_x11_screen_get_xscreen (screen),
++					 1, 1,
++					 _win_extents.left,
++					 _win_extents.right,
++					 _win_extents.top + titlebar_height,
++					 _win_extents.bottom,
++					 _win_extents.left -
++					 TRANSLUCENT_CORNER_SIZE,
++					 _win_extents.right -
++					 TRANSLUCENT_CORNER_SIZE,
++					 _win_extents.top + titlebar_height -
++					 TRANSLUCENT_CORNER_SIZE,
++					 _win_extents.bottom -
++					 TRANSLUCENT_CORNER_SIZE,
++					 &opt_no_shadow,
++					 &window_context_no_shadow,
++					 draw_border_shape,
++					 0);
++
++    decor_context_t *context = &window_context_no_shadow;
++
++
++    if (max_border_active_shadow)
++    {
++	decor_shadow_destroy (xdisplay, max_border_active_shadow);
++	max_border_active_shadow = NULL;
++    }
++
++    max_border_active_shadow = (*theme_update_shadow) (SHADOW_TYPE_ACTIVE_MAX);
++
++    if (!max_border_active_shadow)
++	max_border_active_shadow = cairo_update_shadow (SHADOW_TYPE_ACTIVE_MAX);
++
++    if (max_border_inactive_shadow)
++    {
++	decor_shadow_destroy (xdisplay, max_border_inactive_shadow);
++	max_border_inactive_shadow = NULL;
++    }
++
++    max_border_inactive_shadow = (*theme_update_shadow) (SHADOW_TYPE_INACTIVE_MAX);
++
++    if (!max_border_inactive_shadow)
++	max_border_inactive_shadow = cairo_update_shadow (SHADOW_TYPE_INACTIVE_MAX);
++
++    if (max_border_no_shadow)
++    {
++	decor_shadow_destroy (xdisplay, max_border_active_shadow);
++	max_border_active_shadow = NULL;
++    }
++
++    max_border_no_shadow =
++	decor_shadow_create (xdisplay,
++			     gdk_x11_screen_get_xscreen (screen),
++			     1, 1,
++			     _max_win_extents.left,
++			     _max_win_extents.right,
++			     _max_win_extents.top + max_titlebar_height,
++			     _max_win_extents.bottom,
++			     _max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
++			     _max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
++			     _max_win_extents.top + max_titlebar_height -
++			     TRANSLUCENT_CORNER_SIZE,
++			     _max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
++			     &opt_no_shadow,
++			     &max_window_context_no_shadow,
++			     draw_border_shape,
++			     (void *) 1);
++
++    if (switcher_shadow)
++    {
++	decor_shadow_destroy (xdisplay, switcher_shadow);
++	switcher_shadow = NULL;
++    }
++
++    switcher_shadow = decor_shadow_create (xdisplay,
++					   gdk_x11_screen_get_xscreen (screen),
++					   1, 1,
++					   _switcher_extents.left,
++					   _switcher_extents.right,
++					   _switcher_extents.top,
++					   _switcher_extents.bottom,
++					   _switcher_extents.left -
++					   TRANSLUCENT_CORNER_SIZE,
++					   _switcher_extents.right -
++					   TRANSLUCENT_CORNER_SIZE,
++					   _switcher_extents.top -
++					   TRANSLUCENT_CORNER_SIZE,
++					   _switcher_extents.bottom -
++					   TRANSLUCENT_CORNER_SIZE,
++					   &opt_inactive_shadow,
++					   &switcher_context,
++					   decor_draw_simple,
++					   0);
++
++    return 1;
++}
++
++void
++update_window_decoration (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->decorated)
++    {
++	/* force size update */
++	d->context = NULL;
++	d->width = d->height = 0;
++
++	update_window_decoration_size (win);
++	update_event_windows (win);
++    }
++}
++
++void
++update_window_decoration_state (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    d->state = wnck_window_get_state (win);
++}
++
++void
++update_window_decoration_actions (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    d->actions = wnck_window_get_actions (win);
++}
++
++static gboolean
++draw_decor_list (void *data)
++{
++    GSList  *list;
++    decor_t *d;
++
++    draw_idle_id = 0;
++
++    for (list = draw_list; list; list = list->next)
++    {
++	d = (decor_t *) list->data;
++	(*d->draw) (d);
++    }
++
++    g_slist_free (draw_list);
++    draw_list = NULL;
++
++    return FALSE;
++}
++
++void
++queue_decor_draw (decor_t *d)
++{
++    if (g_slist_find (draw_list, d))
++	return;
++
++    draw_list = g_slist_append (draw_list, d);
++
++    if (!draw_idle_id)
++	draw_idle_id = g_idle_add (draw_decor_list, NULL);
++}
++
++void
++update_default_decorations (GdkScreen *screen)
++{
++    long	    data[256];
++    Window	    xroot;
++    GdkDisplay	    *gdkdisplay = gdk_display_get_default ();
++    Display	    *xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay);
++    Atom	    bareAtom, normalAtom, activeAtom;
++    decor_t	    d;
++    gint	    nQuad;
++    decor_quad_t    quads[N_QUADS_MAX];
++    decor_extents_t extents = _win_extents;
++
++    xroot = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen));
++
++    bareAtom   = XInternAtom (xdisplay, DECOR_BARE_ATOM_NAME, FALSE);
++    normalAtom = XInternAtom (xdisplay, DECOR_NORMAL_ATOM_NAME, FALSE);
++    activeAtom = XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, FALSE);
++
++    if (no_border_shadow)
++    {
++	decor_layout_t layout;
++
++	decor_get_default_layout (&shadow_context, 1, 1, &layout);
++
++	nQuad = decor_set_lSrStSbS_window_quads (quads, &shadow_context,
++						 &layout);
++
++	decor_quads_to_property (data, no_border_shadow->pixmap,
++				 &_shadow_extents, &_shadow_extents,
++				 &_shadow_extents, &_shadow_extents,
++				 0, 0, quads, nQuad);
++
++	XChangeProperty (xdisplay, xroot,
++			 bareAtom,
++			 XA_INTEGER,
++			 32, PropModeReplace, (guchar *) data,
++			 BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
++
++	if (minimal)
++	{
++	    XChangeProperty (xdisplay, xroot,
++			     normalAtom,
++			     XA_INTEGER,
++			     32, PropModeReplace, (guchar *) data,
++			     BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
++	    XChangeProperty (xdisplay, xroot,
++			     activeAtom,
++			     XA_INTEGER,
++			     32, PropModeReplace, (guchar *) data,
++			     BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
++	}
++    }
++    else
++    {
++	XDeleteProperty (xdisplay, xroot, bareAtom);
++
++	if (minimal)
++	{
++	    XDeleteProperty (xdisplay, xroot, normalAtom);
++	    XDeleteProperty (xdisplay, xroot, activeAtom);
++	}
++    }
++
++    if (minimal)
++	return;
++
++    memset (&d, 0, sizeof (d));
++
++    if (d.active)
++    {
++	d.context = &window_active_context;
++	d.shadow  = border_active_shadow;
++    }
++    else
++    {
++	d.context = &window_inactive_context;
++	d.shadow  = border_inactive_shadow;
++    }
++
++    d.layout  = pango_layout_new (pango_context);
++
++    decor_get_default_layout (d.context, 1, 1, &d.border_layout);
++
++    d.width  = d.border_layout.width;
++    d.height = d.border_layout.height;
++
++    extents.top += titlebar_height;
++
++    d.draw = theme_draw_window_decoration;
++
++    if (decor_normal_pixmap)
++	g_object_unref (G_OBJECT (decor_normal_pixmap));
++
++    nQuad = decor_set_lSrStSbS_window_quads (quads, d.context,
++					     &d.border_layout);
++
++    decor_normal_pixmap = create_pixmap (d.width, d.height, 32);
++
++    if (decor_normal_pixmap)
++    {
++	d.pixmap  = decor_normal_pixmap;
++	d.active  = FALSE;
++	d.picture = XRenderCreatePicture (xdisplay,
++					  GDK_PIXMAP_XID (d.pixmap),
++					  xformat_rgba, 0, NULL);
++
++	(*d.draw) (&d);
++
++	XRenderFreePicture (xdisplay, d.picture);
++
++	fprintf (stderr, "extents are %i %i %i %i %i\n", extents.left, extents.right, extents.top, extents.bottom);
++
++	decor_quads_to_property (data, GDK_PIXMAP_XID (d.pixmap),
++				 &extents, &extents, &extents, &extents, 0, 0, quads, nQuad);
++
++	XChangeProperty (xdisplay, xroot,
++			 normalAtom,
++			 XA_INTEGER,
++			 32, PropModeReplace, (guchar *) data,
++			 BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
++    }
++
++    if (decor_active_pixmap)
++	g_object_unref (G_OBJECT (decor_active_pixmap));
++
++    decor_active_pixmap = create_pixmap (d.width, d.height, 32);
++
++    if (decor_active_pixmap)
++    {
++	d.pixmap  = decor_active_pixmap;
++	d.active  = TRUE;
++	d.picture = XRenderCreatePicture (xdisplay,
++					  GDK_PIXMAP_XID (d.pixmap),
++					  xformat_rgba, 0, NULL);
++
++	(*d.draw) (&d);
++
++	XRenderFreePicture (xdisplay, d.picture);
++
++	decor_quads_to_property (data, GDK_PIXMAP_XID (d.pixmap),
++				 &extents, &extents, &extents, &extents, 0, 0, quads, nQuad);
++
++	XChangeProperty (xdisplay, xroot,
++			 activeAtom,
++			 XA_INTEGER,
++			 32, PropModeReplace, (guchar *) data,
++			 BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
++    }
++
++    if (d.layout)
++	g_object_unref (G_OBJECT (d.layout));
++}
++
++void
++copy_to_front_buffer (decor_t *d)
++{
++    if (!d->buffer_pixmap)
++	return;
++
++    cairo_set_operator (d->cr, CAIRO_OPERATOR_SOURCE);
++    gdk_cairo_set_source_pixmap (d->cr, d->buffer_pixmap, 0, 0);
++    cairo_paint (d->cr);
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/decorprops.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/decorprops.c	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,135 @@
++#include "gtk-window-decorator.h"
++
++void
++decor_update_window_property (decor_t *d)
++{
++    long	    data[256];
++    Display	    *xdisplay =
++	GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    decor_extents_t extents = _win_extents;
++    gint	    nQuad;
++    decor_quad_t    quads[N_QUADS_MAX];
++    int		    w, h;
++    gint	    stretch_offset;
++    REGION	    top, bottom, left, right;
++
++    w = d->border_layout.top.x2 - d->border_layout.top.x1 -
++	d->context->left_space - d->context->right_space;
++
++    if (d->border_layout.rotation)
++	h = d->border_layout.left.x2 - d->border_layout.left.x1;
++    else
++	h = d->border_layout.left.y2 - d->border_layout.left.y1;
++
++    stretch_offset = w - d->button_width - 1;
++
++    nQuad = decor_set_lSrStXbS_window_quads (quads, d->context,
++					     &d->border_layout,
++					     stretch_offset);
++
++    extents.top += titlebar_height;
++
++    if (d->frame_window)
++    {
++	decor_gen_window_property (data, &extents, &extents, 20, 20);
++    }
++    else
++    {
++	decor_quads_to_property (data, GDK_PIXMAP_XID (d->pixmap),
++			     &extents, &extents, &extents, &extents,
++			     ICON_SPACE + d->button_width,
++			     0,
++			     quads, nQuad);
++    }
++
++    gdk_error_trap_push ();
++    XChangeProperty (xdisplay, d->prop_xid,
++		     win_decor_atom,
++		     XA_INTEGER,
++		     32, PropModeReplace, (guchar *) data,
++		     BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
++    gdk_display_sync (gdk_display_get_default ());
++    gdk_error_trap_pop ();
++
++    top.rects = &top.extents;
++    top.numRects = top.size = 1;
++
++    top.extents.x1 = -extents.left;
++    top.extents.y1 = -extents.top;
++    top.extents.x2 = w + extents.right;
++    top.extents.y2 = 0;
++
++    bottom.rects = &bottom.extents;
++    bottom.numRects = bottom.size = 1;
++
++    bottom.extents.x1 = -extents.left;
++    bottom.extents.y1 = 0;
++    bottom.extents.x2 = w + extents.right;
++    bottom.extents.y2 = extents.bottom;
++
++    left.rects = &left.extents;
++    left.numRects = left.size = 1;
++
++    left.extents.x1 = -extents.left;
++    left.extents.y1 = 0;
++    left.extents.x2 = 0;
++    left.extents.y2 = h;
++
++    right.rects = &right.extents;
++    right.numRects = right.size = 1;
++
++    right.extents.x1 = 0;
++    right.extents.y1 = 0;
++    right.extents.x2 = extents.right;
++    right.extents.y2 = h;
++
++    decor_update_blur_property (d,
++				w, h,
++				&top, stretch_offset,
++				&bottom, w / 2,
++				&left, h / 2,
++				&right, h / 2);
++}
++
++void
++decor_update_switcher_property (decor_t *d)
++{
++    long	 data[256];
++    Display	 *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    gint	 nQuad;
++    decor_quad_t quads[N_QUADS_MAX];
++    GtkStyle     *style;
++    long         fgColor[4];
++    
++    nQuad = decor_set_lSrStSbX_window_quads (quads, &switcher_context,
++					     &d->border_layout,
++					     d->border_layout.top.x2 -
++					     d->border_layout.top.x1 -
++					     switcher_context.extents.left -
++						 switcher_context.extents.right -
++						     32);
++    
++    decor_quads_to_property (data, GDK_PIXMAP_XID (d->pixmap),
++			     &_switcher_extents, &_switcher_extents,
++			     &_switcher_extents, &_switcher_extents,
++			     0, 0, quads, nQuad);
++    
++    style = gtk_widget_get_style (style_window_rgba);
++    
++    fgColor[0] = style->fg[GTK_STATE_NORMAL].red;
++    fgColor[1] = style->fg[GTK_STATE_NORMAL].green;
++    fgColor[2] = style->fg[GTK_STATE_NORMAL].blue;
++    fgColor[3] = SWITCHER_ALPHA;
++    
++    gdk_error_trap_push ();
++    XChangeProperty (xdisplay, d->prop_xid,
++		     win_decor_atom,
++		     XA_INTEGER,
++		     32, PropModeReplace, (guchar *) data,
++		     BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
++    XChangeProperty (xdisplay, d->prop_xid, switcher_fg_atom,
++		     XA_INTEGER, 32, PropModeReplace, (guchar *) fgColor, 4);
++    gdk_display_sync (gdk_display_get_default ());
++    gdk_error_trap_pop ();
++    
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/events.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/events.c	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,1173 @@
++#include "gtk-window-decorator.h"
++
++void
++move_resize_window (WnckWindow *win,
++		    int	       direction,
++		    decor_event *gtkwd_event)
++{
++    Display    *xdisplay;
++    GdkDisplay *gdkdisplay;
++    GdkScreen  *screen;
++    Window     xroot;
++    XEvent     ev;
++
++    gdkdisplay = gdk_display_get_default ();
++    xdisplay   = GDK_DISPLAY_XDISPLAY (gdkdisplay);
++    screen     = gdk_display_get_default_screen (gdkdisplay);
++    xroot      = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen));
++
++    if (action_menu_mapped)
++    {
++	gtk_object_destroy (GTK_OBJECT (action_menu));
++	action_menu_mapped = FALSE;
++	action_menu = NULL;
++	return;
++    }
++
++    ev.xclient.type    = ClientMessage;
++    ev.xclient.display = xdisplay;
++
++    ev.xclient.serial	  = 0;
++    ev.xclient.send_event = TRUE;
++
++    ev.xclient.window	    = wnck_window_get_xid (win);
++    ev.xclient.message_type = wm_move_resize_atom;
++    ev.xclient.format	    = 32;
++
++    ev.xclient.data.l[0] = gtkwd_event->x_root;
++    ev.xclient.data.l[1] = gtkwd_event->y_root;
++    ev.xclient.data.l[2] = direction;
++    ev.xclient.data.l[3] = gtkwd_event->button;
++    ev.xclient.data.l[4] = 1;
++
++    XUngrabPointer (xdisplay, gtkwd_event->time);
++    XUngrabKeyboard (xdisplay, gtkwd_event->time);
++
++    XSendEvent (xdisplay, xroot, FALSE,
++		SubstructureRedirectMask | SubstructureNotifyMask,
++		&ev);
++
++    XSync (xdisplay, FALSE);
++}
++
++void
++common_button_event (WnckWindow *win,
++		     decor_event *gtkwd_event,
++		     decor_event_type gtkwd_type,
++		     int	button,
++		     int	max)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[button];
++
++    if (d->frame_window && gtkwd_type == GEnterNotify)
++    {
++	GdkCursor* cursor;
++	cursor = gdk_cursor_new (GDK_LEFT_PTR);
++	gdk_window_set_cursor (d->frame_window, cursor);
++	gdk_cursor_unref (cursor);
++    }
++
++    switch (gtkwd_type) {
++    case GButtonPress:
++	if (gtkwd_event->button <= max)
++	    d->button_states[button] |= PRESSED_EVENT_WINDOW;
++	break;
++    case GButtonRelease:
++	if (gtkwd_event->button <= max)
++	    d->button_states[button] &= ~PRESSED_EVENT_WINDOW;
++	break;
++    case GEnterNotify:
++	d->button_states[button] |= IN_EVENT_WINDOW;
++	break;
++    case GLeaveNotify:
++	d->button_states[button] &= ~IN_EVENT_WINDOW;
++	break;
++    default:
++	break;
++    }
++
++    if (state != d->button_states[button])
++	queue_decor_draw (d);
++}
++
++#define BUTTON_EVENT_ACTION_STATE (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW)
++
++void
++close_button_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_CLOSE];
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_CLOSE, 1);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button == 1)
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++		wnck_window_close (win, gtkwd_event->time);
++	break;
++    default:
++	break;
++    }
++}
++
++void
++max_button_event (WnckWindow *win,
++		  decor_event *gtkwd_event,
++		  decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_MAX];
++
++    if (wnck_window_is_maximized (win))
++	common_button_event (win, gtkwd_event, gtkwd_type, BUTTON_MAX,
++			     3);
++    else
++	common_button_event (win, gtkwd_event, gtkwd_type, BUTTON_MAX,
++			     3);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button <= 3)
++	{
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++	    {
++		if (gtkwd_event->button == 2)
++		{
++		    if (wnck_window_is_maximized_vertically (win))
++			wnck_window_unmaximize_vertically (win);
++		    else
++			wnck_window_maximize_vertically (win);
++		}
++		else if (gtkwd_event->button == 3)
++		{
++		    if (wnck_window_is_maximized_horizontally (win))
++			wnck_window_unmaximize_horizontally (win);
++		    else
++			wnck_window_maximize_horizontally (win);
++		}
++		else
++		{
++		    if (wnck_window_is_maximized (win))
++			wnck_window_unmaximize (win);
++		    else
++			wnck_window_maximize (win);
++		}
++	    }
++	}
++	break;
++    default:
++	break;
++    }
++}
++
++void
++min_button_event (WnckWindow *win,
++		  decor_event *gtkwd_event,
++		  decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_MIN];
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_MIN, 1);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button == 1)
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++		wnck_window_minimize (win);
++	break;
++    default:
++	break;
++    }
++}
++
++void
++menu_button_event (WnckWindow *win,
++		   decor_event *gtkwd_event,
++		   decor_event_type gtkwd_type)
++{
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_MENU, 1);
++
++    switch (gtkwd_type) {
++    case GButtonPress:
++	if (gtkwd_event->button == 1)
++	    action_menu_map (win,
++			     gtkwd_event->button,
++			     gtkwd_event->time);
++	break;
++    default:
++	break;
++    }
++}
++
++void
++shade_button_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_SHADE];
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_SHADE, 1);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button == 1)
++	{
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++		wnck_window_shade (win);
++	}
++	break;
++    default:
++	break;
++    }
++}
++
++void
++above_button_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_ABOVE];
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_ABOVE, 1);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button == 1)
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++#ifdef HAVE_LIBWNCK_2_18_1
++		wnck_window_make_above (win);
++#endif
++	break;
++    default:
++	break;
++    }
++}
++
++void
++stick_button_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_STICK];
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_STICK, 1);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button == 1)
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++		wnck_window_stick (win);
++	break;
++    default:
++	break;
++    }
++}
++
++void
++unshade_button_event (WnckWindow *win,
++		      decor_event *gtkwd_event,
++		      decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_UNSHADE];
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_UNSHADE, 1);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button == 1)
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++		wnck_window_unshade (win);
++	break;
++    default:
++	break;
++    }
++}
++
++void
++unabove_button_event (WnckWindow *win,
++		      decor_event *gtkwd_event,
++		      decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_UNABOVE];
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_UNABOVE, 1);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button == 1)
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++#ifdef HAVE_LIBWNCK_2_18_1
++		wnck_window_unmake_above (win);
++#endif
++	break;
++    default:
++	break;
++    }
++}
++
++void
++unstick_button_event (WnckWindow *win,
++		      decor_event *gtkwd_event,
++		      decor_event_type gtkwd_type)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    guint   state = d->button_states[BUTTON_UNSTICK];
++
++    common_button_event (win, gtkwd_event, gtkwd_type,
++			 BUTTON_UNSTICK, 1);
++
++    switch (gtkwd_type) {
++    case GButtonRelease:
++	if (gtkwd_event->button == 1)
++	    if (state == BUTTON_EVENT_ACTION_STATE)
++		wnck_window_unstick (win);
++	break;
++    default:
++	break;
++    }
++}
++
++void
++handle_title_button_event (WnckWindow   *win,
++			   int          action,
++			   decor_event *gtkwd_event)
++{
++    switch (action) {
++    case CLICK_ACTION_SHADE:
++	if (wnck_window_is_shaded (win))
++	    wnck_window_unshade (win);
++	else
++	    wnck_window_shade (win);
++	break;
++    case CLICK_ACTION_MAXIMIZE:
++	if (wnck_window_is_maximized (win))
++	    wnck_window_unmaximize (win);
++	else
++	    wnck_window_maximize (win);
++	break;
++    case CLICK_ACTION_MINIMIZE:
++	if (!wnck_window_is_minimized (win))
++	    wnck_window_minimize (win);
++	break;
++    case CLICK_ACTION_RAISE:
++	restack_window (win, Above);
++	break;
++    case CLICK_ACTION_LOWER:
++	restack_window (win, Below);
++	break;
++    case CLICK_ACTION_MENU:
++	action_menu_map (win, gtkwd_event->button, gtkwd_event->time);
++	break;
++    }
++}
++
++void
++handle_mouse_wheel_title_event (WnckWindow   *win,
++				unsigned int button)
++{
++    switch (wheel_action) {
++    case WHEEL_ACTION_SHADE:
++	if (button == 4)
++	{
++	    if (!wnck_window_is_shaded (win))
++		wnck_window_shade (win);
++	}
++	else if (button == 5)
++	{
++	    if (wnck_window_is_shaded (win))
++		wnck_window_unshade (win);
++	}
++	break;
++    default:
++	break;
++    }
++}
++
++void
++title_event (WnckWindow       *win,
++	     decor_event      *gtkwd_event,
++	     decor_event_type gtkwd_type)
++{
++    static int	  last_button_num = 0;
++    static Window last_button_xwindow = None;
++    static Time	  last_button_time = 0;
++    static int	  last_button_x = 0;
++    static int	  last_button_y = 0;
++
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->frame_window && gtkwd_type == GEnterNotify)
++    {
++	GdkCursor* cursor = gdk_cursor_new (GDK_LEFT_PTR);
++	gdk_window_set_cursor (d->frame_window, cursor);
++	gdk_cursor_unref (cursor);
++    }
++
++    if (gtkwd_type != GButtonPress)
++	return;
++
++    if (gtkwd_event->button == 1)
++    {
++	if (gtkwd_event->button == last_button_num		        &&
++	    gtkwd_event->window == last_button_xwindow		        &&
++	    gtkwd_event->time < last_button_time + double_click_timeout &&
++	    dist (gtkwd_event->x, gtkwd_event->y,
++		  last_button_x, last_button_y) < DOUBLE_CLICK_DISTANCE)
++	{
++	    handle_title_button_event (win, double_click_action,
++				       gtkwd_event);
++
++	    last_button_num	= 0;
++	    last_button_xwindow = None;
++	    last_button_time	= 0;
++	    last_button_x	= 0;
++	    last_button_y	= 0;
++	}
++	else
++	{
++	    last_button_num	= gtkwd_event->button;
++	    last_button_xwindow = gtkwd_event->window;
++	    last_button_time	= gtkwd_event->time;
++	    last_button_x	= gtkwd_event->x;
++	    last_button_y	= gtkwd_event->y;
++
++	    restack_window (win, Above);
++
++	    move_resize_window (win, WM_MOVERESIZE_MOVE, gtkwd_event);
++	}
++    }
++    else if (gtkwd_event->button == 2)
++    {
++	handle_title_button_event (win, middle_click_action,
++				   gtkwd_event);
++    }
++    else if (gtkwd_event->button == 3)
++    {
++	handle_title_button_event (win, right_click_action,
++				   gtkwd_event);
++    }
++    else if (gtkwd_event->button == 4 ||
++	     gtkwd_event->button == 5)
++    {
++	handle_mouse_wheel_title_event (win, gtkwd_event->button);
++    }
++}
++
++void
++frame_common_event (WnckWindow       *win,
++		    int              direction,
++		    decor_event      *gtkwd_event,
++		    decor_event_type gtkwd_type)
++{
++
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->frame_window && gtkwd_type == GEnterNotify)
++    {
++	GdkCursor *cursor = NULL;
++
++	switch (direction)
++	{
++	    case WM_MOVERESIZE_SIZE_TOPLEFT:
++		cursor = gdk_cursor_new (GDK_TOP_LEFT_CORNER);
++		break;
++	    case WM_MOVERESIZE_SIZE_LEFT:
++		cursor = gdk_cursor_new (GDK_LEFT_SIDE);
++		break;
++	    case WM_MOVERESIZE_SIZE_BOTTOMLEFT:
++		cursor = gdk_cursor_new (GDK_BOTTOM_LEFT_CORNER);
++		break;
++	    case WM_MOVERESIZE_SIZE_BOTTOM:
++		cursor = gdk_cursor_new (GDK_BOTTOM_SIDE);
++	        break;
++	    case WM_MOVERESIZE_SIZE_BOTTOMRIGHT:
++		cursor = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER);
++		break;
++	    case WM_MOVERESIZE_SIZE_RIGHT:
++		cursor = gdk_cursor_new (GDK_RIGHT_SIDE);
++		break;
++	    case WM_MOVERESIZE_SIZE_TOPRIGHT:
++		cursor = gdk_cursor_new (GDK_TOP_RIGHT_CORNER);
++		break;
++	    case WM_MOVERESIZE_SIZE_TOP:
++		cursor = gdk_cursor_new (GDK_TOP_SIDE);
++		break;
++	    default:
++		break;
++	}
++
++	if (cursor)
++	{
++	    gdk_window_set_cursor (d->frame_window, cursor);
++	    gdk_cursor_unref (cursor);
++	}
++    }
++
++    if (gtkwd_type != GButtonPress)
++	return;
++
++    switch (gtkwd_event->button) {
++    case 1:
++	move_resize_window (win, direction, gtkwd_event);
++	restack_window (win, Above);
++	break;
++    case 2:
++	handle_title_button_event (win, middle_click_action,
++				   gtkwd_event);
++	break;
++    case 3:
++	handle_title_button_event (win, right_click_action,
++				   gtkwd_event);
++	break;
++    }
++}
++
++void
++top_left_event (WnckWindow       *win,
++		decor_event      *gtkwd_event,
++		decor_event_type gtkwd_type)
++{
++    frame_common_event (win, WM_MOVERESIZE_SIZE_TOPLEFT,
++		        gtkwd_event, gtkwd_type);
++}
++
++void
++top_event (WnckWindow       *win,
++	   decor_event      *gtkwd_event,
++	   decor_event_type gtkwd_type)
++{
++    frame_common_event (win, WM_MOVERESIZE_SIZE_TOP,
++			gtkwd_event, gtkwd_type);
++}
++
++void
++top_right_event (WnckWindow       *win,
++		 decor_event      *gtkwd_event,
++		 decor_event_type gtkwd_type)
++{
++    frame_common_event (win, WM_MOVERESIZE_SIZE_TOPRIGHT,
++			gtkwd_event, gtkwd_type);
++}
++
++void
++left_event (WnckWindow       *win,
++	    decor_event      *gtkwd_event,
++	    decor_event_type gtkwd_type)
++{
++    frame_common_event (win, WM_MOVERESIZE_SIZE_LEFT,
++			gtkwd_event, gtkwd_type);
++}
++
++void
++right_event (WnckWindow       *win,
++	     decor_event      *gtkwd_event,
++	     decor_event_type gtkwd_type)
++{
++    frame_common_event (win, WM_MOVERESIZE_SIZE_RIGHT,
++			gtkwd_event, gtkwd_type);
++}
++
++void
++bottom_left_event (WnckWindow *win,
++		   decor_event *gtkwd_event,
++		   decor_event_type gtkwd_type)
++{
++    frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOMLEFT,
++			gtkwd_event, gtkwd_type);
++}
++
++void
++bottom_event (WnckWindow *win,
++	      decor_event *gtkwd_event,
++	      decor_event_type gtkwd_type)
++{
++    frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOM,
++			gtkwd_event, gtkwd_type);
++}
++
++void
++bottom_right_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type)
++{
++    frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOMRIGHT,
++			gtkwd_event, gtkwd_type);
++}
++
++void
++frame_window_realized (GtkWidget *widget,
++		       gpointer  data)
++{
++    decor_t *d = (decor_t *) data;
++
++    if (d)
++    {
++	GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window);
++	gdk_window_reparent (gdk_frame_window, d->frame_window, 0, 0);
++	gdk_window_lower (gdk_frame_window);
++
++    }
++}
++
++event_callback
++find_event_callback_for_point (decor_t *d,
++			       int     x,
++			       int     y,
++			       Bool    *enter,
++			       Bool    *leave,
++			       BoxPtr  *entered_box)
++{
++    int    i, j;
++    BoxPtr box;
++
++    for (i = 0; i < BUTTON_NUM; i++)
++    {
++	box = &d->button_windows[i].pos;
++	if (x >= box->x1 && x <= box->x2 &&
++	    y >= box->y1 && y <= box->y2)
++	{
++	    if (d->last_pos_entered != box)
++	    {
++		if (enter)
++		    *enter = TRUE;
++		if (leave && d->last_pos_entered)
++		    *leave = TRUE;
++		if (entered_box)
++		    *entered_box = box;
++	    }
++	    return d->button_windows[i].callback;
++	}
++    }
++
++    for (i = 0; i < 3; i++)
++    {
++	for (j = 0; j < 3; j++)
++	{
++	    box = &d->event_windows[i][j].pos;
++	    if (x >= box->x1 && x <= box->x2 &&
++		y >= box->y1 && y <= box->y2)
++	    {
++		if (d->last_pos_entered != box)
++		{
++		    if (enter)
++			*enter = TRUE;
++		    if (leave && d->last_pos_entered)
++			*leave = TRUE;
++		    if (entered_box)
++			*entered_box = box;
++		}
++		return d->event_windows[i][j].callback;
++	    }
++	}
++    }
++
++    return NULL;
++}
++
++event_callback
++find_leave_event_callback (decor_t *d)
++{
++    int i, j;
++
++    for (i = 0; i < BUTTON_NUM; i++)
++    {
++	if (d->last_pos_entered == &d->button_windows[i].pos)
++	    return d->button_windows[i].callback;
++    }
++
++    for (i = 0; i < 3; i++)
++    {
++	for (j = 0; j < 3; j++)
++	{
++	    if (d->last_pos_entered == &d->event_windows[i][j].pos)
++		return d->event_windows[i][j].callback;
++	}
++    }
++
++    return NULL;
++}
++
++void
++frame_handle_button_press (GtkWidget      *widget,
++			   GdkEventButton *event,
++			   gpointer       user_data)
++{
++    decor_t *d = (decor_t *) user_data;
++
++    if (d)
++    {
++	/* Check to see where the event happened and fill out an appropriate
++	 * struct
++	 */
++	event_callback cb;
++
++	cb = find_event_callback_for_point (d, event->x, event->y,
++					    NULL, NULL, NULL);
++
++	if (cb && d->decorated)
++	{
++	    decor_event gtkwd_event;
++
++	    gtkwd_event.window = GDK_WINDOW_XID (d->frame_window);
++	    gtkwd_event.button = event->button;
++	    gtkwd_event.x      = event->x;
++	    gtkwd_event.y      = event->y;
++	    gtkwd_event.x_root = event->x_root;
++	    gtkwd_event.y_root = event->y_root;
++	    gtkwd_event.time   = event->time;
++
++	    (*cb) (d->win, &gtkwd_event, GButtonPress);
++	}
++    }
++}
++
++void
++frame_handle_button_release (GtkWidget      *widget,
++			     GdkEventButton *event,
++			     gpointer       user_data)
++{
++    decor_t *d = (decor_t *) user_data;
++
++    if (d)
++    {
++	event_callback cb;
++
++	cb = find_event_callback_for_point (d, event->x, event->y,
++					    NULL, NULL, NULL);
++
++	if (cb && d->decorated)
++	{
++	    decor_event gtkwd_event;
++
++	    gtkwd_event.window = GDK_WINDOW_XID (d->frame_window);
++	    gtkwd_event.button = event->button;
++	    gtkwd_event.x      = event->x;
++	    gtkwd_event.y      = event->y;
++	    gtkwd_event.x_root = event->x_root;
++	    gtkwd_event.y_root = event->y_root;
++	    gtkwd_event.time   = event->time;
++
++	    (*cb) (d->win, &gtkwd_event, GButtonRelease);
++	}
++    }
++}
++
++void
++frame_handle_motion (GtkWidget      *widget,
++		     GdkEventMotion *event,
++		     gpointer       user_data)
++{
++    decor_t *d = (decor_t *) user_data;
++
++    if (d)
++    {
++	event_callback cb = NULL;
++	Bool           send_enter = FALSE;
++	Bool           send_leave = FALSE;
++	BoxPtr         entered_box;
++
++	cb = find_event_callback_for_point (d, event->x, event->y,
++					    &send_enter, &send_leave,
++					    &entered_box);
++
++	if (cb && d->decorated)
++	{
++	    decor_event gtkwd_event;
++
++	    gtkwd_event.window = GDK_WINDOW_XID (d->frame_window);
++	    gtkwd_event.x      = event->x;
++	    gtkwd_event.y      = event->y;
++	    gtkwd_event.x_root = event->x_root;
++	    gtkwd_event.y_root = event->y_root;
++	    gtkwd_event.time   = event->time;
++
++	    if (send_enter)
++		(*cb) (d->win, &gtkwd_event, GEnterNotify);
++
++	    if (send_leave)
++	    {
++		event_callback leave_cb;
++
++		leave_cb = find_leave_event_callback (d);
++
++		if (leave_cb)
++		    (*leave_cb) (d->win, &gtkwd_event, GLeaveNotify);
++
++	    }
++
++	    if (send_enter)
++		d->last_pos_entered = entered_box;
++	}
++	else if (d->last_pos_entered && d->decorated)
++	{
++	    /* We are not in an event / button window but last_pos_entered
++	     * is still set, so send a GLeaveNotify to last_pos_entered
++	     * and set it to NULL
++	     */
++
++	    event_callback leave_cb;
++
++	    leave_cb = find_leave_event_callback (d);
++
++	    if (leave_cb)
++	    {
++		decor_event    gtkwd_event;
++
++		gtkwd_event.window = GDK_WINDOW_XID (d->frame_window);
++		gtkwd_event.x      = event->x;
++		gtkwd_event.y      = event->y;
++		gtkwd_event.x_root = event->x_root;
++		gtkwd_event.y_root = event->y_root;
++		gtkwd_event.time   = event->time;
++
++		(*leave_cb) (d->win, &gtkwd_event, GLeaveNotify);
++	    }
++
++	    d->last_pos_entered = NULL;
++	}
++    }
++}
++
++GdkFilterReturn
++event_filter_func (GdkXEvent *gdkxevent,
++		   GdkEvent  *event,
++		   gpointer  data)
++{
++    Display    *xdisplay;
++    GdkDisplay *gdkdisplay;
++    XEvent     *xevent = gdkxevent;
++    gulong     xid = 0;
++    Window     select = 0;
++
++    gdkdisplay = gdk_display_get_default ();
++    xdisplay   = GDK_DISPLAY_XDISPLAY (gdkdisplay);
++
++    switch (xevent->type) {
++    case CreateNotify:
++	{
++	    if (!wnck_window_get (xevent->xcreatewindow.window))
++	    {
++		GdkWindow *toplevel = gdk_window_foreign_new_for_display (gdkdisplay,
++								      	  xevent->xcreatewindow.window);
++
++		if (toplevel)
++		{
++		    gdk_window_set_events (toplevel,
++					   gdk_window_get_events (toplevel) |
++					   GDK_PROPERTY_CHANGE_MASK);
++
++		    /* check if the window is a switcher and update accordingly */
++
++		    if (get_window_prop (xevent->xcreatewindow.window, select_window_atom, &select))
++			update_switcher_window (xevent->xcreatewindow.window, select);
++		}
++	    }
++	}
++	break;
++    case ButtonPress:
++    case ButtonRelease:
++	xid = (gulong)
++	    g_hash_table_lookup (frame_table,
++				 GINT_TO_POINTER (xevent->xbutton.window));
++	break;
++    case EnterNotify:
++    case LeaveNotify:
++	xid = (gulong)
++	    g_hash_table_lookup (frame_table,
++				 GINT_TO_POINTER (xevent->xcrossing.window));
++	break;
++    case MotionNotify:
++	xid = (gulong)
++	    g_hash_table_lookup (frame_table,
++				 GINT_TO_POINTER (xevent->xmotion.window));
++	break;
++    case PropertyNotify:
++	if (xevent->xproperty.atom == frame_input_window_atom)
++	{
++	    WnckWindow *win;
++
++	    xid = xevent->xproperty.window;
++
++	    win = wnck_window_get (xid);
++	    if (win)
++	    {
++		Window frame;
++
++		if (!get_window_prop (xid, select_window_atom, &select))
++		{
++		    if (get_window_prop (xid, frame_input_window_atom, &frame))
++			add_frame_window (win, frame, FALSE);
++		    else
++			remove_frame_window (win);
++		}
++	    }
++	}
++	if (xevent->xproperty.atom == frame_output_window_atom)
++	{
++	    WnckWindow *win;
++
++	    xid = xevent->xproperty.window;
++
++	    win = wnck_window_get (xid);
++	    if (win)
++	    {
++		Window frame;
++
++		if (!get_window_prop (xid, select_window_atom, &select))
++		{
++		    if (get_window_prop (xid, frame_output_window_atom, &frame))
++			add_frame_window (win, frame, TRUE);
++		    else
++			remove_frame_window (win);
++		}
++	    }
++	}
++	else if (xevent->xproperty.atom == compiz_shadow_info_atom ||
++		 xevent->xproperty.atom == compiz_shadow_color_atom)
++	{
++	    GdkScreen  *g_screen = gdk_display_get_default_screen (gdkdisplay);
++	    Window     root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (g_screen));
++	    WnckScreen *screen;
++
++	    screen = wnck_screen_get_for_root (root);
++
++	    if (screen)
++	    {
++		shadow_property_changed (screen);
++	    }
++	}
++	else if (xevent->xproperty.atom == mwm_hints_atom)
++	{
++	    WnckWindow *win;
++
++	    xid = xevent->xproperty.window;
++
++	    win = wnck_window_get (xid);
++	    if (win)
++	    {
++		decor_t  *d = g_object_get_data (G_OBJECT (win), "decor");
++		gboolean decorated = FALSE;
++
++		if (get_mwm_prop (xid) & (MWM_DECOR_ALL | MWM_DECOR_TITLE))
++		    decorated = TRUE;
++
++		if (decorated != d->decorated)
++		{
++		    d->decorated = decorated;
++		    if (decorated)
++		    {
++			d->context = NULL;
++			d->width = d->height = 0;
++
++			update_window_decoration_size (win);
++			update_event_windows (win);
++		    }
++		    else
++		    {
++			gdk_error_trap_push ();
++			XDeleteProperty (xdisplay, xid, win_decor_atom);
++			gdk_display_sync (gdk_display_get_default ());
++			gdk_error_trap_pop ();
++		    }
++		}
++	    }
++	}
++	else if (xevent->xproperty.atom == select_window_atom)
++	{
++	    Window select;
++
++	    if (get_window_prop (xevent->xproperty.window, select_window_atom, &select))
++		update_switcher_window (xevent->xproperty.window, select);
++	}
++	else if (xevent->xproperty.atom == XA_WM_TRANSIENT_FOR)
++	{
++	    WnckWindow *win = wnck_window_get (xevent->xproperty.window);
++
++	    if (win &&
++		wnck_window_get_window_type (win) == WNCK_WINDOW_DIALOG)
++	    {
++		Window parent;
++
++		if (get_window_prop (xevent->xproperty.window, XA_WM_TRANSIENT_FOR, &parent))
++		{
++		    WnckWindow *p = wnck_window_get (parent);
++		    decor_t *d = g_object_get_data (G_OBJECT (p), "decor");
++		    decor_t *d_transient = g_object_get_data (G_OBJECT (p), "decor");
++
++		    if (g_slist_find (d->transient_windows, p))
++			break;
++
++		    if (d)
++		    {
++			d->transient_windows = g_slist_append (d->transient_windows, win);
++			d_transient->transient_parent = p;
++		    }
++		}
++	    }
++	}
++	break;
++    case DestroyNotify:
++    {
++	g_hash_table_remove (frame_table,
++			     GINT_TO_POINTER (xevent->xproperty.window));
++
++	break;
++    }
++    case ClientMessage:
++	if (xevent->xclient.message_type == toolkit_action_atom)
++	{
++	    long action;
++
++	    action = xevent->xclient.data.l[0];
++	    if (action == toolkit_action_window_menu_atom)
++	    {
++		WnckWindow *win;
++
++		win = wnck_window_get (xevent->xclient.window);
++		if (win)
++		{
++		    action_menu_map (win,
++				     xevent->xclient.data.l[2],
++				     xevent->xclient.data.l[1]);
++		}
++	    }
++	    else if (action == toolkit_action_force_quit_dialog_atom)
++	    {
++		WnckWindow *win;
++
++		win = wnck_window_get (xevent->xclient.window);
++		if (win)
++		{
++		    if (xevent->xclient.data.l[2])
++			show_force_quit_dialog (win,
++						xevent->xclient.data.l[1]);
++		    else
++			hide_force_quit_dialog (win);
++		}
++	    }
++	}
++    default:
++	break;
++    }
++
++    if (xid)
++    {
++	WnckWindow *win;
++
++	win = wnck_window_get (xid);
++	if (win)
++	{
++	    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++	    if (d->decorated)
++	    {
++		gint             i, j;
++		event_callback   cb = NULL;
++		Window           w = xevent->xany.window;
++
++		for (i = 0; i < 3; i++)
++		    for (j = 0; j < 3; j++)
++			if (d->event_windows[i][j].window == w)
++			    cb = d->event_windows[i][j].callback;
++
++		if (!cb)
++		{
++		    for (i = 0; i < BUTTON_NUM; i++)
++			if (d->button_windows[i].window == w)
++			    cb = d->button_windows[i].callback;
++		}
++
++		if (cb)
++		{
++		    decor_event      gtkwd_event;
++		    decor_event_type gtkwd_type;
++
++		    gtkwd_event.window = w;
++
++		    switch (xevent->type)
++		    {
++			case ButtonPress:
++			case ButtonRelease:
++			    if (xevent->type == ButtonPress)
++				gtkwd_type = GButtonPress;
++			    else
++				gtkwd_type = GButtonRelease;
++			    gtkwd_event.button = xevent->xbutton.button;
++			    gtkwd_event.x = xevent->xbutton.x;
++			    gtkwd_event.y = xevent->xbutton.y;
++			    gtkwd_event.x_root = xevent->xbutton.x_root;
++			    gtkwd_event.y_root = xevent->xbutton.y_root;
++			    gtkwd_event.time = xevent->xbutton.time;
++			    break;
++			case EnterNotify:
++			case LeaveNotify:
++			    if (xevent->type == EnterNotify)
++				gtkwd_type = GEnterNotify;
++			    else
++				gtkwd_type = GLeaveNotify;
++			    gtkwd_event.x = xevent->xcrossing.x;
++			    gtkwd_event.y = xevent->xcrossing.y;
++			    gtkwd_event.x_root = xevent->xcrossing.x_root;
++			    gtkwd_event.y_root = xevent->xcrossing.y_root;
++			    gtkwd_event.time = xevent->xcrossing.time;
++			    break;
++			default:
++			    cb = NULL;
++			    break;
++		    }
++		    if (cb)
++			(*cb) (win, &gtkwd_event, gtkwd_type);
++		}
++	    }
++	}
++    }
++
++    return GDK_FILTER_CONTINUE;
++}
++
++GdkFilterReturn
++selection_event_filter_func (GdkXEvent *gdkxevent,
++			     GdkEvent  *event,
++			     gpointer  data)
++{
++    Display    *xdisplay;
++    GdkDisplay *gdkdisplay;
++    XEvent     *xevent = gdkxevent;
++    int	       status;
++
++    gdkdisplay = gdk_display_get_default ();
++    xdisplay   = GDK_DISPLAY_XDISPLAY (gdkdisplay);
++
++    switch (xevent->type) {
++    case SelectionRequest:
++	decor_handle_selection_request (xdisplay, xevent, dm_sn_timestamp);
++	break;
++    case SelectionClear:
++	status = decor_handle_selection_clear (xdisplay, xevent, 0);
++	if (status == DECOR_SELECTION_GIVE_UP)
++	    exit (0);
++    default:
++	break;
++    }
++
++    return GDK_FILTER_CONTINUE;
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/forcequit.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/forcequit.c	2011-03-23 11:45:03.602056472 +0800
+@@ -0,0 +1,176 @@
++#include "gtk-window-decorator.h"
++
++static char *
++get_client_machine (Window xwindow)
++{
++    Atom   atom, type;
++    gulong nitems, bytes_after;
++    guchar *str = NULL;
++    int    format, result;
++    char   *retval;
++
++    atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "WM_CLIENT_MACHINE", FALSE);
++
++    gdk_error_trap_push ();
++
++    result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
++				 xwindow, atom,
++				 0, G_MAXLONG,
++				 FALSE, XA_STRING, &type, &format, &nitems,
++				 &bytes_after, &str);
++
++    gdk_error_trap_pop ();
++
++    if (result != Success)
++	return NULL;
++
++    if (type != XA_STRING)
++    {
++	XFree (str);
++	return NULL;
++    }
++
++    retval = g_strdup ((gchar *) str);
++
++    XFree (str);
++
++    return retval;
++}
++
++static void
++kill_window (WnckWindow *win)
++{
++    WnckApplication *app;
++
++    app = wnck_window_get_application (win);
++    if (app)
++    {
++	gchar buf[257], *client_machine;
++	int   pid;
++
++	pid = wnck_application_get_pid (app);
++	client_machine = get_client_machine (wnck_application_get_xid (app));
++
++	if (client_machine && pid > 0)
++	{
++	    if (gethostname (buf, sizeof (buf) - 1) == 0)
++	    {
++		if (strcmp (buf, client_machine) == 0)
++		    kill (pid, 9);
++	    }
++	}
++
++	if (client_machine)
++	    g_free (client_machine);
++    }
++
++    gdk_error_trap_push ();
++    XKillClient (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wnck_window_get_xid (win));
++    gdk_display_sync (gdk_display_get_default ());
++    gdk_error_trap_pop ();
++}
++
++static void
++force_quit_dialog_realize (GtkWidget *dialog,
++			   void      *data)
++{
++    WnckWindow *win = data;
++
++    gdk_error_trap_push ();
++    XSetTransientForHint (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
++			  GDK_WINDOW_XID (dialog->window),
++			  wnck_window_get_xid (win));
++    gdk_display_sync (gdk_display_get_default ());
++    gdk_error_trap_pop ();
++}
++
++static void
++force_quit_dialog_response (GtkWidget *dialog,
++			    gint      response,
++			    void      *data)
++{
++    WnckWindow *win = data;
++    decor_t    *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (response == GTK_RESPONSE_ACCEPT)
++	kill_window (win);
++
++    if (d->force_quit_dialog)
++    {
++	d->force_quit_dialog = NULL;
++	gtk_widget_destroy (dialog);
++    }
++}
++
++void
++show_force_quit_dialog (WnckWindow *win,
++			Time        timestamp)
++{
++    decor_t   *d = g_object_get_data (G_OBJECT (win), "decor");
++    GtkWidget *dialog;
++    gchar     *str, *tmp;
++
++    if (d->force_quit_dialog)
++	return;
++
++    tmp = g_markup_escape_text (wnck_window_get_name (win), -1);
++    str = g_strdup_printf (_("The window \"%s\" is not responding."), tmp);
++
++    g_free (tmp);
++
++    dialog = gtk_message_dialog_new (NULL, 0,
++				     GTK_MESSAGE_WARNING,
++				     GTK_BUTTONS_NONE,
++				     "<b>%s</b>\n\n%s",
++				     str,
++				     _("Forcing this application to "
++				     "quit will cause you to lose any "
++				     "unsaved changes."));
++    g_free (str);
++
++    gtk_window_set_icon_name (GTK_WINDOW (dialog), "force-quit");
++
++    gtk_label_set_use_markup (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label),
++			      TRUE);
++    gtk_label_set_line_wrap (GTK_LABEL (GTK_MESSAGE_DIALOG (dialog)->label),
++			     TRUE);
++
++    gtk_dialog_add_buttons (GTK_DIALOG (dialog),
++			    GTK_STOCK_CANCEL,
++			    GTK_RESPONSE_REJECT,
++			    _("_Force Quit"),
++			    GTK_RESPONSE_ACCEPT,
++			    NULL);
++
++    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_REJECT);
++
++    g_signal_connect (G_OBJECT (dialog), "realize",
++		      G_CALLBACK (force_quit_dialog_realize),
++		      win);
++
++    g_signal_connect (G_OBJECT (dialog), "response",
++		      G_CALLBACK (force_quit_dialog_response),
++		      win);
++
++    gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
++
++    gtk_widget_realize (dialog);
++
++    gdk_x11_window_set_user_time (dialog->window, timestamp);
++
++    gtk_widget_show (dialog);
++
++    d->force_quit_dialog = dialog;
++}
++
++void
++hide_force_quit_dialog (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->force_quit_dialog)
++    {
++	gtk_widget_destroy (d->force_quit_dialog);
++	d->force_quit_dialog = NULL;
++    }
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/gdk.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/gdk.c	2011-03-23 11:45:03.612056499 +0800
+@@ -0,0 +1,87 @@
++#include "gtk-window-decorator.h"
++
++GdkPixmap *
++pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, int depth)
++{
++    GdkPixmap *pixmap;
++    guint     width, height;
++    cairo_t   *cr;
++
++    width  = gdk_pixbuf_get_width (pixbuf);
++    height = gdk_pixbuf_get_height (pixbuf);
++
++    pixmap = create_pixmap (width, height, depth);
++    if (!pixmap)
++	return NULL;
++
++    cr = (cairo_t *) gdk_cairo_create (GDK_DRAWABLE (pixmap));
++    gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
++    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++    cairo_paint (cr);
++    cairo_destroy (cr);
++
++    return pixmap;
++}
++
++
++void
++gdk_cairo_set_source_color_alpha (cairo_t  *cr,
++				  GdkColor *color,
++				  double   alpha)
++{
++    cairo_set_source_rgba (cr,
++			   color->red   / 65535.0,
++			   color->green / 65535.0,
++			   color->blue  / 65535.0,
++			   alpha);
++}
++
++inline GdkWindow *
++create_gdk_window (Window xframe)
++{
++    GdkDisplay  *display = gdk_display_get_default ();
++    GdkScreen   *screen  = gdk_display_get_default_screen (display);
++    GdkWindow   *window  = gdk_window_foreign_new (xframe);
++    GdkColormap *cmap    = gdk_screen_get_rgb_colormap (screen);
++
++    gdk_drawable_set_colormap (GDK_DRAWABLE (window), cmap);
++
++    return window;
++}
++
++GdkColormap *
++get_colormap_for_drawable (GdkDrawable *d)
++{
++    GdkDisplay *display = gdk_display_get_default ();
++    GdkScreen  *screen  = gdk_display_get_default_screen (display);
++
++    if (gdk_drawable_get_depth (d) == 32)
++	return gdk_screen_get_rgba_colormap (screen);
++
++    return gdk_screen_get_rgb_colormap (screen);
++}
++
++XRenderPictFormat *
++get_format_for_drawable (decor_t *d, GdkDrawable *drawable)
++{
++    if (!d->frame_window || gdk_drawable_get_depth (drawable) == 32)
++	return xformat_rgba;
++
++    return xformat_rgb;
++}
++
++GdkPixmap *
++create_pixmap (int w,
++	       int h,
++	       int depth)
++{
++    GtkWidget *widget;
++    GdkWindow *window;
++
++    if (w == 0 || h == 0)
++	abort ();
++
++    widget = (depth > 24) ? style_window_rgba : style_window_rgb;
++    window = gtk_widget_get_window (widget);
++    return gdk_pixmap_new (GDK_DRAWABLE (window), w, h, depth);
++}
+\ No newline at end of file
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/gtk-window-decorator.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/gtk-window-decorator.c	2011-03-23 11:45:03.612056499 +0800
+@@ -0,0 +1,443 @@
++/*
++ * Copyright © 2006 Novell, Inc.
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 02111-1307, USA.
++ *
++ * Author: David Reveman <davidr@xxxxxxxxxx>
++ */
++
++#include "gtk-window-decorator.h"
++
++gboolean minimal = FALSE;
++
++double decoration_alpha = 0.5;
++
++#define SWITCHER_SPACE 40
++
++decor_extents_t _shadow_extents      = { 0, 0, 0, 0 };
++decor_extents_t _win_extents         = { 6, 6, 6, 6 };
++decor_extents_t _max_win_extents     = { 6, 6, 4, 6 };
++decor_extents_t _default_win_extents = { 6, 6, 6, 6 };
++decor_extents_t _switcher_extents    = { 6, 6, 6, 6 + SWITCHER_SPACE };
++
++int titlebar_height = 17;
++int max_titlebar_height = 17;
++
++decor_context_t window_active_context = {
++    { 0, 0, 0, 0 },
++    6, 6, 4, 6,
++    0, 0, 0, 0
++};
++
++decor_context_t max_window_active_context = {
++    { 0, 0, 0, 0 },
++    6, 6, 4, 6,
++    0, 0, 0, 0
++};
++
++decor_context_t window_inactive_context = {
++    { 0, 0, 0, 0 },
++    6, 6, 4, 6,
++    0, 0, 0, 0
++};
++
++decor_context_t max_window_inactive_context = {
++    { 0, 0, 0, 0 },
++    6, 6, 4, 6,
++    0, 0, 0, 0
++};
++
++decor_context_t window_context_no_shadow = {
++    { 0, 0, 0, 0 },
++    6, 6, 4, 6,
++    0, 0, 0, 0
++};
++
++decor_context_t max_window_context_no_shadow = {
++    { 0, 0, 0, 0 },
++    6, 6, 4, 6,
++    0, 0, 0, 0
++};
++
++decor_context_t switcher_context = {
++    { 0, 0, 0, 0 },
++    6, 6, 6, 6 + SWITCHER_SPACE,
++    0, 0, 0, 0
++};
++
++decor_context_t shadow_context = {
++    { 0, 0, 0, 0 },
++    0, 0, 0, 0,
++    0, 0, 0, 0,
++};
++
++gdouble shadow_radius   = SHADOW_RADIUS;
++gdouble shadow_opacity  = SHADOW_OPACITY;
++gushort shadow_color[3] = {
++  SHADOW_COLOR_RED,
++  SHADOW_COLOR_GREEN,
++  SHADOW_COLOR_BLUE
++};
++gint    shadow_offset_x = SHADOW_OFFSET_X;
++gint    shadow_offset_y = SHADOW_OFFSET_Y;
++
++guint cmdline_options = 0;
++
++decor_shadow_t *no_border_shadow = NULL;
++decor_shadow_t *border_active_shadow = NULL;
++decor_shadow_t *border_inactive_shadow = NULL;
++decor_shadow_t *max_border_active_shadow = NULL;
++decor_shadow_t *max_border_inactive_shadow = NULL;
++decor_shadow_t *border_no_shadow = NULL;
++decor_shadow_t *max_border_no_shadow = NULL;
++decor_shadow_t *switcher_shadow = NULL;
++
++GdkPixmap *decor_normal_pixmap = NULL;
++GdkPixmap *decor_active_pixmap = NULL;
++
++Atom frame_input_window_atom;
++Atom frame_output_window_atom;
++Atom win_decor_atom;
++Atom win_blur_decor_atom;
++Atom wm_move_resize_atom;
++Atom restack_window_atom;
++Atom select_window_atom;
++Atom mwm_hints_atom;
++Atom switcher_fg_atom;
++
++Atom compiz_shadow_info_atom;
++Atom compiz_shadow_color_atom;
++
++Atom toolkit_action_atom;
++Atom toolkit_action_window_menu_atom;
++Atom toolkit_action_force_quit_dialog_atom;
++
++Time dm_sn_timestamp;
++
++struct _cursor cursor[3][3] = {
++    { C (top_left_corner),    C (top_side),    C (top_right_corner)    },
++    { C (left_side),	      C (left_ptr),    C (right_side)	       },
++    { C (bottom_left_corner), C (bottom_side), C (bottom_right_corner) }
++};
++
++struct _pos pos[3][3] = {
++    {
++	{  0,  0, 10, 21,   0, 0, 0, 0, 0, 1 },
++	{ 10,  0, -8,  6,   0, 0, 1, 0, 0, 1 },
++	{  2,  0, 10, 21,   1, 0, 0, 0, 0, 1 }
++    }, {
++	{  0, 10,  6, 11,   0, 0, 0, 1, 1, 0 },
++	{  6,  6,  0, 15,   0, 0, 1, 0, 0, 1 },
++	{  6, 10,  6, 11,   1, 0, 0, 1, 1, 0 }
++    }, {
++	{  0, 17, 10, 10,   0, 1, 0, 0, 1, 0 },
++	{ 10, 21, -8,  6,   0, 1, 1, 0, 1, 0 },
++	{  2, 17, 10, 10,   1, 1, 0, 0, 1, 0 }
++    }
++}, bpos[] = {
++    { 0, 6, 16, 16,   1, 0, 0, 0, 0, 0 },
++    { 0, 6, 16, 16,   1, 0, 0, 0, 0, 0 },
++    { 0, 6, 16, 16,   1, 0, 0, 0, 0, 0 },
++    { 6, 2, 16, 16,   0, 0, 0, 0, 0, 0 }
++};
++
++char *program_name;
++
++GtkWidget     *style_window_rgba;
++GtkWidget     *style_window_rgb;
++GtkWidget     *switcher_label;
++
++GHashTable    *frame_table;
++GtkWidget     *action_menu = NULL;
++gboolean      action_menu_mapped = FALSE;
++decor_color_t _title_color[2];
++PangoContext  *pango_context;
++gint	     double_click_timeout = 250;
++
++GSList *draw_list = NULL;
++guint  draw_idle_id = 0;
++
++PangoFontDescription *titlebar_font = NULL;
++gboolean		    use_system_font = FALSE;
++gint		    text_height;
++
++gint blur_type = BLUR_TYPE_NONE;
++
++GdkPixmap *switcher_pixmap = NULL;
++GdkPixmap *switcher_buffer_pixmap = NULL;
++gint      switcher_width;
++gint      switcher_height;
++Window    switcher_selected_window = None;
++decor_t   *switcher_window = NULL;
++
++XRenderPictFormat *xformat_rgba;
++XRenderPictFormat *xformat_rgb;
++
++int
++main (int argc, char *argv[])
++{
++    GdkDisplay *gdkdisplay;
++    Display    *xdisplay;
++    GdkScreen  *gdkscreen;
++    WnckScreen *screen;
++    gint       i, j, status;
++    unsigned int nchildren;
++    Window     root_ret, parent_ret;
++    Window     *children = NULL;
++    gboolean   replace = FALSE;
++
++#ifdef USE_METACITY
++    char       *meta_theme = NULL;
++#endif
++
++    program_name = argv[0];
++
++    gtk_init (&argc, &argv);
++
++    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
++    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
++    textdomain (GETTEXT_PACKAGE);
++
++    for (i = 0; i < argc; i++)
++    {
++	if (strcmp (argv[i], "--minimal") == 0)
++	{
++	    minimal = TRUE;
++	}
++	else if (strcmp (argv[i], "--replace") == 0)
++	{
++	    replace = TRUE;
++	}
++	else if (strcmp (argv[i], "--blur") == 0)
++	{
++	    if (argc > ++i)
++	    {
++		if (strcmp (argv[i], "titlebar") == 0)
++		    blur_type = BLUR_TYPE_TITLEBAR;
++		else if (strcmp (argv[i], "all") == 0)
++		    blur_type = BLUR_TYPE_ALL;
++	    }
++	    cmdline_options |= CMDLINE_BLUR;
++	}
++
++#ifdef USE_METACITY
++	else if (strcmp (argv[i], "--opacity") == 0)
++	{
++	    if (argc > ++i)
++		meta_opacity = atof (argv[i]);
++	    cmdline_options |= CMDLINE_OPACITY;
++	}
++	else if (strcmp (argv[i], "--no-opacity-shade") == 0)
++	{
++	    meta_shade_opacity = FALSE;
++	    cmdline_options |= CMDLINE_OPACITY_SHADE;
++	}
++	else if (strcmp (argv[i], "--active-opacity") == 0)
++	{
++	    if (argc > ++i)
++		meta_active_opacity = atof (argv[i]);
++	    cmdline_options |= CMDLINE_ACTIVE_OPACITY;
++	}
++	else if (strcmp (argv[i], "--no-active-opacity-shade") == 0)
++	{
++	    meta_active_shade_opacity = FALSE;
++	    cmdline_options |= CMDLINE_ACTIVE_OPACITY_SHADE;
++	}
++	else if (strcmp (argv[i], "--metacity-theme") == 0)
++	{
++	    if (argc > ++i)
++		meta_theme = argv[i];
++	    cmdline_options |= CMDLINE_THEME;
++	}
++#endif
++
++	else if (strcmp (argv[i], "--help") == 0)
++	{
++	    fprintf (stderr, "%s "
++		     "[--minimal] "
++		     "[--replace] "
++		     "[--blur none|titlebar|all] "
++
++#ifdef USE_METACITY
++		     "[--opacity OPACITY] "
++		     "[--no-opacity-shade] "
++		     "[--active-opacity OPACITY] "
++		     "[--no-active-opacity-shade] "
++		     "[--metacity-theme THEME] "
++#endif
++
++		     "[--help]"
++
++		     "\n", program_name);
++	    return 0;
++	}
++    }
++
++    theme_draw_window_decoration    = draw_window_decoration;
++    theme_calc_decoration_size	    = calc_decoration_size;
++    theme_update_border_extents	    = update_border_extents;
++    theme_get_event_window_position = get_event_window_position;
++    theme_get_button_position       = get_button_position;
++    theme_update_shadow		    = cairo_update_shadow;
++    theme_get_shadow		    = get_shadow;
++
++#ifdef USE_METACITY
++    if (meta_theme)
++    {
++	meta_theme_set_current (meta_theme, TRUE);
++	if (meta_theme_get_current ())
++	{
++	    theme_draw_window_decoration    = meta_draw_window_decoration;
++	    theme_calc_decoration_size	    = meta_calc_decoration_size;
++	    theme_update_border_extents	    = meta_update_border_extents;
++	    theme_get_event_window_position = meta_get_event_window_position;
++	    theme_get_button_position	    = meta_get_button_position;
++	    theme_update_shadow		    = meta_update_shadow;
++	    theme_get_shadow		    = meta_get_shadow;
++	}
++    }
++#endif
++
++    gdkdisplay = gdk_display_get_default ();
++    xdisplay   = gdk_x11_display_get_xdisplay (gdkdisplay);
++    gdkscreen  = gdk_display_get_default_screen (gdkdisplay);
++
++    frame_input_window_atom  = XInternAtom (xdisplay,
++					    DECOR_INPUT_FRAME_ATOM_NAME, FALSE);
++    frame_output_window_atom = XInternAtom (xdisplay,
++					    DECOR_OUTPUT_FRAME_ATOM_NAME, FALSE);
++
++    win_decor_atom	= XInternAtom (xdisplay, DECOR_WINDOW_ATOM_NAME, FALSE);
++    win_blur_decor_atom	= XInternAtom (xdisplay, DECOR_BLUR_ATOM_NAME, FALSE);
++    wm_move_resize_atom = XInternAtom (xdisplay, "_NET_WM_MOVERESIZE", FALSE);
++    restack_window_atom = XInternAtom (xdisplay, "_NET_RESTACK_WINDOW", FALSE);
++    select_window_atom	= XInternAtom (xdisplay, DECOR_SWITCH_WINDOW_ATOM_NAME,
++				       FALSE);
++    mwm_hints_atom	= XInternAtom (xdisplay, "_MOTIF_WM_HINTS", FALSE);
++    switcher_fg_atom    = XInternAtom (xdisplay,
++				       DECOR_SWITCH_FOREGROUND_COLOR_ATOM_NAME,
++				       FALSE);
++
++    compiz_shadow_info_atom  = XInternAtom (xdisplay, "_COMPIZ_NET_CM_SHADOW_PROPERTIES", FALSE);
++    compiz_shadow_color_atom = XInternAtom (xdisplay, "_COMPIZ_NET_CM_SHADOW_COLOR", FALSE);
++
++    toolkit_action_atom			  =
++	XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION", FALSE);
++    toolkit_action_window_menu_atom	  =
++	XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION_WINDOW_MENU", FALSE);
++    toolkit_action_force_quit_dialog_atom =
++	XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION_FORCE_QUIT_DIALOG",
++		     FALSE);
++
++    status = decor_acquire_dm_session (xdisplay,
++				       gdk_screen_get_number (gdkscreen),
++				       "gwd", replace, &dm_sn_timestamp);
++    if (status != DECOR_ACQUIRE_STATUS_SUCCESS)
++    {
++	if (status == DECOR_ACQUIRE_STATUS_FAILED)
++	{
++	    fprintf (stderr,
++		     "%s: Could not acquire decoration manager "
++		     "selection on screen %d display \"%s\"\n",
++		     program_name, gdk_screen_get_number (gdkscreen),
++		     DisplayString (xdisplay));
++	}
++	else if (status == DECOR_ACQUIRE_STATUS_OTHER_DM_RUNNING)
++	{
++	    fprintf (stderr,
++		     "%s: Screen %d on display \"%s\" already "
++		     "has a decoration manager; try using the "
++		     "--replace option to replace the current "
++		     "decoration manager.\n",
++		     program_name, gdk_screen_get_number (gdkscreen),
++		     DisplayString (xdisplay));
++	}
++
++	return 1;
++    }
++
++    for (i = 0; i < 3; i++)
++    {
++	for (j = 0; j < 3; j++)
++	{
++	    if (cursor[i][j].shape != XC_left_ptr)
++		cursor[i][j].cursor =
++		    XCreateFontCursor (xdisplay, cursor[i][j].shape);
++	}
++    }
++
++    xformat_rgba = XRenderFindStandardFormat (xdisplay, PictStandardARGB32);
++    xformat_rgb  = XRenderFindStandardFormat (xdisplay, PictStandardRGB24);
++
++    frame_table = g_hash_table_new (NULL, NULL);
++
++    screen = wnck_screen_get_default ();
++    wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER);
++
++    gdk_window_add_filter (NULL,
++			   selection_event_filter_func,
++			   NULL);
++
++    if (!minimal)
++    {
++	GdkWindow *root = gdk_window_foreign_new_for_display (gdkdisplay,
++							      gdk_x11_get_default_root_xwindow ());
++
++	gdk_window_add_filter (NULL,
++			       event_filter_func,
++			       NULL);
++			       
++	XQueryTree (xdisplay, gdk_x11_get_default_root_xwindow (),
++		    &root_ret, &parent_ret, &children, &nchildren);
++
++	for (i = 0; i < nchildren; i++)
++	{
++	    GdkWindow *toplevel = gdk_window_foreign_new_for_display (gdkdisplay,
++								      children[i]);
++
++	    /* Need property notify on all windows */
++
++	    gdk_window_set_events (toplevel,
++				   gdk_window_get_events (toplevel) |
++				   GDK_PROPERTY_CHANGE_MASK);
++	}
++
++	/* Need MapNotify on new windows */
++	gdk_window_set_events (root, gdk_window_get_events (root) |
++			       GDK_STRUCTURE_MASK |
++			       GDK_PROPERTY_CHANGE_MASK |
++			       GDK_VISIBILITY_NOTIFY_MASK |
++			       GDK_SUBSTRUCTURE_MASK);
++
++	connect_screen (screen);
++    }
++
++    if (!init_settings (screen))
++    {
++	fprintf (stderr, "%s: Failed to get necessary gtk settings\n", argv[0]);
++	return 1;
++    }
++
++    decor_set_dm_check_hint (xdisplay, gdk_screen_get_number (gdkscreen),
++			     WINDOW_DECORATION_TYPE_PIXMAP |
++			     WINDOW_DECORATION_TYPE_WINDOW);
++
++    update_default_decorations (gdkscreen);
++
++    gtk_main ();
++
++    return 0;
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/gtk-window-decorator.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/gtk-window-decorator.h	2011-03-23 11:45:03.612056499 +0800
+@@ -0,0 +1,980 @@
++#ifndef _GTK_WINDOW_DECORATOR_H
++#define _GTK_WINDOW_DECORATOR_H
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <decoration.h>
++
++#include <X11/Xlib.h>
++#include <X11/Xatom.h>
++#include <X11/cursorfont.h>
++#include <X11/extensions/Xrender.h>
++#include <X11/Xregion.h>
++
++#ifndef GDK_DISABLE_DEPRECATED
++#define GDK_DISABLE_DEPRECATED
++#endif
++
++#ifndef GTK_DISABLE_DEPRECATED
++#define GTK_DISABLE_DEPRECATED
++#endif
++
++#include <gtk/gtk.h>
++#include <gdk/gdkx.h>
++#include <gdk/gdk.h>
++
++#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR
++#include <gconf/gconf-client.h>
++#endif
++
++#ifdef USE_DBUS_GLIB
++#define DBUS_API_SUBJECT_TO_CHANGE
++#include <dbus/dbus.h>
++#include <dbus/dbus-glib-lowlevel.h>
++#endif
++
++#define WNCK_I_KNOW_THIS_IS_UNSTABLE
++#include <libwnck/libwnck.h>
++#include <libwnck/window-action-menu.h>
++
++#ifndef HAVE_LIBWNCK_2_19_4
++#define wnck_window_get_client_window_geometry wnck_window_get_geometry
++#endif
++
++#include <cairo.h>
++#include <cairo-xlib.h>
++
++#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 1, 0)
++#define CAIRO_EXTEND_PAD CAIRO_EXTEND_NONE
++#endif
++
++#include <pango/pango-context.h>
++#include <pango/pangocairo.h>
++
++#include <string.h>
++#include <stdlib.h>
++#include <math.h>
++#include <limits.h>
++#include <unistd.h>
++#include <sys/types.h>
++#include <signal.h>
++
++#include <libintl.h>
++#define _(x)  gettext (x)
++#define N_(x) x
++
++#ifdef USE_METACITY
++#include <metacity-private/theme.h>
++#endif
++
++#define METACITY_GCONF_DIR "/apps/metacity/general"
++
++#define COMPIZ_USE_SYSTEM_FONT_KEY		    \
++METACITY_GCONF_DIR "/titlebar_uses_system_font"
++
++#define COMPIZ_TITLEBAR_FONT_KEY	\
++METACITY_GCONF_DIR "/titlebar_font"
++
++#define COMPIZ_DOUBLE_CLICK_TITLEBAR_KEY	       \
++METACITY_GCONF_DIR "/action_double_click_titlebar"
++
++#define COMPIZ_MIDDLE_CLICK_TITLEBAR_KEY	       \
++METACITY_GCONF_DIR "/action_middle_click_titlebar"
++
++#define COMPIZ_RIGHT_CLICK_TITLEBAR_KEY	       \
++METACITY_GCONF_DIR "/action_right_click_titlebar"
++
++#define COMPIZ_GCONF_DIR1 "/apps/compiz/plugins/decoration/allscreens/options"
++
++#define COMPIZ_SHADOW_RADIUS_KEY \
++COMPIZ_GCONF_DIR1 "/shadow_radius"
++
++#define COMPIZ_SHADOW_OPACITY_KEY \
++COMPIZ_GCONF_DIR1 "/shadow_opacity"
++
++#define COMPIZ_SHADOW_COLOR_KEY \
++COMPIZ_GCONF_DIR1 "/shadow_color"
++
++#define COMPIZ_SHADOW_OFFSET_X_KEY \
++COMPIZ_GCONF_DIR1 "/shadow_x_offset"
++
++#define COMPIZ_SHADOW_OFFSET_Y_KEY \
++COMPIZ_GCONF_DIR1 "/shadow_y_offset"
++
++#define META_THEME_KEY		\
++METACITY_GCONF_DIR "/theme"
++
++#define META_BUTTON_LAYOUT_KEY		\
++METACITY_GCONF_DIR "/button_layout"
++
++#define GCONF_DIR "/apps/gwd"
++
++#define USE_META_THEME_KEY	    \
++GCONF_DIR "/use_metacity_theme"
++
++#define META_THEME_OPACITY_KEY	        \
++GCONF_DIR "/metacity_theme_opacity"
++
++#define META_THEME_SHADE_OPACITY_KEY	      \
++GCONF_DIR "/metacity_theme_shade_opacity"
++
++#define META_THEME_ACTIVE_OPACITY_KEY	       \
++GCONF_DIR "/metacity_theme_active_opacity"
++
++#define META_THEME_ACTIVE_SHADE_OPACITY_KEY          \
++GCONF_DIR "/metacity_theme_active_shade_opacity"
++
++#define BLUR_TYPE_KEY	   \
++GCONF_DIR "/blur_type"
++
++#define WHEEL_ACTION_KEY   \
++GCONF_DIR "/mouse_wheel_action"
++
++#define DBUS_DEST       "org.freedesktop.compiz"
++#define DBUS_PATH       "/org/freedesktop/compiz/decor/screen0"
++#define DBUS_INTERFACE  "org.freedesktop.compiz"
++#define DBUS_METHOD_GET "get"
++
++#define STROKE_ALPHA 0.6
++
++#define ICON_SPACE 20
++
++#define DOUBLE_CLICK_DISTANCE 8.0
++
++#define WM_MOVERESIZE_SIZE_TOPLEFT      0
++#define WM_MOVERESIZE_SIZE_TOP          1
++#define WM_MOVERESIZE_SIZE_TOPRIGHT     2
++#define WM_MOVERESIZE_SIZE_RIGHT        3
++#define WM_MOVERESIZE_SIZE_BOTTOMRIGHT  4
++#define WM_MOVERESIZE_SIZE_BOTTOM       5
++#define WM_MOVERESIZE_SIZE_BOTTOMLEFT   6
++#define WM_MOVERESIZE_SIZE_LEFT         7
++#define WM_MOVERESIZE_MOVE              8
++#define WM_MOVERESIZE_SIZE_KEYBOARD     9
++#define WM_MOVERESIZE_MOVE_KEYBOARD    10
++
++#define SHADOW_RADIUS      8.0
++#define SHADOW_OPACITY     0.5
++#define SHADOW_OFFSET_X    1
++#define SHADOW_OFFSET_Y    1
++#define SHADOW_COLOR_RED   0x0000
++#define SHADOW_COLOR_GREEN 0x0000
++#define SHADOW_COLOR_BLUE  0x0000
++
++#define SHADOW_TYPE_ACTIVE_NORMAL 1
++#define SHADOW_TYPE_ACTIVE_MAX    2
++#define SHADOW_TYPE_INACTIVE_NORMAL 3
++#define SHADOW_TYPE_INACTIVE_MAX    4
++
++#define META_OPACITY              0.75
++#define META_SHADE_OPACITY        TRUE
++#define META_ACTIVE_OPACITY       1.0
++#define META_ACTIVE_SHADE_OPACITY TRUE
++
++#define META_MAXIMIZED (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY | \
++WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY)
++
++#define CMDLINE_OPACITY              (1 << 0)
++#define CMDLINE_OPACITY_SHADE        (1 << 1)
++#define CMDLINE_ACTIVE_OPACITY       (1 << 2)
++#define CMDLINE_ACTIVE_OPACITY_SHADE (1 << 3)
++#define CMDLINE_BLUR                 (1 << 4)
++#define CMDLINE_THEME                (1 << 5)
++
++#define MWM_HINTS_DECORATIONS (1L << 1)
++
++#define MWM_DECOR_ALL      (1L << 0)
++#define MWM_DECOR_BORDER   (1L << 1)
++#define MWM_DECOR_HANDLE   (1L << 2)
++#define MWM_DECOR_TITLE    (1L << 3)
++#define MWM_DECOR_MENU     (1L << 4)
++#define MWM_DECOR_MINIMIZE (1L << 5)
++#define MWM_DECOR_MAXIMIZE (1L << 6)
++
++#define PROP_MOTIF_WM_HINT_ELEMENTS 3
++
++/* to save some memory, value is specific to current decorations */
++#define TRANSLUCENT_CORNER_SIZE 3
++
++typedef struct {
++unsigned long flags;
++unsigned long functions;
++unsigned long decorations;
++} MwmHints;
++
++enum {
++    CLICK_ACTION_NONE,
++    CLICK_ACTION_SHADE,
++    CLICK_ACTION_MAXIMIZE,
++    CLICK_ACTION_MINIMIZE,
++    CLICK_ACTION_RAISE,
++    CLICK_ACTION_LOWER,
++    CLICK_ACTION_MENU
++};
++
++enum {
++    WHEEL_ACTION_NONE,
++    WHEEL_ACTION_SHADE
++};
++
++#define DOUBLE_CLICK_ACTION_DEFAULT CLICK_ACTION_MAXIMIZE
++#define MIDDLE_CLICK_ACTION_DEFAULT CLICK_ACTION_LOWER
++#define RIGHT_CLICK_ACTION_DEFAULT  CLICK_ACTION_MENU
++#define WHEEL_ACTION_DEFAULT        WHEEL_ACTION_NONE
++
++int double_click_action;
++int middle_click_action;
++int right_click_action;
++int wheel_action;
++
++extern gboolean minimal;
++extern double decoration_alpha;
++
++#define SWITCHER_SPACE 40
++
++extern decor_extents_t _shadow_extents;
++extern decor_extents_t _win_extents;
++extern decor_extents_t _max_win_extents;
++extern decor_extents_t _default_win_extents;
++extern decor_extents_t _switcher_extents;
++
++extern int titlebar_height;
++extern int max_titlebar_height;
++
++extern decor_context_t window_active_context;
++extern decor_context_t window_inactive_context;
++extern decor_context_t window_context_no_shadow;
++extern decor_context_t max_window_active_context;
++extern decor_context_t max_window_inactive_context;
++extern decor_context_t max_window_context_no_shadow;
++extern decor_context_t switcher_context;
++extern decor_context_t shadow_context;
++
++extern gdouble shadow_radius;
++extern gdouble shadow_opacity;
++extern gushort shadow_color[3];
++extern gint    shadow_offset_x;
++extern gint    shadow_offset_y;
++
++#ifdef USE_METACITY
++extern double   meta_opacity;
++extern gboolean meta_shade_opacity;
++extern double   meta_active_opacity;
++extern gboolean meta_active_shade_opacity;
++
++extern gboolean         meta_button_layout_set;
++extern MetaButtonLayout meta_button_layout;
++#endif
++
++extern guint cmdline_options;
++
++extern decor_shadow_t *no_border_shadow;
++extern decor_shadow_t *border_active_shadow;
++extern decor_shadow_t *border_inactive_shadow;
++extern decor_shadow_t *border_no_shadow;
++extern decor_shadow_t *max_border_active_shadow;
++extern decor_shadow_t *max_border_inactive_shadow;
++extern decor_shadow_t *max_border_no_shadow;
++extern decor_shadow_t *switcher_shadow;
++
++extern GdkPixmap *decor_normal_pixmap;
++extern GdkPixmap *decor_active_pixmap;
++
++extern Atom frame_input_window_atom;
++extern Atom frame_output_window_atom;
++extern Atom win_decor_atom;
++extern Atom win_blur_decor_atom;
++extern Atom wm_move_resize_atom;
++extern Atom restack_window_atom;
++extern Atom select_window_atom;
++extern Atom mwm_hints_atom;
++extern Atom switcher_fg_atom;
++
++extern Atom toolkit_action_atom;
++extern Atom toolkit_action_window_menu_atom;
++extern Atom toolkit_action_force_quit_dialog_atom;
++
++extern Time dm_sn_timestamp;
++
++#define C(name) { 0, XC_ ## name }
++
++struct _cursor {
++    Cursor	 cursor;
++    unsigned int shape;
++};
++
++extern struct _cursor cursor[3][3];
++
++#define BUTTON_CLOSE   0
++#define BUTTON_MAX     1
++#define BUTTON_MIN     2
++#define BUTTON_MENU    3
++#define BUTTON_SHADE   4
++#define BUTTON_ABOVE   5
++#define BUTTON_STICK   6
++#define BUTTON_UNSHADE 7
++#define BUTTON_UNABOVE 8
++#define BUTTON_UNSTICK 9
++#define BUTTON_NUM     10
++
++struct _pos {
++    int x, y, w, h;
++    int xw, yh, ww, hh, yth, hth;
++};
++
++extern struct _pos pos[3][3], bpos[];
++
++typedef struct _decor_color {
++    double r;
++    double g;
++    double b;
++} decor_color_t;
++
++
++#define IN_EVENT_WINDOW      (1 << 0)
++#define PRESSED_EVENT_WINDOW (1 << 1)
++
++typedef struct _decor_event {
++    guint time;
++    guint window;
++    guint x;
++    guint y;
++    guint x_root;
++    guint y_root;
++    guint button;
++} decor_event;
++
++typedef enum _decor_event_type {
++    GButtonPress = 1,
++    GButtonRelease,
++    GEnterNotify,
++    GLeaveNotify,
++    GMotionNotify
++} decor_event_type;
++
++typedef void (*event_callback) (WnckWindow       *win,
++				decor_event      *gtkwd_event,
++				decor_event_type gtkwd_type);
++
++typedef struct {
++    Window         window;
++    Box            pos;
++    event_callback callback;
++} event_window;
++
++typedef struct _decor {
++    WnckWindow	      *win;
++    event_window      event_windows[3][3];
++    event_window      button_windows[BUTTON_NUM];
++    Box		      *last_pos_entered;
++    guint	      button_states[BUTTON_NUM];
++    GdkPixmap	      *pixmap;
++    GdkPixmap	      *buffer_pixmap;
++    GdkWindow	      *frame_window;
++    GtkWidget         *decor_window;
++    GtkWidget	      *decor_event_box;
++    GtkWidget         *decor_image;
++    cairo_t	      *cr;
++    decor_layout_t    border_layout;
++    decor_context_t   *context;
++    decor_shadow_t    *shadow;
++    Picture	      picture;
++    gint	      button_width;
++    gint	      width;
++    gint	      height;
++    gint	      client_width;
++    gint	      client_height;
++    gboolean	      decorated;
++    gboolean	      active;
++    PangoLayout	      *layout;
++    gchar	      *name;
++    cairo_pattern_t   *icon;
++    GdkPixmap	      *icon_pixmap;
++    GdkPixbuf	      *icon_pixbuf;
++    WnckWindowState   state;
++    WnckWindowActions actions;
++    XID		      prop_xid;
++    GtkWidget	      *force_quit_dialog;
++    GSList	      *transient_windows;
++    WnckWindow	      *transient_parent;
++    Bool	      created;
++    void	      (*draw) (struct _decor *d);
++} decor_t;
++
++void     (*theme_draw_window_decoration)    (decor_t *d);
++gboolean (*theme_calc_decoration_size)      (decor_t *d,
++					     int     client_width,
++					     int     client_height,
++					     int     text_width,
++					     int     *width,
++					     int     *height);
++void     (*theme_update_border_extents)     (gint    text_height);
++void     (*theme_get_event_window_position) (decor_t *d,
++					     gint    i,
++					     gint    j,
++					     gint    width,
++					     gint    height,
++					     gint    *x,
++					     gint    *y,
++					     gint    *w,
++					     gint    *h);
++gboolean (*theme_get_button_position)       (decor_t *d,
++					     gint    i,
++					     gint    width,
++					     gint    height,
++					     gint    *x,
++					     gint    *y,
++					     gint    *w,
++					     gint    *h);
++
++decor_shadow_t * (*theme_update_shadow) (gint    shadow_type);
++
++void (*theme_get_shadow) (decor_t *d,
++			  gint    shadow_type);
++
++extern char *program_name;
++
++extern GtkWidget     *style_window_rgba;
++extern GtkWidget     *style_window_rgb;
++extern GtkWidget     *switcher_label;
++
++extern GHashTable    *frame_table;
++extern GtkWidget     *action_menu;
++extern gboolean      action_menu_mapped;
++extern decor_color_t _title_color[2];
++extern PangoContext  *pango_context;
++extern gint	     double_click_timeout;
++
++extern GSList *draw_list;
++extern guint  draw_idle_id;
++
++extern PangoFontDescription *titlebar_font;
++extern gboolean		    use_system_font;
++extern gint		    text_height;
++
++#define BLUR_TYPE_NONE     0
++#define BLUR_TYPE_TITLEBAR 1
++#define BLUR_TYPE_ALL      2
++
++extern gint blur_type;
++
++extern GdkPixmap *switcher_pixmap;
++extern GdkPixmap *switcher_buffer_pixmap;
++extern gint      switcher_width;
++extern gint      switcher_height;
++extern Window    switcher_selected_window;
++extern decor_t   *switcher_window;
++
++extern XRenderPictFormat *xformat_rgba;
++extern XRenderPictFormat *xformat_rgb;
++
++extern Atom compiz_shadow_info_atom;
++extern Atom compiz_shadow_color_atom;
++
++/* gtk-window-decorator.c */
++
++double
++dist (double x1, double y1,
++      double x2, double y2);
++
++/* decorator.c */
++
++gboolean
++update_window_decoration_size (WnckWindow *win);
++
++void
++update_window_decoration_name (WnckWindow *win);
++
++gint
++max_window_name_width (WnckWindow *win);
++
++void
++update_default_decorations (GdkScreen *screen);
++
++void
++update_window_decoration_state (WnckWindow *win);
++
++void
++update_window_decoration_actions (WnckWindow *win);
++
++void
++update_window_decoration_icon (WnckWindow *win);
++
++void
++update_event_windows (WnckWindow *win);
++
++int
++update_shadow (void);
++
++void
++shadow_property_changed (WnckScreen *screen);
++
++void
++update_titlebar_font (void);
++
++void
++update_window_decoration_name (WnckWindow *win);
++
++void
++update_window_decoration (WnckWindow *win);
++
++void
++queue_decor_draw (decor_t *d);
++
++void
++copy_to_front_buffer (decor_t *d);
++
++void
++draw_border_shape (Display	   *xdisplay,
++		   Pixmap	   pixmap,
++		   Picture	   picture,
++		   int		   width,
++		   int		   height,
++		   decor_context_t *c,
++		   void		   *closure);
++
++
++/* wnck.c*/
++
++void
++decorations_changed (WnckScreen *screen);
++
++void
++connect_screen (WnckScreen *screen);
++
++void
++add_frame_window (WnckWindow *win,
++		  Window     frame,
++		  Bool	     mode);
++
++void
++remove_frame_window (WnckWindow *win);
++
++void
++restack_window (WnckWindow *win,
++		int	   stack_mode);
++
++void connect_window (WnckWindow *win);
++
++/* blur.c */
++
++void
++decor_update_blur_property (decor_t *d,
++			    int     width,
++			    int     height,
++			    Region  top_region,
++			    int     top_offset,
++			    Region  bottom_region,
++			    int     bottom_offset,
++			    Region  left_region,
++			    int     left_offset,
++			    Region  right_region,
++			    int     right_offset);
++
++/* decorprops.c */
++
++void
++decor_update_window_property (decor_t *d);
++
++void
++decor_update_switcher_property (decor_t *d);
++
++/* cairo.c */
++
++#define CORNER_TOPLEFT     (1 << 0)
++#define CORNER_TOPRIGHT    (1 << 1)
++#define CORNER_BOTTOMRIGHT (1 << 2)
++#define CORNER_BOTTOMLEFT  (1 << 3)
++
++#define SHADE_LEFT   (1 << 0)
++#define SHADE_RIGHT  (1 << 1)
++#define SHADE_TOP    (1 << 2)
++#define SHADE_BOTTOM (1 << 3)
++
++void
++draw_shadow_background (decor_t		*d,
++			cairo_t		*cr,
++			decor_shadow_t  *s,
++			decor_context_t *c);
++
++void
++draw_window_decoration (decor_t *d);
++
++void
++fill_rounded_rectangle (cairo_t       *cr,
++			double        x,
++			double        y,
++			double        w,
++			double        h,
++			double	      radius,
++			int	      corner,
++			decor_color_t *c0,
++			double        alpha0,
++			decor_color_t *c1,
++			double	      alpha1,
++			int	      gravity);
++
++void
++rounded_rectangle (cairo_t *cr,
++		   double  x,
++		   double  y,
++		   double  w,
++		   double  h,
++		   double  radius,
++		   int	   corner);
++
++gboolean
++calc_decoration_size (decor_t *d,
++		      gint    w,
++		      gint    h,
++		      gint    name_width,
++		      gint    *width,
++		      gint    *height);
++
++void
++update_border_extents (gint text_height);
++
++gboolean
++get_button_position (decor_t *d,
++		     gint    i,
++		     gint    width,
++		     gint    height,
++		     gint    *x,
++		     gint    *y,
++		     gint    *w,
++		     gint    *h);
++
++void
++get_event_window_position (decor_t *d,
++			   gint    i,
++			   gint    j,
++			   gint    width,
++			   gint    height,
++			   gint    *x,
++			   gint    *y,
++			   gint    *w,
++			   gint    *h);
++
++decor_shadow_t *
++cairo_update_shadow (gint shadow_type);
++
++void
++get_shadow (decor_t *, gint shadow_type);
++
++/* gdk.c */
++
++void
++gdk_cairo_set_source_color_alpha (cairo_t  *cr,
++				  GdkColor *color,
++				  double   alpha);
++
++inline GdkWindow *
++create_gdk_window (Window xframe);
++
++GdkColormap *
++get_colormap_for_drawable (GdkDrawable *d);
++
++XRenderPictFormat *
++get_format_for_drawable (decor_t *d, GdkDrawable *drawable);
++
++GdkPixmap *
++create_pixmap (int w,
++	       int h,
++	       int depth);
++
++GdkPixmap *
++pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, int depth);
++
++/* metacity.c */
++#ifdef USE_METACITY
++void
++meta_draw_window_decoration (decor_t *d);
++
++void
++meta_get_decoration_geometry (decor_t		*d,
++			      MetaTheme	        *theme,
++			      MetaFrameFlags    *flags,
++			      MetaFrameGeometry *fgeom,
++			      MetaButtonLayout  *button_layout,
++			      GdkRectangle      *clip);
++
++void
++meta_calc_button_size (decor_t *d);
++
++gboolean
++meta_calc_decoration_size (decor_t *d,
++			   gint    w,
++			   gint    h,
++			   gint    name_width,
++			   gint    *width,
++			   gint    *height);
++
++gboolean
++meta_get_button_position (decor_t *d,
++			  gint    i,
++			  gint	  width,
++			  gint	  height,
++			  gint    *x,
++			  gint    *y,
++			  gint    *w,
++			  gint    *h);
++
++gboolean
++meta_button_present (MetaButtonLayout   *button_layout,
++		     MetaButtonFunction function);
++
++void
++meta_get_event_window_position (decor_t *d,
++				gint    i,
++				gint    j,
++				gint	width,
++				gint	height,
++				gint    *x,
++				gint    *y,
++				gint    *w,
++				gint    *h);
++void
++meta_update_border_extents (gint text_height);
++
++void
++meta_update_button_layout (const char *value);
++
++decor_shadow_t *
++meta_update_shadow (gint shadow_type);
++
++void
++meta_get_shadow (decor_t *, gint shadow_type);
++
++#endif
++/* switcher.c */
++
++#define SWITCHER_ALPHA 0xa0a0
++
++void
++draw_switcher_decoration (decor_t *d);
++
++gboolean
++update_switcher_window (Window 	   popup,
++			Window     selected);
++
++decor_t *
++switcher_window_opened (Window popup, Window selected);
++
++void
++switcher_window_closed ();
++
++/* events.c */
++
++void
++move_resize_window (WnckWindow *win,
++		    int	       direction,
++		    decor_event *gtkwd_event);
++
++void
++common_button_event (WnckWindow *win,
++		     decor_event *gtkwd_event,
++		     decor_event_type gtkwd_type,
++		     int	button,
++		     int	max);
++
++void
++close_button_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type);
++
++void
++max_button_event (WnckWindow *win,
++		  decor_event *gtkwd_event,
++		  decor_event_type gtkwd_type);
++
++void
++min_button_event (WnckWindow *win,
++		  decor_event *gtkwd_event,
++		  decor_event_type gtkwd_type);
++
++void
++menu_button_event (WnckWindow *win,
++		   decor_event *gtkwd_event,
++		   decor_event_type gtkwd_type);
++
++void
++shade_button_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type);
++
++void
++above_button_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type);
++
++void
++stick_button_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type);
++void
++unshade_button_event (WnckWindow *win,
++		      decor_event *gtkwd_event,
++		      decor_event_type gtkwd_type);
++
++void
++unabove_button_event (WnckWindow *win,
++		      decor_event *gtkwd_event,
++		      decor_event_type gtkwd_type);
++
++void
++unstick_button_event (WnckWindow *win,
++		      decor_event *gtkwd_event,
++		      decor_event_type gtkwd_type);
++
++void
++handle_title_button_event (WnckWindow   *win,
++			   int          action,
++			   decor_event *gtkwd_event);
++
++void
++handle_mouse_wheel_title_event (WnckWindow   *win,
++				unsigned int button);
++
++void
++title_event (WnckWindow       *win,
++	     decor_event      *gtkwd_event,
++	     decor_event_type gtkwd_type);
++
++void
++frame_common_event (WnckWindow       *win,
++		    int              direction,
++		    decor_event      *gtkwd_event,
++		    decor_event_type gtkwd_type);
++
++void
++top_left_event (WnckWindow       *win,
++		decor_event      *gtkwd_event,
++		decor_event_type gtkwd_type);
++
++void
++top_event (WnckWindow       *win,
++	   decor_event      *gtkwd_event,
++	   decor_event_type gtkwd_type);
++
++void
++top_right_event (WnckWindow       *win,
++		 decor_event      *gtkwd_event,
++		 decor_event_type gtkwd_type);
++
++void
++left_event (WnckWindow       *win,
++	    decor_event      *gtkwd_event,
++	    decor_event_type gtkwd_type);
++void
++right_event (WnckWindow       *win,
++	     decor_event      *gtkwd_event,
++	     decor_event_type gtkwd_type);
++
++void
++bottom_left_event (WnckWindow *win,
++		   decor_event *gtkwd_event,
++		   decor_event_type gtkwd_type);
++
++void
++bottom_event (WnckWindow *win,
++	      decor_event *gtkwd_event,
++	      decor_event_type gtkwd_type);
++void
++bottom_right_event (WnckWindow *win,
++		    decor_event *gtkwd_event,
++		    decor_event_type gtkwd_type);
++
++void
++frame_window_realized (GtkWidget *widget,
++		       gpointer  data);
++
++event_callback
++find_event_callback_for_point (decor_t *d,
++			       int     x,
++			       int     y,
++			       Bool    *enter,
++			       Bool    *leave,
++			       BoxPtr  *entered_box);
++
++event_callback
++find_leave_event_callback (decor_t *d);
++
++void
++frame_handle_button_press (GtkWidget      *widget,
++			   GdkEventButton *event,
++			   gpointer       user_data);
++
++void
++frame_handle_button_release (GtkWidget      *widget,
++			     GdkEventButton *event,
++			     gpointer       user_data);
++
++void
++frame_handle_motion (GtkWidget      *widget,
++		     GdkEventMotion *event,
++		     gpointer       user_data);
++
++GdkFilterReturn
++selection_event_filter_func (GdkXEvent *gdkxevent,
++			     GdkEvent  *event,
++			     gpointer  data);
++
++GdkFilterReturn
++event_filter_func (GdkXEvent *gdkxevent,
++		   GdkEvent  *event,
++		   gpointer  data);
++
++/* forcequit.c */
++
++void
++show_force_quit_dialog (WnckWindow *win,
++			Time        timestamp);
++
++void
++hide_force_quit_dialog (WnckWindow *win);
++
++/* actionmenu.c */
++
++void
++action_menu_map (WnckWindow *win,
++		 long	     button,
++		 Time	     time);
++
++/* util.c */
++
++double
++square (double x);
++
++double
++dist (double x1, double y1,
++      double x2, double y2);
++
++void
++shade (const decor_color_t *a,
++       decor_color_t	   *b,
++       float		   k);
++
++gboolean
++get_window_prop (Window xwindow,
++		 Atom   atom,
++		 Window *val);
++
++unsigned int
++get_mwm_prop (Window xwindow);
++
++
++/* style.c */
++
++void
++update_style (GtkWidget *widget);
++
++void
++style_changed (GtkWidget *widget);
++
++/* settings.c */
++
++gboolean
++init_settings (WnckScreen *screen);
++
++#endif
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/gwd.schemas.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/gwd.schemas.in	2011-03-23 11:45:03.612056499 +0800
+@@ -0,0 +1,81 @@
++<gconfschemafile>
++    <schemalist>
++        <schema>
++            <key>/schemas/apps/gwd/blur_type</key>
++            <applyto>/apps/gwd/blur_type</applyto>
++            <owner>gwd</owner>
++            <type>string</type>
++            <default>none</default>
++            <locale name="C">
++                <short>Blur type</short>
++                <long>Type of blur used for window decorations</long>
++            </locale>
++        </schema>
++        <schema>
++            <key>/schemas/apps/gwd/use_metacity_theme</key>
++            <applyto>/apps/gwd/use_metacity_theme</applyto>
++            <owner>gwd</owner>
++            <type>bool</type>
++            <default>true</default>
++            <locale name="C">
++                <short>Use metacity theme</short>
++                <long>Use metacity theme when drawing window decorations</long>
++            </locale>
++        </schema>
++        <schema>
++            <key>/schemas/apps/gwd/mouse_wheel_action</key>
++            <applyto>/apps/gwd/mouse_wheel_action</applyto>
++            <owner>gwd</owner>
++            <type>string</type>
++            <default>none</default>
++            <locale name="C">
++                <short>Title bar mouse wheel action</short>
++                <long>Action to take when scrolling the mouse wheel on a window title bar.</long>
++            </locale>
++        </schema>
++        <schema>
++            <key>/schemas/apps/gwd/metacity_theme_opacity</key>
++            <applyto>/apps/gwd/metacity_theme_opacity</applyto>
++            <owner>gwd</owner>
++            <type>float</type>
++            <default>0.75</default>
++            <locale name="C">
++                <short>Metacity theme opacity</short>
++                <long>Opacity to use for metacity theme decorations</long>
++            </locale>
++        </schema>
++        <schema>
++            <key>/schemas/apps/gwd/metacity_theme_shade_opacity</key>
++            <applyto>/apps/gwd/metacity_theme_shade_opacity</applyto>
++            <owner>gwd</owner>
++            <type>bool</type>
++            <default>true</default>
++            <locale name="C">
++                <short>Metacity theme opacity shade</short>
++                <long>Shade windows with metacity theme decorations from opaque to translucent</long>
++            </locale>
++        </schema>
++        <schema>
++            <key>/schemas/apps/gwd/metacity_theme_active_opacity</key>
++            <applyto>/apps/gwd/metacity_theme_active_opacity</applyto>
++            <owner>gwd</owner>
++            <type>float</type>
++            <default>1.0</default>
++            <locale name="C">
++                <short>Metacity theme active window opacity</short>
++                <long>Opacity to use for active windows with metacity theme decorations</long>
++            </locale>
++        </schema>
++        <schema>
++            <key>/schemas/apps/gwd/metacity_theme_active_shade_opacity</key>
++            <applyto>/apps/gwd/metacity_theme_active_shade_opacity</applyto>
++            <owner>gwd</owner>
++            <type>bool</type>
++            <default>true</default>
++            <locale name="C">
++                <short>Metacity theme active window opacity shade</short>
++                <long>Shade active windows with metacity theme decorations from opaque to translucent</long>
++            </locale>
++        </schema>
++    </schemalist>  
++</gconfschemafile>
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/metacity.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/metacity.c	2011-03-23 12:12:13.344446799 +0800
+@@ -0,0 +1,1923 @@
++#include "gtk-window-decorator.h"
++
++#ifdef USE_METACITY
++
++double   meta_opacity              = META_OPACITY;
++gboolean meta_shade_opacity        = META_SHADE_OPACITY;
++double   meta_active_opacity       = META_ACTIVE_OPACITY;
++gboolean meta_active_shade_opacity = META_ACTIVE_SHADE_OPACITY;
++
++gboolean         meta_button_layout_set = FALSE;
++MetaButtonLayout meta_button_layout;
++
++static void
++decor_update_meta_window_property (decor_t	  *d,
++				   MetaTheme	  *theme,
++				   MetaFrameFlags flags,
++				   Region	  top,
++				   Region	  bottom,
++				   Region	  left,
++				   Region	  right)
++{
++    long	    data[256];
++    Display	    *xdisplay =
++	GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    gint	    nQuad;
++    decor_extents_t extents, max_extents, frame_extents, frame_max_extents;
++    decor_quad_t    quads[N_QUADS_MAX];
++    gint            w, lh, rh;
++    gint	    top_stretch_offset;
++    gint	    bottom_stretch_offset;
++    gint	    left_stretch_offset;
++    gint	    right_stretch_offset;
++    MetaFrameStyle		    *frame_style;
++    MetaInvisibleGrabAreaProperties *invisible_grab_area_properties;
++
++    w = d->border_layout.top.x2 - d->border_layout.top.x1 -
++	d->context->left_space - d->context->right_space;
++
++    if (d->border_layout.rotation)
++	lh = d->border_layout.left.x2 - d->border_layout.left.x1;
++    else
++	lh = d->border_layout.left.y2 - d->border_layout.left.y1;
++
++    if (d->border_layout.rotation)
++	rh = d->border_layout.right.x2 - d->border_layout.right.x1;
++    else
++	rh = d->border_layout.right.y2 - d->border_layout.right.y1;
++
++    left_stretch_offset   = lh / 2;
++    right_stretch_offset  = rh / 2;
++    top_stretch_offset    = w - d->button_width - 1;
++    bottom_stretch_offset = (d->border_layout.bottom.x2 -
++			     d->border_layout.bottom.x1 -
++			     d->context->left_space -
++			     d->context->right_space) / 2;
++
++    nQuad = decor_set_lXrXtXbX_window_quads (quads, d->context,
++					     &d->border_layout,
++					     left_stretch_offset,
++					     right_stretch_offset,
++					     top_stretch_offset,
++					     bottom_stretch_offset);
++
++    extents = frame_extents = _win_extents;
++    max_extents = frame_max_extents = _max_win_extents;
++
++    /* Add the invisible grab area padding, but only for
++     * pixmap type decorations */
++    frame_style = meta_theme_get_frame_style (theme, META_FRAME_TYPE_NORMAL, flags);
++
++    if (!frame_style)
++	return;
++
++    invisible_grab_area_properties =
++        meta_frame_style_get_invisible_grab_area_properties (frame_style);
++
++    if (!d->frame_window && invisible_grab_area_properties)
++    {
++	frame_extents.left += invisible_grab_area_properties->left;
++	frame_extents.right += invisible_grab_area_properties->right;
++	frame_extents.bottom += invisible_grab_area_properties->bottom;
++    }
++
++    extents.top += titlebar_height;
++    frame_extents.top += titlebar_height;
++    max_extents.top += max_titlebar_height;
++    frame_max_extents.top += max_titlebar_height;
++
++    if (d->frame_window)
++	decor_gen_window_property (data, &extents, &max_extents, 20, 20);
++    else
++	decor_quads_to_property (data, GDK_PIXMAP_XID (d->pixmap),
++				 &frame_extents, &extents, &frame_max_extents, &max_extents,
++				 ICON_SPACE + d->button_width,
++				 0,
++				 quads, nQuad);
++
++    gdk_error_trap_push ();
++    XChangeProperty (xdisplay, d->prop_xid,
++		     win_decor_atom,
++		     XA_INTEGER,
++		     32, PropModeReplace, (guchar *) data,
++		     BASE_PROP_SIZE + QUAD_PROP_SIZE * nQuad);
++    gdk_display_sync (gdk_display_get_default ());
++    gdk_error_trap_pop ();
++
++    decor_update_blur_property (d,
++				w, lh,
++				top, top_stretch_offset,
++				bottom, bottom_stretch_offset,
++				left, left_stretch_offset,
++				right, right_stretch_offset);
++}
++
++static void
++meta_get_corner_radius (const MetaFrameGeometry *fgeom,
++			int			*top_left_radius,
++			int			*top_right_radius,
++			int			*bottom_left_radius,
++			int			*bottom_right_radius)
++{
++
++#ifdef HAVE_METACITY_2_17_0
++    *top_left_radius     = fgeom->top_left_corner_rounded_radius;
++    *top_right_radius    = fgeom->top_right_corner_rounded_radius;
++    *bottom_left_radius  = fgeom->bottom_left_corner_rounded_radius;
++    *bottom_right_radius = fgeom->bottom_right_corner_rounded_radius;
++#else
++    *top_left_radius     = fgeom->top_left_corner_rounded ? 5 : 0;
++    *top_right_radius    = fgeom->top_right_corner_rounded ? 5 : 0;
++    *bottom_left_radius  = fgeom->bottom_left_corner_rounded ? 5 : 0;
++    *bottom_right_radius = fgeom->bottom_right_corner_rounded ? 5 : 0;
++#endif
++
++}
++
++static int
++radius_to_width (int radius,
++		 int i)
++{
++    float r1 = sqrt (radius) + radius;
++    float r2 = r1 * r1 - (r1 - (i + 0.5)) * (r1 - (i + 0.5));
++
++    return floor (0.5f + r1 - sqrt (r2));
++}
++
++static Region
++meta_get_top_border_region (const MetaFrameGeometry *fgeom,
++			    int			    width)
++{
++    Region     corners_xregion, border_xregion;
++    XRectangle xrect;
++    int	       top_left_radius;
++    int	       top_right_radius;
++    int	       bottom_left_radius;
++    int	       bottom_right_radius;
++    int	       w, i;
++
++    corners_xregion = XCreateRegion ();
++
++    meta_get_corner_radius (fgeom,
++			    &top_left_radius,
++			    &top_right_radius,
++			    &bottom_left_radius,
++			    &bottom_right_radius);
++
++    if (top_left_radius)
++    {
++	for (i = 0; i < top_left_radius; i++)
++	{
++	    w = radius_to_width (top_left_radius, i);
++
++	    xrect.x	 = 0;
++	    xrect.y	 = i;
++	    xrect.width  = w;
++	    xrect.height = 1;
++
++	    XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
++	}
++    }
++
++    if (top_right_radius)
++    {
++	for (i = 0; i < top_right_radius; i++)
++	{
++	    w = radius_to_width (top_right_radius, i);
++
++	    xrect.x	 = width - w;
++	    xrect.y	 = i;
++	    xrect.width  = w;
++	    xrect.height = 1;
++
++	    XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
++	}
++    }
++
++    border_xregion = XCreateRegion ();
++
++    xrect.x = 0;
++    xrect.y = 0;
++    xrect.width = width;
++    xrect.height = fgeom->top_height;
++
++    XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
++
++    XSubtractRegion (border_xregion, corners_xregion, border_xregion);
++
++    XDestroyRegion (corners_xregion);
++
++    return border_xregion;
++}
++
++static Region
++meta_get_bottom_border_region (const MetaFrameGeometry *fgeom,
++			       int		        width)
++{
++    Region     corners_xregion, border_xregion;
++    XRectangle xrect;
++    int	       top_left_radius;
++    int	       top_right_radius;
++    int	       bottom_left_radius;
++    int	       bottom_right_radius;
++    int	       w, i;
++
++    corners_xregion = XCreateRegion ();
++
++    meta_get_corner_radius (fgeom,
++			    &top_left_radius,
++			    &top_right_radius,
++			    &bottom_left_radius,
++			    &bottom_right_radius);
++
++    if (bottom_left_radius)
++    {
++	for (i = 0; i < bottom_left_radius; i++)
++	{
++	    w = radius_to_width (bottom_left_radius, i);
++
++	    xrect.x	 = 0;
++	    xrect.y	 = fgeom->bottom_height - i - 1;
++	    xrect.width  = w;
++	    xrect.height = 1;
++
++	    XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
++	}
++    }
++
++    if (bottom_right_radius)
++    {
++	for (i = 0; i < bottom_right_radius; i++)
++	{
++	    w = radius_to_width (bottom_right_radius, i);
++
++	    xrect.x	 = width - w;
++	    xrect.y	 = fgeom->bottom_height - i - 1;
++	    xrect.width  = w;
++	    xrect.height = 1;
++
++	    XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
++	}
++    }
++
++    border_xregion = XCreateRegion ();
++
++    xrect.x = 0;
++    xrect.y = 0;
++    xrect.width = width;
++    xrect.height = fgeom->bottom_height;
++
++    XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
++
++    XSubtractRegion (border_xregion, corners_xregion, border_xregion);
++
++    XDestroyRegion (corners_xregion);
++
++    return border_xregion;
++}
++
++static Region
++meta_get_left_border_region (const MetaFrameGeometry *fgeom,
++			     int		     height)
++{
++    Region     border_xregion;
++    XRectangle xrect;
++
++    border_xregion = XCreateRegion ();
++
++    xrect.x	 = 0;
++    xrect.y	 = 0;
++    xrect.width  = fgeom->left_width;
++    xrect.height = height - fgeom->top_height - fgeom->bottom_height;
++
++    XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
++
++    return border_xregion;
++}
++
++static Region
++meta_get_right_border_region (const MetaFrameGeometry *fgeom,
++			      int		      height)
++{
++    Region     border_xregion;
++    XRectangle xrect;
++
++    border_xregion = XCreateRegion ();
++
++    xrect.x	 = 0;
++    xrect.y	 = 0;
++    xrect.width  = fgeom->right_width;
++    xrect.height = height - fgeom->top_height - fgeom->bottom_height;
++
++    XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
++
++    return border_xregion;
++}
++
++static MetaButtonState
++meta_button_state (int state)
++{
++    if (state & IN_EVENT_WINDOW)
++    {
++	if (state & PRESSED_EVENT_WINDOW)
++	    return META_BUTTON_STATE_PRESSED;
++
++	return META_BUTTON_STATE_PRELIGHT;
++    }
++
++    return META_BUTTON_STATE_NORMAL;
++}
++
++static MetaButtonType
++meta_function_to_type (MetaButtonFunction function)
++{
++    switch (function) {
++    case META_BUTTON_FUNCTION_MENU:
++	return META_BUTTON_TYPE_MENU;
++    case META_BUTTON_FUNCTION_MINIMIZE:
++	return META_BUTTON_TYPE_MINIMIZE;
++    case META_BUTTON_FUNCTION_MAXIMIZE:
++	return META_BUTTON_TYPE_MAXIMIZE;
++    case META_BUTTON_FUNCTION_CLOSE:
++	return META_BUTTON_TYPE_CLOSE;
++
++#ifdef HAVE_METACITY_2_17_0
++    case META_BUTTON_FUNCTION_SHADE:
++	return META_BUTTON_TYPE_SHADE;
++    case META_BUTTON_FUNCTION_ABOVE:
++	return META_BUTTON_TYPE_ABOVE;
++    case META_BUTTON_FUNCTION_STICK:
++	return META_BUTTON_TYPE_STICK;
++    case META_BUTTON_FUNCTION_UNSHADE:
++	return META_BUTTON_TYPE_UNSHADE;
++    case META_BUTTON_FUNCTION_UNABOVE:
++	return META_BUTTON_TYPE_UNABOVE;
++    case META_BUTTON_FUNCTION_UNSTICK:
++	return META_BUTTON_TYPE_UNSTICK;
++#endif
++
++    default:
++	break;
++    }
++
++    return META_BUTTON_TYPE_LAST;
++}
++
++static MetaButtonState
++meta_button_state_for_button_type (decor_t	  *d,
++				   MetaButtonType type)
++{
++    switch (type) {
++    case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
++	type = meta_function_to_type (meta_button_layout.left_buttons[0]);
++	break;
++    case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
++	type = meta_function_to_type (meta_button_layout.left_buttons[1]);
++	break;
++    case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
++	type = meta_function_to_type (meta_button_layout.left_buttons[2]);
++	break;
++    case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
++	type = meta_function_to_type (meta_button_layout.right_buttons[0]);
++	break;
++    case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
++	type = meta_function_to_type (meta_button_layout.right_buttons[1]);
++	break;
++    case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
++	type = meta_function_to_type (meta_button_layout.right_buttons[2]);
++    default:
++	break;
++    }
++
++    switch (type) {
++    case META_BUTTON_TYPE_CLOSE:
++	return meta_button_state (d->button_states[BUTTON_CLOSE]);
++    case META_BUTTON_TYPE_MAXIMIZE:
++	return meta_button_state (d->button_states[BUTTON_MAX]);
++    case META_BUTTON_TYPE_MINIMIZE:
++	return meta_button_state (d->button_states[BUTTON_MIN]);
++    case META_BUTTON_TYPE_MENU:
++	return meta_button_state (d->button_states[BUTTON_MENU]);
++
++#ifdef HAVE_METACITY_2_17_0
++    case META_BUTTON_TYPE_SHADE:
++	return meta_button_state (d->button_states[BUTTON_SHADE]);
++    case META_BUTTON_TYPE_ABOVE:
++	return meta_button_state (d->button_states[BUTTON_ABOVE]);
++    case META_BUTTON_TYPE_STICK:
++	return meta_button_state (d->button_states[BUTTON_STICK]);
++    case META_BUTTON_TYPE_UNSHADE:
++	return meta_button_state (d->button_states[BUTTON_UNSHADE]);
++    case META_BUTTON_TYPE_UNABOVE:
++	return meta_button_state (d->button_states[BUTTON_UNABOVE]);
++    case META_BUTTON_TYPE_UNSTICK:
++	return meta_button_state (d->button_states[BUTTON_UNSTICK]);
++#endif
++
++    default:
++	break;
++    }
++
++    return META_BUTTON_STATE_NORMAL;
++}
++
++void
++meta_get_decoration_geometry (decor_t		*d,
++			      MetaTheme	        *theme,
++			      MetaFrameFlags    *flags,
++			      MetaFrameGeometry *fgeom,
++			      MetaButtonLayout  *button_layout,
++			      GdkRectangle      *clip)
++{
++    gint left_width, right_width, top_height, bottom_height;
++
++    if (meta_button_layout_set)
++    {
++	*button_layout = meta_button_layout;
++    }
++    else
++    {
++	gint i;
++
++	button_layout->left_buttons[0] = META_BUTTON_FUNCTION_MENU;
++
++	for (i = 1; i < MAX_BUTTONS_PER_CORNER; i++)
++	    button_layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
++
++	button_layout->right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE;
++	button_layout->right_buttons[1] = META_BUTTON_FUNCTION_MAXIMIZE;
++	button_layout->right_buttons[2] = META_BUTTON_FUNCTION_CLOSE;
++
++	for (i = 3; i < MAX_BUTTONS_PER_CORNER; i++)
++	    button_layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
++    }
++
++    *flags = 0;
++
++    if (d->actions & WNCK_WINDOW_ACTION_CLOSE)
++	*flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_DELETE;
++
++    if (d->actions & WNCK_WINDOW_ACTION_MINIMIZE)
++	*flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MINIMIZE;
++
++    if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE)
++	*flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MAXIMIZE;
++
++    *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MENU;
++
++    if (d->actions & WNCK_WINDOW_ACTION_RESIZE)
++    {
++	if (!(d->state & WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
++	    *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_VERTICAL_RESIZE;
++	if (!(d->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY))
++	    *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_HORIZONTAL_RESIZE;
++    }
++
++    if (d->actions & WNCK_WINDOW_ACTION_MOVE)
++	*flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MOVE;
++
++    if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE)
++	*flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MAXIMIZE;
++
++    if (d->actions & WNCK_WINDOW_ACTION_SHADE)
++	*flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_SHADE;
++
++    if (d->active)
++	*flags |= (MetaFrameFlags ) META_FRAME_HAS_FOCUS;
++    else if (d->transient_windows)
++    {
++	GSList  *transient_windows = d->transient_windows;
++
++	for (; transient_windows;
++	     transient_windows = transient_windows->next)
++	{
++	    if (!transient_windows->data)
++		continue;
++
++	    decor_t *d_transient = g_object_get_data (transient_windows->data, "decor");
++
++	    if (d_transient)
++	    {
++		if (d_transient->active)
++		{
++		    *flags |= (MetaFrameFlags ) META_FRAME_HAS_FOCUS;
++		    break;
++		}
++	    }
++	}
++    }
++
++    if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
++	*flags |= (MetaFrameFlags ) META_FRAME_MAXIMIZED;
++
++    if (d->state & WNCK_WINDOW_STATE_STICKY)
++	*flags |= (MetaFrameFlags ) META_FRAME_STUCK;
++
++    if (d->state & WNCK_WINDOW_STATE_FULLSCREEN)
++	*flags |= (MetaFrameFlags ) META_FRAME_FULLSCREEN;
++
++    if (d->state & WNCK_WINDOW_STATE_SHADED)
++	*flags |= (MetaFrameFlags ) META_FRAME_SHADED;
++
++#ifdef HAVE_METACITY_2_17_0
++    if (d->state & WNCK_WINDOW_STATE_ABOVE)
++	*flags |= (MetaFrameFlags ) META_FRAME_ABOVE;
++#endif
++
++    meta_theme_get_frame_borders (theme,
++				  META_FRAME_TYPE_NORMAL,
++				  text_height,
++				  *flags,
++				  &top_height,
++				  &bottom_height,
++				  &left_width,
++				  &right_width);
++
++    clip->x = d->context->left_space - left_width;
++    clip->y = d->context->top_space - top_height;
++
++    clip->width = d->border_layout.top.x2 - d->border_layout.top.x1;
++    clip->width -= d->context->right_space + d->context->left_space;
++
++    if (d->border_layout.rotation)
++	clip->height = d->border_layout.left.x2 - d->border_layout.left.x1;
++    else
++	clip->height = d->border_layout.left.y2 - d->border_layout.left.y1;
++
++    meta_theme_calc_geometry (theme,
++			      META_FRAME_TYPE_NORMAL,
++			      text_height,
++			      *flags,
++			      clip->width,
++			      clip->height,
++			      button_layout,
++			      fgeom);
++
++    clip->width  += left_width + right_width;
++    clip->height += top_height + bottom_height;
++}
++
++void
++meta_draw_window_decoration (decor_t *d)
++{
++    Display	      *xdisplay =
++	GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    GdkPixmap	      *pixmap;
++    Picture	      src;
++    MetaButtonState   button_states[META_BUTTON_TYPE_LAST];
++    MetaButtonLayout  button_layout;
++    MetaFrameGeometry fgeom;
++    MetaFrameFlags    flags;
++    MetaTheme	      *theme;
++    GtkStyle	      *style;
++    cairo_t	      *cr;
++    gint	      size, i;
++    GdkRectangle      clip, rect;
++    GdkDrawable       *drawable;
++    Region	      top_region = NULL;
++    Region	      bottom_region = NULL;
++    Region	      left_region = NULL;
++    Region	      right_region = NULL;
++    double	      alpha = (d->active) ? meta_active_opacity : meta_opacity;
++    gboolean	      shade_alpha = (d->active) ? meta_active_shade_opacity :
++						  meta_shade_opacity;
++    MetaFrameStyle    *frame_style;
++    GtkWidget	      *style_window;
++    GdkColor	      bg_color;
++    double	      bg_alpha;
++
++    if (!d->pixmap || !d->picture)
++	return;
++
++    if (d->frame_window)
++    {
++	GdkColormap *cmap;
++
++	cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap));
++	gdk_drawable_set_colormap (GDK_DRAWABLE (d->pixmap), cmap);
++	gdk_drawable_set_colormap (GDK_DRAWABLE (d->buffer_pixmap), cmap);
++    }
++
++    if (decoration_alpha == 1.0)
++	alpha = 1.0;
++
++    if (gdk_drawable_get_depth (GDK_DRAWABLE (d->pixmap)) == 32)
++    {
++	style = gtk_widget_get_style (style_window_rgba);
++	style_window = style_window_rgba;
++    }
++    else
++    {
++	style = gtk_widget_get_style (style_window_rgb);
++	style_window = style_window_rgb;
++    }
++
++    drawable = d->buffer_pixmap ? d->buffer_pixmap : d->pixmap;
++
++    cr = gdk_cairo_create (GDK_DRAWABLE (drawable));
++
++    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++
++    theme = meta_theme_get_current ();
++
++    meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
++				  &clip);
++
++    /* we only have to redraw the shadow background when decoration
++       changed size */
++    if ((d->prop_xid || !d->buffer_pixmap) && !d->frame_window)
++	draw_shadow_background (d, cr, d->shadow, d->context);
++
++    for (i = 0; i < META_BUTTON_TYPE_LAST; i++)
++	button_states[i] = meta_button_state_for_button_type (d, i);
++
++    frame_style = meta_theme_get_frame_style (theme,
++					      META_FRAME_TYPE_NORMAL,
++					      flags);
++
++    bg_color = style->bg[GTK_STATE_NORMAL];
++    bg_alpha = 1.0;
++
++#ifdef HAVE_METACITY_2_17_0
++    if (frame_style->window_background_color)
++    {
++	meta_color_spec_render (frame_style->window_background_color,
++				GTK_WIDGET (style_window),
++				&bg_color);
++
++	bg_alpha = frame_style->window_background_alpha / 255.0;
++    }
++#endif
++
++    cairo_destroy (cr);
++
++    rect.x     = 0;
++    rect.y     = 0;
++    rect.width = clip.width;
++
++    size = MAX (fgeom.top_height, fgeom.bottom_height);
++
++    if (rect.width && size)
++    {
++	XRenderPictFormat *format;
++
++	if (d->frame_window)
++	{
++	    int         depth;
++	    GdkColormap *cmap;
++
++	    cmap   = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap));
++	    depth  = gdk_drawable_get_depth (GDK_DRAWABLE (d->frame_window));
++	    pixmap = create_pixmap (rect.width, size, depth);
++	    gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), cmap);
++	}
++	else
++	    pixmap = create_pixmap (rect.width, size, 32);
++
++	cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
++	gdk_cairo_set_source_color_alpha (cr, &bg_color, bg_alpha);
++	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++
++	format = get_format_for_drawable (d, GDK_DRAWABLE (pixmap));
++	src = XRenderCreatePicture (xdisplay, GDK_PIXMAP_XID (pixmap),
++				    format, 0, NULL);
++
++	if (fgeom.top_height)
++	{
++	    rect.height = fgeom.top_height;
++
++	    cairo_paint (cr);
++
++	    meta_theme_draw_frame (theme,
++				   style_window,
++				   pixmap,
++				   &rect,
++				   0, 0,
++				   META_FRAME_TYPE_NORMAL,
++				   flags,
++				   clip.width - fgeom.left_width -
++				   fgeom.right_width,
++				   clip.height - fgeom.top_height -
++				   fgeom.bottom_height,
++				   d->layout,
++				   text_height,
++				   &button_layout,
++				   button_states,
++				   d->icon_pixbuf,
++				   NULL);
++
++	    top_region = meta_get_top_border_region (&fgeom, clip.width);
++
++	    decor_blend_border_picture (xdisplay,
++					d->context,
++					src,
++					0, 0,
++					d->picture,
++					&d->border_layout,
++					BORDER_TOP,
++					top_region,
++					alpha * 0xffff,
++					shade_alpha,
++				        0);
++	}
++
++	if (fgeom.bottom_height)
++	{
++	    rect.height = fgeom.bottom_height;
++
++	    cairo_paint (cr);
++
++	    meta_theme_draw_frame (theme,
++				   style_window,
++				   pixmap,
++				   &rect,
++				   0,
++				   -(clip.height - fgeom.bottom_height),
++				   META_FRAME_TYPE_NORMAL,
++				   flags,
++				   clip.width - fgeom.left_width -
++				   fgeom.right_width,
++				   clip.height - fgeom.top_height -
++				   fgeom.bottom_height,
++				   d->layout,
++				   text_height,
++				   &button_layout,
++				   button_states,
++				   d->icon_pixbuf,
++				   NULL);
++
++	    bottom_region = meta_get_bottom_border_region (&fgeom, clip.width);
++
++	    decor_blend_border_picture (xdisplay,
++					d->context,
++					src,
++					0, 0,
++					d->picture,
++					&d->border_layout,
++					BORDER_BOTTOM,
++					bottom_region,
++					alpha * 0xffff,
++					shade_alpha,
++					0);
++
++	}
++
++	cairo_destroy (cr);
++
++	g_object_unref (G_OBJECT (pixmap));
++
++	XRenderFreePicture (xdisplay, src);
++    }
++
++    rect.height = clip.height - fgeom.top_height - fgeom.bottom_height;
++
++    size = MAX (fgeom.left_width, fgeom.right_width);
++
++    if (size && rect.height)
++    {
++	XRenderPictFormat *format;
++
++	if (d->frame_window)
++	{
++	    int         depth;
++	    GdkColormap *cmap;
++
++	    cmap   = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap));
++	    depth  = gdk_drawable_get_depth (GDK_DRAWABLE (d->frame_window));
++	    pixmap = create_pixmap (size, rect.height, depth);
++	    gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), cmap);
++	}
++	else
++	    pixmap = create_pixmap (size, rect.height, 32);
++
++	cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
++	gdk_cairo_set_source_color_alpha (cr, &bg_color, bg_alpha);
++	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++
++	format = get_format_for_drawable (d, GDK_DRAWABLE (pixmap));
++	src = XRenderCreatePicture (xdisplay, GDK_PIXMAP_XID (pixmap),
++				    format, 0, NULL);
++
++	if (fgeom.left_width)
++	{
++	    rect.width = fgeom.left_width;
++
++	    cairo_paint (cr);
++
++	    meta_theme_draw_frame (theme,
++				   style_window,
++				   pixmap,
++				   &rect,
++				   0,
++				   -fgeom.top_height,
++				   META_FRAME_TYPE_NORMAL,
++				   flags,
++				   clip.width - fgeom.left_width -
++				   fgeom.right_width,
++				   clip.height - fgeom.top_height -
++				   fgeom.bottom_height,
++				   d->layout,
++				   text_height,
++				   &button_layout,
++				   button_states,
++				   d->icon_pixbuf,
++				   NULL);
++
++	    left_region = meta_get_left_border_region (&fgeom, clip.height);
++
++	    decor_blend_border_picture (xdisplay,
++					d->context,
++					src,
++					0, 0,
++					d->picture,
++					&d->border_layout,
++					BORDER_LEFT,
++					left_region,
++					alpha * 0xffff,
++					shade_alpha,
++				        0);
++	}
++
++	if (fgeom.right_width)
++	{
++	    rect.width = fgeom.right_width;
++
++	    cairo_paint (cr);
++
++	    meta_theme_draw_frame (theme,
++				   style_window,
++				   pixmap,
++				   &rect,
++				   -(clip.width - fgeom.right_width),
++				   -fgeom.top_height,
++				   META_FRAME_TYPE_NORMAL,
++				   flags,
++				   clip.width - fgeom.left_width -
++				   fgeom.right_width,
++				   clip.height - fgeom.top_height -
++				   fgeom.bottom_height,
++				   d->layout,
++				   text_height,
++				   &button_layout,
++				   button_states,
++				   d->icon_pixbuf,
++				   NULL);
++
++	    right_region = meta_get_right_border_region (&fgeom, clip.height);
++
++	    decor_blend_border_picture (xdisplay,
++					d->context,
++					src,
++					0, 0,
++					d->picture,
++					&d->border_layout,
++					BORDER_RIGHT,
++					right_region,
++					alpha * 0xffff,
++					shade_alpha,
++				        0);
++	}
++
++	cairo_destroy (cr);
++
++	g_object_unref (G_OBJECT (pixmap));
++
++	XRenderFreePicture (xdisplay, src);
++    }
++
++    copy_to_front_buffer (d);
++
++    if (d->frame_window)
++    {
++	GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window);
++	decor_extents_t extents;
++
++	if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
++			WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
++	{
++	    extents.left = 0;
++	    extents.right = 0;
++	    extents.top = 10;
++	    extents.bottom = 0;
++	}
++	else
++	{
++	    extents = _win_extents;
++	}
++
++	/*
++	 * FIXME: What is '4' supposed to be for here...
++	 */
++
++	gtk_image_set_from_pixmap (GTK_IMAGE (d->decor_image), d->pixmap, NULL);
++	gtk_window_resize (GTK_WINDOW (d->decor_window), d->width, d->height);
++	gdk_window_move (gdk_frame_window,
++			 d->context->left_corner_space - 1,
++			 d->context->top_corner_space - 1);
++	gdk_window_lower (gdk_frame_window);
++    }
++
++    if (d->prop_xid)
++    {
++	/* translate from frame to client window space */
++	if (top_region)
++	    XOffsetRegion (top_region, -fgeom.left_width, -fgeom.top_height);
++	if (bottom_region)
++	    XOffsetRegion (bottom_region, -fgeom.left_width, 0);
++	if (left_region)
++	    XOffsetRegion (left_region, -fgeom.left_width, 0);
++
++	decor_update_meta_window_property (d, theme, flags,
++					   top_region,
++					   bottom_region,
++					   left_region,
++					   right_region);
++	d->prop_xid = 0;
++    }
++
++    if (top_region)
++	XDestroyRegion (top_region);
++    if (bottom_region)
++	XDestroyRegion (bottom_region);
++    if (left_region)
++	XDestroyRegion (left_region);
++    if (right_region)
++	XDestroyRegion (right_region);
++}
++
++void
++meta_calc_button_size (decor_t *d)
++{
++    gint i, min_x, x, y, w, h, width;
++
++    width = d->border_layout.top.x2 - d->border_layout.top.x1 -
++	    d->context->left_space - d->context->right_space;
++    min_x = width;
++
++    for (i = 0; i < 3; i++)
++    {
++	static guint button_actions[3] = {
++	    WNCK_WINDOW_ACTION_CLOSE,
++	    WNCK_WINDOW_ACTION_MAXIMIZE,
++	    WNCK_WINDOW_ACTION_MINIMIZE
++	};
++
++	if (d->actions & button_actions[i])
++	{
++	    if (meta_get_button_position (d, i, width, 256,
++					  &x, &y, &w, &h))
++	    {
++		if (x > width / 2 && x < min_x)
++		    min_x = x;
++	    }
++	}
++    }
++
++    d->button_width = width - min_x + 6;
++}
++
++gboolean
++meta_get_button_position (decor_t *d,
++			  gint    i,
++			  gint	  width,
++			  gint	  height,
++			  gint    *x,
++			  gint    *y,
++			  gint    *w,
++			  gint    *h)
++{
++    MetaButtonLayout  button_layout;
++    MetaFrameGeometry fgeom;
++    MetaFrameFlags    flags;
++    MetaTheme	      *theme;
++    MetaFrameStyle    *frame_style;
++    MetaInvisibleGrabAreaProperties *invisible_grab_area_properties;
++    GdkRectangle      clip;
++
++#ifdef HAVE_METACITY_2_15_21
++    MetaButtonSpace   *space;
++#else
++    GdkRectangle      *space;
++#endif
++
++    if (!d->context)
++    {
++	/* undecorated windows implicitly have no buttons */
++	return FALSE;
++    }
++
++    theme = meta_theme_get_current ();
++
++    meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
++				  &clip);
++
++    frame_style = meta_theme_get_frame_style (theme, META_FRAME_TYPE_NORMAL, flags);
++
++    if (!frame_style)
++	return FALSE;
++
++    invisible_grab_area_properties =
++        meta_frame_style_get_invisible_grab_area_properties (frame_style);
++
++    switch (i) {
++    case BUTTON_MENU:
++	if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_MENU))
++	    return FALSE;
++
++	space = &fgeom.menu_rect;
++	break;
++    case BUTTON_MIN:
++	if (!meta_button_present (&button_layout,
++				  META_BUTTON_FUNCTION_MINIMIZE))
++	    return FALSE;
++
++	space = &fgeom.min_rect;
++	break;
++    case BUTTON_MAX:
++	if (!meta_button_present (&button_layout,
++				  META_BUTTON_FUNCTION_MAXIMIZE))
++	    return FALSE;
++
++	space = &fgeom.max_rect;
++	break;
++    case BUTTON_CLOSE:
++	if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_CLOSE))
++	    return FALSE;
++
++	space = &fgeom.close_rect;
++	break;
++
++#if defined (HAVE_METACITY_2_17_0) && defined (HAVE_LIBWNCK_2_18_1)
++    case BUTTON_SHADE:
++	if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_SHADE))
++	    return FALSE;
++
++	space = &fgeom.shade_rect;
++	break;
++    case BUTTON_ABOVE:
++	if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_ABOVE))
++	    return FALSE;
++
++	space = &fgeom.above_rect;
++	break;
++    case BUTTON_STICK:
++	if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_STICK))
++	    return FALSE;
++
++	space = &fgeom.stick_rect;
++	break;
++    case BUTTON_UNSHADE:
++	if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_UNSHADE))
++	    return FALSE;
++
++	space = &fgeom.unshade_rect;
++	break;
++    case BUTTON_UNABOVE:
++	if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_UNABOVE))
++	    return FALSE;
++
++	space = &fgeom.unabove_rect;
++	break;
++    case BUTTON_UNSTICK:
++	if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_UNSTICK))
++	    return FALSE;
++
++	space = &fgeom.unstick_rect;
++	break;
++#endif
++
++    default:
++	return FALSE;
++    }
++
++#ifdef HAVE_METACITY_2_15_21
++    if (!space->clickable.width && !space->clickable.height)
++	return FALSE;
++
++    *x = space->clickable.x;
++    *y = space->clickable.y;
++    *w = space->clickable.width;
++    *h = space->clickable.height;
++#else
++    if (!space->width && !space->height)
++	return FALSE;
++
++    *x = space->x;
++    *y = space->y;
++    *w = space->width;
++    *h = space->height;
++#endif
++
++    if (d->frame_window)
++    {
++	*x += _win_extents.left + 4;
++	*y += _win_extents.top + 2;
++    }
++    else if (invisible_grab_area_properties)
++    {
++	*x += invisible_grab_area_properties->left;
++    }
++
++    return TRUE;
++}
++
++gboolean
++meta_calc_decoration_size (decor_t *d,
++			   gint    w,
++			   gint    h,
++			   gint    name_width,
++			   gint    *width,
++			   gint    *height)
++{
++    decor_layout_t  layout;
++    decor_context_t *context;
++    decor_shadow_t  *shadow;
++
++    if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
++    {
++	if (!d->frame_window)
++	{
++	    if (d->active)
++	    {
++		context = &max_window_active_context;
++		shadow  = max_border_active_shadow;
++	    }
++	    else
++	    {
++		context = &max_window_inactive_context;
++		shadow  = max_border_inactive_shadow;
++	    }
++	}
++	else
++	{
++	    context = &max_window_context_no_shadow;
++	    shadow  = max_border_no_shadow;
++	}
++    }
++    else
++    {
++	if (!d->frame_window)
++	{
++	    if (d->active)
++	    {
++		context = &window_active_context;
++		shadow  = border_active_shadow;
++	    }
++	    else
++	    {
++		context = &window_inactive_context;
++		shadow  = border_inactive_shadow;
++	    }
++	}
++	else
++	{
++	    context = &window_context_no_shadow;
++	    shadow  = border_no_shadow;
++	}
++    }
++
++    if (!d->frame_window)
++    {
++	decor_get_best_layout (context, w, h, &layout);
++
++	if (context != d->context ||
++	    memcmp (&layout, &d->border_layout, sizeof (layout)))
++	{
++	    *width  = layout.width;
++	    *height = layout.height;
++
++	    d->border_layout = layout;
++	    d->context       = context;
++	    d->shadow        = shadow;
++
++	    meta_calc_button_size (d);
++
++	    return TRUE;
++	}
++    }
++    else
++    {
++	if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
++	    decor_get_default_layout (context, d->client_width,
++				      d->client_height - titlebar_height,
++				      &layout);
++	else
++	    decor_get_default_layout (context, d->client_width,
++				      d->client_height, &layout);
++
++	*width  = layout.width;
++	*height = layout.height;
++
++	d->border_layout = layout;
++	d->shadow	 = no_border_shadow;
++	d->context       = context;
++
++	meta_calc_button_size (d);
++
++	return TRUE;
++    }
++
++    return FALSE;
++}
++
++gboolean
++meta_button_present (MetaButtonLayout   *button_layout,
++		     MetaButtonFunction function)
++{
++    int i;
++
++    for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
++	if (button_layout->left_buttons[i] == function)
++	    return TRUE;
++
++    for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
++	if (button_layout->right_buttons[i] == function)
++	    return TRUE;
++
++    return FALSE;
++}
++
++#define TOP_RESIZE_HEIGHT 2
++#define RESIZE_EXTENDS 15
++
++void
++meta_get_event_window_position (decor_t *d,
++				gint    i,
++				gint    j,
++				gint	width,
++				gint	height,
++				gint    *x,
++				gint    *y,
++				gint    *w,
++				gint    *h)
++{
++    MetaButtonLayout  button_layout;
++    MetaFrameGeometry fgeom;
++    MetaFrameFlags    flags;
++    MetaFrameStyle    *frame_style;
++    MetaInvisibleGrabAreaProperties *invisible_grab_area_properties;
++    MetaTheme	      *theme;
++    GdkRectangle      clip;
++
++    theme = meta_theme_get_current ();
++
++    meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
++				  &clip);
++
++    frame_style = meta_theme_get_frame_style (theme, META_FRAME_TYPE_NORMAL, flags);
++
++    if (!frame_style)
++	return;
++
++    invisible_grab_area_properties =
++        meta_frame_style_get_invisible_grab_area_properties (frame_style);
++
++    width  += fgeom.right_width + fgeom.left_width;
++    height += fgeom.top_height  + fgeom.bottom_height;
++
++    switch (i) {
++    case 2: /* bottom */
++	switch (j) {
++	case 2: /* bottom right */
++	    if (d->frame_window)
++	    {
++		*x = width - fgeom.right_width - RESIZE_EXTENDS +
++		     _win_extents.left + 2;
++		*y = height - fgeom.bottom_height - RESIZE_EXTENDS +
++		     _win_extents.top + 2;
++	    }
++	    else
++	    {
++		*x = width - fgeom.right_width - RESIZE_EXTENDS;
++		*y = height - fgeom.bottom_height - RESIZE_EXTENDS;
++	    }
++	    *w = fgeom.right_width + RESIZE_EXTENDS;
++	    *h = fgeom.bottom_height + RESIZE_EXTENDS;
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++	    {
++		*x += invisible_grab_area_properties->left;
++		*w += invisible_grab_area_properties->right;
++		*h += invisible_grab_area_properties->bottom;
++	    }
++
++	    break;
++	case 1: /* bottom */
++	    *x = fgeom.left_width + RESIZE_EXTENDS;
++	    *y = height - fgeom.bottom_height;
++	    if (d->frame_window)
++		*y += _win_extents.top + 2;
++	    *w = width - fgeom.left_width - fgeom.right_width -
++		 (2 * RESIZE_EXTENDS);
++	    *h = fgeom.bottom_height;
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++	    {
++		*x -= invisible_grab_area_properties->left;
++		*h += invisible_grab_area_properties->bottom;
++		*w += invisible_grab_area_properties->left +
++		     invisible_grab_area_properties->right;
++	    }
++
++
++	    break;
++	case 0: /* bottom left */
++	default:
++	    *x = 0;
++	    *y = height - fgeom.bottom_height - RESIZE_EXTENDS;
++	    if (d->frame_window)
++	    {
++		*x += _win_extents.left + 4;
++		*y += _win_extents.bottom + 2;
++	    }
++	    *w = fgeom.left_width + RESIZE_EXTENDS;
++	    *h = fgeom.bottom_height + RESIZE_EXTENDS;
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++	    {
++		*w += invisible_grab_area_properties->left;
++		*h += invisible_grab_area_properties->bottom;
++	    }
++
++	    break;
++	}
++	break;
++    case 1: /* middle */
++	switch (j) {
++	case 2: /* right */
++	    *x = width - fgeom.right_width;
++	    *y = fgeom.top_height + RESIZE_EXTENDS; 
++	    if (d->frame_window)
++		*x += _win_extents.left + 2;
++	    *w = fgeom.right_width;
++	    *h = height - fgeom.top_height - fgeom.bottom_height -
++		 (2 * RESIZE_EXTENDS);
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++	    {
++		*x += invisible_grab_area_properties->left;
++		*w += invisible_grab_area_properties->right;
++		*h += invisible_grab_area_properties->bottom;
++	    }
++
++	    break;
++	case 1: /* middle */
++	    *x = fgeom.left_width;
++	    *y = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
++	    *w = width - fgeom.left_width - fgeom.right_width;
++	    *h = height - fgeom.top_titlebar_edge - fgeom.bottom_height;
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++	    {
++		*x += invisible_grab_area_properties->left;
++	    }
++	    break;
++	case 0: /* left */
++	default:
++	    *x = 0;
++	    if (d->frame_window)
++		*x += _win_extents.left + 4;
++	    *y = fgeom.top_height + RESIZE_EXTENDS;
++	    *w = fgeom.left_width;
++	    *h = height - fgeom.top_height - fgeom.bottom_height -
++		 (2 * RESIZE_EXTENDS);
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++	    {
++		*h += invisible_grab_area_properties->bottom;
++		*w += invisible_grab_area_properties->left;
++	    }
++
++	    break;
++	}
++	break;
++    case 0: /* top */
++    default:
++	switch (j) {
++	case 2: /* top right */
++	    *x = width - fgeom.right_width - RESIZE_EXTENDS;
++	    *y = 0;
++	    if (d->frame_window)
++	    {
++		*x += _win_extents.left + 2;
++		*y += _win_extents.top + 2 - fgeom.title_rect.height;
++	    }
++	    *w = fgeom.right_width + RESIZE_EXTENDS;
++	    *h = fgeom.top_height + RESIZE_EXTENDS;
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++	    {
++		*x += invisible_grab_area_properties->left;
++		*w += invisible_grab_area_properties->right;
++	    }
++	    break;
++	case 1: /* top */
++	    *x = fgeom.left_width + RESIZE_EXTENDS;
++	    *y = 0;
++	    if (d->frame_window)
++		*y += _win_extents.top + 2;
++	    *w = width - fgeom.left_width - fgeom.right_width -
++		 (2 * RESIZE_EXTENDS);
++	    *h = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++	    {
++		*x -= invisible_grab_area_properties->left;
++		*w += invisible_grab_area_properties->right +
++		      invisible_grab_area_properties->left;
++	    }
++
++	    break;
++	case 0: /* top left */
++	default:
++	    *x = 0;
++	    *y = 0;
++	    if (d->frame_window)
++	    {
++		*x += _win_extents.left + 4;
++		*y += _win_extents.top + 2 - fgeom.title_rect.height;
++	    }
++	    *w = fgeom.left_width + RESIZE_EXTENDS;
++	    *h = fgeom.top_height + RESIZE_EXTENDS;
++
++	    if (!d->frame_window && invisible_grab_area_properties)
++		*w += invisible_grab_area_properties->left;
++
++	    break;
++	}
++    }
++
++    if (!(flags & META_FRAME_ALLOWS_VERTICAL_RESIZE))
++    {
++	/* turn off top and bottom event windows */
++	if (i == 0 || i == 2)
++	    *w = *h = 0;
++    }
++
++    if (!(flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE))
++    {
++	/* turn off left and right event windows */
++	if (j == 0 || j == 2)
++	    *w = *h = 0;
++    }
++}
++
++static MetaButtonFunction
++meta_button_function_from_string (const char *str)
++{
++    if (strcmp (str, "menu") == 0)
++	return META_BUTTON_FUNCTION_MENU;
++    else if (strcmp (str, "minimize") == 0)
++	return META_BUTTON_FUNCTION_MINIMIZE;
++    else if (strcmp (str, "maximize") == 0)
++	return META_BUTTON_FUNCTION_MAXIMIZE;
++    else if (strcmp (str, "close") == 0)
++	return META_BUTTON_FUNCTION_CLOSE;
++
++#ifdef HAVE_METACITY_2_17_0
++    else if (strcmp (str, "shade") == 0)
++	return META_BUTTON_FUNCTION_SHADE;
++    else if (strcmp (str, "above") == 0)
++	return META_BUTTON_FUNCTION_ABOVE;
++    else if (strcmp (str, "stick") == 0)
++	return META_BUTTON_FUNCTION_STICK;
++    else if (strcmp (str, "unshade") == 0)
++	return META_BUTTON_FUNCTION_UNSHADE;
++    else if (strcmp (str, "unabove") == 0)
++	return META_BUTTON_FUNCTION_UNABOVE;
++    else if (strcmp (str, "unstick") == 0)
++	return META_BUTTON_FUNCTION_UNSTICK;
++#endif
++
++    else
++	return META_BUTTON_FUNCTION_LAST;
++}
++
++static MetaButtonFunction
++meta_button_opposite_function (MetaButtonFunction ofwhat)
++{
++    switch (ofwhat)
++    {
++#ifdef HAVE_METACITY_2_17_0
++    case META_BUTTON_FUNCTION_SHADE:
++	return META_BUTTON_FUNCTION_UNSHADE;
++    case META_BUTTON_FUNCTION_UNSHADE:
++	return META_BUTTON_FUNCTION_SHADE;
++
++    case META_BUTTON_FUNCTION_ABOVE:
++	return META_BUTTON_FUNCTION_UNABOVE;
++    case META_BUTTON_FUNCTION_UNABOVE:
++	return META_BUTTON_FUNCTION_ABOVE;
++
++    case META_BUTTON_FUNCTION_STICK:
++	return META_BUTTON_FUNCTION_UNSTICK;
++    case META_BUTTON_FUNCTION_UNSTICK:
++	return META_BUTTON_FUNCTION_STICK;
++#endif
++
++    default:
++	return META_BUTTON_FUNCTION_LAST;
++    }
++}
++
++static void
++meta_initialize_button_layout (MetaButtonLayout *layout)
++{
++    int	i;
++
++    for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
++    {
++	layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
++	layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
++#ifdef HAVE_METACITY_2_23_2
++	layout->left_buttons_has_spacer[i] = FALSE;
++	layout->right_buttons_has_spacer[i] = FALSE;
++#endif
++    }
++}
++
++void
++meta_update_button_layout (const char *value)
++{
++    MetaButtonLayout   new_layout;
++    MetaButtonFunction f;
++    char	       **sides;
++    int		       i;
++
++    meta_initialize_button_layout (&new_layout);
++
++    sides = g_strsplit (value, ":", 2);
++
++    if (sides[0] != NULL)
++    {
++	char	 **buttons;
++	int	 b;
++	gboolean used[META_BUTTON_FUNCTION_LAST];
++
++	for (i = 0; i < META_BUTTON_FUNCTION_LAST; i++)
++	   used[i] = FALSE;
++
++	buttons = g_strsplit (sides[0], ",", -1);
++
++	i = b = 0;
++	while (buttons[b] != NULL)
++	{
++	    f = meta_button_function_from_string (buttons[b]);
++#ifdef HAVE_METACITY_2_23_2
++	    if (i > 0 && strcmp ("spacer", buttons[b]) == 0)
++            {
++	       new_layout.left_buttons_has_spacer[i - 1] = TRUE;
++	       f = meta_button_opposite_function (f);
++
++	       if (f != META_BUTTON_FUNCTION_LAST)
++                  new_layout.left_buttons_has_spacer[i - 2] = TRUE;
++            }
++	    else
++#endif
++	    {
++	       if (f != META_BUTTON_FUNCTION_LAST && !used[f])
++	       {
++                  used[f] = TRUE;
++                  new_layout.left_buttons[i++] = f;
++
++		  f = meta_button_opposite_function (f);
++
++                  if (f != META_BUTTON_FUNCTION_LAST)
++                      new_layout.left_buttons[i++] = f;
++
++	       }
++	       else
++	       {
++		  fprintf (stderr, "%s: Ignoring unknown or already-used "
++			   "button name \"%s\"\n", program_name, buttons[b]);
++	       }
++	    }
++	    b++;
++	}
++
++	new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
++
++	g_strfreev (buttons);
++
++	if (sides[1] != NULL)
++	{
++	    for (i = 0; i < META_BUTTON_FUNCTION_LAST; i++)
++		used[i] = FALSE;
++
++	    buttons = g_strsplit (sides[1], ",", -1);
++
++	    i = b = 0;
++	    while (buttons[b] != NULL)
++	    {
++	       f = meta_button_function_from_string (buttons[b]);
++#ifdef HAVE_METACITY_2_23_2
++	       if (i > 0 && strcmp ("spacer", buttons[b]) == 0)
++	       {
++		  new_layout.right_buttons_has_spacer[i - 1] = TRUE;
++		  f = meta_button_opposite_function (f);
++		  if (f != META_BUTTON_FUNCTION_LAST)
++		     new_layout.right_buttons_has_spacer[i - 2] = TRUE;
++	       }
++	       else
++#endif
++	       {
++		   if (f != META_BUTTON_FUNCTION_LAST && !used[f])
++		   {
++		       used[f] = TRUE;
++		       new_layout.right_buttons[i++] = f;
++
++		       f = meta_button_opposite_function (f);
++
++		       if (f != META_BUTTON_FUNCTION_LAST)
++			   new_layout.right_buttons[i++] = f;
++		   }
++		   else
++		   {
++		       fprintf (stderr, "%s: Ignoring unknown or "
++				"already-used button name \"%s\"\n",
++				program_name, buttons[b]);
++		   }
++	       }
++	       b++;
++	    }
++	    new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
++
++	    g_strfreev (buttons);
++	}
++    }
++
++    g_strfreev (sides);
++
++    /* Invert the button layout for RTL languages */
++    if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
++    {
++	MetaButtonLayout rtl_layout;
++	int j;
++
++	meta_initialize_button_layout (&rtl_layout);
++
++	i = 0;
++	while (new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST)
++	    i++;
++
++	for (j = 0; j < i; j++)
++	{
++	    rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
++#ifdef HAVE_METACITY_2_23_2
++	    if (j == 0)
++		rtl_layout.right_buttons_has_spacer[i - 1] =
++		    new_layout.left_buttons_has_spacer[i - j - 1];
++	    else
++		rtl_layout.right_buttons_has_spacer[j - 1] =
++		    new_layout.left_buttons_has_spacer[i - j - 1];
++#endif
++	}
++
++	i = 0;
++	while (new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST)
++	    i++;
++
++	for (j = 0; j < i; j++)
++	{
++	    rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
++#ifdef HAVE_METACITY_2_23_2
++	    if (j == 0)
++		rtl_layout.left_buttons_has_spacer[i - 1] =
++		    new_layout.right_buttons_has_spacer[i - j - 1];
++	    else
++		rtl_layout.left_buttons_has_spacer[j - 1] =
++		    new_layout.right_buttons_has_spacer[i - j - 1];
++#endif
++	}
++
++	new_layout = rtl_layout;
++    }
++
++    meta_button_layout = new_layout;
++}
++
++void
++meta_update_border_extents (gint text_height)
++{
++    MetaTheme *theme;
++    gint      top_height, bottom_height, left_width, right_width;
++
++    theme = meta_theme_get_current ();
++
++    meta_theme_get_frame_borders (theme,
++				  META_FRAME_TYPE_NORMAL,
++				  text_height, 0,
++				  &top_height,
++				  &bottom_height,
++				  &left_width,
++				  &right_width);
++
++    _win_extents.top    = _default_win_extents.top;
++    _win_extents.bottom = bottom_height;
++    _win_extents.left   = left_width;
++    _win_extents.right  = right_width;
++
++    titlebar_height = top_height - _win_extents.top;
++
++    meta_theme_get_frame_borders (theme,
++				  META_FRAME_TYPE_NORMAL,
++				  text_height, META_FRAME_MAXIMIZED,
++				  &top_height,
++				  &bottom_height,
++				  &left_width,
++				  &right_width);
++
++    _max_win_extents.top    = _default_win_extents.top;
++    _max_win_extents.bottom = bottom_height;
++    _max_win_extents.left   = left_width;
++    _max_win_extents.right  = right_width;
++
++    max_titlebar_height = top_height - _max_win_extents.top;
++}
++
++decor_shadow_t *
++meta_update_shadow (gint shadow_type)
++{
++
++    decor_shadow_options_t opt_shadow;
++    MetaTheme		   *theme;
++    MetaFrameStyle         *frame_style;
++    MetaShadowProperties   *shadow_properties;
++    MetaFrameFlags	   frame_flags;
++    Display		   *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    GdkDisplay		   *display = gdk_display_get_default ();
++    GdkScreen		   *screen = gdk_display_get_default_screen (display);
++
++    memcpy (opt_shadow.shadow_color, shadow_color, sizeof (shadow_color));
++    memset (&frame_flags, 0, sizeof (MetaFrameFlags));
++
++
++    theme = meta_theme_get_current ();
++
++    switch (shadow_type)
++    {
++	case SHADOW_TYPE_ACTIVE_NORMAL:
++
++	    frame_flags |= META_FRAME_HAS_FOCUS;
++	    frame_style = meta_theme_get_frame_style (theme,
++						      META_FRAME_TYPE_NORMAL,
++					              frame_flags);
++
++	    if (!frame_style)
++		return NULL;
++
++	    shadow_properties =  meta_frame_style_get_shadow_properties (frame_style);
++
++	    if (!shadow_properties)
++		return NULL;
++
++	    opt_shadow.shadow_radius = shadow_properties->unity_shadow_radius;
++	    opt_shadow.shadow_offset_x = shadow_properties->unity_shadow_x_offset;
++	    opt_shadow.shadow_offset_y = shadow_properties->unity_shadow_y_offset;
++	    opt_shadow.shadow_opacity = shadow_properties->unity_shadow_opacity;
++
++	    return decor_shadow_create (xdisplay,
++					gdk_x11_screen_get_xscreen (screen),
++					1, 1,
++					_win_extents.left,
++					_win_extents.right,
++					_win_extents.top + titlebar_height,
++					_win_extents.bottom,
++					_win_extents.left -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.right -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.top + titlebar_height -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.bottom -
++					TRANSLUCENT_CORNER_SIZE,
++					&opt_shadow,
++					&window_active_context,
++					draw_border_shape,
++					0);
++	    break;
++	case SHADOW_TYPE_ACTIVE_MAX:
++
++	    frame_flags |= META_FRAME_MAXIMIZED;
++	    frame_flags |= META_FRAME_HAS_FOCUS;
++
++	    frame_style = meta_theme_get_frame_style (theme,
++						      META_FRAME_TYPE_NORMAL,
++					              frame_flags);
++	    if (!frame_style)
++		return NULL;
++
++	    shadow_properties =  meta_frame_style_get_shadow_properties (frame_style);
++
++	    if (!shadow_properties)
++		return NULL;
++
++	    opt_shadow.shadow_radius = shadow_properties->unity_shadow_radius;
++	    opt_shadow.shadow_offset_x = shadow_properties->unity_shadow_x_offset;
++	    opt_shadow.shadow_offset_y = shadow_properties->unity_shadow_y_offset;
++	    opt_shadow.shadow_opacity = shadow_properties->unity_shadow_opacity;
++
++	    return decor_shadow_create (xdisplay,
++					gdk_x11_screen_get_xscreen (screen),
++					1, 1,
++					_max_win_extents.left,
++					_max_win_extents.right,
++					_max_win_extents.top + max_titlebar_height,
++					_max_win_extents.bottom,
++					_max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.top + max_titlebar_height -
++					TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
++					&opt_shadow,
++					&max_window_active_context,
++					draw_border_shape,
++					(void *) 1);
++	case SHADOW_TYPE_INACTIVE_NORMAL:
++
++	    frame_style = meta_theme_get_frame_style (theme,
++						      META_FRAME_TYPE_NORMAL,
++					              frame_flags);
++	    if (!frame_style)
++		return NULL;
++
++	    shadow_properties =  meta_frame_style_get_shadow_properties (frame_style);
++
++	    if (!shadow_properties)
++		return NULL;
++
++	    opt_shadow.shadow_radius = shadow_properties->unity_shadow_radius;
++	    opt_shadow.shadow_offset_x = shadow_properties->unity_shadow_x_offset;
++	    opt_shadow.shadow_offset_y = shadow_properties->unity_shadow_y_offset;
++	    opt_shadow.shadow_opacity = shadow_properties->unity_shadow_opacity;
++
++	    return decor_shadow_create (xdisplay,
++					gdk_x11_screen_get_xscreen (screen),
++					1, 1,
++					_win_extents.left,
++					_win_extents.right,
++					_win_extents.top + titlebar_height,
++					_win_extents.bottom,
++					_win_extents.left -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.right -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.top + titlebar_height -
++					TRANSLUCENT_CORNER_SIZE,
++					_win_extents.bottom -
++					TRANSLUCENT_CORNER_SIZE,
++					&opt_shadow,
++					&window_inactive_context,
++					draw_border_shape,
++					0);
++
++	case SHADOW_TYPE_INACTIVE_MAX:
++
++	    frame_flags |= META_FRAME_MAXIMIZED;
++
++	    frame_style = meta_theme_get_frame_style (theme,
++						      META_FRAME_TYPE_NORMAL,
++					              frame_flags);
++	    if (!frame_style)
++		return NULL;
++
++	    shadow_properties =  meta_frame_style_get_shadow_properties (frame_style);
++
++	    if (!shadow_properties)
++		return NULL;
++
++	    opt_shadow.shadow_radius = shadow_properties->unity_shadow_radius;
++	    opt_shadow.shadow_offset_x = shadow_properties->unity_shadow_x_offset;
++	    opt_shadow.shadow_offset_y = shadow_properties->unity_shadow_y_offset;
++	    opt_shadow.shadow_opacity = shadow_properties->unity_shadow_opacity;
++
++	    return decor_shadow_create (xdisplay,
++					gdk_x11_screen_get_xscreen (screen),
++					1, 1,
++					_max_win_extents.left,
++					_max_win_extents.right,
++					_max_win_extents.top + max_titlebar_height,
++					_max_win_extents.bottom,
++					_max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.top + max_titlebar_height -
++					TRANSLUCENT_CORNER_SIZE,
++					_max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
++					&opt_shadow,
++					&max_window_inactive_context,
++					draw_border_shape,
++					(void *) 1);
++	default:
++	    return NULL;
++    }
++
++    return NULL;
++}
++
++void
++meta_get_shadow (decor_t *d, gint shadow_type)
++{
++}
++
++
++#endif
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/settings.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/settings.c	2011-03-23 11:45:03.622056507 +0800
+@@ -0,0 +1,564 @@
++#include "gtk-window-decorator.h"
++
++/* TODO: Trash all of this and use a window property
++ * instead - much much cleaner!
++ */
++
++void
++shadow_property_changed (WnckScreen *s)
++{
++    GdkDisplay *display = gdk_display_get_default ();
++    Display    *xdisplay = GDK_DISPLAY_XDISPLAY (display);
++    GdkScreen  *screen = gdk_display_get_default_screen (display);
++    Window     root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
++    Atom actual;
++    int  result, format;
++    unsigned long n, left;
++    unsigned char *prop_data;
++    gboolean	  changed = FALSE;
++    XTextProperty shadow_color_xtp;
++
++    result = XGetWindowProperty (xdisplay, root, compiz_shadow_info_atom,
++				 0, 32768, 0, XA_INTEGER, &actual,
++				 &format, &n, &left, &prop_data);
++
++    if (result != Success)
++	return;
++
++    if (n == 4)
++    {
++	long *data      = (long *) prop_data;
++	gdouble radius  = data[0];
++	gdouble opacity = data[1];
++	gint x_off      = data[2];
++	gint y_off      = data[3];
++
++	/* Radius and Opacity are multiplied by 1000 to keep precision,
++	 * divide by that much to get our real radius and opacity
++	 */
++	radius /= 1000;
++	opacity /= 1000;
++
++	changed = radius != shadow_radius   ||
++		  opacity != shadow_opacity ||
++		  x_off != shadow_offset_x  ||
++		  y_off != shadow_offset_y;
++
++	shadow_radius = (gdouble) MAX (0.0, MIN (radius, 48.0));
++	shadow_opacity = (gdouble) MAX (0.0, MIN (opacity, 6.0));
++	shadow_offset_x = (gint) MAX (-16, MIN (x_off, 16));
++	shadow_offset_y = (gint) MAX (-16, MIN (y_off, 16));
++    }
++
++    XFree (prop_data);
++
++    result = XGetTextProperty (xdisplay, root, &shadow_color_xtp,
++			       compiz_shadow_color_atom);
++
++    if (shadow_color_xtp.value)
++    {
++	int  ret_count = 0;
++	char **t_data = NULL;
++
++	XTextPropertyToStringList (&shadow_color_xtp, &t_data, &ret_count);
++
++	if (ret_count == 1)
++	{
++	    int c[4];
++
++	    if (sscanf (t_data[0], "#%2x%2x%2x%2x",
++			&c[0], &c[1], &c[2], &c[3]) == 4)
++	    {
++		shadow_color[0] = c[0] << 8 | c[0];
++		shadow_color[1] = c[1] << 8 | c[1];
++		shadow_color[2] = c[2] << 8 | c[2];
++		changed = TRUE;
++	    }
++	}
++
++	XFree (shadow_color_xtp.value);
++	if (t_data)
++	    XFreeStringList (t_data);
++    }
++
++    if (changed)
++	decorations_changed (s);
++}
++
++#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR
++static gboolean
++blur_settings_changed (GConfClient *client)
++{
++    gchar *type;
++    int   new_type = blur_type;
++
++    if (cmdline_options & CMDLINE_BLUR)
++	return FALSE;
++
++    type = gconf_client_get_string (client,
++				    BLUR_TYPE_KEY,
++				    NULL);
++
++    if (type)
++    {
++	if (strcmp (type, "titlebar") == 0)
++	    new_type = BLUR_TYPE_TITLEBAR;
++	else if (strcmp (type, "all") == 0)
++	    new_type = BLUR_TYPE_ALL;
++	else if (strcmp (type, "none") == 0)
++	    new_type = BLUR_TYPE_NONE;
++
++	g_free (type);
++    }
++
++    if (new_type != blur_type)
++    {
++	blur_type = new_type;
++	return TRUE;
++    }
++
++    return FALSE;
++}
++
++static gboolean
++theme_changed (GConfClient *client)
++{
++
++#ifdef USE_METACITY
++    gboolean use_meta_theme;
++
++    if (cmdline_options & CMDLINE_THEME)
++	return FALSE;
++
++    use_meta_theme = gconf_client_get_bool (client,
++					    USE_META_THEME_KEY,
++					    NULL);
++
++    if (use_meta_theme)
++    {
++	gchar *theme;
++
++	theme = gconf_client_get_string (client,
++					 META_THEME_KEY,
++					 NULL);
++
++	if (theme)
++	{
++	    meta_theme_set_current (theme, TRUE);
++	    if (!meta_theme_get_current ())
++		use_meta_theme = FALSE;
++
++	    g_free (theme);
++	}
++	else
++	{
++	    use_meta_theme = FALSE;
++	}
++    }
++
++    if (use_meta_theme)
++    {
++	theme_draw_window_decoration	= meta_draw_window_decoration;
++	theme_calc_decoration_size	= meta_calc_decoration_size;
++	theme_update_border_extents	= meta_update_border_extents;
++	theme_get_event_window_position = meta_get_event_window_position;
++	theme_get_button_position	= meta_get_button_position;
++	theme_update_shadow		= meta_update_shadow;
++	theme_get_shadow		= meta_get_shadow;
++    }
++    else
++    {
++	theme_draw_window_decoration	= draw_window_decoration;
++	theme_calc_decoration_size	= calc_decoration_size;
++	theme_update_border_extents	= update_border_extents;
++	theme_get_event_window_position = get_event_window_position;
++	theme_get_button_position	= get_button_position;
++	theme_update_shadow		= cairo_update_shadow;
++	theme_get_shadow		= get_shadow;
++    }
++
++    return TRUE;
++#else
++    theme_draw_window_decoration    = draw_window_decoration;
++    theme_calc_decoration_size	    = calc_decoration_size;
++    theme_update_border_extents	    = update_border_extents;
++    theme_get_event_window_position = get_event_window_position;
++    theme_get_button_position	    = get_button_position;
++
++    return FALSE;
++#endif
++
++}
++
++static gboolean
++theme_opacity_changed (GConfClient *client)
++{
++
++#ifdef USE_METACITY
++    gboolean shade_opacity, changed = FALSE;
++    gdouble  opacity;
++
++    opacity = gconf_client_get_float (client,
++				      META_THEME_OPACITY_KEY,
++				      NULL);
++
++    if (!(cmdline_options & CMDLINE_OPACITY) &&
++	opacity != meta_opacity)
++    {
++	meta_opacity = opacity;
++	changed = TRUE;
++    }
++
++    if (opacity < 1.0)
++    {
++	shade_opacity = gconf_client_get_bool (client,
++					       META_THEME_SHADE_OPACITY_KEY,
++					       NULL);
++
++	if (!(cmdline_options & CMDLINE_OPACITY_SHADE) &&
++	    shade_opacity != meta_shade_opacity)
++	{
++	    meta_shade_opacity = shade_opacity;
++	    changed = TRUE;
++	}
++    }
++
++    opacity = gconf_client_get_float (client,
++				      META_THEME_ACTIVE_OPACITY_KEY,
++				      NULL);
++
++    if (!(cmdline_options & CMDLINE_ACTIVE_OPACITY) &&
++	opacity != meta_active_opacity)
++    {
++	meta_active_opacity = opacity;
++	changed = TRUE;
++    }
++
++    if (opacity < 1.0)
++    {
++	shade_opacity =
++	    gconf_client_get_bool (client,
++				   META_THEME_ACTIVE_SHADE_OPACITY_KEY,
++				   NULL);
++
++	if (!(cmdline_options & CMDLINE_ACTIVE_OPACITY_SHADE) &&
++	    shade_opacity != meta_active_shade_opacity)
++	{
++	    meta_active_shade_opacity = shade_opacity;
++	    changed = TRUE;
++	}
++    }
++
++    return changed;
++#else
++    return FALSE;
++#endif
++
++}
++
++static gboolean
++button_layout_changed (GConfClient *client)
++{
++
++#ifdef USE_METACITY
++    gchar *button_layout;
++
++    button_layout = gconf_client_get_string (client,
++					     META_BUTTON_LAYOUT_KEY,
++					     NULL);
++
++    if (button_layout)
++    {
++	meta_update_button_layout (button_layout);
++
++	meta_button_layout_set = TRUE;
++
++	g_free (button_layout);
++
++	return TRUE;
++    }
++
++    if (meta_button_layout_set)
++    {
++	meta_button_layout_set = FALSE;
++	return TRUE;
++    }
++#endif
++
++    return FALSE;
++}
++
++static void
++titlebar_font_changed (GConfClient *client)
++{
++    gchar *str;
++
++    str = gconf_client_get_string (client,
++				   COMPIZ_TITLEBAR_FONT_KEY,
++				   NULL);
++    if (!str)
++	str = g_strdup ("Sans Bold 12");
++
++    if (titlebar_font)
++	pango_font_description_free (titlebar_font);
++
++    titlebar_font = pango_font_description_from_string (str);
++
++    g_free (str);
++}
++
++static void
++titlebar_click_action_changed (GConfClient *client,
++			       const gchar *key,
++			       int         *action_value,
++			       int          default_value)
++{
++    gchar *action;
++
++    *action_value = default_value;
++
++    action = gconf_client_get_string (client, key, NULL);
++    if (action)
++    {
++	if (strcmp (action, "toggle_shade") == 0)
++	    *action_value = CLICK_ACTION_SHADE;
++	else if (strcmp (action, "toggle_maximize") == 0)
++	    *action_value = CLICK_ACTION_MAXIMIZE;
++	else if (strcmp (action, "minimize") == 0)
++	    *action_value = CLICK_ACTION_MINIMIZE;
++	else if (strcmp (action, "raise") == 0)
++	    *action_value = CLICK_ACTION_RAISE;
++	else if (strcmp (action, "lower") == 0)
++	    *action_value = CLICK_ACTION_LOWER;
++	else if (strcmp (action, "menu") == 0)
++	    *action_value = CLICK_ACTION_MENU;
++	else if (strcmp (action, "none") == 0)
++	    *action_value = CLICK_ACTION_NONE;
++
++	g_free (action);
++    }
++}
++
++static void
++wheel_action_changed (GConfClient *client)
++{
++    gchar *action;
++
++    wheel_action = WHEEL_ACTION_DEFAULT;
++
++    action = gconf_client_get_string (client, WHEEL_ACTION_KEY, NULL);
++    if (action)
++    {
++	if (strcmp (action, "shade") == 0)
++	    wheel_action = WHEEL_ACTION_SHADE;
++	else if (strcmp (action, "none") == 0)
++	    wheel_action = WHEEL_ACTION_NONE;
++
++	g_free (action);
++    }
++}
++
++static void
++value_changed (GConfClient *client,
++	       const gchar *key,
++	       GConfValue  *value,
++	       void        *data)
++{
++    gboolean changed = FALSE;
++
++    if (strcmp (key, COMPIZ_USE_SYSTEM_FONT_KEY) == 0)
++    {
++	if (gconf_client_get_bool (client,
++				   COMPIZ_USE_SYSTEM_FONT_KEY,
++				   NULL) != use_system_font)
++	{
++	    use_system_font = !use_system_font;
++	    changed = TRUE;
++	}
++    }
++    else if (strcmp (key, COMPIZ_TITLEBAR_FONT_KEY) == 0)
++    {
++	titlebar_font_changed (client);
++	changed = !use_system_font;
++    }
++    else if (strcmp (key, COMPIZ_DOUBLE_CLICK_TITLEBAR_KEY) == 0)
++    {
++	titlebar_click_action_changed (client, key,
++				       &double_click_action,
++				       DOUBLE_CLICK_ACTION_DEFAULT);
++    }
++    else if (strcmp (key, COMPIZ_MIDDLE_CLICK_TITLEBAR_KEY) == 0)
++    {
++	titlebar_click_action_changed (client, key,
++				       &middle_click_action,
++				       MIDDLE_CLICK_ACTION_DEFAULT);
++    }
++    else if (strcmp (key, COMPIZ_RIGHT_CLICK_TITLEBAR_KEY) == 0)
++    {
++	titlebar_click_action_changed (client, key,
++				       &right_click_action,
++				       RIGHT_CLICK_ACTION_DEFAULT);
++    }
++    else if (strcmp (key, WHEEL_ACTION_KEY) == 0)
++    {
++	wheel_action_changed (client);
++    }
++    else if (strcmp (key, BLUR_TYPE_KEY) == 0)
++    {
++	if (blur_settings_changed (client))
++	    changed = TRUE;
++    }
++    else if (strcmp (key, USE_META_THEME_KEY) == 0 ||
++	     strcmp (key, META_THEME_KEY) == 0)
++    {
++	if (theme_changed (client))
++	    changed = TRUE;
++    }
++    else if (strcmp (key, META_BUTTON_LAYOUT_KEY) == 0)
++    {
++	if (button_layout_changed (client))
++	    changed = TRUE;
++    }
++    else if (strcmp (key, META_THEME_OPACITY_KEY)	       == 0 ||
++	     strcmp (key, META_THEME_SHADE_OPACITY_KEY)	       == 0 ||
++	     strcmp (key, META_THEME_ACTIVE_OPACITY_KEY)       == 0 ||
++	     strcmp (key, META_THEME_ACTIVE_SHADE_OPACITY_KEY) == 0)
++    {
++	if (theme_opacity_changed (client))
++	    changed = TRUE;
++    }
++
++    if (changed)
++	decorations_changed (data);
++}
++#endif
++
++gboolean
++init_settings (WnckScreen *screen)
++{
++    GtkSettings	   *settings;
++    GdkScreen	   *gdkscreen;
++    GdkColormap	   *colormap;
++    AtkObject	   *switcher_label_obj;
++
++#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR
++    GConfClient	   *gconf;
++
++    gconf = gconf_client_get_default ();
++
++    gconf_client_add_dir (gconf,
++			  GCONF_DIR,
++			  GCONF_CLIENT_PRELOAD_ONELEVEL,
++			  NULL);
++
++    gconf_client_add_dir (gconf,
++			  METACITY_GCONF_DIR,
++			  GCONF_CLIENT_PRELOAD_ONELEVEL,
++			  NULL);
++
++    g_signal_connect (G_OBJECT (gconf),
++		      "value_changed",
++		      G_CALLBACK (value_changed),
++		      screen);
++#endif
++
++    style_window_rgba = gtk_window_new (GTK_WINDOW_POPUP);
++
++    gdkscreen = gdk_display_get_default_screen (gdk_display_get_default ());
++    colormap = gdk_screen_get_rgba_colormap (gdkscreen);
++    if (colormap)
++	gtk_widget_set_colormap (style_window_rgba, colormap);
++
++    gtk_widget_realize (style_window_rgba);
++
++    switcher_label = gtk_label_new ("");
++    switcher_label_obj = gtk_widget_get_accessible (switcher_label);
++    atk_object_set_role (switcher_label_obj, ATK_ROLE_STATUSBAR);
++    gtk_container_add (GTK_CONTAINER (style_window_rgba), switcher_label);
++
++    gtk_widget_set_size_request (style_window_rgba, 0, 0);
++    gtk_window_move (GTK_WINDOW (style_window_rgba), -100, -100);
++    gtk_widget_show_all (style_window_rgba);
++
++    g_signal_connect_object (style_window_rgba, "style-set",
++			     G_CALLBACK (style_changed),
++			     0, 0);
++
++    settings = gtk_widget_get_settings (style_window_rgba);
++
++    g_object_get (G_OBJECT (settings), "gtk-double-click-time",
++		  &double_click_timeout, NULL);
++
++    pango_context = gtk_widget_create_pango_context (style_window_rgba);
++
++    style_window_rgb = gtk_window_new (GTK_WINDOW_POPUP);
++
++    gdkscreen = gdk_display_get_default_screen (gdk_display_get_default ());
++    colormap = gdk_screen_get_rgb_colormap (gdkscreen);
++    if (colormap)
++	gtk_widget_set_colormap (style_window_rgb, colormap);
++
++    gtk_widget_realize (style_window_rgb);
++
++    switcher_label = gtk_label_new ("");
++    switcher_label_obj = gtk_widget_get_accessible (switcher_label);
++    atk_object_set_role (switcher_label_obj, ATK_ROLE_STATUSBAR);
++    gtk_container_add (GTK_CONTAINER (style_window_rgb), switcher_label);
++
++    gtk_widget_set_size_request (style_window_rgb, 0, 0);
++    gtk_window_move (GTK_WINDOW (style_window_rgb), -100, -100);
++    gtk_widget_show_all (style_window_rgb);
++
++    g_signal_connect_object (style_window_rgb, "style-set",
++			     G_CALLBACK (style_changed),
++			     0, 0);
++
++    settings = gtk_widget_get_settings (style_window_rgb);
++
++    g_object_get (G_OBJECT (settings), "gtk-double-click-time",
++		  &double_click_timeout, NULL);
++
++    pango_context = gtk_widget_create_pango_context (style_window_rgb);
++
++#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR
++    use_system_font = gconf_client_get_bool (gconf,
++					     COMPIZ_USE_SYSTEM_FONT_KEY,
++					     NULL);
++    theme_changed (gconf);
++    theme_opacity_changed (gconf);
++    button_layout_changed (gconf);
++#endif
++
++    update_style (style_window_rgba);
++    update_style (style_window_rgb);
++#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR
++    titlebar_font_changed (gconf);
++#endif
++
++    update_titlebar_font ();
++
++#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR
++    titlebar_click_action_changed (gconf,
++				   COMPIZ_DOUBLE_CLICK_TITLEBAR_KEY,
++				   &double_click_action,
++				   DOUBLE_CLICK_ACTION_DEFAULT);
++    titlebar_click_action_changed (gconf,
++				   COMPIZ_MIDDLE_CLICK_TITLEBAR_KEY,
++				   &middle_click_action,
++				   MIDDLE_CLICK_ACTION_DEFAULT);
++    titlebar_click_action_changed (gconf,
++				   COMPIZ_RIGHT_CLICK_TITLEBAR_KEY,
++				   &right_click_action,
++				   RIGHT_CLICK_ACTION_DEFAULT);
++    wheel_action_changed (gconf);
++    blur_settings_changed (gconf);
++#endif
++
++    (*theme_update_border_extents) (text_height);
++
++    shadow_property_changed (screen);
++
++    update_shadow ();
++
++    return TRUE;
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/style.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/style.c	2011-03-23 11:45:03.622056507 +0800
+@@ -0,0 +1,42 @@
++#include "gtk-window-decorator.h"
++
++void
++update_style (GtkWidget *widget)
++{
++    GtkStyle      *style;
++    decor_color_t spot_color;
++    
++    style = gtk_widget_get_style (widget);
++    g_object_ref (G_OBJECT (style));
++    
++    style = gtk_style_attach (style, widget->window);
++    
++    spot_color.r = style->bg[GTK_STATE_SELECTED].red   / 65535.0;
++    spot_color.g = style->bg[GTK_STATE_SELECTED].green / 65535.0;
++    spot_color.b = style->bg[GTK_STATE_SELECTED].blue  / 65535.0;
++    
++    g_object_unref (G_OBJECT (style));
++    
++    shade (&spot_color, &_title_color[0], 1.05);
++    shade (&_title_color[0], &_title_color[1], 0.85);
++    
++}
++
++void
++style_changed (GtkWidget *widget)
++{
++    GdkDisplay *gdkdisplay;
++    GdkScreen  *gdkscreen;
++    WnckScreen *screen;
++
++    gdkdisplay = gdk_display_get_default ();
++    gdkscreen  = gdk_display_get_default_screen (gdkdisplay);
++    screen     = wnck_screen_get_default ();
++
++    update_style (widget);
++
++    pango_cairo_context_set_resolution (pango_context,
++					gdk_screen_get_resolution (gdkscreen));
++
++    decorations_changed (screen);
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/switcher.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/switcher.c	2011-03-23 11:45:03.622056507 +0800
+@@ -0,0 +1,455 @@
++#include "gtk-window-decorator.h"
++
++static void
++draw_switcher_background (decor_t *d)
++{
++    Display	  *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    cairo_t	  *cr;
++    GtkStyle	  *style;
++    decor_color_t color;
++    double	  alpha = SWITCHER_ALPHA / 65535.0;
++    double	  x1, y1, x2, y2, h;
++    int		  top;
++    unsigned long pixel;
++    ushort	  a = SWITCHER_ALPHA;
++
++    if (!d->buffer_pixmap)
++	return;
++
++    style = gtk_widget_get_style (style_window_rgba);
++
++    color.r = style->bg[GTK_STATE_NORMAL].red   / 65535.0;
++    color.g = style->bg[GTK_STATE_NORMAL].green / 65535.0;
++    color.b = style->bg[GTK_STATE_NORMAL].blue  / 65535.0;
++
++    cr = gdk_cairo_create (GDK_DRAWABLE (d->buffer_pixmap));
++
++    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++
++    top = _switcher_extents.top;
++
++    x1 = switcher_context.left_space - _switcher_extents.left;
++    y1 = switcher_context.top_space - _switcher_extents.top;
++    x2 = d->width - switcher_context.right_space + _switcher_extents.right;
++    y2 = d->height - switcher_context.bottom_space + _switcher_extents.bottom;
++
++    h = y2 - y1 - _switcher_extents.top - _switcher_extents.top;
++
++    cairo_set_line_width (cr, 1.0);
++
++    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++
++    draw_shadow_background (d, cr, switcher_shadow, &switcher_context);
++
++    fill_rounded_rectangle (cr,
++			    x1 + 0.5,
++			    y1 + 0.5,
++			    _switcher_extents.left - 0.5,
++			    top - 0.5,
++			    5.0, CORNER_TOPLEFT,
++			    &color, alpha, &color, alpha * 0.75,
++			    SHADE_TOP | SHADE_LEFT);
++
++    fill_rounded_rectangle (cr,
++			    x1 + _switcher_extents.left,
++			    y1 + 0.5,
++			    x2 - x1 - _switcher_extents.left -
++			    _switcher_extents.right,
++			    top - 0.5,
++			    5.0, 0,
++			    &color, alpha, &color, alpha * 0.75,
++			    SHADE_TOP);
++
++    fill_rounded_rectangle (cr,
++			    x2 - _switcher_extents.right,
++			    y1 + 0.5,
++			    _switcher_extents.right - 0.5,
++			    top - 0.5,
++			    5.0, CORNER_TOPRIGHT,
++			    &color, alpha, &color, alpha * 0.75,
++			    SHADE_TOP | SHADE_RIGHT);
++
++    fill_rounded_rectangle (cr,
++			    x1 + 0.5,
++			    y1 + top,
++			    _switcher_extents.left - 0.5,
++			    h,
++			    5.0, 0,
++			    &color, alpha, &color, alpha * 0.75,
++			    SHADE_LEFT);
++
++    fill_rounded_rectangle (cr,
++			    x2 - _switcher_extents.right,
++			    y1 + top,
++			    _switcher_extents.right - 0.5,
++			    h,
++			    5.0, 0,
++			    &color, alpha, &color, alpha * 0.75,
++			    SHADE_RIGHT);
++
++    fill_rounded_rectangle (cr,
++			    x1 + 0.5,
++			    y2 - _switcher_extents.top,
++			    _switcher_extents.left - 0.5,
++			    _switcher_extents.top - 0.5,
++			    5.0, CORNER_BOTTOMLEFT,
++			    &color, alpha, &color, alpha * 0.75,
++			    SHADE_BOTTOM | SHADE_LEFT);
++
++    fill_rounded_rectangle (cr,
++			    x1 + _switcher_extents.left,
++			    y2 - _switcher_extents.top,
++			    x2 - x1 - _switcher_extents.left -
++			    _switcher_extents.right,
++			    _switcher_extents.top - 0.5,
++			    5.0, 0,
++			    &color, alpha, &color, alpha * 0.75,
++			    SHADE_BOTTOM);
++
++    fill_rounded_rectangle (cr,
++			    x2 - _switcher_extents.right,
++			    y2 - _switcher_extents.top,
++			    _switcher_extents.right - 0.5,
++			    _switcher_extents.top - 0.5,
++			    5.0, CORNER_BOTTOMRIGHT,
++			    &color, alpha, &color, alpha * 0.75,
++			    SHADE_BOTTOM | SHADE_RIGHT);
++
++    cairo_rectangle (cr, x1 + _switcher_extents.left,
++		     y1 + top,
++		     x2 - x1 - _switcher_extents.left - _switcher_extents.right,
++		     h);
++    gdk_cairo_set_source_color_alpha (cr,
++				      &style->bg[GTK_STATE_NORMAL],
++				      alpha);
++    cairo_fill (cr);
++
++    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
++
++    rounded_rectangle (cr,
++		       x1 + 0.5, y1 + 0.5,
++		       x2 - x1 - 1.0, y2 - y1 - 1.0,
++		       5.0,
++		       CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT |
++		       CORNER_BOTTOMRIGHT);
++
++    cairo_clip (cr);
++
++    cairo_translate (cr, 1.0, 1.0);
++
++    rounded_rectangle (cr,
++		       x1 + 0.5, y1 + 0.5,
++		       x2 - x1 - 1.0, y2 - y1 - 1.0,
++		       5.0,
++		       CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT |
++		       CORNER_BOTTOMRIGHT);
++
++    cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.4);
++    cairo_stroke (cr);
++
++    cairo_translate (cr, -2.0, -2.0);
++
++    rounded_rectangle (cr,
++		       x1 + 0.5, y1 + 0.5,
++		       x2 - x1 - 1.0, y2 - y1 - 1.0,
++		       5.0,
++		       CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT |
++		       CORNER_BOTTOMRIGHT);
++
++    cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.1);
++    cairo_stroke (cr);
++
++    cairo_translate (cr, 1.0, 1.0);
++
++    cairo_reset_clip (cr);
++
++    rounded_rectangle (cr,
++		       x1 + 0.5, y1 + 0.5,
++		       x2 - x1 - 1.0, y2 - y1 - 1.0,
++		       5.0,
++		       CORNER_TOPLEFT | CORNER_TOPRIGHT | CORNER_BOTTOMLEFT |
++		       CORNER_BOTTOMRIGHT);
++
++    gdk_cairo_set_source_color_alpha (cr,
++				      &style->fg[GTK_STATE_NORMAL],
++				      alpha);
++
++    cairo_stroke (cr);
++
++    cairo_destroy (cr);
++
++    copy_to_front_buffer (d);
++
++    pixel = ((((a * style->bg[GTK_STATE_NORMAL].blue ) >> 24) & 0x0000ff) |
++	     (((a * style->bg[GTK_STATE_NORMAL].green) >> 16) & 0x00ff00) |
++	     (((a * style->bg[GTK_STATE_NORMAL].red  ) >>  8) & 0xff0000) |
++	     (((a & 0xff00) << 16)));
++
++    decor_update_switcher_property (d);
++
++    gdk_error_trap_push ();
++    XSetWindowBackground (xdisplay, d->prop_xid, pixel);
++    XClearWindow (xdisplay, d->prop_xid);
++
++    gdk_display_sync (gdk_display_get_default ());
++    gdk_error_trap_pop ();
++
++    d->prop_xid = 0;
++}
++
++static void
++draw_switcher_foreground (decor_t *d)
++{
++    cairo_t	  *cr;
++    GtkStyle	  *style;
++    double	  alpha = SWITCHER_ALPHA / 65535.0;
++
++    if (!d->pixmap || !d->buffer_pixmap)
++	return;
++
++    style = gtk_widget_get_style (style_window_rgba);
++
++    cr = gdk_cairo_create (GDK_DRAWABLE (d->buffer_pixmap));
++
++    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++
++    cairo_rectangle (cr, switcher_context.left_space,
++		     d->height - switcher_context.bottom_space,
++		     d->width - switcher_context.left_space -
++		     switcher_context.right_space,
++		     SWITCHER_SPACE);
++
++    gdk_cairo_set_source_color_alpha (cr,
++				      &style->bg[GTK_STATE_NORMAL],
++				      alpha);
++    cairo_fill (cr);
++
++    if (d->layout)
++    {
++	int w;
++
++	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
++
++	gdk_cairo_set_source_color_alpha (cr,
++					  &style->fg[GTK_STATE_NORMAL],
++					  1.0);
++
++	pango_layout_get_pixel_size (d->layout, &w, NULL);
++
++	cairo_move_to (cr, d->width / 2 - w / 2,
++		       d->height - switcher_context.bottom_space +
++		       SWITCHER_SPACE / 2 - text_height / 2);
++
++	pango_cairo_show_layout (cr, d->layout);
++    }
++
++    cairo_destroy (cr);
++
++    copy_to_front_buffer (d);
++}
++
++void
++draw_switcher_decoration (decor_t *d)
++{
++    if (d->prop_xid)
++	draw_switcher_background (d);
++
++    draw_switcher_foreground (d);
++}
++
++void
++switcher_window_closed ()
++{
++    g_free (switcher_window);
++    switcher_window = NULL;
++}
++
++/* Switcher is override-redirect now, we need to track
++ * it separately */
++decor_t *
++switcher_window_opened (Window popup, Window window)
++{
++    decor_t      *d;
++
++    d = switcher_window = calloc (1, sizeof (decor_t));
++    if (!d)
++	return NULL;
++
++    return d;
++}
++
++gboolean
++update_switcher_window (Window	   popup,
++			Window     selected)
++{
++    decor_t           *d = switcher_window;
++    GdkPixmap         *pixmap, *buffer_pixmap = NULL;
++    unsigned int      height, width = 0, border, depth;
++    int		      x, y;
++    Window	      root_return;
++    WnckWindow        *selected_win;
++    Display           *xdisplay;
++    XRenderPictFormat *format;
++
++    if (!d)
++	d = switcher_window_opened (popup, selected);
++
++    xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++
++    /* Thats a round-trip */
++    XGetGeometry (gdk_x11_get_default_xdisplay (), popup, &root_return,
++		  &x, &y, &width, &height, &border, &depth);
++
++    decor_get_default_layout (&switcher_context, width, 1, &d->border_layout);
++
++    width  = d->border_layout.width;
++    height = d->border_layout.height;
++
++    d->decorated = FALSE;
++    d->draw	 = draw_switcher_decoration;
++
++    if (!d->pixmap && switcher_pixmap)
++    {
++	g_object_ref (G_OBJECT (switcher_pixmap));
++
++	d->pixmap = switcher_pixmap;
++    }
++
++    if (!d->buffer_pixmap && switcher_buffer_pixmap)
++    {
++	g_object_ref (G_OBJECT (switcher_buffer_pixmap));
++	d->buffer_pixmap = switcher_buffer_pixmap;
++    }
++
++    if (!d->width)
++	d->width = switcher_width;
++
++    if (!d->height)
++	d->height = switcher_height;
++
++    selected_win = wnck_window_get (selected);
++    if (selected_win)
++    {
++	glong		name_length;
++	PangoLayoutLine *line;
++	const gchar	*name;
++
++	if (d->name)
++	{
++	    g_free (d->name);
++	    d->name = NULL;
++	}
++
++	name = wnck_window_get_name (selected_win);
++	if (name && (name_length = strlen (name)))
++	{
++	    if (!d->layout)
++	    {
++		d->layout = pango_layout_new (pango_context);
++		if (d->layout)
++		    pango_layout_set_wrap (d->layout, PANGO_WRAP_CHAR);
++	    }
++
++	    if (d->layout)
++	    {
++		int tw;
++
++		tw = width - switcher_context.left_space -
++		    switcher_context.right_space - 64;
++		pango_layout_set_auto_dir (d->layout, FALSE);
++		pango_layout_set_width (d->layout, tw * PANGO_SCALE);
++		pango_layout_set_text (d->layout, name, name_length);
++
++		line = pango_layout_get_line (d->layout, 0);
++
++		name_length = line->length;
++		if (pango_layout_get_line_count (d->layout) > 1)
++		{
++		    if (name_length < 4)
++		    {
++			g_object_unref (G_OBJECT (d->layout));
++			d->layout = NULL;
++		    }
++		    else
++		    {
++			d->name = g_strndup (name, name_length);
++			strcpy (d->name + name_length - 3, "...");
++		    }
++		}
++		else
++		    d->name = g_strndup (name, name_length);
++
++		if (d->layout)
++		    pango_layout_set_text (d->layout, d->name, name_length);
++	    }
++	}
++	else if (d->layout)
++	{
++	    g_object_unref (G_OBJECT (d->layout));
++	    d->layout = NULL;
++	}
++    }
++
++    if (selected != switcher_selected_window)
++    {
++	gtk_label_set_text (GTK_LABEL (switcher_label), "");
++	if (selected_win && d->name)
++	    gtk_label_set_text (GTK_LABEL (switcher_label), d->name);
++	switcher_selected_window = selected;
++    }
++
++    pixmap = create_pixmap (width, height, 32);
++    if (!pixmap)
++	return FALSE;
++
++    buffer_pixmap = create_pixmap (width, height, 32);
++    if (!buffer_pixmap)
++    {
++	g_object_unref (G_OBJECT (pixmap));
++	return FALSE;
++    }
++
++    if (switcher_pixmap)
++	g_object_unref (G_OBJECT (switcher_pixmap));
++
++    if (switcher_buffer_pixmap)
++	g_object_unref (G_OBJECT (switcher_buffer_pixmap));
++
++    if (d->pixmap)
++	g_object_unref (G_OBJECT (d->pixmap));
++
++    if (d->buffer_pixmap)
++	g_object_unref (G_OBJECT (d->buffer_pixmap));
++
++    if (d->cr)
++	cairo_destroy (d->cr);
++
++    if (d->picture)
++	XRenderFreePicture (xdisplay, d->picture);
++
++    switcher_pixmap	   = pixmap;
++    switcher_buffer_pixmap = buffer_pixmap;
++
++    switcher_width  = width;
++    switcher_height = height;
++
++    g_object_ref (G_OBJECT (pixmap));
++    g_object_ref (G_OBJECT (buffer_pixmap));
++
++    d->pixmap	     = pixmap;
++    d->buffer_pixmap = buffer_pixmap;
++    d->cr	     = gdk_cairo_create (pixmap);
++
++    format = get_format_for_drawable (d, GDK_DRAWABLE (d->buffer_pixmap));
++    d->picture = XRenderCreatePicture (xdisplay, GDK_PIXMAP_XID (buffer_pixmap),
++				       format, 0, NULL);
++
++    d->width  = width;
++    d->height = height;
++
++    d->prop_xid = popup;
++
++    queue_decor_draw (d);
++
++    return TRUE;
++}
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/util.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/util.c	2011-03-23 11:45:03.622056507 +0800
+@@ -0,0 +1,278 @@
++#include "gtk-window-decorator.h"
++
++double
++square (double x)
++{
++    return x * x;
++}
++
++double
++dist (double x1, double y1,
++      double x2, double y2)
++{
++    return sqrt (square (x1 - x2) + square (y1 - y2));
++}
++
++gboolean
++get_window_prop (Window xwindow,
++		 Atom   atom,
++		 Window *val)
++{
++    Atom   type;
++    int	   format;
++    gulong nitems;
++    gulong bytes_after;
++    Window *w;
++    int    err, result;
++
++    *val = 0;
++
++    gdk_error_trap_push ();
++
++    type = None;
++    result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
++				 xwindow,
++				 atom,
++				 0, G_MAXLONG,
++				 False, XA_WINDOW, &type, &format, &nitems,
++				 &bytes_after, (void*) &w);
++    err = gdk_error_trap_pop ();
++    if (err != Success || result != Success)
++	return FALSE;
++
++    if (type != XA_WINDOW)
++    {
++	XFree (w);
++	return FALSE;
++    }
++
++    *val = *w;
++    XFree (w);
++
++    return TRUE;
++}
++
++unsigned int
++get_mwm_prop (Window xwindow)
++{
++    Display	  *xdisplay;
++    Atom	  actual;
++    int		  err, result, format;
++    unsigned long n, left;
++    unsigned char *data;
++    unsigned int  decor = MWM_DECOR_ALL;
++
++    xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++
++    gdk_error_trap_push ();
++
++    result = XGetWindowProperty (xdisplay, xwindow, mwm_hints_atom,
++				 0L, 20L, FALSE, mwm_hints_atom,
++				 &actual, &format, &n, &left, &data);
++
++    err = gdk_error_trap_pop ();
++    if (err != Success || result != Success)
++	return decor;
++
++    if (data)
++    {
++	MwmHints *mwm_hints = (MwmHints *) data;
++
++	if (n >= PROP_MOTIF_WM_HINT_ELEMENTS)
++	{
++	    if (mwm_hints->flags & MWM_HINTS_DECORATIONS)
++		decor = mwm_hints->decorations;
++	}
++
++	XFree (data);
++    }
++
++    return decor;
++}
++
++/* from clearlooks theme */
++static void
++rgb_to_hls (gdouble *r,
++	    gdouble *g,
++	    gdouble *b)
++{
++    gdouble min;
++    gdouble max;
++    gdouble red;
++    gdouble green;
++    gdouble blue;
++    gdouble h, l, s;
++    gdouble delta;
++
++    red = *r;
++    green = *g;
++    blue = *b;
++
++    if (red > green)
++    {
++	if (red > blue)
++	    max = red;
++	else
++	    max = blue;
++
++	if (green < blue)
++	    min = green;
++	else
++	    min = blue;
++    }
++    else
++    {
++	if (green > blue)
++	    max = green;
++	else
++	    max = blue;
++
++	if (red < blue)
++	    min = red;
++	else
++	    min = blue;
++    }
++
++    l = (max + min) / 2;
++    s = 0;
++    h = 0;
++
++    if (max != min)
++    {
++	if (l <= 0.5)
++	    s = (max - min) / (max + min);
++	else
++	    s = (max - min) / (2 - max - min);
++
++	delta = max -min;
++	if (red == max)
++	    h = (green - blue) / delta;
++	else if (green == max)
++	    h = 2 + (blue - red) / delta;
++	else if (blue == max)
++	    h = 4 + (red - green) / delta;
++
++	h *= 60;
++	if (h < 0.0)
++	    h += 360;
++    }
++
++    *r = h;
++    *g = l;
++    *b = s;
++}
++
++static void
++hls_to_rgb (gdouble *h,
++	    gdouble *l,
++	    gdouble *s)
++{
++    gdouble hue;
++    gdouble lightness;
++    gdouble saturation;
++    gdouble m1, m2;
++    gdouble r, g, b;
++
++    lightness = *l;
++    saturation = *s;
++
++    if (lightness <= 0.5)
++	m2 = lightness * (1 + saturation);
++    else
++	m2 = lightness + saturation - lightness * saturation;
++
++    m1 = 2 * lightness - m2;
++
++    if (saturation == 0)
++    {
++	*h = lightness;
++	*l = lightness;
++	*s = lightness;
++    }
++    else
++    {
++	hue = *h + 120;
++	while (hue > 360)
++	    hue -= 360;
++	while (hue < 0)
++	    hue += 360;
++
++	if (hue < 60)
++	    r = m1 + (m2 - m1) * hue / 60;
++	else if (hue < 180)
++	    r = m2;
++	else if (hue < 240)
++	    r = m1 + (m2 - m1) * (240 - hue) / 60;
++	else
++	    r = m1;
++
++	hue = *h;
++	while (hue > 360)
++	    hue -= 360;
++	while (hue < 0)
++	    hue += 360;
++
++	if (hue < 60)
++	    g = m1 + (m2 - m1) * hue / 60;
++	else if (hue < 180)
++	    g = m2;
++	else if (hue < 240)
++	    g = m1 + (m2 - m1) * (240 - hue) / 60;
++	else
++	    g = m1;
++
++	hue = *h - 120;
++	while (hue > 360)
++	    hue -= 360;
++	while (hue < 0)
++	    hue += 360;
++
++	if (hue < 60)
++	    b = m1 + (m2 - m1) * hue / 60;
++	else if (hue < 180)
++	    b = m2;
++	else if (hue < 240)
++	    b = m1 + (m2 - m1) * (240 - hue) / 60;
++	else
++	    b = m1;
++
++	*h = r;
++	*l = g;
++	*s = b;
++    }
++}
++
++void
++shade (const decor_color_t *a,
++       decor_color_t	   *b,
++       float		   k)
++{
++    double red;
++    double green;
++    double blue;
++
++    red   = a->r;
++    green = a->g;
++    blue  = a->b;
++
++    rgb_to_hls (&red, &green, &blue);
++
++    green *= k;
++    if (green > 1.0)
++	green = 1.0;
++    else if (green < 0.0)
++	green = 0.0;
++
++    blue *= k;
++    if (blue > 1.0)
++	blue = 1.0;
++    else if (blue < 0.0)
++	blue = 0.0;
++
++    hls_to_rgb (&red, &green, &blue);
++
++    b->r = red;
++    b->g = green;
++    b->b = blue;
++}
++
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/wnck.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/wnck.c	2011-03-23 12:08:41.634136287 +0800
+@@ -0,0 +1,772 @@
++#include "gtk-window-decorator.h"
++
++static void
++window_name_changed (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->decorated)
++    {
++	if (!update_window_decoration_size (win))
++	    queue_decor_draw (d);
++    }
++}
++
++static void
++window_geometry_changed (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->decorated)
++    {
++	int width, height;
++
++	wnck_window_get_client_window_geometry (win, NULL, NULL,
++						&width, &height);
++
++	if (width != d->client_width || height != d->client_height)
++	{
++	    d->client_width  = width;
++	    d->client_height = height;
++
++	    update_window_decoration_size (win);
++	    update_event_windows (win);
++	}
++    }
++}
++
++static void
++window_icon_changed (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->decorated)
++    {
++	update_window_decoration_icon (win);
++	queue_decor_draw (d);
++    }
++}
++
++static void
++window_state_changed (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->decorated)
++    {
++	update_window_decoration_state (win);
++	if (!update_window_decoration_size (win))
++	    queue_decor_draw (d);
++
++	update_event_windows (win);
++    }
++}
++
++static void
++window_actions_changed (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++
++    if (d->decorated)
++    {
++	update_window_decoration_actions (win);
++	if (!update_window_decoration_size (win))
++	    queue_decor_draw (d);
++
++	update_event_windows (win);
++    }
++}
++
++void
++decorations_changed (WnckScreen *screen)
++{
++    GdkDisplay *gdkdisplay;
++    GdkScreen  *gdkscreen;
++    GList      *windows;
++    Window select;
++
++    gdkdisplay = gdk_display_get_default ();
++    gdkscreen  = gdk_display_get_default_screen (gdkdisplay);
++
++    update_titlebar_font ();
++    (*theme_update_border_extents) (text_height);
++    update_shadow ();
++
++    update_default_decorations (gdkscreen);
++
++    if (minimal)
++	return;
++
++    /* Update all normal windows */
++
++    windows = wnck_screen_get_windows (screen);
++    while (windows != NULL)
++    {
++	decor_t *d = g_object_get_data (G_OBJECT (windows->data), "decor");
++
++	if (d->decorated)
++	{
++
++#ifdef USE_METACITY
++	    if (d->draw == draw_window_decoration ||
++		d->draw == meta_draw_window_decoration)
++		d->draw = theme_draw_window_decoration;
++#endif
++
++	}
++
++	update_window_decoration (WNCK_WINDOW (windows->data));
++	windows = windows->next;
++    }
++
++    /* Update switcher window */
++
++    if (switcher_window &&
++	get_window_prop (switcher_window->prop_xid,
++			 select_window_atom, &select))
++    {
++	decor_t *d = switcher_window;
++	/* force size update */
++	d->context = NULL;
++	d->width = d->height = 0;
++	switcher_width = switcher_height = 0;
++
++	update_switcher_window (d->prop_xid, select);
++    }
++}
++
++void
++restack_window (WnckWindow *win,
++		int	   stack_mode)
++{
++    Display    *xdisplay;
++    GdkDisplay *gdkdisplay;
++    GdkScreen  *screen;
++    Window     xroot;
++    XEvent     ev;
++
++    gdkdisplay = gdk_display_get_default ();
++    xdisplay   = GDK_DISPLAY_XDISPLAY (gdkdisplay);
++    screen     = gdk_display_get_default_screen (gdkdisplay);
++    xroot      = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen));
++
++    if (action_menu_mapped)
++    {
++	gtk_object_destroy (GTK_OBJECT (action_menu));
++	action_menu_mapped = FALSE;
++	action_menu = NULL;
++	return;
++    }
++
++    ev.xclient.type    = ClientMessage;
++    ev.xclient.display = xdisplay;
++
++    ev.xclient.serial	  = 0;
++    ev.xclient.send_event = TRUE;
++
++    ev.xclient.window	    = wnck_window_get_xid (win);
++    ev.xclient.message_type = restack_window_atom;
++    ev.xclient.format	    = 32;
++
++    ev.xclient.data.l[0] = 2;
++    ev.xclient.data.l[1] = None;
++    ev.xclient.data.l[2] = stack_mode;
++    ev.xclient.data.l[3] = 0;
++    ev.xclient.data.l[4] = 0;
++
++    XSendEvent (xdisplay, xroot, FALSE,
++		SubstructureRedirectMask | SubstructureNotifyMask,
++		&ev);
++
++    XSync (xdisplay, FALSE);
++}
++
++
++void
++add_frame_window (WnckWindow *win,
++		  Window     frame,
++		  Bool	     mode)
++{
++    Display		 *xdisplay;
++    XSetWindowAttributes attr;
++    gulong		 xid = wnck_window_get_xid (win);
++    decor_t		 *d = g_object_get_data (G_OBJECT (win), "decor");
++    gint		 i, j;
++
++    xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++
++    /* If we have already done this, there is no need to do it again, except
++     * if the property changed.
++     *
++     * The reason this check is here is because sometimes the PropertyNotify X
++     * event can come a bit after the property on the window is actually set
++     * which might result in this function being called twice - once by
++     * wnck through window_opened and once through our X event handler
++     * event_filter_func
++     */
++
++    if (d->created && mode && d->frame_window)
++	return;
++
++    d->active = wnck_window_is_active (win);
++    d->win = win;
++    d->last_pos_entered = NULL;
++
++    attr.event_mask = ButtonPressMask | EnterWindowMask |
++		      LeaveWindowMask | ExposureMask;
++    attr.override_redirect = TRUE;
++
++    gdk_error_trap_push ();
++
++    if (mode)
++    {
++	GdkColormap *colormap;
++
++	d->frame_window = create_gdk_window (frame);
++	d->decor_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
++
++	colormap = get_colormap_for_drawable (GDK_DRAWABLE (d->frame_window));
++
++	d->decor_image = gtk_image_new ();
++
++	gtk_widget_set_colormap (d->decor_window, colormap);
++	gtk_widget_set_colormap (d->decor_image, colormap);
++
++	d->decor_event_box = gtk_event_box_new ();
++	gtk_event_box_set_visible_window (GTK_EVENT_BOX (d->decor_event_box),
++					  FALSE);
++	gtk_widget_set_events (d->decor_event_box, GDK_BUTTON_PRESS_MASK |
++						   GDK_BUTTON_RELEASE_MASK |
++						   GDK_POINTER_MOTION_MASK);
++
++	g_signal_connect (G_OBJECT (d->decor_event_box), "button-press-event",
++			  G_CALLBACK (frame_handle_button_press),
++			  (gpointer) (d));
++
++	g_signal_connect (G_OBJECT (d->decor_event_box), "button-release-event",
++			  G_CALLBACK (frame_handle_button_release),
++			  (gpointer) (d));
++
++	g_signal_connect (G_OBJECT (d->decor_event_box), "motion-notify-event",
++			  G_CALLBACK (frame_handle_motion),
++			  (gpointer) (d));
++
++	gtk_container_add (GTK_CONTAINER (d->decor_event_box), d->decor_image);
++	gtk_event_box_set_above_child (GTK_EVENT_BOX (d->decor_event_box), TRUE);
++	gtk_widget_show_all (d->decor_event_box);
++	gtk_window_set_decorated (GTK_WINDOW (d->decor_window), FALSE);
++	gtk_window_set_default_size (GTK_WINDOW (d->decor_window), 1000, 1000);
++	gtk_container_add (GTK_CONTAINER (d->decor_window), d->decor_event_box);
++
++	/* Assumed realization happens here */
++
++	g_signal_connect (G_OBJECT (d->decor_window), "realize",
++			  G_CALLBACK (frame_window_realized), (gpointer) d);
++
++	gtk_widget_show_all (d->decor_window);
++	gtk_widget_show (d->decor_window);
++
++	g_object_set_data (G_OBJECT (d->frame_window),
++			   "client_wnck_window", win);
++    }
++    else
++    {
++	d->frame_window = NULL;
++
++	for (i = 0; i < 3; i++)
++	{
++	    for (j = 0; j < 3; j++)
++	    {
++		d->event_windows[i][j].window =
++		XCreateWindow (xdisplay,
++			       frame,
++			       0, 0, 1, 1, 0,
++			       CopyFromParent, CopyFromParent, CopyFromParent,
++			       CWOverrideRedirect | CWEventMask, &attr);
++
++		if (cursor[i][j].cursor)
++		    XDefineCursor (xdisplay, d->event_windows[i][j].window,
++		    cursor[i][j].cursor);
++	    }
++	}
++
++	attr.event_mask |= ButtonReleaseMask;
++
++	for (i = 0; i < BUTTON_NUM; i++)
++	{
++	    d->button_windows[i].window =
++	    XCreateWindow (xdisplay,
++			   frame,
++			   0, 0, 1, 1, 0,
++			   CopyFromParent, CopyFromParent, CopyFromParent,
++			   CWOverrideRedirect | CWEventMask, &attr);
++
++	    d->button_states[i] = 0;
++	}
++    }
++
++    gdk_display_sync (gdk_display_get_default ());
++    if (!gdk_error_trap_pop ())
++    {
++	if (get_mwm_prop (xid) & (MWM_DECOR_ALL | MWM_DECOR_TITLE))
++	    d->decorated = TRUE;
++
++	for (i = 0; i < 3; i++)
++	    for (j = 0; j < 3; j++)
++	    {
++		Window win = d->event_windows[i][j].window;
++		g_hash_table_insert (frame_table,
++				     GINT_TO_POINTER (win),
++				     GINT_TO_POINTER (xid));
++	    }
++
++	for (i = 0; i < BUTTON_NUM; i++)
++	    g_hash_table_insert (frame_table,
++				 GINT_TO_POINTER (d->button_windows[i].window),
++				 GINT_TO_POINTER (xid));
++
++	if (d->frame_window)
++	{
++	    g_hash_table_insert (frame_table,
++				 GINT_TO_POINTER (frame),
++				 GINT_TO_POINTER (xid));
++	}
++	update_window_decoration_state (win);
++	update_window_decoration_actions (win);
++	update_window_decoration_icon (win);
++	update_window_decoration_size (win);
++
++	update_event_windows (win);
++    }
++    else
++    {
++	for (i = 0; i < 3; i++)
++	    for (j = 0; j < 3; j++)
++		d->event_windows[i][j].window = None;
++    }
++
++    d->created = TRUE;
++}
++
++void
++remove_frame_window (WnckWindow *win)
++{
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    Display *xdisplay;
++
++    xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++
++    if (d->pixmap)
++    {
++	g_object_unref (G_OBJECT (d->pixmap));
++	d->pixmap = NULL;
++    }
++
++    if (d->buffer_pixmap)
++    {
++	g_object_unref (G_OBJECT (d->buffer_pixmap));
++	d->buffer_pixmap = NULL;
++    }
++
++    if (d->cr)
++    {
++	cairo_destroy (d->cr);
++	d->cr = NULL;
++    }
++
++    if (d->picture && !d->frame_window)
++    {
++	XRenderFreePicture (xdisplay, d->picture);
++	d->picture = 0;
++    }
++
++    if (d->name)
++    {
++	g_free (d->name);
++	d->name = NULL;
++    }
++
++    if (d->layout)
++    {
++	g_object_unref (G_OBJECT (d->layout));
++	d->layout = NULL;
++    }
++
++    if (d->icon)
++    {
++	cairo_pattern_destroy (d->icon);
++	d->icon = NULL;
++    }
++
++    if (d->icon_pixmap)
++    {
++	g_object_unref (G_OBJECT (d->icon_pixmap));
++	d->icon_pixmap = NULL;
++    }
++
++    if (d->icon_pixbuf)
++    {
++	g_object_unref (G_OBJECT (d->icon_pixbuf));
++	d->icon_pixbuf = NULL;
++    }
++
++    if (d->force_quit_dialog)
++    {
++	GtkWidget *dialog = d->force_quit_dialog;
++
++	d->force_quit_dialog = NULL;
++	gtk_widget_destroy (dialog);
++    }
++
++    if (d->frame_window)
++    {
++	gdk_window_destroy (d->frame_window);
++	d->frame_window = NULL;
++    }
++
++    if (d->decor_image)
++    {
++	g_object_unref (d->decor_image);
++	d->decor_image = NULL;
++    }
++
++    if (d->decor_event_box)
++    {
++	g_object_unref (d->decor_event_box);
++	d->decor_event_box = NULL;
++    }
++
++    if (d->decor_window)
++    {
++	g_object_unref (d->decor_window);
++	d->decor_window = NULL;
++    }
++
++    d->width  = 0;
++    d->height = 0;
++
++    d->decorated = FALSE;
++
++    d->state   = 0;
++    d->actions = 0;
++
++    d->context = NULL;
++    d->shadow  = NULL;
++
++    draw_list = g_slist_remove (draw_list, d);
++}
++
++void
++connect_window (WnckWindow *win)
++{
++    g_signal_connect_object (win, "name_changed",
++			     G_CALLBACK (window_name_changed),
++			     0, 0);
++    g_signal_connect_object (win, "geometry_changed",
++			     G_CALLBACK (window_geometry_changed),
++			     0, 0);
++    g_signal_connect_object (win, "icon_changed",
++			     G_CALLBACK (window_icon_changed),
++			     0, 0);
++    g_signal_connect_object (win, "state_changed",
++			     G_CALLBACK (window_state_changed),
++			     0, 0);
++    g_signal_connect_object (win, "actions_changed",
++			     G_CALLBACK (window_actions_changed),
++			     0, 0);
++}
++
++static void
++active_window_changed (WnckScreen *screen)
++{
++    WnckWindow *win;
++    decor_t    *d;
++
++    win = wnck_screen_get_previously_active_window (screen);
++    if (win)
++    {
++	d = g_object_get_data (G_OBJECT (win), "decor");
++	if (d && d->pixmap)
++	{
++	    d->active = wnck_window_is_active (win);
++
++	    if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
++	    {
++		if (!d->frame_window)
++		{
++		    if (d->active)
++		    {
++			d->context = &max_window_active_context;
++			d->shadow  = max_border_active_shadow;
++		    }
++		    else
++		    {
++			d->context = &max_window_inactive_context;
++			d->shadow  = max_border_inactive_shadow;
++		    }
++		}
++		else
++		{
++		    d->shadow  = max_border_no_shadow;
++		}
++	    }
++	    else
++	    {
++		if (!d->frame_window)
++		{
++		    if (d->active)
++		    {
++			d->context = &window_active_context;
++			d->shadow  = border_active_shadow;
++		    }
++		    else
++		    {
++			d->context = &window_inactive_context;
++			d->shadow  = border_inactive_shadow;
++		    }
++		}
++		else
++		{
++		    d->shadow  = border_no_shadow;
++		}
++	    }
++
++	    /* We need to update the decoration size here
++	     * since the shadow size might have changed and
++	     * in that case the decoration will be redrawn,
++	     * however if the shadow size doesn't change
++	     * then we need to redraw the decoration anyways
++	     * since the image would have changed */
++	    if (!update_window_decoration_size (d->win))
++		queue_decor_draw (d);
++
++	    /* Also update any parents of this window
++	     * since they won't get a notification here
++	     */
++	    if (d->transient_parent)
++	    {
++		decor_t *d_parent = g_object_get_data (d->transient_parent, "decor");
++		queue_decor_draw (d_parent);
++	    }
++
++	}
++    }
++
++    win = wnck_screen_get_active_window (screen);
++    if (win)
++    {
++	d = g_object_get_data (G_OBJECT (win), "decor");
++	if (d && d->pixmap)
++	{
++	    d->active = wnck_window_is_active (win);
++
++	    if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
++	    {
++		if (!d->frame_window)
++		{
++		    if (d->active)
++		    {
++			d->context = &max_window_active_context;
++			d->shadow  = max_border_active_shadow;
++		    }
++		    else
++		    {
++			d->context = &max_window_inactive_context;
++			d->shadow  = max_border_inactive_shadow;
++		    }
++		}
++		else
++		{
++		    d->shadow  = max_border_no_shadow;
++		}
++	    }
++	    else
++	    {
++		if (!d->frame_window)
++		{
++		    if (d->active)
++		    {
++			d->context = &window_active_context;
++			d->shadow  = border_active_shadow;
++		    }
++		    else
++		    {
++			d->context = &window_inactive_context;
++			d->shadow  = border_inactive_shadow;
++		    }
++		}
++		else
++		{
++		    d->shadow  = border_no_shadow;
++		}
++	    }
++
++	    /* We need to update the decoration size here
++	     * since the shadow size might have changed and
++	     * in that case the decoration will be redrawn,
++	     * however if the shadow size doesn't change
++	     * then we need to redraw the decoration anyways
++	     * since the image would have changed */
++	    if (!update_window_decoration_size (d->win))
++		queue_decor_draw (d);
++
++	    /* Also update any parents of this window
++	     * since they won't get a notification here
++	     */
++	    if (d->transient_parent)
++	    {
++		decor_t *d_parent = g_object_get_data (d->transient_parent, "decor");
++		queue_decor_draw (d_parent);
++	    }
++	}
++    }
++}
++
++static void
++window_opened (WnckScreen *screen,
++	       WnckWindow *win)
++{
++    decor_t      *d;
++    Window       window;
++    gulong       xid;
++    unsigned int i, j;
++
++    static event_callback callback[3][3] = {
++	{ top_left_event,    top_event,    top_right_event    },
++	{ left_event,	     title_event,  right_event	      },
++	{ bottom_left_event, bottom_event, bottom_right_event }
++    };
++    static event_callback button_callback[BUTTON_NUM] = {
++	close_button_event,
++	max_button_event,
++	min_button_event,
++	menu_button_event,
++	shade_button_event,
++	above_button_event,
++	stick_button_event,
++	unshade_button_event,
++	unabove_button_event,
++	unstick_button_event
++    };
++
++    d = calloc (1, sizeof (decor_t));
++    if (!d)
++	return;
++
++    for (i = 0; i < 3; i++)
++	for (j = 0; j < 3; j++)
++	    d->event_windows[i][j].callback = callback[i][j];
++
++    for (i = 0; i < BUTTON_NUM; i++)
++	d->button_windows[i].callback = button_callback[i];
++
++    wnck_window_get_client_window_geometry (win, NULL, NULL,
++					    &d->client_width,
++					    &d->client_height);
++
++    d->draw = theme_draw_window_decoration;
++
++    d->created = FALSE;
++    d->pixmap = NULL;
++    d->cr = NULL;
++    d->buffer_pixmap = NULL;
++    d->picture = None;
++    d->transient_windows = NULL;
++
++    connect_window (win);
++
++    g_object_set_data (G_OBJECT (win), "decor", d);
++
++    xid = wnck_window_get_xid (win);
++
++    if (get_window_prop (xid, frame_input_window_atom, &window))
++    {
++	add_frame_window (win, window, FALSE);
++    }
++    else if (get_window_prop (xid, frame_output_window_atom, &window))
++    {
++	add_frame_window (win, window, TRUE);
++    }
++
++    if (wnck_window_get_window_type (win) == WNCK_WINDOW_DIALOG)
++    {
++	Window parent;
++
++	if (get_window_prop (xid, XA_WM_TRANSIENT_FOR, &parent))
++	{
++	    WnckWindow *p = wnck_window_get (parent);
++	    decor_t *d = g_object_get_data (G_OBJECT (p), "decor");
++	    decor_t *d_transient = g_object_get_data (G_OBJECT (win), "decor");
++
++	    if (d)
++	    {
++		d->transient_windows = g_slist_append (d->transient_windows, win);
++		d_transient->transient_parent = p;
++	    }
++	}
++    }
++}
++
++static void
++window_closed (WnckScreen *screen,
++	       WnckWindow *win)
++{
++    Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
++    GSList *list;
++
++    for (list = d->transient_windows; list; list = list->next)
++    {
++	WnckWindow *win = (WnckWindow *) list->data;
++	decor_t    *d_transient = g_object_get_data (G_OBJECT (win), "decor");
++
++	d_transient->transient_parent = NULL;
++    }
++
++    g_slist_free (d->transient_windows);
++    d->transient_windows = NULL;
++
++    if (d->transient_parent)
++    {
++	decor_t *d_parent = g_object_get_data (G_OBJECT (d->transient_parent), "decor");
++
++ 	d_parent->transient_windows = g_slist_remove (d_parent->transient_windows, win);
++
++	if (!g_slist_length (d_parent->transient_windows))
++	    d_parent->transient_windows = NULL;
++    }
++
++    remove_frame_window (win);
++
++    g_object_set_data (G_OBJECT (win), "decor", NULL);
++
++    gdk_error_trap_push ();
++    XDeleteProperty (xdisplay, wnck_window_get_xid (win), win_decor_atom);
++    gdk_display_sync (gdk_display_get_default ());
++    gdk_error_trap_pop ();
++
++    g_free (d);
++}
++
++void
++connect_screen (WnckScreen *screen)
++{
++    GList *windows;
++
++    g_signal_connect_object (G_OBJECT (screen), "active_window_changed",
++			     G_CALLBACK (active_window_changed),
++			     0, 0);
++    g_signal_connect_object (G_OBJECT (screen), "window_opened",
++			     G_CALLBACK (window_opened),
++			     0, 0);
++    g_signal_connect_object (G_OBJECT (screen), "window_closed",
++			     G_CALLBACK (window_closed),
++			     0, 0);
++
++    windows = wnck_screen_get_windows (screen);
++    while (windows != NULL)
++    {
++	window_opened (screen, windows->data);
++	windows = windows->next;
++    }
++}

=== added file 'debian/patches/029_default_options.patch'
--- debian/patches/029_default_options.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/029_default_options.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,288 @@
+## Description: add some description
+## Origin/Author: add some origin or author
+## Bug: bug URL
+Author: Michael Vogt <michael.vogt@xxxxxxxxxx>
+Description: Various default settings
+ Changes in various defaults.  From what I can tell (these were originally
+ from ubuntu, but I (the debian maintainer) will do my best to summarize
+ them below).
+ .
+ * Desktop Horizontal virtual size of 2 instead of 4.
+ * Sync to vblank: false by default.
+ * Make an exception to focus prevention matching for PolicyKit windows.
+ * Remove top-right hotcorner from scale plugin by default.
+ * Increase drop-shadow radius from 8 to 9.
+ * Set default decorator to /usr/bin/compiz-decorator.
+ * Change default colors for faces in cube plugin.
+ * Use "Smart" placement mode (2) by default for placement plugin.
+ * Use "Rectangle" resize mode (2) by default for resize plugin.
+ * Add exception to not fade notify-osd windows in fade plugin.
+ .
+ The following changes from the original Ubuntu patch were modified:
+ * Use slightly more Debianish/Gnomeish colors for the cube face top.
+ The following changes from the original Ubuntu patch were not included:
+ * Add Ubuntu logo for top face of cube.
+ The following changes were introduced to the Debian version of this patch:
+ * Add Debian logo for top face of cube.
+Origin: vendor, ubuntu (1:0.6.0+git20071006-0ubuntu1) or perhaps earlier.
+Index: compiz-0.9.4/metadata/core.xml.in
+===================================================================
+--- compiz-0.9.4.orig/metadata/core.xml.in	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/metadata/core.xml.in	2011-03-17 17:12:02.028886771 +0100
+@@ -138,7 +138,7 @@
+ 			<option name="focus_prevention_match" type="match">
+ 			<_short>Focus Prevention Windows</_short>
+ 			<_long>Focus prevention windows</_long>
+-			<default>any</default>
++			<default>!(class=Polkit-gnome-authentication-agent-1)</default>
+ 			</option>
+ 		</group>
+ 		<group>
+@@ -244,14 +244,14 @@
+ 			<option name="hsize" type="int">
+ 			<_short>Horizontal Virtual Size</_short>
+ 			<_long>Screen size multiplier for horizontal virtual size</_long>
+-			<default>4</default>
++			<default>2</default>
+ 			<min>1</min>
+ 			<max>32</max>
+ 			</option>
+ 			<option name="vsize" type="int">
+ 			<_short>Vertical Virtual Size</_short>
+ 			<_long>Screen size multiplier for vertical virtual size</_long>
+-			<default>1</default>
++			<default>2</default>
+ 			<min>1</min>
+ 			<max>32</max>
+ 			</option>
+Index: compiz-0.9.4/plugins/scale/scale.xml.in
+===================================================================
+--- compiz-0.9.4.orig/plugins/scale/scale.xml.in	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/scale/scale.xml.in	2011-03-17 17:12:36.117055808 +0100
+@@ -18,14 +18,14 @@
+ 			<option name="spacing" type="int">
+ 				<_short>Spacing</_short>
+ 				<_long>Space between windows</_long>
+-				<default>10</default>
++				<default>68</default>
+ 				<min>0</min>
+ 				<max>250</max>
+ 			</option>
+ 			<option name="speed" type="float">
+ 				<_short>Speed</_short>
+ 				<_long>Scale speed</_long>
+-				<default>1.5</default>
++				<default>2.4</default>
+ 				<min>0.1</min>
+ 				<max>50</max>
+ 				<precision>0.1</precision>
+@@ -33,7 +33,7 @@
+ 			<option name="timestep" type="float">
+ 				<_short>Timestep</_short>
+ 				<_long>Scale timestep</_long>
+-				<default>1.2</default>
++				<default>0.1</default>
+ 				<min>0.1</min>
+ 				<max>50</max>
+ 				<precision>0.1</precision>
+@@ -46,7 +46,7 @@
+ 			<option name="opacity" type="int">
+ 				<_short>Opacity</_short>
+ 				<_long>Amount of opacity in percent</_long>
+-				<default>75</default>
++				<default>100</default>
+ 				<min>0</min>
+ 				<max>100</max>
+ 			</option>
+@@ -55,7 +55,7 @@
+ 				<_long>Overlay an icon on windows once they are scaled</_long>
+ 				<min>0</min>
+ 				<max>2</max>
+-				<default>1</default>
++				<default>0</default>
+ 				<desc>
+ 					<value>0</value>
+ 					<_name>None</_name>
+@@ -105,7 +105,7 @@
+ 			<option name="key_bindings_toggle" type="bool">
+ 			    <_short>Key Bindings Toggle Scale Mode</_short>
+ 			    <_long>Key bindings toggle scale mode instead of enabling it when pressed and disabling it when released.</_long>
+-			    <default>false</default>
++			    <default>true</default>
+ 			</option>
+ 			<option name="button_bindings_toggle" type="bool">
+ 			    <_short>Button Bindings Toggle Scale Mode</_short>
+@@ -115,9 +115,6 @@
+ 			<option name="initiate_edge" type="edge">
+ 				<_short>Initiate Window Picker</_short>
+ 				<_long>Layout and start transforming windows</_long>
+-				<default>
+-				<edge name="TopRight"/>
+-				</default>
+ 				<allowed edgednd="true"/>
+ 			</option>
+ 			<option name="initiate_key" type="key">
+@@ -141,6 +138,7 @@
+ 			<option name="initiate_all_key" type="key">
+ 				<_short>Initiate Window Picker For All Windows</_short>
+ 				<_long>Layout and start transforming all windows</_long>
++				<default>&lt;Super&gt;w</default>
+ 			</option>
+ 			<option name="initiate_group_edge" type="edge">
+ 				<_short>Initiate Window Picker For Window Group</_short>
+@@ -171,7 +169,7 @@
+ 			<option name="show_desktop" type="bool">
+ 				<_short>Click Desktop to Show Desktop</_short>
+ 				<_long>Enter Show Desktop mode when Desktop is clicked during Scale</_long>
+-				<default>true</default>
++				<default>false</default>
+ 			</option>
+ 	    </group>
+ 	</options>
+Index: compiz-0.9.4/plugins/decor/decor.xml.in
+===================================================================
+--- compiz-0.9.4.orig/plugins/decor/decor.xml.in	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/decor/decor.xml.in	2011-03-17 17:12:02.028886771 +0100
+@@ -20,7 +20,7 @@
+ 	    <option name="shadow_radius" type="float">
+ 		<_short>Shadow Radius</_short>
+ 		<_long>Drop shadow radius</_long>
+-		<default>8.0</default>
++		<default>15.0</default>
+ 		<min>0.1</min>
+ 		<max>18.0</max>
+ 		<precision>0.1</precision>
+@@ -47,13 +47,14 @@
+ 	    <option name="shadow_y_offset" type="int">
+ 		<_short>Shadow Offset Y</_short>
+ 		<_long>Drop shadow Y offset</_long>
+-		<default>1</default>
++		<default>5</default>
+ 		<min>-16</min>
+ 		<max>16</max>
+ 	    </option>
+ 	    <option name="command" type="string">
+ 		<_short>Command</_short>
+ 		<_long>Decorator command line that is executed if no decorator is already running</_long>
++		<default>/usr/bin/compiz-decorator</default>
+ 	    </option>
+ 	    <option name="mipmap" type="bool">
+ 		<_short>Mipmap</_short>
+Index: compiz-0.9.4/plugins/cube/cube.xml.in
+===================================================================
+--- compiz-0.9.4.orig/plugins/cube/cube.xml.in	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/cube/cube.xml.in	2011-03-17 17:12:02.028886771 +0100
+@@ -86,18 +86,18 @@
+ 				<_short>Top</_short>
+ 				<_long>Color of top face of the cube</_long>
+ 				<default>
+-					<red>0xffff</red>
+-					<green>0xffff</green>
+-					<blue>0xffff</blue>
++					<red>0xcdcd</red>
++					<green>0xbebe</green>
++					<blue>0x7070</blue>
+ 				</default>
+ 			</option>
+ 			<option name="bottom_color" type="color">
+ 				<_short>Bottom</_short>
+ 				<_long>Color of bottom face of the cube</_long>
+ 				<default>
+-					<red>0xffff</red>
+-					<green>0xffff</green>
+-					<blue>0xffff</blue>
++					<red>0xcdcd</red>
++					<green>0xbebe</green>
++					<blue>0x7070</blue>
+ 				</default>
+ 			</option>
+ 			</subgroup>
+@@ -112,6 +112,7 @@
+ 			<_short>Skydome Image</_short>
+ 			<_long>Image to use as texture for the skydome</_long>
+ 			<hints>file;image;</hints>
++			<default><value>/usr/share/gdm/themes/Human/ubuntu.png</value></default>
+ 			</option>
+ 			<option name="skydome_animated" type="bool">
+ 			<_short>Animate Skydome</_short>
+Index: compiz-0.9.4/plugins/place/place.xml.in
+===================================================================
+--- compiz-0.9.4.orig/plugins/place/place.xml.in	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/place/place.xml.in	2011-03-17 17:12:02.032886795 +0100
+@@ -19,7 +19,7 @@
+ 	    <option name="mode" type="int">
+ 		<_short>Placement Mode</_short>
+ 		<_long>Algorithm to use for window placement</_long>
+-		<default>0</default>
++		<default>2</default>
+ 		<min>0</min>
+ 		<max>5</max>
+ 		<desc>
+Index: compiz-0.9.4/plugins/resize/resize.xml.in
+===================================================================
+--- compiz-0.9.4.orig/plugins/resize/resize.xml.in	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/resize/resize.xml.in	2011-03-17 17:12:02.032886795 +0100
+@@ -123,7 +123,7 @@
+ 	    <option name="mode" type="int">
+ 		<_short>Default Resize Mode</_short>
+ 		<_long>Default mode used for window resizing</_long>
+-		<default>0</default>
++		<default>2</default>
+ 		<min>0</min>
+ 		<max>3</max>
+ 		<desc>
+@@ -147,20 +147,20 @@
+ 		<_short>Border Color</_short>
+ 		<_long>Border color used for outline and rectangle resize modes</_long>
+ 		<default>
+-		    <red>0x2f2f</red>
+-		    <green>0x2f2f</green>
+-		    <blue>0x4f4f</blue>
+-		    <alpha>0x9f9f</alpha>
++		    <red>0xffff</red>
++		    <green>0xffff</green>
++		    <blue>0xffff</blue>
++		    <alpha>0x6464</alpha>
+ 		</default>
+ 	    </option>
+ 	    <option name="fill_color" type="color">
+ 		<_short>Fill Color</_short>
+ 		<_long>Fill color used for rectangle resize mode</_long>
+ 		<default>
+-		    <red>0x2f2f</red>
+-		    <green>0x2f2f</green>
+-		    <blue>0x4f4f</blue>
+-		    <alpha>0x4f4f</alpha>
++		    <red>0x0</red>
++		    <green>0x0</green>
++		    <blue>0x0</blue>
++		    <alpha>0x1e1e</alpha>
+ 		</default>
+ 	    </option>
+ 	    <option name="normal_match" type="match">
+Index: compiz-0.9.4/plugins/fade/fade.xml.in
+===================================================================
+--- compiz-0.9.4.orig/plugins/fade/fade.xml.in	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/fade/fade.xml.in	2011-03-17 17:12:02.032886795 +0100
+@@ -49,7 +49,7 @@
+ 	    <option name="window_match" type="match">
+ 		<_short>Fade windows</_short>
+ 		<_long>Windows that should be fading</_long>
+-		<default>any</default>
++                <default>any &amp; !(title=notify-osd)</default>
+ 	    </option>
+ 	    <option name="visual_bell" type="bool">
+ 		<_short>Visual Bell</_short>
+Index: compiz-0.9.4/plugins/opengl/opengl.xml.in
+===================================================================
+--- compiz-0.9.4.orig/plugins/opengl/opengl.xml.in	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/opengl/opengl.xml.in	2011-03-17 17:12:02.032886795 +0100
+@@ -31,7 +31,7 @@
+ 	    <option name="lighting" type="bool">
+ 		<_short>Lighting</_short>
+ 		<_long>Use diffuse light when screen is transformed</_long>
+-		<default>true</default>
++		<default>false</default>
+ 	    </option>
+ 	    <option name="sync_to_vblank" type="bool">
+ 		<_short>Sync To VBlank</_short>

=== added file 'debian/patches/02_add_debug_spewer_for_apport.patch'
--- debian/patches/02_add_debug_spewer_for_apport.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/02_add_debug_spewer_for_apport.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,850 @@
+From 36ffb13299d48e51f6e9b8d2a48b71b95099982e Mon Sep 17 00:00:00 2001
+From: Sam Spilsbury <smspillaz@xxxxxxxxx>
+Date: Thu, 13 Jan 2011 15:25:10 +0800
+Subject: [PATCH] Add debug spewer for apport
+
+---
+ include/core/screen.h                           |    4 +-
+ include/core/window.h                           |    2 +
+ plugins/composite/include/composite/composite.h |    4 +
+ plugins/debugspew/CMakeLists.txt                |    5 +
+ plugins/debugspew/debugspew.xml.in              |   24 +
+ plugins/debugspew/src/debugspew.cpp             |  637 +++++++++++++++++++++++
+ plugins/debugspew/src/debugspew.h               |   55 ++
+ plugins/opengl/include/opengl/opengl.h          |    4 +
+ src/privatescreen.h                             |    1 +
+ 9 files changed, 735 insertions(+), 1 deletions(-)
+ create mode 100644 plugins/debugspew/CMakeLists.txt
+ create mode 100644 plugins/debugspew/debugspew.xml.in
+ create mode 100644 plugins/debugspew/src/debugspew.cpp
+ create mode 100644 plugins/debugspew/src/debugspew.h
+
+Index: compiz-0.9.4/include/core/screen.h
+===================================================================
+--- compiz-0.9.4.orig/include/core/screen.h	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/include/core/screen.h	2011-02-24 11:14:21.837779472 +0100
+@@ -409,11 +409,13 @@
+ 	friend class CompTimeoutSource;
+ 	friend class CompManager;
+ 	friend class CompWatchFd;
++	friend class SpewScreen;
++	friend class SpewWindow;
+ 
+     private:
+ 	PrivateScreen *priv;
+ 
+-    public :
++    public:
+ 
+ 	static bool showDesktop (CompAction         *action,
+ 				 CompAction::State  state,
+Index: compiz-0.9.4/include/core/window.h
+===================================================================
+--- compiz-0.9.4.orig/include/core/window.h	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/include/core/window.h	2011-02-24 11:16:53.150529788 +0100
+@@ -551,6 +551,8 @@
+ 	friend class PrivateScreen;
+ 	friend class ModifierHandler;
+ 	friend class CoreWindow;
++	friend class SpewScreen;
++	friend class SpewWindow;
+ 
+     private:
+ 	CompWindow (Window	      aboveId,
+Index: compiz-0.9.4/plugins/composite/include/composite/composite.h
+===================================================================
+--- compiz-0.9.4.orig/plugins/composite/include/composite/composite.h	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/composite/include/composite/composite.h	2011-02-24 11:14:21.841779485 +0100
+@@ -221,6 +221,8 @@
+ 		      getWindowPaintList);
+ 
+ 	friend class PrivateCompositeDisplay;
++	friend class SpewScreen;
++	friend class SpewWindow;
+ 
+     private:
+ 	PrivateCompositeScreen *priv;
+@@ -400,6 +402,8 @@
+ 
+ 	friend class PrivateCompositeWindow;
+ 	friend class CompositeScreen;
++	friend class SpewScreen;
++	friend class SpewWindow;
+ 
+     private:
+ 	PrivateCompositeWindow *priv;
+Index: compiz-0.9.4/plugins/debugspew/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4/plugins/debugspew/CMakeLists.txt	2011-02-24 11:14:21.845779508 +0100
+@@ -0,0 +1,5 @@
++find_package (Compiz REQUIRED)
++
++include (CompizPlugin)
++
++compiz_plugin (debugspew PLUGINDEPS composite opengl)
+Index: compiz-0.9.4/plugins/debugspew/debugspew.xml.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4/plugins/debugspew/debugspew.xml.in	2011-02-24 11:14:21.845779508 +0100
+@@ -0,0 +1,24 @@
++<compiz>
++    <plugin name="debugspew" useBcop="true">
++    <_short>Debug Spewer</_short>
++    <_long>Spew debugging information about the current state to a file</_long>
++    <deps>
++      <requirement>
++        <plugin>composite</plugin>
++        <plugin>opengl</plugin>
++      </requirement>
++    </deps>
++    <options>
++	<option name="spew_key" type="key">
++	<_short>Spew Key</_short>
++	<_long>Keybinding to spew the current compiz state</_long>
++	<default></default>
++	</option>
++	<option name="spew_on_fatal" type="bool">
++	<_short>Spew on Fatal errors</_short>
++	<_long>Spew when a plugin indicates that something is going wrong</_long>
++	<default>True</default>
++	</option>
++    </options>
++    </plugin>
++</compiz>
+Index: compiz-0.9.4/plugins/debugspew/src/debugspew.cpp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4/plugins/debugspew/src/debugspew.cpp	2011-02-24 11:14:21.845779508 +0100
+@@ -0,0 +1,637 @@
++#include "debugspew.h"
++#include "../../src/privatescreen.h"
++#include "../../src/privatewindow.h"
++#include "../../plugins/composite/src/privates.h"
++#include "../../plugins/opengl/src/privates.h"
++
++#include <signal.h>
++#include <stdio.h>
++#include <fcntl.h>
++
++COMPIZ_PLUGIN_20090315 (debugspew, SpewPluginVTable);
++
++static void
++handle_crash (int sig)
++{
++    SpewScreen *ss = SpewScreen::get (screen);
++
++    signal (SIGSEGV, SIG_DFL);
++    signal (SIGFPE, SIG_DFL);
++    signal (SIGILL, SIG_DFL);
++    signal (SIGABRT, SIG_DFL);
++
++    ss->spew ();
++
++    raise (sig); // die
++}
++
++void
++SpewWindow::spew (CompString &f)
++{
++    f = f + compPrintf (" == Window Information 0x%x==\n", w->id ());
++    f = f + compPrintf ("  Geometry received from server: x %i y %i w %i h %i b %i\n", w->geometry ().x (), w->geometry ().y (), w->geometry ().width (), w->geometry ().height (), w->geometry ().border ());
++    f = f + compPrintf ("  Geometry last sent to server: x %i y %i w %i h %i b %i\n", w->serverGeometry ().x (), w->serverGeometry ().y (), w->serverGeometry ().width (), w->serverGeometry ().height (), w->serverGeometry ().border ());
++    f = f + compPrintf ("  Input Rect: x %i y %i w %i h %i\n", w->inputRect ().x (), w->inputRect ().y (), w->inputRect ().width (), w->inputRect ().height ());
++    f = f + compPrintf ("  Output Rect: x %i y %i w %i h %i\n", w->outputRect ().x (), w->outputRect ().y (), w->outputRect ().width (), w->outputRect ().height ());
++    f = f + compPrintf ("  Window id 0x%x Reparented into Wrapper id 0x%x Reparented into Frame id 0x%x\n", w->id (), w->priv->wrapper, w->priv->frame);
++    if (w->resName ().size ())
++	f = f + compPrintf ("  Window name: %s\n", w->resName ().c_str ());
++    f = f + compPrintf ("  === WINDOW REGION ===\n");
++    f = f + compPrintf ("   Bounding Rect: %i %i %i %i\n", w->region ().boundingRect ().x (), w->region ().boundingRect ().y (), w->region ().boundingRect ().width (),w->region ().boundingRect ().height ());
++    foreach (const CompRect &r, w->region ().rects ())
++	f = f + compPrintf ("   Rect: %i %i %i %i\n", r.x (), r.y (), r.width (), r.height ());
++    f = f + compPrintf ("  === WINDOW FRAME REGION ===\n");
++    f = f + compPrintf ("   Bounding Rect: %i %i %i %i\n", w->frameRegion ().boundingRect ().x (), w->frameRegion ().boundingRect ().y (), w->frameRegion ().boundingRect ().width (),w->frameRegion ().boundingRect ().height ());
++    foreach (const CompRect &r, w->frameRegion ().rects ())
++	f = f + compPrintf ("   Rect: %i %i %i %i\n", r.x (), r.y (), r.width (), r.height ());
++    f = f + compPrintf ("  Set _NET_WM_WINDOW_TYPE: ");
++
++#define SPEW_WINDOW_TYPE(type) \
++    case type: \
++	f = f + compPrintf (#type) + compPrintf ("\n"); \
++	break; \
++
++    switch (w->wmType ())
++    {
++	SPEW_WINDOW_TYPE (CompWindowTypeDesktopMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeDockMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeToolbarMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeMenuMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeUtilMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeSplashMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeDialogMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeNormalMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeDropdownMenuMask)
++	SPEW_WINDOW_TYPE (CompWindowTypePopupMenuMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeTooltipMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeNotificationMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeComboMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeDndMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeModalDialogMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeFullscreenMask)
++	SPEW_WINDOW_TYPE (CompWindowTypeUnknownMask)
++	default:
++	    f = f + compPrintf ("WARNING: Typeless window\n");
++	    break;
++    }
++
++#define SPEW_INTERNAL_TYPE(type) \
++    case type: \
++	f = f + compPrintf (#type) + compPrintf ("\n"); \
++	break; \
++
++    f = f + compPrintf ("  Internal Type: ");
++
++    switch (w->type ())
++    {
++	SPEW_INTERNAL_TYPE (CompWindowTypeDesktopMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeDockMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeToolbarMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeMenuMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeUtilMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeSplashMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeDialogMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeNormalMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeDropdownMenuMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypePopupMenuMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeTooltipMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeNotificationMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeComboMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeDndMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeModalDialogMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeFullscreenMask)
++	SPEW_INTERNAL_TYPE (CompWindowTypeUnknownMask)
++	default:
++	    f = f + compPrintf ("WARNING: Typeless window\n");
++	    break;
++    }
++
++    f = f + compPrintf ("  Window State: ");
++
++#define SPEW_WINDOW_STATE(state) \
++    case state: \
++	f = f + compPrintf (#state) + compPrintf (" "); \
++	break; \
++
++
++    switch (w->state ())
++    {
++	SPEW_WINDOW_STATE (CompWindowStateModalMask)
++	SPEW_WINDOW_STATE (CompWindowStateStickyMask)
++	SPEW_WINDOW_STATE (CompWindowStateMaximizedVertMask)
++	SPEW_WINDOW_STATE (CompWindowStateMaximizedHorzMask)
++	SPEW_WINDOW_STATE (CompWindowStateShadedMask)
++	SPEW_WINDOW_STATE (CompWindowStateSkipTaskbarMask)
++	SPEW_WINDOW_STATE (CompWindowStateSkipPagerMask)
++	SPEW_WINDOW_STATE (CompWindowStateHiddenMask)
++	SPEW_WINDOW_STATE (CompWindowStateFullscreenMask)
++	SPEW_WINDOW_STATE (CompWindowStateAboveMask)
++	SPEW_WINDOW_STATE (CompWindowStateBelowMask)
++	SPEW_WINDOW_STATE (CompWindowStateDemandsAttentionMask)
++	SPEW_WINDOW_STATE (CompWindowStateDisplayModalMask)
++	default:
++	    f = f + compPrintf ("Stateless window");
++	    break;
++    }
++
++    f = f + compPrintf ("\n");
++    f = f + compPrintf ("  Available  actions: ");
++
++#define SPEW_WINDOW_ACTIONS(action) \
++    if (w->actions () & action) \
++	f = f + compPrintf (#action) + compPrintf (" ");
++
++    {
++	SPEW_WINDOW_ACTIONS (CompWindowActionMoveMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionResizeMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionStickMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionMinimizeMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionMaximizeHorzMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionMaximizeVertMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionFullscreenMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionCloseMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionShadeMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionChangeDesktopMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionAboveMask)
++	SPEW_WINDOW_ACTIONS (CompWindowActionBelowMask)
++    }
++
++    f = f + compPrintf ("\n");
++    
++    f = f + compPrintf ("  WM Protocols :");
++
++#define SPEW_WINDOW_PROTOCOL(protocol) \
++    if (w->protocols () & protocol) \
++	f = f + compPrintf (#protocol) + compPrintf (" ");
++
++    {
++	SPEW_WINDOW_PROTOCOL (CompWindowProtocolDeleteMask)
++	SPEW_WINDOW_PROTOCOL (CompWindowProtocolTakeFocusMask)
++	SPEW_WINDOW_PROTOCOL (CompWindowProtocolPingMask)
++	SPEW_WINDOW_PROTOCOL (CompWindowProtocolSyncRequestMask)
++    }
++
++    f = f + compPrintf ("  Showdesktop mode: %i\n", w->inShowDesktopMode ());
++    f = f + compPrintf ("  Grabbed: %i\n", w->grabbed ());
++    f = f + compPrintf ("  Pending maps: %i\n", w->pendingMaps ());
++    f = f + compPrintf ("  Active Num: %i\n", w->activeNum ());
++    f = f + compPrintf ("  Struts:\n");
++    if (w->struts ())
++    {
++	f = f + compPrintf ("   Left: %i %i %i %i\n", w->struts ()->left.x, w->struts ()->left.y, w->struts ()->left.width, w->struts ()->left.height);
++	f = f + compPrintf ("   Left: %i %i %i %i\n", w->struts ()->right.x, w->struts ()->right.y, w->struts ()->right.width, w->struts ()->right.height);
++	f = f + compPrintf ("   Left: %i %i %i %i\n", w->struts ()->top.x, w->struts ()->top.y, w->struts ()->top.width, w->struts ()->top.height);
++	f = f + compPrintf ("   Left: %i %i %i %i\n", w->struts ()->bottom.x, w->struts ()->bottom.y, w->struts ()->bottom.width, w->struts ()->bottom.height);
++    }
++    f = f + compPrintf ("  SaveMask CWX %i CWY %i CWWidth %i CWHeight %i CWBorder %i CWStackMode %i CWSibling %i\n", w->saveMask () & CWX, w->saveMask () & CWY, w->saveMask () & CWWidth, w->saveMask () & CWHeight, w->saveMask () & CWBorderWidth, w->saveMask () & CWStackMode, w->saveMask () & CWSibling);
++    f = f + compPrintf ("  Save Window Changes x %i y %i width %i height %i border %i stack_mode %i sibling 0x%x\n", w->saveWc ().x, w->saveWc ().y, w->saveWc ().width, w->saveWc ().height, w->saveWc ().border_width, w->saveWc ().stack_mode, w->saveWc ().sibling);
++    f = f + compPrintf ("  Startup Notification Id %s\n", w->startupId ());
++    f = f + compPrintf ("  Desktop: %i\n", w->desktop ());
++    f = f + compPrintf ("  ClientLeader (ancestor): 0x%x\n", w->clientLeader (true));
++    f = f + compPrintf ("  ClientLeader (non-ancestor): 0x%x\n", w->clientLeader (false));
++    //f = f + compPrintf ("Sync Alarm TODO\n");
++    f = f + compPrintf ("  Default viewport %i %i\n", w->defaultViewport ().x (), w->defaultViewport ().y ());
++    f = f + compPrintf ("  Initial viewport %i %i\n", w->initialViewport ().x (), w->initialViewport ().y ());
++    f = f + compPrintf ("  Window icon : Geometry with width %i height %i\n", w->iconGeometry ().width (), w->iconGeometry ().height ());
++    f = f + compPrintf ("  OutputDevice %i\n", w->outputDevice ());
++    f = f + compPrintf ("  On current desktop: %i\n", w->onCurrentDesktop ());
++    f = f + compPrintf ("  OnAllViewports %i\n", w->onAllViewports ());
++    f = f + compPrintf ("  Transient window 0x%x\n", w->transientFor ());
++    f = f + compPrintf ("  Pending unmaps 0x%x\n", w->pendingUnmaps ());
++    f = f + compPrintf ("  Placed window: %i\n", w->placed ());
++    f = f + compPrintf ("  Shaded: %i\n", w->shaded ());
++    f = f + compPrintf ("  Input extents %i %i %i %i\n", w->input ().left, w->input ().right, w->input ().top, w->input ().bottom);
++    f = f + compPrintf ("  Output Extents %i %i %i %i\n", w->input ().left, w->input ().right, w->input ().top, w->input ().bottom);
++    //f = f + compPrintf ("  Size Hints %i %i %i %i \n");
++    f = f + compPrintf ("  Destroyed window %i\n", w->destroyed ());
++    f = f + compPrintf ("  Inivisible window %i \n", w->invisible ());
++    f = f + compPrintf ("  Waiting for sync %i\n", w->syncWait ());
++    f = f + compPrintf ("  Alive window %i\n", w->alive ());
++    f = f + compPrintf ("  Override Redirect %i\n", w->overrideRedirect ());
++    f = f + compPrintf ("  Window is mapped %i\n", w->isMapped ());
++    f = f + compPrintf ("  Window is viewable %i\n", w->isViewable ());
++    f = f + compPrintf ("  Window class %i\n", w->windowClass ());
++    f = f + compPrintf ("  Window depth %i\n", w->depth ());
++
++#define SPEW_MWM_DECOR(decor) \
++    if (w->mwmDecor () & decor) \
++	f = f + compPrintf (#decor) + compPrintf (" ");
++
++    f = f + compPrintf ("Motif WM Decor \n");
++
++    SPEW_MWM_DECOR (MwmDecorAll);
++    SPEW_MWM_DECOR (MwmDecorBorder);
++    SPEW_MWM_DECOR (MwmDecorHandle);
++    SPEW_MWM_DECOR (MwmDecorTitle);
++    SPEW_MWM_DECOR (MwmDecorMenu);
++    SPEW_MWM_DECOR (MwmDecorMinimize);
++    SPEW_MWM_DECOR (MwmDecorMaximize);
++
++    f = f + compPrintf ("MOTIF WM Func \n");
++
++#define SPEW_MWM_FUNC(func) \
++    if (w->mwmFunc () & func) \
++	f = f + compPrintf (#func) + compPrintf (" ");
++
++    SPEW_MWM_FUNC (MwmFuncAll);
++    SPEW_MWM_FUNC (MwmFuncResize);
++    SPEW_MWM_FUNC (MwmFuncMove);
++    SPEW_MWM_FUNC (MwmFuncIconify);
++    SPEW_MWM_FUNC (MwmFuncClose);
++
++    f = f + compPrintf ("\n   === PRIVATE WINDOW ===\n");
++    f = f + compPrintf ("    MapNum: %i\n", w->priv->mapNum);
++    f = f + compPrintf ("    ActiveNum: %i\n", w->priv->activeNum);
++    f = f + compPrintf ("    Window attributes x %i y %i width %i height %i border_width %i depth %i visual 0x%x root 0x%x 0x%x bit_grabity 0x%x win_grabity 0x%x " \
++		"colormap 0x%x map_installed %i map_state %i event_masks 0x%x all_event_masks 0x%x, do_not_protogate_mask 0x%x override_redirect %i\n",
++	     w->priv->attrib.x, w->priv->attrib.y,
++	     w->priv->attrib.width, w->priv->attrib.height, w->priv->attrib.border_width, w->priv->attrib.depth,
++	     w->priv->attrib.visual, w->priv->attrib.root, w->priv->attrib.bit_gravity, w->priv->attrib.win_gravity,
++	     &w->priv->attrib.colormap, w->priv->attrib.map_installed, w->priv->attrib.map_state, w->priv->attrib.your_event_mask,
++	     w->priv->attrib.all_event_masks, w->priv->attrib.your_event_mask,
++	     w->priv->attrib.do_not_propagate_mask, w->priv->attrib.override_redirect);
++    f = f + compPrintf ("    Size hints mask USPosition %i USSize %i PPosition %i PSize %i PMinSize %i  PMaxSize %i PResizeInc %i PAspect %i PBaseSize %i PWinGravity %i " \
++		" x %i y %i w %i h %i min_w %i  min_h %i " \
++	        " max_w %i max_h %i width_inc %i height_inc %i base_w %i base_h %i win_gravity 0x%x\n",
++	     w->priv->sizeHints.flags & USPosition, w->priv->sizeHints.flags & USSize,
++	     w->priv->sizeHints.flags & PPosition, w->priv->sizeHints.flags & PSize, w->priv->sizeHints.flags & PMinSize, w->priv->sizeHints.flags & PMaxSize,
++	     w->priv->sizeHints.flags & PResizeInc, w->priv->sizeHints.flags & PAspect, w->priv->sizeHints.flags & PBaseSize, w->priv->sizeHints.flags & PWinGravity,
++	     w->priv->sizeHints.x, w->priv->sizeHints.y, w->priv->sizeHints.width,
++	     w->priv->sizeHints.height, w->priv->sizeHints.min_width, w->priv->sizeHints.min_height,
++	     w->priv->sizeHints.max_width, w->priv->sizeHints.max_height, w->priv->sizeHints.width_inc, w->priv->sizeHints.height_inc,
++	     w->priv->sizeHints.base_width, w->priv->sizeHints.base_height, w->priv->sizeHints.win_gravity);
++    if (w->priv->hints)
++    {
++        f = f + compPrintf ("    WM hints mask InputHint %i StateHint %i IconPixmapHint %i IconWindowHint %i IconPositionHint %i IconMaskHint %i"\
++			"WindowGroupHint %i XUrgencyHint %i  input %i initial_state %i icon_window 0x%x icon_x %i icon_y %i window_group 0x%x\n",
++			w->priv->hints->flags & InputHint,
++			w->priv->hints->flags & StateHint, w->priv->hints->flags & IconPixmapHint,
++			w->priv->hints->flags & IconWindowHint,  w->priv->hints->flags & IconPositionHint,
++			w->priv->hints->flags & IconMaskHint, w->priv->hints->flags & WindowGroupHint, w->priv->hints->flags & XUrgencyHint,
++			w->priv->hints->input, w->priv->hints->initial_state,
++			w->priv->hints->icon_window, w->priv->hints->icon_x, w->priv->hints->icon_y, w->priv->hints->window_group);
++    }
++    f = f + compPrintf ("    InputHint %i\n", w->priv->inputHint);
++    f = f + compPrintf ("    Has alpha channel: %i\n", w->priv->alpha);
++    f = f + compPrintf ("    Input Region :\n");
++    foreach (const CompRect &r, w->frameRegion ().rects ())
++	f = f + compPrintf ("   Rect: %i %i %i %i\n", r.x (), r.y (), r.width (), r.height ());
++    f = f + compPrintf ("    Manged %i Unmanaged %i\n", w->priv->managed, w->priv->unmanaging);
++    f = f + compPrintf ("    Destroy refcount %i\n", w->priv->destroyRefCnt);
++    f = f + compPrintf ("    Unmap refcount %i\n", w->priv->unmapRefCnt);
++    f = f + compPrintf ("    Initial timestamp %i set %i\n", w->priv->initialTimestamp, w->priv->initialTimestampSet);
++    f = f + compPrintf ("    Hidden window %i\n", w->priv->hidden);
++    f = f + compPrintf ("    Grabbed %i\n", w->grabbed ());
++    f = f + compPrintf ("    Pending Unmaps %i\n", w->pendingUnmaps ());
++    f = f + compPrintf ("    Pending Maps %i\n", w->priv->pendingMaps);
++    f = f + compPrintf ("    Last pong from window %i\n", w->priv->lastPong);
++    f = f + compPrintf ("    Close requests: %i\n", w->priv->closeRequests);
++    f = f + compPrintf ("    Last close request time %i\n", w->priv->lastCloseRequestTime);
++
++    f = f + compPrintf ("= OPENGL WINDOW =\n");
++    f = f + compPrintf ("ClipRegion, bRect %i %i %i %i\n", gWindow->clip ().boundingRect ().x (), gWindow->clip ().boundingRect ().y (), gWindow->clip ().boundingRect ().width (), gWindow->clip ().boundingRect ().height ());
++    foreach (const CompRect &r, gWindow->clip ().rects ())
++	f = f + compPrintf (" Rect: %i %i %i %i\n", r.x (), r.y (), r.width (), r.height ());
++    f = f + compPrintf ("Current PAttrib opacity %i brightness %i saturation %i xScale %i yScale %i xTranslate %i, yTranslate %i\n", gWindow->paintAttrib ().opacity, gWindow->paintAttrib ().brightness, gWindow->paintAttrib ().saturation, gWindow->paintAttrib ().xScale, gWindow->paintAttrib ().yScale, gWindow->paintAttrib ().xTranslate, gWindow->paintAttrib ().yTranslate);
++    f = f + compPrintf ("Last PAttrib opacity %i brightness %i saturation %i xScale %i yScale %i xTranslate %i, yTranslate %i\n", gWindow->lastPaintAttrib ().opacity, gWindow->lastPaintAttrib ().brightness, gWindow->lastPaintAttrib ().saturation, gWindow->lastPaintAttrib ().xScale, gWindow->lastPaintAttrib ().yScale, gWindow->lastPaintAttrib ().xTranslate, gWindow->lastPaintAttrib ().yTranslate);
++
++#define SPEW_LAST_PAINT_MASK(mask) \
++    if (gWindow->lastMask () & mask) \
++	f = f + compPrintf (#mask) + compPrintf (" ");
++
++    SPEW_LAST_PAINT_MASK (PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK);
++    SPEW_LAST_PAINT_MASK (PAINT_WINDOW_OCCLUSION_DETECTION_MASK);
++    SPEW_LAST_PAINT_MASK (PAINT_WINDOW_WITH_OFFSET_MASK);
++    SPEW_LAST_PAINT_MASK (PAINT_WINDOW_TRANSLUCENT_MASK);
++    SPEW_LAST_PAINT_MASK (PAINT_WINDOW_TRANSFORMED_MASK);
++    SPEW_LAST_PAINT_MASK (PAINT_WINDOW_NO_CORE_INSTANCE_MASK);
++    SPEW_LAST_PAINT_MASK (PAINT_WINDOW_BLEND_MASK);
++
++    f = f + compPrintf (" == TEXTURES ==\n");
++    foreach (GLTexture *tex, gWindow->textures ())
++    {
++	f = f + compPrintf ("  Texture name: %i target %i, matrix.xx %i matrix.xy %i, matrix.x0 %i matrix.yy %i, matrix.yx %i, matrix.y0 %i, mipmapping %i \n", tex->name (), tex->target (), tex->matrix ().xx, tex->matrix ().xy, tex->matrix ().x0, tex->matrix ().yy, tex->matrix ().yx, tex->matrix ().y0, tex->mipmap ());
++    }
++
++    GLTexture *tex = gWindow->getIcon (128, 128);
++
++    if (tex)
++	f = f + compPrintf (" Icon texture: name: %i target %i, matrix.xx %i matrix.xy %i, matrix.x0 %i matrix.yy %i, matrix.yx %i, matrix.y0 %i, mipmapping %i \n", tex->name (), tex->target (), tex->matrix ().xx, tex->matrix ().xy, tex->matrix ().x0, tex->matrix ().yy, tex->matrix ().yx, tex->matrix ().y0, tex->mipmap ());
++
++    f = f + compPrintf (" == GEOMETRY ==\n");
++    f = f + compPrintf ("  Vertex Size %i Vertex Stride %i\n", gWindow->geometry ().vertexSize, gWindow->geometry ().vertexStride);
++    for (int i  = 0; i < gWindow->geometry ().vertexSize; i++)
++	f = f + compPrintf ("Vertex %f\n", gWindow->geometry ().vertices[i]);
++    f = f + compPrintf ("  Index Size %i Index count %i \n", gWindow->geometry ().indexSize, gWindow->geometry ().indexCount);
++    for (int i  = 0; i < gWindow->geometry ().indexSize; i++)
++	f = f + compPrintf ("Vertex %f\n", gWindow->geometry ().indices[i]);
++    f = f + compPrintf ("  vCount %i texUnits %i texCoordSize %i\n", gWindow->geometry ().vCount, gWindow->geometry ().texUnits, gWindow->geometry ().texCoordSize);
++
++    f = f + compPrintf (" == REGIONS == \n");
++    foreach (CompRegion &reg, gWindow->priv->regions)
++    { 
++	f = f + compPrintf ("  Region, bRect %i %i %i %i\n", reg.boundingRect ().x (), reg.boundingRect ().y (), reg.boundingRect ().width (), reg.boundingRect ().height ());
++	foreach (const CompRect &r, reg.rects ())
++	{
++	    f = f + compPrintf ("   Rect: %i %i %i %i\n", r.x (), r.y (), r.width (), r.height ());
++	}
++    }
++
++    f = f + compPrintf ("== COMPOSITE WINDOW==\n");
++
++    f = f + compPrintf (" Pixmap id 0x%x\n", cWindow->pixmap ());
++
++    Window root;
++    int    x, y;
++    unsigned int width, height, border, depth;
++
++    if (XGetGeometry (screen->dpy (), cWindow->pixmap (), &root, &x, &y, &width, &height, &border, &depth))
++    {
++	f = f + compPrintf (" XGetGeometry succeeded: x %i y %i width %i height %i border %i depth %i\n", x, y, width, height, border, depth);
++    }
++    else
++    {
++	f = f + compPrintf (" XGetGeometry failed\n");
++    }
++
++    f = f + compPrintf (" redirected: %i\n", cWindow->redirected ());
++    f = f + compPrintf (" overlay: %i\n", cWindow->overlayWindow ());
++    f = f + compPrintf (" damaged: %i\n", cWindow->damaged ());
++    f = f + compPrintf (" bound: %i\n", !cWindow->priv->bindFailed);
++    f = f + compPrintf (" == DAMAGE RECTS ==\n");
++    f = f + compPrintf ("  current damage rect %i\n", cWindow->priv->nDamage);
++    for (int i = 0; i < cWindow->priv->sizeDamage; i++)
++	f = f + compPrintf ("  rect: %i %i %i %i\n", cWindow->priv->damageRects[i].x, cWindow->priv->damageRects[i].y, cWindow->priv->damageRects[i].width, cWindow->priv->damageRects[i].height);
++
++}
++
++void
++SpewScreen::spewScreenEdge (CompString &f, unsigned int i)
++{
++    struct screenEdgeGeometry {
++	int xw, x0;
++	int yh, y0;
++	int ww, w0;
++	int hh, h0;
++    } geometry[SCREEN_EDGE_NUM] = {
++	{ 0,  0,   0,  2,   0,  2,   1, -4 }, /* left */
++	{ 1, -2,   0,  2,   0,  2,   1, -4 }, /* right */
++	{ 0,  2,   0,  0,   1, -4,   0,  2 }, /* top */
++	{ 0,  2,   1, -2,   1, -4,   0,  2 }, /* bottom */
++	{ 0,  0,   0,  0,   0,  2,   0,  2 }, /* top-left */
++	{ 1, -2,   0,  0,   0,  2,   0,  2 }, /* top-right */
++	{ 0,  0,   1, -2,   0,  2,   0,  2 }, /* bottom-left */
++	{ 1, -2,   1, -2,   0,  2,   0,  2 }  /* bottom-right */
++    };
++    int x, y, w, h;
++
++    x = geometry[i].xw * screen->width () + geometry[i].x0;
++    y = geometry[i].yh * screen->height () + geometry[i].y0;
++    w = geometry[i].ww * screen->width () + geometry[i].w0;
++    h = geometry[i].hh * screen->height () + geometry[i].h0;
++
++    f = compPrintf ("  Screen edge %i Window id 0x%x, Geometry %i %i %i %i\n", i, screen->priv->screenEdge[i].id, x, y, w, h);
++}
++
++bool
++SpewScreen::spew ()
++{
++    CompString f;
++    int pid = getpid ();
++
++    CompString filename = compPrintf ("/tmp/compiz_internal_state%i.log", pid);
++    int fd;
++    /* CompScreen */
++
++    f = f + compPrintf ("\n");
++
++    f = f + compPrintf ("= Screen Information =\n");
++    f = f + compPrintf ("Startup display option: %s\n", screen->displayString ());
++    f = f + compPrintf ("Currently active window: 0x%x\n", screen->activeWindow ());
++    f = f + compPrintf ("Window we want to auto-raise: 0x%x\n", screen->autoRaiseWindow ());
++    f = f + compPrintf ("== Root window information ==\n");
++    f = f + compPrintf (" Root window id: 0x%x\n", screen->root ());
++    f = f + compPrintf (" === X Window attributes of the root window ===\n");
++    f = f + compPrintf ("  attributes x %i y %i width %i height %i border_width %i depth %i visual 0x%x root 0x%x 0x%x bit_grabity 0x%x win_grabity 0x%x " \
++		"colormap 0x%x map_installed %i map_state %i event_masks 0x%x all_event_masks 0x%x, do_not_protogate_mask 0x%x override_redirect %i\n", screen->priv->attrib.x, screen->priv->attrib.y,
++	     screen->priv->attrib.width, screen->priv->attrib.height, screen->priv->attrib.border_width, screen->priv->attrib.depth,
++	     screen->priv->attrib.visual, screen->priv->attrib.root, screen->priv->attrib.bit_gravity, screen->priv->attrib.win_gravity,
++	     &screen->priv->attrib.colormap, screen->priv->attrib.map_installed, screen->priv->attrib.map_state, screen->priv->attrib.your_event_mask,
++	     screen->priv->attrib.all_event_masks, screen->priv->attrib.your_event_mask,
++	     screen->priv->attrib.do_not_propagate_mask, screen->priv->attrib.override_redirect);
++    f = f + compPrintf ("Screen Number: %i\n", screen->screenNum ());
++    f = f + compPrintf ("Window that has the selection 0x%x\n", screen->selectionWindow ());
++    f = f + compPrintf ("Current output extents x %i y %i width %i height %i\n", screen->getCurrentOutputExtents ().x (), screen->getCurrentOutputExtents ().y (), screen->getCurrentOutputExtents ().width (), screen->getCurrentOutputExtents ().height ());
++    f = f + compPrintf ("Current active output number: %i\n", screen->currentOutputDev ().id ());
++    f = f + compPrintf ("= OUTPUT DEVICES=\n");
++    foreach (CompOutput &o, screen->outputDevs ())
++	f = f + compPrintf ( " id %i name %s x %i y %i width %i height %i wa x %i wa y %i wa width %i wa height %i\n", o.id (), o.name ().c_str (), o.x (), o.y (), o.width (), o.height (), o.workArea().x (), o.workArea ().y (), o.workArea ().width (), o.workArea ().height ());
++    f = f + compPrintf ("Current viewport: %i %i\n", screen->vp ().x (), screen->vp ().y ());
++    f = f + compPrintf ("Current viewport size: %i %i\n", screen->vpSize ().width (), screen->vpSize ().height ());
++    f = f + compPrintf ("Number of desktop windows %i\n", screen->desktopWindowCount ());
++    f = f + compPrintf ("Current number of _NET_WM_DESKTOPs %i\n", screen->nDesktop ());
++    f = f + compPrintf (" _NET_WM_DESKTOP %i\n", screen->currentDesktop ());
++    f = f + compPrintf ("= ACTIVE WINDOW HISTORY =\n");
++    f = f + compPrintf (" current history is number: %i\n", screen->priv->currentHistory);
++    for (unsigned int i = 0; i < ACTIVE_WINDOW_HISTORY_NUM; i++)
++    {
++	f = f + compPrintf (" checking history %i x %i y %i activeNum %i\n", i, screen->currentHistory ()[i].x, screen->currentHistory ()[i].y, screen->currentHistory ()[i].activeNum);
++	for (unsigned int j = 0; j < ACTIVE_WINDOW_HISTORY_SIZE; j++)
++	    f = f + compPrintf ("  window id 0x%x\n", screen->currentHistory ()[i].id[j]);
++    }
++
++
++    f = f + compPrintf ("User has overlapping outputs %i\n", screen->hasOverlappingOutputs ());
++    f = f + compPrintf ("Fullscreen output geometry x %i y %i width %i height %i\n", screen->fullscreenOutput ().x (), screen->fullscreenOutput ().y (), screen->fullscreenOutput ().width (), screen->fullscreenOutput ().height ());
++    f = f + compPrintf ("= XINERAMA SCREEN INFORMATION =\n");
++    foreach (XineramaScreenInfo &si, screen->priv->screenInfo)
++	f = f + compPrintf (" Screen number %i x_org %i y_org %i width %i height %i\n", si.screen_number, si.x_org, si.y_org, si.width, si.height);
++    f = f + compPrintf ("Serialize Bit: %i\n", screen->shouldSerializePlugins ());
++    f = f + compPrintf ("= PRIVATE SCREEN =\n");
++    f = f + compPrintf (" Last time pinged 0x%x\n", screen->priv->lastPing);
++    f = f + compPrintf (" Next Active window 0x%x\n", screen->priv->nextActiveWindow);
++    f = f + compPrintf (" Current below window 0x%x\n", screen->priv->below);
++    f = f + compPrintf (" Escape KeyCode 0x%x\n", screen->priv->escapeKeyCode);
++    f = f + compPrintf (" Return KeyCode 0x%x\n", screen->priv->returnKeyCode);
++    f = f + compPrintf (" Current internal plugin load list : ");
++    foreach (CompOption::Value &v, screen->priv->plugin.list ())
++	f = f + compPrintf ("%s", v.s ().c_str ());
++    f = f + compPrintf ("\n");
++    f = f + compPrintf (" Screen region: %i %i %i %i\n", screen->priv->region.boundingRect ().x (), screen->priv->region.boundingRect ().y (), screen->priv->region.boundingRect ().width (), screen->priv->region.boundingRect ().height ());
++    f = f + compPrintf (" == REGION INFO ==\n");
++    foreach (const CompRect &r, screen->priv->region.rects ())
++	f = f + compPrintf ("  Rect %i %i %i %i\n", r.x (), r.y (), r.width (), r.height ());
++    f = f + compPrintf (" lastViewport %i %i %i %i\n", screen->priv->lastViewport.x, screen->priv->lastViewport.y, screen->priv->lastViewport.width, screen->priv->lastViewport.height);
++    f = f + compPrintf (" == SCREEN EDGES ==\n");
++    for (unsigned int i = 0; i < SCREEN_EDGE_NUM; i++)
++	spewScreenEdge (f, i);
++    f = f + compPrintf (" == STARTUP SEQUENCES ==\n");
++    foreach (CompStartupSequence *start, screen->priv->startupSequences)
++	f = f + compPrintf ( "vp x %i vp y %i\n", start->viewportX, start->viewportY);//spewStartupSequence (start);
++    f = f + compPrintf (" == WINDOW GROUPS ==\n");
++    foreach (CompGroup *g, screen->priv->groups)
++	f = f + compPrintf ( "id %i refCnt %i\n", g->id, g->refCnt);//spewGroup (g);
++    f = f + compPrintf (" == MAPPING ORDER ==\n");
++    foreach (CompWindow *w, screen->priv->clientList)
++    {
++	if (!w->resName ().empty ())
++	    f = f + compPrintf ( "  Window ID: 0x%x Window Title: %s\n", w->id (), w->resName ().c_str ());
++	else
++	    f = f + compPrintf ( "  Window ID: 0x%x\n", w->id ());
++    }
++    f = f + compPrintf (" == STACKING ORDER ==\n");
++    foreach (CompWindow *w, screen->priv->clientListStacking)
++    {
++	if (!w->resName ().empty ())
++	    f = f + compPrintf ( "  Window ID: 0x%x Name: %s\n", w->id (), w->resName ().c_str ());
++	else
++	    f = f + compPrintf ( "  Window ID: 0x%x\n", w->id ());
++    }
++    f = f + compPrintf (" == MAPPING ID ORDER ==\n");
++    foreach (Window &id, screen->priv->clientIdList)
++	f = f + compPrintf ( "  Window ID: 0x%x\n", id);
++    f = f + compPrintf (" == STACKING ID ORDER ==\n");
++    foreach (Window &id, screen->priv->clientIdListStacking)
++	f = f + compPrintf ( "  Window ID: 0x%x\n", id);
++    f = f + compPrintf (" == BUTTON GRABS ==\n");
++    foreach (PrivateScreen::ButtonGrab &b, screen->priv->buttonGrabs)
++	f = f + compPrintf ( "  button %i mods 0x%x, count %i\n", b.button, b.modifiers, b.count);
++    f = f + compPrintf (" == KEY GRABS ==\n");
++    foreach (PrivateScreen::KeyGrab &k, screen->priv->keyGrabs)
++	f = f + compPrintf ( "  keycode 0x%x mods 0x%x, count %i\n", k.keycode, k.modifiers, k.count);
++    f = f + compPrintf (" == ACTIVE GRABS ==\n");
++    foreach (PrivateScreen::Grab *g, screen->priv->grabs)
++	f = f + compPrintf ( "  Grab 0x%x, CursorId 0x%x, Name 0x%x\n", g, g->cursor, g->name);
++    f = f + compPrintf ("Screen Grabbed %i\n", screen->priv->grabbed);
++    f = f + compPrintf ("Number of pending destroys %i\n", screen->priv->pendingDestroys);
++    f = f + compPrintf ("Showdesktop Mask 0x%x\n", screen->priv->showingDesktopMask);
++
++    f = f + compPrintf ("= Composite Screen =\n");
++    f = f + compPrintf (" Compositing Active: %i\n", cScreen->compositingActive ());
++    f = f + compPrintf (" DamageMask Pending %i Region %i All %i\n", cScreen->damageMask () & COMPOSITE_SCREEN_DAMAGE_PENDING_MASK, cScreen->damageMask () & COMPOSITE_SCREEN_DAMAGE_REGION_MASK, cScreen->damageMask () & COMPOSITE_SCREEN_DAMAGE_ALL_MASK); 
++    f = f + compPrintf (" Current Damage region bRect %i %i %i %i\n", cScreen->priv->damage.boundingRect ().x (), cScreen->priv->damage.boundingRect ().y (), cScreen->priv->damage.boundingRect ().width (), cScreen->priv->damage.boundingRect ().height ());
++    foreach (const CompRect &r, cScreen->priv->damage.rects ())
++	f = f + compPrintf ("  Rect: %i %i %i %i\n", r.x (), r.y (), r.width (), r.height ());
++
++    f = f + compPrintf (" Overlay window 0x%x\n", cScreen->overlay ());
++    f = f + compPrintf (" Output 0x%x\n", cScreen->output ());
++    f = f + compPrintf (" overlaywindowcount %i\n", cScreen->overlayWindowCount ());
++    f = f + compPrintf (" Window Paint offset %i %i\n", cScreen->windowPaintOffset ().x (), cScreen->windowPaintOffset ().y ());
++    f = f + compPrintf (" FPS Limiter mode %i\n", cScreen->FPSLimiterMode ());
++    f = f + compPrintf (" Redraw time %i\n", cScreen->redrawTime ());
++    f = f + compPrintf (" Optimal redraw time %i\n", cScreen->optimalRedrawTime ());
++    f = f + compPrintf (" Exposed Rects \n");
++    foreach (CompRect &r, cScreen->priv->exposeRects)
++    {
++	f = f + compPrintf (" Rect %i %i %i %i\n", r.x (), r.y (), r.width (), r.height ());
++    }
++
++    //f = f + compPrintf (" Last redraw happened at %i.%i\n", cScreen->priv->lastRedraw.tv_sec, cScreen->priv->lastRedraw.tv_msec);
++    f = f + compPrintf (" Next redraw at %i\n", cScreen->priv->nextRedraw);
++    f = f + compPrintf (" Frame status %i\n", cScreen->priv->frameStatus);
++    f = f + compPrintf (" Time multiplier: %i\n", cScreen->priv->timeMult);
++    f = f + compPrintf (" Idle %i\n", cScreen->priv->idle);
++    f = f + compPrintf (" timeLeft %i\n", cScreen->priv->timeLeft);
++    f = f + compPrintf (" slowAnimations %i\n", cScreen->priv->slowAnimations);
++    f = f + compPrintf (" active %i\n", cScreen->priv->active);
++    f = f + compPrintf (" frame time accumulator: %i\n", cScreen->priv->frameTimeAccumulator);
++
++    f = f + compPrintf ("= GLScreen =\n");
++    f = f + compPrintf (" Texture Filter: %i\n", gScreen->textureFilter ());
++    //f = f + compPrintf (" Compiz Texture Filter: %i\n", gScreen->filter ());
++    f = f + compPrintf (" Lighting: %i\n", gScreen->lighting ());
++    f = f + compPrintf (" FBConfigs:\n");
++
++    for (unsigned int i = 0; i < MAX_DEPTH; i++)
++    {
++	GLFBConfig *fbc = gScreen->glxPixmapFBConfig (i);
++	f = f + compPrintf (" GLFBConfig %i: GLXFBConfigRec TODO yInverted: %i, mipmap %i, textureFormat %i, textureTarget %i\n", i, fbc->yInverted, fbc->mipmap, fbc->textureFormat, fbc->textureTargets);
++    }
++
++    const float *m = gScreen->projectionMatrix ();
++
++    f = f + compPrintf ("Projection Matrix: [[%i %i %i %i]\n"\
++			"		     [%i %i %i %i]\n"\
++			"		     [%i %i %i %i]\n"\
++			"		     [%i %i %i %i]\n"\
++			"		     [%i %i %i %i]]\n",
++			m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15]);
++
++    f = f + compPrintf ("  Backgrounds loaded %i nBackgrounds %i\n", gScreen->priv->backgroundLoaded, gScreen->priv->backgroundTextures.size ());
++    f = f + compPrintf ("  ClearBuffers %i\n", gScreen->priv->clearBuffers);
++    f = f + compPrintf ("  lighting %i\n", gScreen->priv->lighting);
++    f = f + compPrintf ("  GLXContext TODO\n");
++    f = f + compPrintf ("  pendingCommands %i\n", gScreen->priv->pendingCommands);
++    f = f + compPrintf ("  lastViewport: x %i y %i width %i height %i\n", gScreen->priv->lastViewport.x, gScreen->priv->lastViewport.y, gScreen->priv->lastViewport.width, gScreen->priv->lastViewport.height);
++    f = f + compPrintf ("  hasCompositing: %i\n", gScreen->priv->hasCompositing);
++
++    f = f + compPrintf ("== EACH WINDOW ==\n");
++    foreach (CompWindow *w, screen->priv->windows)
++	SpewWindow::get (w)->spew (f);
++
++    fprintf (stderr, "%s", f.c_str ());
++
++    /* Write it to a file called comp_internal_state */
++
++    fd = open (filename.c_str (), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
++
++    if (fd)
++    {
++	lseek (fd, 0, SEEK_SET);
++	int result = write (fd, (void *) f.c_str (), f.size ());
++	if (result)
++	    fsync (fd);
++	close (fd);
++    }
++    else
++    {
++	f = f + compPrintf ( "%m\n");
++    }
++
++    return true;
++}
++
++void
++SpewScreen::handleCompizEvent (const char *plugin, const char *action, CompOption::Vector &opts)
++{
++    if (strcmp ("fatal_fallback", action) == 0)
++    {
++	spew ();
++    }
++
++    screen->handleCompizEvent (plugin, action, opts);
++}
++
++SpewScreen::SpewScreen (CompScreen *s) :
++    PluginClassHandler <SpewScreen, CompScreen> (s),
++    cScreen (CompositeScreen::get (s)),
++    gScreen (GLScreen::get (s))
++{
++    ScreenInterface::setHandler (s);
++
++    optionSetSpewKeyInitiate (boost::bind (&SpewScreen::spew, this));
++
++    //signal (SIGSEGV, handle_crash);
++    //signal (SIGFPE, handle_crash);
++    //signal (SIGILL, handle_crash);
++    //signal (SIGABRT, handle_crash);
++}
++
++SpewWindow::SpewWindow (CompWindow *w) :
++    PluginClassHandler <SpewWindow, CompWindow> (w),
++    w (w),
++    cWindow (CompositeWindow::get (w)),
++    gWindow (GLWindow::get (w))
++{
++}
++
++bool
++SpewPluginVTable::init ()
++{
++    if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION) ||
++	!CompPlugin::checkPluginABI ("composite", COMPIZ_COMPOSITE_ABI) ||
++	!CompPlugin::checkPluginABI ("opengl", COMPIZ_OPENGL_ABI))
++	return false;
++
++    return true;
++}
+Index: compiz-0.9.4/plugins/debugspew/src/debugspew.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4/plugins/debugspew/src/debugspew.h	2011-02-24 11:14:21.845779508 +0100
+@@ -0,0 +1,55 @@
++/* Copyright */
++
++#include <core/core.h>
++#include <composite/composite.h>
++#include <opengl/opengl.h>
++#include "debugspew_options.h"
++
++class SpewWindow :
++    public PluginClassHandler <SpewWindow, CompWindow>
++{
++    public:
++
++	SpewWindow (CompWindow *w);
++
++    public:
++
++	CompWindow	*w;
++	CompositeWindow *cWindow;
++	GLWindow	*gWindow;
++
++	void
++	spew (CompString &f);
++};
++
++class SpewScreen :
++    public PluginClassHandler <SpewScreen, CompScreen>,
++    public ScreenInterface,
++    public DebugspewOptions
++{
++    public:
++
++	SpewScreen (CompScreen *);
++
++	CompositeScreen *cScreen;
++	GLScreen	*gScreen;
++
++    public:
++
++	void
++	handleCompizEvent (const char *, const char *, CompOption::Vector &);
++
++	bool
++	spew ();
++
++	void
++	spewScreenEdge (CompString &f, unsigned int i);
++};
++
++class SpewPluginVTable :
++    public CompPlugin::VTableForScreenAndWindow <SpewScreen, SpewWindow>
++{
++    public:
++
++	bool init ();
++};
+Index: compiz-0.9.4/plugins/opengl/include/opengl/opengl.h
+===================================================================
+--- compiz-0.9.4.orig/plugins/opengl/include/opengl/opengl.h	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/plugins/opengl/include/opengl/opengl.h	2011-02-24 11:14:21.849779533 +0100
+@@ -398,6 +398,8 @@
+ 	WRAPABLE_HND (4, GLScreenInterface, void, glDisableOutputClipping);
+ 
+ 	friend class GLTexture;
++	friend class SpewScreen;
++	friend class SpewWindow;
+ 
+     private:
+ 	PrivateGLScreen *priv;
+@@ -582,6 +584,8 @@
+ 
+ 	friend class GLScreen;
+ 	friend class PrivateGLScreen;
++	friend class SpewScreen;
++	friend class SpewWindow;
+ 
+     private:
+ 	PrivateGLWindow *priv;
+Index: compiz-0.9.4/src/privatescreen.h
+===================================================================
+--- compiz-0.9.4.orig/src/privatescreen.h	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/src/privatescreen.h	2011-02-24 11:14:21.849779533 +0100
+@@ -196,6 +196,7 @@
+ 	    public:
+ 
+ 		friend class CompScreen;
++		friend class SpewScreen;
+ 	    private:
+ 		Cursor     cursor;
+ 		const char *name;

=== added file 'debian/patches/030_no_fade_in_staticswicher.patch'
--- debian/patches/030_no_fade_in_staticswicher.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/030_no_fade_in_staticswicher.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,12 @@
+Index: compiz-0.9.2.1+glibmainloop2/plugins/fade/fade.xml.in
+===================================================================
+--- compiz-0.9.2.1+glibmainloop2.orig/plugins/fade/fade.xml.in	2010-12-06 12:23:04.705212002 +0100
++++ compiz-0.9.2.1+glibmainloop2/plugins/fade/fade.xml.in	2010-12-06 12:23:23.761212002 +0100
+@@ -9,6 +9,7 @@
+ 	    </requirement>
+ 	    <relation type="after">
+ 		<plugin>decor</plugin>
++		<plugin>staticswitcher</plugin>
+ 	    </relation>
+ 	    <relation type="before">
+ 		<plugin>cube</plugin>

=== added file 'debian/patches/060_move_checks_to_compiz.patch'
--- debian/patches/060_move_checks_to_compiz.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/060_move_checks_to_compiz.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,43 @@
+# Description: Add additional checks for features before running
+#  We used to ship a shell script that checked for various things before
+#  running compiz. However, this duplicated several checks that compiz
+#  runs on its own and was slow due to being a shell script.
+#  .
+#  This patch adds in default options and plugins if none are provided on
+#  the command line so running `compiz` continues to work like expected.
+# Forwarded: not-needed
+# Origin: Ubuntu
+# Author: Travis Watkins <amaranth@xxxxxxxxxx>
+
+Index: compiz-0.9.4/src/main.cpp
+===================================================================
+--- compiz-0.9.4.orig/src/main.cpp	2011-02-24 10:27:13.000000000 +0100
++++ compiz-0.9.4/src/main.cpp	2011-02-24 11:17:38.142752891 +0100
+@@ -170,6 +170,10 @@
+ 	}
+     }
+ 
++    /* add in default plugins if none are given */
++    if (plugins.size () == 0)
++	plugins.push_back ("ccp");
++
+     initialPlugins = plugins;
+ 
+     return true;
+@@ -226,7 +230,16 @@
+ 	return false;
+ 
+     if (!disableSm)
++    {
++	if (clientId == NULL)
++	{
++	    char *desktop_autostart_id = getenv ("DESKTOP_AUTOSTART_ID");
++	    if (desktop_autostart_id != NULL)
++		clientId = strdup (desktop_autostart_id);
++	    unsetenv ("DESKTOP_AUTOSTART_ID");
++	}
+ 	CompSession::init (clientId);
++    }
+ 
+     return true;
+ }

=== added file 'debian/patches/065_add_bailer_and_detection_plugins.patch'
--- debian/patches/065_add_bailer_and_detection_plugins.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/065_add_bailer_and_detection_plugins.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,652 @@
+## Description: add some description
+## Origin/Author: add some origin or author
+## Bug: bug URL
+Index: compiz-0.9.2.1+glibmainloop4/plugins/bailer/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/bailer/CMakeLists.txt	2011-01-25 13:31:48.235567002 +0100
+@@ -0,0 +1,5 @@
++find_package (Compiz REQUIRED)
++
++include (CompizPlugin)
++
++compiz_plugin (bailer)
+Index: compiz-0.9.2.1+glibmainloop4/plugins/bailer/bailer.xml.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/bailer/bailer.xml.in	2011-01-25 13:31:48.235567002 +0100
+@@ -0,0 +1,82 @@
++<compiz>
++    <plugin name="bailer" useBcop="true">
++    <_short>Bailer</_short>
++    <_long>Take decisive action if something is affecting the experience</_long>
++    <category>Utility</category>
++    <deps>
++        <relation type="before">
++            <plugin>composite</plugin>
++            <plugin>opengl</plugin>
++        </relation>
++    </deps>
++	<options>
++	    <option name="fatal_fallback_mode" type="int">
++		<_short>Fatal fallback mode</_short>
++		<_long>How best to handle a fatal fallback</_long>
++		<min>0</min>
++		<max>3</max>
++		<default>2</default>
++		<desc>
++		    <value>0</value>
++		    <_name>No action</_name>
++		</desc>
++		<desc>
++		    <value>1</value>
++		    <_name>Reduced functionality mode</_name>
++		</desc>
++		<desc>
++		    <value>2</value>
++		    <_name>Detect session fallback</_name>
++		</desc>
++		<desc>
++		    <value>3</value>
++		    <_name>Execute custom fallback</_name>
++		</desc>
++	    </option>
++	    <option name="custom_fallback_window_manager" type="string">
++		<_short>Custom fallback window manager command</_short>
++		<_long>Command to execute when selecting to do a custom fallback</_long>
++	    </option>
++	    <option name="custom_alternative_shell" type="string">
++		<_short>Custom alternative shell command</_short>
++		<_long>If compiz is providing a shell and it can't load, an alternative shell will be launched. This is to override the alternative shell detection</_long>
++	    </option>
++	    <option name="poor_performance_fallback" type="int">
++		<_short>Poor performance fallback</_short>
++		<_long>What do do when plugins indicate that performance is reading poor levels</_long>
++		<desc>
++		    <value>0</value>
++		    <_name>No action</_name>
++		</desc>
++		<desc>
++		    <value>1</value>
++		    <_name>Launch fatal fallback</_name>
++		</desc>
++		<desc>
++		    <value>2</value>
++		    <_name>Unload a custom list of plugins</_name>
++		</desc>
++		<desc>
++		    <value>3</value>
++		    <_name>Reduced functionality mode</_name>
++		</desc>
++		<min>0</min>
++		<max>2</max>
++		<default>0</default>
++	    </option>
++	    <option name="bad_performance_threshold" type="int">
++		<_short>Bad performance threshold</_short>
++		<_long>How much bad performance to tolerate before taking decisive action</_long>
++		<min>0</min>
++		<max>300</max>
++		<default>50</default>
++	    </option>
++	    <option name="bad_plugins" type="list">
++		<_short>Bad Plugins</_short>
++		<_long>Plugins to unload in case the session is being impacted</_long>
++		<default></default>
++		<type>string</type>
++	    </option>
++	</options>
++    </plugin>
++</compiz>
+Index: compiz-0.9.2.1+glibmainloop4/plugins/bailer/src/bailer.cpp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/bailer/src/bailer.cpp	2011-01-25 13:34:27.007567000 +0100
+@@ -0,0 +1,277 @@
++/**
++ * Compiz bailer plugin
++ *
++ * bailer.cpp
++ *
++ * Copyright (c) 2010 Canonical Ltd
++ *
++ * This plugin should be thought of as a "manager" plugin for compiz
++ * it handles signals by various other plugins (eg handleCompizEvent)
++ * and then takes decisive action on those signals when appropriate
++ * based on the configuration.
++ *
++ * For example, it will handle signals from plugins that someone is
++ * doing something stupid and terminate the offending plugin,
++ * or handle signals that performance is poor, wait a little while
++ * and then take decisive action to restore the user experience.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 3
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * AUTHORS: Didier Roche <didrocks@xxxxxxxxxx>
++ * 	    Sam Spilsbury <sam.spilsbury@xxxxxxxxxxxxx>
++ */
++
++#include "bailer.h"
++
++COMPIZ_PLUGIN_20090315 (bailer, BailerPluginVTable);
++
++static CompString reducedFunctionalityUnload[] = {"opengl", "composite"};
++static CompString compizShellUnload[] = {"unityshell"};
++static CompString noARBUnload[] = {"colorfilter", "blur", "bicubic", "water", "reflex"};
++static CompString noComplexUnload[] = {"blur", "water"};
++
++/*
++ * BailerScreen::detectFallbackWM ()
++ *
++ * Reads the session environment propeties and tries to detect
++ * which fallback window manager would be appropriate to launch here
++ *
++ * returns: a CompString with the fallback wm command
++ *
++ */
++CompString
++BailerScreen::detectFallbackWM ()
++{
++    if (getenv ("KDE_FULL_SESSION") != NULL)
++	return "kwin --replace";
++    else if (getenv ("GNOME_DESKTOP_SESSION_ID") != NULL)
++	return "metacity --replace";
++    else if (access ("/usr/bin/xfwm4", F_OK) == 0)
++	return "xfwm4 --replace";
++
++    return "";
++}
++
++/*
++ * BailerScreen::ensureShell
++ *
++ * Because compiz might be providing the panel shell or whatever
++ * (eg, Ubuntu's Unity plugin), we need to ensure that our desktop
++ * services come back when compiz goes away or when the Compiz
++ * shell(s) can't run.
++ *
++ */
++void
++BailerScreen::ensureShell ()
++{
++
++    CompString alternative_shell = optionGetCustomAlternativeShell();
++    compLogMessage ("bailer",
++			        CompLogLevelInfo,
++			        "Ensuring a shell for your session");
++
++    /* FIXME: will be nicer to get the detection module at start and so, not loading plugin rather
++                   than unloading them, isn't it? */    
++    unloadPlugins (compizShellUnload);    
++    
++    if (strcmp (alternative_shell.c_str (), "") != 0)
++    {
++	compLogMessage ("bailer",
++			            CompLogLevelInfo,
++			            "Custom shell set: no detection magic: %s", alternative_shell.c_str ());
++	screen->runCommand (alternative_shell.c_str ());
++	return;
++    }
++    
++    if (getenv ("GDMSESSION") != NULL && (strcmp (getenv ("GDMSESSION"), "gnome") == 0)) {
++	screen->runCommand ("gnome-panel");
++    }
++}
++
++/*
++ * BailerScreen::doUnload
++ *
++ * Unload given plugins at the top of the main loop
++ *
++ */
++bool
++BailerScreen::doUnload (std::vector <CompString> plugins)
++{
++    foreach (CompString &plugin, plugins)
++    {
++	CompPlugin *p = CompPlugin::find (plugin.c_str ());
++
++	if (p)
++	    (*loaderUnloadPlugin) (p);
++    }
++
++    return false;
++}
++
++/*
++ * BailerScreen::unloadPlugins
++ *
++ * Add plugins to the unload timer so that we don't unload stuff
++ * during wrapped function calls
++ *
++ */
++void
++BailerScreen::unloadPlugins (CompString *plugins)
++{
++    std::vector <CompString> pv (plugins, plugins + sizeof (plugins) / sizeof (*plugins));
++
++    mSafeUnloadTimer.stop ();
++    mSafeUnloadTimer.setCallback (boost::bind (&BailerScreen::doUnload, this, pv));
++    mSafeUnloadTimer.start ();
++}
++
++void
++BailerScreen::unloadPlugins (std::vector <CompString> plugins)
++{
++    mSafeUnloadTimer.stop ();
++    mSafeUnloadTimer.setCallback (boost::bind (&BailerScreen::doUnload, this, plugins));
++    mSafeUnloadTimer.start ();
++}
++
++
++/*
++ * BailerScreen::doFallback ()
++ *
++ * Do the actual fallback if a plugin asks for it
++ *
++ */
++void
++BailerScreen::doFatalFallback ()
++{
++    switch (optionGetFatalFallbackMode ())
++    {
++	case BailerOptions::FatalFallbackModeReducedFunctionalityMode:
++	    unloadPlugins (reducedFunctionalityUnload); break;
++	case BailerOptions::FatalFallbackModeDetectSessionFallback:
++	    ensureShell ();
++	    screen->runCommand (detectFallbackWM ().c_str ());
++	    exit (EXIT_FAILURE);
++	    break;
++	case BailerOptions::FatalFallbackModeExecuteCustomFallback:
++	    ensureShell ();
++	    screen->runCommand (optionGetCustomFallbackWindowManager ().c_str ());
++	    exit (EXIT_FAILURE);
++	case BailerOptions::FatalFallbackModeNoAction:
++	default:
++	    break;
++    }
++}
++
++/*
++ * BailerScreen::doPerformanceFallback
++ *
++ * Not as bad as a fatal fallback, but try to recover from bad
++ * performance if a plugin thinks we are not doing so well.
++ *
++ */
++void
++BailerScreen::doPerformanceFallback ()
++{
++    switch (optionGetPoorPerformanceFallback ())
++    {
++	case BailerScreen::PoorPerformanceFallbackLaunchFatalFallback:
++	    doFatalFallback ();
++	    break;
++	case BailerScreen::PoorPerformanceFallbackUnloadACustomListOfPlugins:
++	{
++	    CompOption::Value::Vector vv = optionGetBadPlugins ();
++	    std::vector <CompString> pv;
++
++	    foreach (CompOption::Value &v, vv)
++		pv.push_back (v.s ());
++
++	    unloadPlugins (pv);
++
++	    break;
++	}
++	case BailerScreen::PoorPerformanceFallbackReducedFunctionalityMode:
++	    unloadPlugins (reducedFunctionalityUnload); break;
++	case BailerScreen::PoorPerformanceFallbackNoAction:
++	default:
++	    break;
++    }
++}
++
++/*
++ * BailerScreen::changeSessionType
++ *
++ * Unloads and loads plugins depending on what kind of session we wanted
++ *
++ */
++void
++BailerScreen::changeSessionType (SessionType type)
++{
++    switch (type)
++    {
++	case SessionType2D:
++	    unloadPlugins (reducedFunctionalityUnload);
++	    break;
++	case SessionType3DNoARB:
++	    unloadPlugins (noARBUnload);
++	    break;
++	case SessionType3DNoComplex:
++	    unloadPlugins (noComplexUnload);
++	    break;
++	case SessionType3DFull:
++	default:
++	    break;
++    }
++}
++
++/*
++ * BailerScreen::handleCompizEvent
++ *
++ * Checks the compiz event screen if some plugin is screaming for help
++ *
++ */
++void
++BailerScreen::handleCompizEvent (const char *plugin, const char *event,
++				 CompOption::Vector &options)
++{
++    if (strcmp (plugin, "composite") == 0)
++    {
++	if (strcmp (event, "poor_performance") == 0)
++	{
++	    mPoorPerformanceCount++;
++	    if (mPoorPerformanceCount > optionGetBadPerformanceThreshold ())
++		doPerformanceFallback ();
++	}
++    }
++
++    if (strcmp (event, "fatal_fallback") == 0)
++	doFatalFallback ();
++
++    if (strcmp (event, "ensure_shell") == 0)
++	ensureShell ();
++
++    screen->handleCompizEvent (plugin, event, options);
++}
++
++BailerScreen::BailerScreen (CompScreen *s) :
++    PluginClassHandler <BailerScreen, CompScreen> (s),
++    mPoorPerformanceCount (0)
++{
++    ScreenInterface::setHandler (s);
++}
++
++bool
++BailerPluginVTable::init ()
++{
++    if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
++	return false;
++
++    return true;
++}
+Index: compiz-0.9.2.1+glibmainloop4/plugins/bailer/src/bailer.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/bailer/src/bailer.h	2011-01-25 13:31:48.235567002 +0100
+@@ -0,0 +1,86 @@
++/**
++ * Compiz bailer plugin
++ *
++ * bailer.h
++ *
++ * Copyright (c) 2010 Canonical Ltd
++ *
++ * This plugin should be thought of as a "manager" plugin for compiz
++ * it handles signals by various other plugins (eg handleCompizEvent)
++ * and then takes decisive action on those signals when appropriate
++ * based on the configuration.
++ *
++ * For example, it will handle signals from plugins that someone is
++ * doing something stupid and terminate the offending plugin,
++ * or handle signals that performance is poor, wait a little while
++ * and then take decisive action to restore the user experience.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 3
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * AUTHORS: Didier Roche <didrocks@xxxxxxxxxx>
++ * 	    Sam Spilsbury <sam.spilsbury@xxxxxxxxxxxxx>
++ */
++
++#include <core/core.h>
++#include <core/pluginclasshandler.h>
++#include <core/timer.h>
++
++#include "bailer_options.h"
++
++class BailerScreen :
++    public PluginClassHandler <BailerScreen, CompScreen>,
++    public ScreenInterface,
++    public BailerOptions
++{
++    public:
++
++	BailerScreen (CompScreen *);
++
++	void
++	handleCompizEvent (const char *, const char *,
++			   CompOption::Vector &options);
++
++    private:
++
++        typedef enum
++	{
++	    SessionType2D = 0,
++	    SessionType3DNoARB,
++	    SessionType3DNoComplex,
++	    SessionType3DFull
++	} SessionType;
++
++	int mPoorPerformanceCount;
++	CompTimer mSafeUnloadTimer;
++
++	CompString detectFallbackWM ();
++	void ensureShell ();
++
++	void doFatalFallback ();
++	void doPerformanceFallback ();
++
++	void changeSessionType (SessionType);
++
++	void unloadPlugins (CompString *);
++	void unloadPlugins (std::vector <CompString> );
++	bool doUnload (std::vector <CompString>);
++};
++
++#define BAILER_SCREEN(s)					       \
++    BailerScreen *bs = BailerScreen::get (s);
++
++class BailerPluginVTable :
++    public CompPlugin::VTableForScreen <BailerScreen>
++{
++    public:
++
++	bool init ();
++};
+Index: compiz-0.9.2.1+glibmainloop4/plugins/detection/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/detection/CMakeLists.txt	2011-01-25 13:31:48.235567002 +0100
+@@ -0,0 +1,5 @@
++find_package (Compiz REQUIRED)
++
++include (CompizPlugin)
++
++compiz_plugin (detection)
+Index: compiz-0.9.2.1+glibmainloop4/plugins/detection/detection.xml.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/detection/detection.xml.in	2011-01-25 13:31:48.239567002 +0100
+@@ -0,0 +1,28 @@
++<compiz>
++    <plugin name="detection" useBcop="true">
++    <_short>Detection</_short>
++    <_long>Do a bit more clever hardware etc detection</_long>
++    <deps>
++	<relation type="before">
++	    <plugin>composite</plugin>
++	    <plugin>opengl</plugin>
++	</relation>
++	<relation type="after">
++	    <plugin>bailer</plugin>
++	</relation>
++    </deps>
++    <category>Utility</category>
++    <options>
++	<option name="detect_bad_pci" type="bool">
++	    <_short>Detect known bad PCI ids</_short>
++	    <_long>Fallback when known bad PCI ids are detected</_long>
++	    <default>true</default>
++	</option>
++	<option name="detect_bad_drivers" type="bool">
++	    <_short>Detect known bad drivers</_short>
++	    <_long>Fallback when known bad drivers are detected</_long>
++	    <default>true</default>
++	</option>
++    </options>
++    </plugin>
++</compiz>
+Index: compiz-0.9.2.1+glibmainloop4/plugins/detection/src/detection.cpp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/detection/src/detection.cpp	2011-01-25 13:31:48.239567002 +0100
+@@ -0,0 +1,74 @@
++/**
++ * Compiz detection plugin
++ *
++ * detection.cpp
++ *
++ * Copyright (c) 2010 Canonical Ltd
++ *
++ * This plugin should does some quick extra checks to make sure we
++ * are not running on quirky hardware or drivers.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 3
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * AUTHORS: Didier Roche <didrocks@xxxxxxxxxx>
++ * 	    Sam Spilsbury <sam.spilsbury@xxxxxxxxxxxxx>
++ */
++
++#include "detection.h"
++
++COMPIZ_PLUGIN_20090315 (detection, DetectionPluginVTable);
++
++static CompString HW_accell_blacklisted[] = {
++    "8086:3577", /* Intel 830MG, 845G (LP: #259385) */
++    "8086:2562"
++};
++
++bool
++DetectionScreen::doDetection ()
++{
++    CompOption::Vector o (0);
++
++    /* first, take care about the blacklisted cards */
++    for (unsigned int i = 0; i < 2; i++)
++    {
++	CompString cmd = "lspci -n | grep -q " + HW_accell_blacklisted[i];
++
++	if (system (cmd.c_str ()) == 0 && optionGetDetectBadPci ())
++	{
++	    compLogMessage ("detection",
++			    CompLogLevelFatal,
++			    "Accelerated blacklisted PCI ID %s detected",
++			    HW_accell_blacklisted[i].c_str ());
++
++	    screen->handleCompizEvent ("detection", "fatal_fallback", o);
++	}
++    }
++
++    return false;
++}
++
++DetectionScreen::DetectionScreen (CompScreen *s) :
++    PluginClassHandler <DetectionScreen, CompScreen> (s)
++{
++    CompTimer::CallBack cb = boost::bind (&DetectionScreen::doDetection,
++					  this);
++
++    mDetectionTimer.start (cb, 0, 0);
++}
++
++bool
++DetectionPluginVTable::init ()
++{
++    if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
++	return false;
++
++    return true;
++}
+Index: compiz-0.9.2.1+glibmainloop4/plugins/detection/src/detection.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.2.1+glibmainloop4/plugins/detection/src/detection.h	2011-01-25 13:31:48.239567002 +0100
+@@ -0,0 +1,52 @@
++/**
++ * Compiz detection plugin
++ *
++ * detection.h
++ *
++ * Copyright (c) 2010 Canonical Ltd
++ *
++ * This plugin should does some quick extra checks to make sure we
++ * are not running on quirky hardware or drivers.
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 3
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * AUTHORS: Didier Roche <didrocks@xxxxxxxxxx>
++ * 	    Sam Spilsbury <sam.spilsbury@xxxxxxxxxxxxx>
++ */
++
++#include "core/core.h"
++#include "core/pluginclasshandler.h"
++#include "core/timer.h"
++
++#include "detection_options.h"
++
++class DetectionScreen :
++    public PluginClassHandler <DetectionScreen, CompScreen>,
++    public DetectionOptions
++{
++    public:
++
++	DetectionScreen (CompScreen *);
++
++    private:
++
++	bool doDetection ();
++
++	CompTimer mDetectionTimer;
++};
++
++class DetectionPluginVTable:
++    public CompPlugin::VTableForScreen <DetectionScreen>
++{
++    public:
++
++	bool init ();
++};

=== added file 'debian/patches/085_add_grid_plugin.patch'
--- debian/patches/085_add_grid_plugin.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/085_add_grid_plugin.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,1465 @@
+Index: compiz-0.9.4/plugins/grid/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4/plugins/grid/CMakeLists.txt	2011-03-23 00:18:34.416828458 +0800
+@@ -0,0 +1,5 @@
++find_package (Compiz REQUIRED)
++
++include (CompizPlugin)
++
++compiz_plugin(grid PLUGINDEPS composite opengl)
+Index: compiz-0.9.4/plugins/grid/grid.xml.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4/plugins/grid/grid.xml.in	2011-03-23 00:18:34.416828458 +0800
+@@ -0,0 +1,565 @@
++<?xml version="1.0"?>
++<compiz>
++    <plugin name="grid" useBcop="true">
++	<_short>Grid</_short>
++	<_long>Warp and resize windows to fit an imaginary grid.</_long>
++	<category>Window Management</category>
++	<deps>
++	    <requirement>
++		<plugin>opengl</plugin>
++	    </requirement>
++	    <relation type="before">
++		<plugin>wobbly</plugin>
++	    </relation>
++	    <relation type="after">
++		<plugin>composite</plugin>
++		<plugin>opengl</plugin>
++		<plugin>decor</plugin>
++	    </relation>
++	</deps>
++	<options>
++	    <group>
++		<_short>Bindings</_short>
++		<option name="put_center_key" type="key">
++		    <_short>Put Center</_short>
++		    <_long>Move window to the center</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_5</default>
++		</option>
++		<option name="put_left_key" type="key">
++		    <_short>Put Left</_short>
++		    <_long>Move window to the left edge</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_4</default>
++		</option>
++		<option name="put_right_key" type="key">
++		    <_short>Put Right</_short>
++		    <_long>Move window to the right edge</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_6</default>
++		</option>
++		<option name="put_top_key" type="key">
++		    <_short>Put Top</_short>
++		    <_long>Move window to the top edge</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_8</default>
++		</option>
++		<option name="put_bottom_key" type="key">
++		    <_short>Put Bottom</_short>
++		    <_long>Move window to the bottom edge</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_2</default>
++		</option>
++		<option name="put_topleft_key" type="key">
++		    <_short>Put Top Left</_short>
++		    <_long>Move window to the top left corner</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_7</default>
++		</option>
++		<option name="put_topright_key" type="key">
++		    <_short>Put Top Right</_short>
++		    <_long>Move window to the top right corner</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_9</default>
++		</option>
++		<option name="put_bottomleft_key" type="key">
++		    <_short>Put Bottom Left</_short>
++		    <_long>Move window to the bottom left corner</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_1</default>
++		</option>
++		<option name="put_bottomright_key" type="key">
++		    <_short>Put Bottom Right</_short>
++		    <_long>Move window to the bottom right corner</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_3</default>
++		</option>
++		<option name="put_maximize_key" type="key">
++		    <_short>Maximize</_short>
++		    <_long>Maximize window</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;KP_0</default>
++		</option>
++		<option name="put_restore_key" type="key">
++		    <_short>Restore</_short>
++		    <_long>Restore window to it's original size</_long>
++		    <default>&lt;Control&gt;&lt;Alt&gt;r</default>
++		</option>
++	    </group>
++	    <group>
++		<_short>Edges</_short>
++		<subgroup>
++			<_short>Resize Actions</_short>
++			<_long>Window resize action</_long>
++			<option name="top_left_corner_action" type="int">
++			    <_short>Upper Left Corner</_short>
++			    <_long>Action to be performed when window is dropped on the top left corner</_long>
++			    <default>7</default>
++			    <min>0</min>
++			    <max>10</max>
++			    <desc>
++				<value>0</value>
++				<_name>None</_name>
++			    </desc>
++			    <desc>
++				<value>1</value>
++				<_name>Bottom Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>2</value>
++				<_name>Bottom Half</_name>
++			    </desc>
++			    <desc>
++				<value>3</value>
++				<_name>Bottom Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>4</value>
++				<_name>Left Half</_name>
++			    </desc>
++			    <desc>
++				<value>5</value>
++				<_name>Fill Screen</_name>
++			    </desc>
++			    <desc>
++				<value>6</value>
++				<_name>Right Half</_name>
++			    </desc>
++			    <desc>
++				<value>7</value>
++				<_name>Top Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>8</value>
++				<_name>Top Half</_name>
++			    </desc>
++			    <desc>
++				<value>9</value>
++				<_name>Top Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>10</value>
++				<_name>Maximize</_name>
++			    </desc>
++			</option>
++			<option name="top_edge_action" type="int">
++			    <_short>Top Edge</_short>
++			    <_long>Action to be performed when window is dropped on the top edge</_long>
++			    <default>10</default>
++			    <min>0</min>
++			    <max>10</max>
++			    <desc>
++				<value>0</value>
++				<_name>None</_name>
++			    </desc>
++			    <desc>
++				<value>1</value>
++				<_name>Bottom Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>2</value>
++				<_name>Bottom Half</_name>
++			    </desc>
++			    <desc>
++				<value>3</value>
++				<_name>Bottom Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>4</value>
++				<_name>Left Half</_name>
++			    </desc>
++			    <desc>
++				<value>5</value>
++				<_name>Fill Screen</_name>
++			    </desc>
++			    <desc>
++				<value>6</value>
++				<_name>Right Half</_name>
++			    </desc>
++			    <desc>
++				<value>7</value>
++				<_name>Top Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>8</value>
++				<_name>Top Half</_name>
++			    </desc>
++			    <desc>
++				<value>9</value>
++				<_name>Top Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>10</value>
++				<_name>Maximize</_name>
++			    </desc>
++			</option>
++			<option name="top_right_corner_action" type="int">
++			    <_short>Upper Right Corner</_short>
++			    <_long>Action to be performed when window is dropped on the top right corner</_long>
++			    <default>9</default>
++			    <min>0</min>
++			    <max>10</max>
++			    <desc>
++				<value>0</value>
++				<_name>None</_name>
++			    </desc>
++			    <desc>
++				<value>1</value>
++				<_name>Bottom Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>2</value>
++				<_name>Bottom Half</_name>
++			    </desc>
++			    <desc>
++				<value>3</value>
++				<_name>Bottom Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>4</value>
++				<_name>Left Half</_name>
++			    </desc>
++			    <desc>
++				<value>5</value>
++				<_name>Fill Screen</_name>
++			    </desc>
++			    <desc>
++				<value>6</value>
++				<_name>Right Half</_name>
++			    </desc>
++			    <desc>
++				<value>7</value>
++				<_name>Top Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>8</value>
++				<_name>Top Half</_name>
++			    </desc>
++			    <desc>
++				<value>9</value>
++				<_name>Top Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>10</value>
++				<_name>Maximize</_name>
++			    </desc>
++			</option>
++			<option name="left_edge_action" type="int">
++			    <_short>Left Edge</_short>
++			    <_long>Action to be performed when window is dropped on the left edge</_long>
++			    <default>4</default>
++			    <min>0</min>
++			    <max>10</max>
++			    <desc>
++				<value>0</value>
++				<_name>None</_name>
++			    </desc>
++			    <desc>
++				<value>1</value>
++				<_name>Bottom Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>2</value>
++				<_name>Bottom Half</_name>
++			    </desc>
++			    <desc>
++				<value>3</value>
++				<_name>Bottom Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>4</value>
++				<_name>Left Half</_name>
++			    </desc>
++			    <desc>
++				<value>5</value>
++				<_name>Fill Screen</_name>
++			    </desc>
++			    <desc>
++				<value>6</value>
++				<_name>Right Half</_name>
++			    </desc>
++			    <desc>
++				<value>7</value>
++				<_name>Top Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>8</value>
++				<_name>Top Half</_name>
++			    </desc>
++			    <desc>
++				<value>9</value>
++				<_name>Top Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>10</value>
++				<_name>Maximize</_name>
++			    </desc>
++			</option>
++			<option name="right_edge_action" type="int">
++			    <_short>Right Edge</_short>
++			    <_long>Action to be performed when window is dropped on the right edge</_long>
++			    <default>6</default>
++			    <min>0</min>
++			    <max>10</max>
++			    <desc>
++				<value>0</value>
++				<_name>None</_name>
++			    </desc>
++			    <desc>
++				<value>1</value>
++				<_name>Bottom Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>2</value>
++				<_name>Bottom Half</_name>
++			    </desc>
++			    <desc>
++				<value>3</value>
++				<_name>Bottom Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>4</value>
++				<_name>Left Half</_name>
++			    </desc>
++			    <desc>
++				<value>5</value>
++				<_name>Fill Screen</_name>
++			    </desc>
++			    <desc>
++				<value>6</value>
++				<_name>Right Half</_name>
++			    </desc>
++			    <desc>
++				<value>7</value>
++				<_name>Top Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>8</value>
++				<_name>Top Half</_name>
++			    </desc>
++			    <desc>
++				<value>9</value>
++				<_name>Top Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>10</value>
++				<_name>Maximize</_name>
++			    </desc>
++			</option>
++			<option name="bottom_left_corner_action" type="int">
++			    <_short>Bottom Left Corner</_short>
++			    <_long>Action to be performed when window is dropped on the bottom left corner</_long>
++			    <default>1</default>
++			    <min>0</min>
++			    <max>10</max>
++			    <desc>
++				<value>0</value>
++				<_name>None</_name>
++			    </desc>
++			    <desc>
++				<value>1</value>
++				<_name>Bottom Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>2</value>
++				<_name>Bottom Half</_name>
++			    </desc>
++			    <desc>
++				<value>3</value>
++				<_name>Bottom Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>4</value>
++				<_name>Left Half</_name>
++			    </desc>
++			    <desc>
++				<value>5</value>
++				<_name>Fill Screen</_name>
++			    </desc>
++			    <desc>
++				<value>6</value>
++				<_name>Right Half</_name>
++			    </desc>
++			    <desc>
++				<value>7</value>
++				<_name>Top Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>8</value>
++				<_name>Top Half</_name>
++			    </desc>
++			    <desc>
++				<value>9</value>
++				<_name>Top Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>10</value>
++				<_name>Maximize</_name>
++			    </desc>
++			</option>
++			<option name="bottom_edge_action" type="int">
++			    <_short>Bottom Edge</_short>
++			    <_long>Action to be performed when window is dropped on the bottom edge</_long>
++			    <default>2</default>
++			    <min>0</min>
++			    <max>10</max>
++			    <desc>
++				<value>0</value>
++				<_name>None</_name>
++			    </desc>
++			    <desc>
++				<value>1</value>
++				<_name>Bottom Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>2</value>
++				<_name>Bottom Half</_name>
++			    </desc>
++			    <desc>
++				<value>3</value>
++				<_name>Bottom Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>4</value>
++				<_name>Left Half</_name>
++			    </desc>
++			    <desc>
++				<value>5</value>
++				<_name>Fill Screen</_name>
++			    </desc>
++			    <desc>
++				<value>6</value>
++				<_name>Right Half</_name>
++			    </desc>
++			    <desc>
++				<value>7</value>
++				<_name>Top Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>8</value>
++				<_name>Top Half</_name>
++			    </desc>
++			    <desc>
++				<value>9</value>
++				<_name>Top Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>10</value>
++				<_name>Maximize</_name>
++			    </desc>
++			</option>
++			<option name="bottom_right_corner_action" type="int">
++			    <_short>Bottom Right Corner</_short>
++			    <_long>Action to be performed when window is dropped on the bottom right corner</_long>
++			    <default>3</default>
++			    <min>0</min>
++			    <max>10</max>
++			    <desc>
++				<value>0</value>
++				<_name>None</_name>
++			    </desc>
++			    <desc>
++				<value>1</value>
++				<_name>Bottom Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>2</value>
++				<_name>Bottom Half</_name>
++			    </desc>
++			    <desc>
++				<value>3</value>
++				<_name>Bottom Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>4</value>
++				<_name>Left Half</_name>
++			    </desc>
++			    <desc>
++				<value>5</value>
++				<_name>Fill Screen</_name>
++			    </desc>
++			    <desc>
++				<value>6</value>
++				<_name>Right Half</_name>
++			    </desc>
++			    <desc>
++				<value>7</value>
++				<_name>Top Left Corner</_name>
++			    </desc>
++			    <desc>
++				<value>8</value>
++				<_name>Top Half</_name>
++			    </desc>
++			    <desc>
++				<value>9</value>
++				<_name>Top Right Corner</_name>
++			    </desc>
++			    <desc>
++				<value>10</value>
++				<_name>Maximize</_name>
++			    </desc>
++			</option>
++			<option name="snapoff_maximized" type="bool">
++				<_short>Snapoff maximized windows</_short>
++				<_long>Snapoff maximized windows when pulling to edge.</_long>
++				<default>false</default>
++			</option>
++			<option name="snapback_windows" type="bool">
++				<_short>Snap windows back to original size</_short>
++				<_long>Snaps windows back to their original size if dragged away from their gridded position.</_long>
++				<default>true</default>
++			</option>
++		</subgroup>
++		<subgroup>
++			<_short>Thresholds</_short>
++			<option name="left_edge_threshold" type="int">
++				<_short>Left Edge</_short>
++				<_long>Maximum number of pixels from the left edge a window can be dropped</_long>
++				<default>5</default>
++				<min>0</min>
++				<max>500</max>
++			</option>
++			<option name="right_edge_threshold" type="int">
++				<_short>Right Edge</_short>
++				<_long>Maximum number of pixels from the right edge a window can be dropped</_long>
++				<default>5</default>
++				<min>0</min>
++				<max>500</max>
++			</option>
++			<option name="top_edge_threshold" type="int">
++				<_short>Top Edge</_short>
++				<_long>Maximum number of pixels from the top edge a window can be dropped</_long>
++				<default>5</default>
++				<min>0</min>
++				<max>500</max>
++			</option>
++			<option name="bottom_edge_threshold" type="int">
++				<_short>Bottom Edge</_short>
++				<_long>Maximum number of pixels from the Bottom edge a window can be dropped</_long>
++				<default>5</default>
++				<min>0</min>
++				<max>500</max>
++			</option>
++		</subgroup>
++	    </group>
++	    <group>
++		<_short>Appearance</_short>
++		<option name="draw_indicator" type="bool">
++			<_short>Draw Indicator</_short>
++			<_long>Draw Window Resize Indicator</_long>
++			<default>true</default>
++		</option>
++		<option name="outline_color" type="color">
++			<_short>Outline Color</_short>
++			<_long>Color of the resize indicator outline</_long>
++			<default>
++			    <red>0x2f2f</red>
++			    <green>0x2f2f</green>
++			    <blue>0x4f4f</blue>
++			    <alpha>0x9f9f</alpha>
++			</default>
++		</option>
++		<option name="fill_color" type="color">
++			<_short>Fill Color</_short>
++			<_long>Fill color of the resize indicator</_long>
++			<default>
++			    <red>0x2f2f</red>
++			    <green>0x2f2f</green>
++			    <blue>0x4f4f</blue>
++			    <alpha>0x4f4f</alpha>
++			</default>
++		</option>
++	    </group>
++	</options>
++    </plugin>
++</compiz>
+Index: compiz-0.9.4/plugins/grid/src/grid.cpp
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4/plugins/grid/src/grid.cpp	2011-03-23 00:19:23.166899952 +0800
+@@ -0,0 +1,714 @@
++/*
++ * Compiz Fusion Grid plugin
++ *
++ * Copyright (c) 2008 Stephen Kennedy <suasol@xxxxxxxxx>
++ * Copyright (c) 2010 Scott Moreau <oreaus@xxxxxxxxx>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * Description:
++ *
++ * Plugin to act like winsplit revolution (http://www.winsplit-revolution.com/)
++ * use <Control><Alt>NUMPAD_KEY to move and tile your windows.
++ *
++ * Press the tiling keys several times to cycle through some tiling options.
++ */
++
++#include "grid.h"
++
++static const GridProps gridProps[] =
++{
++    {0,1, 1,1},
++
++    {0,1, 2,2},
++    {0,1, 1,2},
++    {1,1, 2,2},
++
++    {0,0, 2,1},
++    {0,0, 1,1},
++    {1,0, 2,1},
++
++    {0,0, 2,2},
++    {0,0, 1,2},
++    {1,0, 2,2},
++
++    {0,0, 1,1},
++};
++
++CompRect
++GridScreen::slotToRect (CompWindow      *w,
++			const CompRect& slot)
++{
++    return CompRect (slot.x () + w->border ().left,
++		     slot.y () + w->border ().top,
++		     slot.width () - (w->border ().left + w->border ().right),
++		     slot.height () - (w->border ().top + w->border ().bottom));
++}
++
++CompRect
++GridScreen::constrainSize (CompWindow      *w,
++			   const CompRect& slot)
++{
++    CompRect result;
++    int      cw, ch;
++
++    result = slotToRect (w, slot);
++
++    if (w->constrainNewWindowSize (result.width (), result.height (), &cw, &ch))
++    {
++	/* constrained size may put window offscreen, adjust for that case */
++	int dx = result.x () + cw - workarea.right () + w->border ().right;
++	int dy = result.y () + ch - workarea.bottom () + w->border ().bottom;
++
++	if (dx > 0)
++	    result.setX (result.x () - dx);
++	if (dy > 0)
++	    result.setY (result.y () - dy);
++
++	result.setWidth (cw);
++	result.setHeight (ch);
++    }
++
++    return result;
++}
++
++void
++GridScreen::getPaintRectangle (CompRect &cRect)
++{
++    if (edgeToGridType () != GridUnknown && optionGetDrawIndicator ())
++	cRect = desiredSlot;
++    else
++	cRect.setGeometry (0, 0, 0, 0);
++}
++
++bool
++GridScreen::initiateCommon (CompAction         *action,
++			    CompAction::State  state,
++			    CompOption::Vector &option,
++			    GridType           where,
++			    bool               resize)
++{
++    Window     xid;
++    CompWindow *cw = 0;
++
++    xid = CompOption::getIntOptionNamed (option, "window");
++    cw  = screen->findWindow (xid);
++
++    if (where == GridUnknown || screen->otherGrabExist ("move", NULL))
++	return false;
++
++    if (cw)
++    {
++	XWindowChanges xwc;
++
++	GRID_WINDOW (cw);
++
++	if (gw->lastTarget != where)
++	    gw->resizeCount = 0;
++
++	props = gridProps[where];
++
++	/* get current available area */
++	if (gw->grabIsMove)
++	    workarea = screen->getWorkareaForOutput
++			    (screen->outputDeviceForPoint (pointerX, pointerY));
++	else
++	{
++	    workarea = screen->getWorkareaForOutput (cw->outputDevice ());
++
++	    if (props.numCellsX == 1)
++		centerCheck = true;
++
++	    if (!gw->isGridResized)
++		/* Store size not including borders when using a keybinding */
++		gw->originalSize = slotToRect(cw, cw->serverBorderRect ());
++	}
++
++	if ((cw->state () & MAXIMIZE_STATE) &&
++	    (resize || optionGetSnapoffMaximized ()))
++	{
++	    /* maximized state interferes with us, clear it */
++	    cw->maximize (0);
++	}
++
++	if (where == GridMaximize && resize)
++	{
++	    /* move the window to the correct output */
++	    if (GridWindow::get (cw)->grabIsMove)
++	    {
++		xwc.x = workarea.x () + 50;
++		xwc.y = workarea.y () + 50;
++		xwc.width = workarea.width ();
++		xwc.height = workarea.height ();
++		cw->configureXWindow (CWX | CWY, &xwc);
++	    }
++	    cw->maximize (MAXIMIZE_STATE);
++	    gw->isGridResized = true;
++	    gw->isGridMaximized = true;
++	    return true;
++	}
++
++	/* Convention:
++	 * xxxSlot include decorations (it's the screen area occupied)
++	 * xxxRect are undecorated (it's the constrained position
++	                            of the contents)
++	 */
++
++	/* slice and dice to get desired slot - including decorations */
++	desiredSlot.setY (workarea.y () + props.gravityDown *
++			  (workarea.height () / props.numCellsY));
++	desiredSlot.setHeight (workarea.height () / props.numCellsY);
++	desiredSlot.setX (workarea.x () + props.gravityRight *
++			  (workarea.width () / props.numCellsX));
++	desiredSlot.setWidth (workarea.width () / props.numCellsX);
++
++	/* Adjust for constraints and decorations */
++	desiredRect = constrainSize (cw, desiredSlot);
++	/* Get current rect not including decorations */
++	currentRect.setGeometry (cw->serverX (), cw->serverY (),
++				 cw->serverWidth (),
++				 cw->serverHeight ());
++
++	if (desiredRect.y () == currentRect.y () &&
++	    desiredRect.height () == currentRect.height () &&
++	    where != GridMaximize && gw->lastTarget == where)
++	{
++	    int slotWidth25  = workarea.width () / 4;
++	    int slotWidth33  = (workarea.width () / 3) + cw->border ().left;
++	    int slotWidth17  = slotWidth33 - slotWidth25;
++	    int slotWidth66  = workarea.width () - slotWidth33;
++	    int slotWidth75  = workarea.width () - slotWidth25;
++	    
++	    CompRect rect25, rect33, rect66, rect75,
++		     slot25, slot33, slot66, slot75;
++
++	    slot25 = desiredSlot;
++	    slot25.setX (workarea.x () +
++			 props.gravityRight * slotWidth75);
++	    slot25.setWidth (slotWidth25);
++	    rect25 = constrainSize (cw, slot25);
++
++	    slot33 = desiredSlot;
++	    slot33.setX (workarea.x () +
++			 props.gravityRight * slotWidth66);
++	    slot33.setWidth (slotWidth33);
++	    rect33 = constrainSize (cw, slot33);
++
++	    slot66 = desiredSlot;
++	    slot66.setX (workarea.x () +
++			 props.gravityRight * slotWidth33);
++	    slot66.setWidth (slotWidth66);
++	    rect66 = constrainSize (cw, slot66);
++
++	    slot75 = desiredSlot;
++	    slot75.setX (workarea.x () +
++			 props.gravityRight * slotWidth25);
++	    slot75.setWidth (slotWidth75);
++	    rect75 = constrainSize (cw, slot75);
++
++	    if (props.numCellsX == 2) /* keys (1, 4, 7, 3, 6, 9) */
++	    {
++		if ((currentRect.width () == desiredRect.width () &&
++		    currentRect.x () == desiredRect.x ()) ||
++		    (gw->resizeCount < 1) || (gw->resizeCount > 5))
++		    gw->resizeCount = 3;
++
++		/* tricky, have to allow for window constraints when
++		 * computing what the 33% and 66% offsets would be
++		 */
++		switch (gw->resizeCount)
++		{
++		    case 1:
++			desiredSlot.setWidth (slotWidth33);
++			desiredSlot.setX (workarea.x () +
++					  props.gravityRight * slotWidth66);
++			gw->resizeCount++;
++			break;
++		    case 2:
++			gw->resizeCount++;
++			break;
++		    case 3:
++			desiredSlot.setWidth (slotWidth66);
++			desiredSlot.setX (workarea.x () +
++					  props.gravityRight * slotWidth33);
++			gw->resizeCount++;
++			break;
++		    case 4:
++			desiredSlot.setWidth (slotWidth75);
++			desiredSlot.setX (workarea.x () +
++					  props.gravityRight * slotWidth25);
++			gw->resizeCount++;
++			break;
++		    case 5:
++			desiredSlot.setWidth (slotWidth25);
++			desiredSlot.setX (workarea.x () +
++					  props.gravityRight * slotWidth75);
++			gw->resizeCount++;
++			break;
++		    default:
++			break;
++		}
++	    }
++	    else /* keys (2, 5, 8) */
++	    {
++
++		if ((currentRect.width () == desiredRect.width () &&
++		    currentRect.x () == desiredRect.x ()) ||
++		    (gw->resizeCount < 1) || (gw->resizeCount > 5))
++		    gw->resizeCount = 1;
++	    
++		switch (gw->resizeCount)
++		{
++		    case 1:
++			desiredSlot.setWidth (slotWidth33 -
++			    (cw->border ().left + cw->border ().right));
++			desiredSlot.setX (workarea.x () + slotWidth33);
++			gw->resizeCount++;
++			break;
++		    case 2:
++			desiredSlot.setWidth ((slotWidth25 * 2));
++			desiredSlot.setX (workarea.x () + slotWidth25);
++			gw->resizeCount++;
++			break;
++		    case 3:
++			desiredSlot.setWidth ((slotWidth25 * 2) +
++					      (slotWidth17 * 2));
++			desiredSlot.setX (workarea.x () +
++					 (slotWidth25 - slotWidth17));
++			gw->resizeCount++;
++			break;
++		    case 4:
++			desiredSlot.setWidth (workarea.width () -
++					     (slotWidth17 * 2));
++			desiredSlot.setX (workarea.x () + slotWidth17);
++			gw->resizeCount++;
++			break;
++		    case 5:
++			gw->resizeCount++;
++			break;
++		    default:
++			break;
++		}
++	    }
++
++	    if (gw->resizeCount == 6)
++		gw->resizeCount = 1;
++
++	    desiredRect = constrainSize (cw, desiredSlot);
++	}
++
++	xwc.x = desiredRect.x ();
++	xwc.y = desiredRect.y ();
++	xwc.width  = desiredRect.width ();
++	xwc.height = desiredRect.height ();
++
++	/* Store a copy of xwc since configureXWindow changes it's values */
++	XWindowChanges wc = xwc;
++
++	if (cw->mapNum ())
++	    cw->sendSyncRequest ();
++
++	/* TODO: animate move+resize */
++	if (resize)
++	{
++	    cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
++	    gw->isGridResized = true;
++	    gw->isGridMaximized = false;
++	}
++
++	/* This centers a window if it could not be resized to the desired
++	 * width. Without this, it can look buggy when desired width is
++	 * beyond the minimum or maximum width of the window.
++	 */
++	if (centerCheck)
++	{
++	    if ((cw->serverBorderRect ().width () >
++		 desiredSlot.width ()) ||
++		 cw->serverBorderRect ().width () <
++		 desiredSlot.width ())
++	    {
++		wc.x = (workarea.width () >> 1) -
++		      ((cw->serverBorderRect ().width () >> 1) -
++			cw->border ().left);
++		cw->configureXWindow (CWX, &wc);
++	    }
++
++	    centerCheck = false;
++	}
++
++	gw->lastTarget = where;
++    }
++
++    return true;
++}
++
++void
++GridScreen::glPaintRectangle (const GLScreenPaintAttrib &sAttrib,
++			      const GLMatrix            &transform,
++			      CompOutput                *output)
++{
++    CompRect rect;
++    GLMatrix sTransform (transform);
++
++    getPaintRectangle (rect);
++
++    glPushMatrix ();
++
++    sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
++
++    glLoadMatrixf (sTransform.getMatrix ());
++
++    glDisableClientState (GL_TEXTURE_COORD_ARRAY);
++    glEnable (GL_BLEND);
++
++    /* fill rectangle */
++    glColor4usv (optionGetFillColor ());
++    glRecti (rect.x1 (), rect.y2 (), rect.x2 (), rect.y1 ());
++
++    /* Set outline rect smaller to avoid damage issues */
++    rect.setGeometry (rect.x () + 1, rect.y () + 1,
++		      rect.width () - 2, rect.height () - 2);
++
++    /* draw outline */
++    glColor4usv (optionGetOutlineColor ());
++    glLineWidth (2.0);
++    glBegin (GL_LINE_LOOP);
++    glVertex2i (rect.x1 (), rect.y1 ());
++    glVertex2i (rect.x2 (), rect.y1 ());
++    glVertex2i (rect.x2 (), rect.y2 ());
++    glVertex2i (rect.x1 (), rect.y2 ());
++    glEnd ();
++
++    /* clean up */
++    glColor4usv (defaultColor);
++    glDisable (GL_BLEND);
++    glEnableClientState (GL_TEXTURE_COORD_ARRAY);
++    glPopMatrix ();
++}
++
++bool
++GridScreen::glPaintOutput (const GLScreenPaintAttrib &attrib,
++			   const GLMatrix            &matrix,
++			   const CompRegion          &region,
++			   CompOutput                *output,
++			   unsigned int              mask)
++{
++    bool status;
++
++    status = glScreen->glPaintOutput (attrib, matrix, region, output, mask);
++
++    glPaintRectangle (attrib, matrix, output);
++
++    return status;
++}
++
++GridType
++GridScreen::edgeToGridType ()
++{
++    GridType ret;
++
++    switch (edge) {
++    case Left:
++	ret = (GridType) optionGetLeftEdgeAction ();
++	break;
++    case Right:
++	ret = (GridType) optionGetRightEdgeAction ();
++	break;
++    case Top:
++	ret = (GridType) optionGetTopEdgeAction ();
++	break;
++    case Bottom:
++	ret = (GridType) optionGetBottomEdgeAction ();
++	break;
++    case TopLeft:
++	ret = (GridType) optionGetTopLeftCornerAction ();
++	break;
++    case TopRight:
++	ret = (GridType) optionGetTopRightCornerAction ();
++	break;
++    case BottomLeft:
++	ret = (GridType) optionGetBottomLeftCornerAction ();
++	break;
++    case BottomRight:
++	ret = (GridType) optionGetBottomRightCornerAction ();
++	break;
++    case NoEdge:
++    default:
++	ret = GridUnknown;
++	break;
++    }
++
++    return ret;
++}
++
++void
++GridScreen::handleEvent (XEvent *event)
++{
++    screen->handleEvent (event);
++
++    if (event->type != MotionNotify)
++	return;
++
++    /* Detect corners first */
++    /* Bottom Left */
++    if (pointerY > (screen->height() - optionGetBottomEdgeThreshold()) &&
++	pointerX < optionGetLeftEdgeThreshold())
++	edge = BottomLeft;
++    /* Bottom Right */
++    else if (pointerY > (screen->height() - optionGetBottomEdgeThreshold()) &&
++	     pointerX > (screen->width() - optionGetRightEdgeThreshold()))
++	edge = BottomRight;
++    /* Top Left */
++    else if (pointerY < optionGetTopEdgeThreshold() &&
++	    pointerX < optionGetLeftEdgeThreshold())
++	edge = TopLeft;
++    /* Top Right */
++    else if (pointerY < optionGetTopEdgeThreshold() &&
++	     pointerX > (screen->width() - optionGetRightEdgeThreshold()))
++	edge = TopRight;
++    /* Left */
++    else if (pointerX < optionGetLeftEdgeThreshold())
++	edge = Left;
++    /* Right */
++    else if (pointerX > (screen->width() - optionGetRightEdgeThreshold()))
++	edge = Right;
++    /* Top */
++    else if (pointerY < optionGetTopEdgeThreshold())
++	edge = Top;
++    /* Bottom */
++    else if (pointerY > (screen->height() - optionGetBottomEdgeThreshold()))
++	edge = Bottom;
++    /* No Edge */
++    else
++	edge = NoEdge;
++
++    /* Detect when cursor enters another output */
++    currentWorkarea = screen->getWorkareaForOutput
++			    (screen->outputDeviceForPoint (pointerX, pointerY));
++    if (lastWorkarea != currentWorkarea)
++    {
++	lastWorkarea = currentWorkarea;
++
++	if (cScreen)
++	    cScreen->damageRegion (desiredSlot);
++
++	initiateCommon (0, 0, o, edgeToGridType (), false);
++
++	if (cScreen)
++	    cScreen->damageRegion (desiredSlot);
++    }
++
++    /* Detect edge region change */
++    if (lastEdge != edge)
++    {
++	lastEdge = edge;
++
++	if (cScreen)
++	    cScreen->damageRegion (desiredSlot);
++
++	initiateCommon (0, 0, o, edgeToGridType (), false);
++
++	if (cScreen)
++	    cScreen->damageRegion (desiredSlot);
++    }
++
++    GRID_WINDOW (screen->findWindow
++				(CompOption::getIntOptionNamed (o, "window")));
++
++    if ((gw->pointerBufDx > SNAPOFF_THRESHOLD ||
++	 gw->pointerBufDy > SNAPOFF_THRESHOLD ||
++	 gw->pointerBufDx < -SNAPOFF_THRESHOLD ||
++	 gw->pointerBufDy < -SNAPOFF_THRESHOLD) &&
++	 gw->isGridResized &&
++	 optionGetSnapbackWindows ())
++	    restoreWindow (0, 0, o);
++}
++
++void
++GridWindow::grabNotify (int          x,
++			int          y,
++			unsigned int state,
++			unsigned int mask)
++{
++    if (screen->grabExist ("move"))
++    {
++	gScreen->o.push_back (CompOption ("window", CompOption::TypeInt));
++	gScreen->o[0].value ().set ((int) window->id ());
++
++	screen->handleEventSetEnabled (gScreen, true);
++	gScreen->glScreen->glPaintOutputSetEnabled (gScreen, true);
++	grabIsMove = true;
++	pointerBufDx = pointerBufDy = 0;
++
++	if (!isGridResized && gScreen->optionGetSnapbackWindows ())
++	    /* Store size not including borders when grabbing with cursor */
++	    originalSize = gScreen->slotToRect(window,
++						    window->serverBorderRect ());
++    }
++
++    if (screen->grabExist ("resize"))
++    {
++	isGridResized = false;
++	resizeCount = 0;
++    }
++
++    window->grabNotify (x, y, state, mask);
++}
++
++void
++GridWindow::ungrabNotify ()
++{
++    if (grabIsMove)
++    {
++	gScreen->initiateCommon
++			(0, 0, gScreen->o, gScreen->edgeToGridType (), true);
++
++	screen->handleEventSetEnabled (gScreen, false);
++	gScreen->glScreen->glPaintOutputSetEnabled (gScreen, false);
++	grabIsMove = false;
++	gScreen->cScreen->damageRegion (gScreen->desiredSlot);
++    }
++
++    gScreen->edge = NoEdge;
++
++    window->ungrabNotify ();
++}
++
++void
++GridWindow::moveNotify (int dx, int dy, bool immediate)
++{
++    window->moveNotify (dx, dy, immediate);
++
++    pointerBufDx += dx;
++    pointerBufDy += dy;
++}
++
++bool
++GridScreen::restoreWindow (CompAction         *action,
++			   CompAction::State  state,
++			   CompOption::Vector &option)
++{
++    XWindowChanges xwc;
++    CompWindow *cw = screen->findWindow (screen->activeWindow ());
++
++    if (!cw)
++	return false;
++
++    GRID_WINDOW (cw);
++
++    if (!gw->isGridResized)
++	return false;
++
++    if (gw->isGridMaximized & !(cw->state () & MAXIMIZE_STATE))
++	    gw->isGridMaximized = false;
++    else
++    {
++	if (gw->grabIsMove)
++	{
++	    xwc.x = pointerX - (gw->originalSize.width () >> 1);
++	    xwc.y = pointerY + (cw->border ().top >> 1);
++	}
++	else
++	{
++	    xwc.x = gw->originalSize.x ();
++	    xwc.y = gw->originalSize.y ();
++	}
++	xwc.width  = gw->originalSize.width ();
++	xwc.height = gw->originalSize.height ();
++	cw->maximize (0);
++	cw->configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc);
++	gw->pointerBufDx = 0;
++	gw->pointerBufDy = 0;
++    }
++    gw->isGridResized = false;
++    gw->resizeCount = 0;
++
++    return true;
++}
++
++void
++GridScreen::snapbackOptionChanged (CompOption *option,
++				    Options    num)
++{
++    GRID_WINDOW (screen->findWindow
++		    (CompOption::getIntOptionNamed (o, "window")));
++    gw->isGridResized = false;
++    gw->isGridMaximized = false;
++    gw->resizeCount = 0;
++}
++
++
++GridScreen::GridScreen (CompScreen *screen) :
++    PluginClassHandler<GridScreen, CompScreen> (screen),
++    cScreen (CompositeScreen::get (screen)),
++    glScreen (GLScreen::get (screen)),
++    centerCheck (false)
++{
++
++    ScreenInterface::setHandler (screen, false);
++    CompositeScreenInterface::setHandler (cScreen, false);
++    GLScreenInterface::setHandler (glScreen, false);
++
++    edge = lastEdge = NoEdge;
++    currentWorkarea = lastWorkarea = screen->getWorkareaForOutput
++			    (screen->outputDeviceForPoint (pointerX, pointerY));
++
++#define GRIDSET(opt,where,resize)					       \
++    optionSet##opt##Initiate (boost::bind (&GridScreen::initiateCommon, this,  \
++					   _1, _2, _3, where, resize))
++
++    GRIDSET (PutCenterKey, GridCenter, true);
++    GRIDSET (PutLeftKey, GridLeft, true);
++    GRIDSET (PutRightKey, GridRight, true);
++    GRIDSET (PutTopKey, GridTop, true);
++    GRIDSET (PutBottomKey, GridBottom, true);
++    GRIDSET (PutTopleftKey, GridTopLeft, true);
++    GRIDSET (PutToprightKey, GridTopRight, true);
++    GRIDSET (PutBottomleftKey, GridBottomLeft, true);
++    GRIDSET (PutBottomrightKey, GridBottomRight, true);
++    GRIDSET (PutMaximizeKey, GridMaximize, true);
++
++#undef GRIDSET
++
++    optionSetSnapbackWindowsNotify (boost::bind (&GridScreen::
++				    snapbackOptionChanged, this, _1, _2));
++
++    optionSetPutRestoreKeyInitiate (boost::bind (&GridScreen::
++					    restoreWindow, this, _1, _2, _3));
++
++}
++
++GridWindow::GridWindow (CompWindow *window) :
++    PluginClassHandler <GridWindow, CompWindow> (window),
++    window (window),
++    gScreen (GridScreen::get (screen)),
++    grabIsMove (false),
++    isGridResized (false),
++    isGridMaximized (false),
++    pointerBufDx (0),
++    pointerBufDy (0),
++    resizeCount (0),
++    lastTarget (GridUnknown)
++{
++    WindowInterface::setHandler (window);
++}
++
++/* Initial plugin init function called. Checks to see if we are ABI
++ * compatible with core, otherwise unload */
++
++bool
++GridPluginVTable::init ()
++{
++    if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION))
++        return false;
++
++    return true;
++}
+Index: compiz-0.9.4/plugins/grid/src/grid.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ compiz-0.9.4/plugins/grid/src/grid.h	2011-03-23 00:18:34.476828545 +0800
+@@ -0,0 +1,161 @@
++/*
++ * Compiz Fusion Grid plugin
++ *
++ * Copyright (c) 2008 Stephen Kennedy <suasol@xxxxxxxxx>
++ * Copyright (c) 2010 Scott Moreau <oreaus@xxxxxxxxx>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * Description:
++ *
++ * Plugin to act like winsplit revolution (http://www.winsplit-revolution.com/)
++ * use <Control><Alt>NUMPAD_KEY to move and tile your windows.
++ *
++ * Press the tiling keys several times to cycle through some tiling options.
++ */
++
++#include <core/core.h>
++#include <core/atoms.h>
++#include <core/pluginclasshandler.h>
++#include <composite/composite.h>
++#include <opengl/opengl.h>
++
++#include "grid_options.h"
++
++#define SNAPOFF_THRESHOLD 50
++
++typedef enum
++{
++    GridUnknown = 0,
++    GridBottomLeft = 1,
++    GridBottom = 2,
++    GridBottomRight = 3,
++    GridLeft = 4,
++    GridCenter = 5,
++    GridRight = 6,
++    GridTopLeft = 7,
++    GridTop = 8,
++    GridTopRight = 9,
++    GridMaximize = 10
++} GridType;
++
++typedef struct _GridProps
++{
++    int gravityRight;
++    int gravityDown;
++    int numCellsX;
++    int numCellsY;
++} GridProps;
++
++enum Edges
++{
++    NoEdge = 0,
++    BottomLeft,
++    Bottom,
++    BottomRight,
++    Left,
++    Right,
++    TopLeft,
++    Top,
++    TopRight
++};
++
++class GridScreen :
++    public ScreenInterface,
++    public CompositeScreenInterface,
++    public GLScreenInterface,
++    public PluginClassHandler <GridScreen, CompScreen>,
++    public GridOptions
++{
++    public:
++
++	GridScreen (CompScreen *);
++	CompositeScreen *cScreen;
++	GLScreen        *glScreen;
++
++	CompRect workarea, currentRect, desiredSlot,
++		 desiredRect, lastWorkarea, currentWorkarea;
++	GridProps props;
++	Edges edge, lastEdge;
++	CompOption::Vector o;
++	bool centerCheck;
++
++	void getPaintRectangle (CompRect&);
++
++	bool initiateCommon (CompAction*, CompAction::State,
++			     CompOption::Vector&, GridType, bool);
++
++	void glPaintRectangle (const GLScreenPaintAttrib&,
++			       const GLMatrix&, CompOutput *);
++
++	bool glPaintOutput (const GLScreenPaintAttrib &,
++			    const GLMatrix &, const CompRegion &,
++			    CompOutput *, unsigned int);
++
++	GridType edgeToGridType ();
++
++	void handleEvent (XEvent *event);
++
++	bool restoreWindow (CompAction*,
++			    CompAction::State,
++			    CompOption::Vector&);
++
++	void
++	snapbackOptionChanged (CompOption *option,
++				Options    num);
++
++	CompRect
++	slotToRect (CompWindow      *w,
++		    const CompRect& slot);
++	CompRect
++	constrainSize (CompWindow *w,
++		       const CompRect& slot);
++};
++
++class GridWindow :
++    public WindowInterface,
++    public PluginClassHandler <GridWindow, CompWindow>
++{
++    public:
++
++	GridWindow (CompWindow *);
++	CompWindow *window;
++	GridScreen *gScreen;
++
++	bool grabIsMove;
++	bool isGridResized;
++	bool isGridMaximized;
++	int pointerBufDx;
++	int pointerBufDy;
++	int resizeCount;
++	CompRect originalSize;
++	GridType lastTarget;
++
++	void grabNotify (int, int, unsigned int, unsigned int);
++
++	void ungrabNotify ();
++
++	void moveNotify (int, int, bool);
++};
++
++#define GRID_WINDOW(w) \
++    GridWindow *gw = GridWindow::get (w)
++
++class GridPluginVTable :
++    public CompPlugin::VTableForScreenAndWindow <GridScreen, GridWindow>
++{
++    public:
++
++	bool init ();
++};
++
++COMPIZ_PLUGIN_20090315 (grid, GridPluginVTable);
++

=== added file 'debian/patches/086_new_grid_defaults.patch'
--- debian/patches/086_new_grid_defaults.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/086_new_grid_defaults.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,49 @@
+Index: compiz-0.9.4/plugins/grid/grid.xml.in
+===================================================================
+--- compiz-0.9.4.orig/plugins/grid/grid.xml.in	2011-02-24 12:56:38.964211832 +0100
++++ compiz-0.9.4/plugins/grid/grid.xml.in	2011-02-24 13:06:00.650997089 +0100
+@@ -84,7 +84,7 @@
+ 			<option name="top_left_corner_action" type="int">
+ 			    <_short>Upper Left Corner</_short>
+ 			    <_long>Action to be performed when window is dropped on the top left corner</_long>
+-			    <default>7</default>
++			    <default>4</default>
+ 			    <min>0</min>
+ 			    <max>10</max>
+ 			    <desc>
+@@ -186,7 +186,7 @@
+ 			<option name="top_right_corner_action" type="int">
+ 			    <_short>Upper Right Corner</_short>
+ 			    <_long>Action to be performed when window is dropped on the top right corner</_long>
+-			    <default>9</default>
++			    <default>6</default>
+ 			    <min>0</min>
+ 			    <max>10</max>
+ 			    <desc>
+@@ -339,7 +339,7 @@
+ 			<option name="bottom_left_corner_action" type="int">
+ 			    <_short>Bottom Left Corner</_short>
+ 			    <_long>Action to be performed when window is dropped on the bottom left corner</_long>
+-			    <default>1</default>
++			    <default>4</default>
+ 			    <min>0</min>
+ 			    <max>10</max>
+ 			    <desc>
+@@ -390,7 +390,7 @@
+ 			<option name="bottom_edge_action" type="int">
+ 			    <_short>Bottom Edge</_short>
+ 			    <_long>Action to be performed when window is dropped on the bottom edge</_long>
+-			    <default>2</default>
++			    <default>0</default>
+ 			    <min>0</min>
+ 			    <max>10</max>
+ 			    <desc>
+@@ -441,7 +441,7 @@
+ 			<option name="bottom_right_corner_action" type="int">
+ 			    <_short>Bottom Right Corner</_short>
+ 			    <_long>Action to be performed when window is dropped on the bottom right corner</_long>
+-			    <default>3</default>
++			    <default>6</default>
+ 			    <min>0</min>
+ 			    <max>10</max>
+ 			    <desc>

=== added file 'debian/patches/090_git_fix_new_invisible_windows.patch'
--- debian/patches/090_git_fix_new_invisible_windows.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/090_git_fix_new_invisible_windows.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,125 @@
+From e4489612952606501869d63b8119bed61d8ee4ed Mon Sep 17 00:00:00 2001
+From: Sam Spilsbury <sam.spilsbury@xxxxxxxxxxxxx>
+Date: Wed, 23 Mar 2011 22:36:30 +0800
+Subject: [PATCH] Don't treat synthetic UnmapNotify the same as the real UnmapNotify
+
+ICCCM section 4.1.4 says that applications need to send us a synthetic
+UnmapNotify to tell us that the window has been withdrawn in all cases
+to cover the case where a window is already unmapped and then withdrawn.
+
+In this case we should handle the UnmapNotify as a request to withdraw
+the window, but we should only handle the *real* UnmapNotify request
+as a request to actually process the window being unmapped and withdraw
+it there, rather than processing both twice and withdrawing the window
+twice
+---
+ src/event.cpp       |   38 ++++++++++++++++++++++++--------------
+ src/privatewindow.h |    2 ++
+ src/window.cpp      |   11 +++++++++++
+ 3 files changed, 37 insertions(+), 14 deletions(-)
+
+diff --git a/src/event.cpp b/src/event.cpp
+index 5c0769d..b27e8b5 100644
+--- a/src/event.cpp
++++ b/src/event.cpp
+@@ -1122,7 +1122,7 @@ CompScreen::handleEvent (XEvent *event)
+ 	 * and then bypassing MapRequest because it *is* override-redirect
+ 	 * at XMapWindow time, so we need to catch this case and make
+ 	 * sure that windows are tracked here */
+-	
++       
+ 	foreach (CoreWindow *cw, priv->createdWindows)
+ 	{
+ 	    if (cw->priv->id == event->xmap.window)
+@@ -1184,30 +1184,40 @@ CompScreen::handleEvent (XEvent *event)
+ 	    }
+ 	    else /* X -> Withdrawn */
+ 	    {
+-		/* Iconic -> Withdrawn */
++		/* Iconic -> Withdrawn:
++		 *
++		 * The window is already unmapped so we need to check the
++		 * synthetic UnmapNotify that comes and withdraw the window here */
+ 		if (w->state () & CompWindowStateHiddenMask)
+ 		{
+ 		    w->priv->minimized = false;
+-
+ 		    w->changeState (w->state () & ~CompWindowStateHiddenMask);
+ 
+ 		    priv->updateClientList ();
++		    w->priv->withdraw ();
+ 		}
+-		else /* Closing */
++		/* Closing:
++		 *
++		 * ICCCM Section 4.1.4 says that clients need to send
++		 * a synthetic UnmapNotify for every real unmap
++		 * in order to reflect the change in state, but
++		 * since we already withdraw the window on the real
++		 * UnmapNotify, no need to do it again on the synthetic
++		 * one. */
++		else if (!event->xunmap.send_event)
++		{
+ 		    w->windowNotify (CompWindowNotifyClose);
+-
+-		if (!w->overrideRedirect ())
+-		    priv->setWmState (WithdrawnState, w->id ());
+-
+-		w->priv->placed     = false;
+-		w->priv->unmanaging = w->priv->managed;
+-		w->priv->managed    = false;
++		    w->priv->withdraw ();
++		}
+ 	    }
+ 
+-	    w->unmap ();
++	    if (!event->xunmap.send_event)
++	    {
++		w->unmap ();
+ 
+-	    if (!w->shaded () && !w->priv->pendingMaps)
+-		w->moveInputFocusToOtherWindow ();
++		if (!w->shaded () && !w->priv->pendingMaps)
++		    w->moveInputFocusToOtherWindow ();
++	    }
+ 	}
+ 	break;
+     case ReparentNotify:
+diff --git a/src/privatewindow.h b/src/privatewindow.h
+index 4bed1bc..2b2d6a4 100644
+--- a/src/privatewindow.h
++++ b/src/privatewindow.h
+@@ -137,6 +137,8 @@ class PrivateWindow {
+ 
+ 	void show ();
+ 
++	void withdraw ();
++
+ 	bool handlePingTimeout (unsigned int lastPing);
+ 
+ 	void handlePing (int lastPing);
+diff --git a/src/window.cpp b/src/window.cpp
+index 53fe4d8..7ea63ba 100644
+--- a/src/window.cpp
++++ b/src/window.cpp
+@@ -1365,6 +1365,17 @@ CompWindow::unmap ()
+     windowNotify (CompWindowNotifyUnmap);
+ }
+ 
++void
++PrivateWindow::withdraw ()
++{
++    if (!attrib.override_redirect)
++	screen->priv->setWmState (WithdrawnState, id);
++
++    placed     = false;
++    unmanaging = managed;
++    managed    = false;
++}
++
+ bool
+ PrivateWindow::restack (Window aboveId)
+ {
+-- 
+1.7.4.1
+

=== added file 'debian/patches/100_bump_core.h.patch'
--- debian/patches/100_bump_core.h.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/100_bump_core.h.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,13 @@
+Index: compiz-0.9.4git20110322/include/core/core.h
+===================================================================
+--- compiz-0.9.4git20110322.orig/include/core/core.h	2011-03-22 19:34:36.779101039 +0100
++++ compiz-0.9.4git20110322/include/core/core.h	2011-03-22 19:34:50.723170182 +0100
+@@ -27,7 +27,7 @@
+ #define _COMPIZ_CORE_H
+ 
+ 
+-#define CORE_ABIVERSION 20110224
++#define CORE_ABIVERSION 20110322
+ 
+ #include <stdio.h>
+ #include <assert.h>

=== added file 'debian/patches/101_disable_2d_decorations.patch'
--- debian/patches/101_disable_2d_decorations.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/101_disable_2d_decorations.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,42 @@
+Index: compiz-0.9.4git20110322/gtk/window-decorator/gtk-window-decorator.c
+===================================================================
+--- compiz-0.9.4git20110322.orig/gtk/window-decorator/gtk-window-decorator.c	2011-03-22 16:46:56.000000000 +0800
++++ compiz-0.9.4git20110322/gtk/window-decorator/gtk-window-decorator.c	2011-03-25 00:03:23.441180942 +0800
+@@ -415,8 +415,7 @@
+     switcher_p = gwd_get_decor_frame ("switcher");
+ 
+     decor_set_dm_check_hint (xdisplay, gdk_screen_get_number (gdkscreen),
+-			     WINDOW_DECORATION_TYPE_PIXMAP |
+-			     WINDOW_DECORATION_TYPE_WINDOW);
++			     WINDOW_DECORATION_TYPE_PIXMAP);
+ 
+     update_default_decorations (gdkscreen);
+ 
+Index: compiz-0.9.4git20110322/kde/window-decorator-kde4/main.cpp
+===================================================================
+--- compiz-0.9.4git20110322.orig/kde/window-decorator-kde4/main.cpp	2011-03-22 16:46:56.000000000 +0800
++++ compiz-0.9.4git20110322/kde/window-decorator-kde4/main.cpp	2011-03-25 00:03:15.321169033 +0800
+@@ -107,8 +107,7 @@
+     }
+ 
+     decor_set_dm_check_hint (QX11Info::display (), QX11Info::appScreen (),
+-			     WINDOW_DECORATION_TYPE_PIXMAP |
+-			     WINDOW_DECORATION_TYPE_WINDOW);
++			     WINDOW_DECORATION_TYPE_PIXMAP);
+ 
+     if (!app->enableDecorations (timestamp))
+     {
+Index: compiz-0.9.4git20110322/unity/unity_window_decorator/src/gtk-window-decorator.c
+===================================================================
+--- compiz-0.9.4git20110322.orig/unity/unity_window_decorator/src/gtk-window-decorator.c	2011-03-25 00:03:15.201168862 +0800
++++ compiz-0.9.4git20110322/unity/unity_window_decorator/src/gtk-window-decorator.c	2011-03-25 00:03:15.321169033 +0800
+@@ -432,8 +432,7 @@
+     }
+ 
+     decor_set_dm_check_hint (xdisplay, gdk_screen_get_number (gdkscreen),
+-			     WINDOW_DECORATION_TYPE_PIXMAP |
+-			     WINDOW_DECORATION_TYPE_WINDOW);
++			     WINDOW_DECORATION_TYPE_PIXMAP);
+ 
+     update_default_decorations (gdkscreen);
+ 

=== added file 'debian/patches/102_fix_xterm.patch'
--- debian/patches/102_fix_xterm.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/102_fix_xterm.patch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,163 @@
+From 9e5ce1695c21d147987d35292aae5dad76825bf8 Mon Sep 17 00:00:00 2001
+From: Sam Spilsbury <sam.spilsbury@xxxxxxxxxxxxx>
+Date: Fri, 25 Mar 2011 03:06:32 +0800
+Subject: [PATCH] Correctly handle server border width in geometry calculations and
+ adjustment from frame window dimentions to client dimentions
+
+---
+ src/window.cpp         |   14 ++++++------
+ src/windowgeometry.cpp |   57 +++++++++++++++++++++++++----------------------
+ 2 files changed, 37 insertions(+), 34 deletions(-)
+
+Index: compiz-0.9.4git20110322/src/window.cpp
+===================================================================
+--- compiz-0.9.4git20110322.orig/src/window.cpp	2011-03-25 13:59:29.116725630 +0800
++++ compiz-0.9.4git20110322/src/window.cpp	2011-03-25 13:59:29.146725678 +0800
+@@ -1632,9 +1632,9 @@
+ 	return;
+ 
+     x      = ce->x + priv->input.left;
+-    y      = ce->y + priv->input.top;
+-    width  = ce->width - priv->input.left - priv->input.right;
+-    height = ce->height - priv->input.top - priv->input.bottom;
++    y      = ce->y + priv->input.top - priv->serverGeometry.border ();
++    width  = ce->width - priv->serverGeometry.border () * 2 - priv->input.left - priv->input.right;
++    height = ce->height - priv->serverGeometry.border () * 2 - priv->input.top - priv->input.bottom;
+ 
+     if (priv->syncWait)
+     {
+@@ -2429,10 +2429,10 @@
+     {
+ 	XWindowChanges wc = *xwc;
+ 
+-	wc.x      -= input.left;
+-	wc.y      -= input.top;
+-	wc.width  += input.left + input.right;
+-	wc.height += input.top + input.bottom;
++	wc.x      -= input.left - serverGeometry.border ();
++	wc.y      -= input.top - serverGeometry.border ();
++	wc.width  += input.left + input.right + serverGeometry.border ();
++	wc.height += input.top + input.bottom + serverGeometry.border ();
+ 
+ 	XConfigureWindow (screen->dpy (), frame, valueMask, &wc);
+ 	valueMask &= ~(CWSibling | CWStackMode);
+Index: compiz-0.9.4git20110322/src/windowgeometry.cpp
+===================================================================
+--- compiz-0.9.4git20110322.orig/src/windowgeometry.cpp	2011-03-22 16:46:56.000000000 +0800
++++ compiz-0.9.4git20110322/src/windowgeometry.cpp	2011-03-25 13:59:29.146725678 +0800
+@@ -103,19 +103,22 @@
+ int
+ CompWindow::width () const
+ {
+-    return priv->width;
++    return priv->width +
++	    priv->geometry.border ()  * 2;
+ }
+ 
+ int
+ CompWindow::height () const
+ {
+-    return priv->height;
++    return priv->height +
++	    priv->geometry.border ()  * 2;;
+ }
+ 
+ CompSize
+ CompWindow::size () const
+ {
+-    return CompSize (priv->width, priv->height);
++    return CompSize (priv->width + priv->geometry.border ()  * 2,
++		     priv->height + priv->geometry.border ()  * 2);
+ }
+ 
+ int
+@@ -164,65 +167,65 @@
+ CompRect
+ CompWindow::borderRect () const
+ {
+-    return CompRect (priv->geometry.x () - priv->border.left,
+-		     priv->geometry.y () - priv->border.top,
+-		     priv->geometry.width () +
++    return CompRect (priv->geometry.x () - priv->geometry.border () - priv->border.left,
++		     priv->geometry.y () - priv->geometry.border () - priv->border.top,
++		     priv->geometry.width () + priv->geometry.border () * 2 +
+ 		     priv->border.left + priv->border.right,
+-		     priv->geometry.height () +
++		     priv->geometry.height () + priv->geometry.border () * 2 +
+ 		     priv->border.top + priv->border.bottom);
+ }
+ 
+ CompRect
+ CompWindow::serverBorderRect () const
+ {
+-    return CompRect (priv->serverGeometry.x () - priv->border.left,
+-		     priv->serverGeometry.y () - priv->border.top,
+-		     priv->serverGeometry.width () +
++    return CompRect (priv->serverGeometry.x () - priv->geometry.border () - priv->border.left,
++		     priv->serverGeometry.y () - priv->geometry.border () - priv->border.top,
++		     priv->serverGeometry.width () + priv->geometry.border () * 2 +
+ 		     priv->border.left + priv->border.right,
+-		     priv->serverGeometry.height () +
++		     priv->serverGeometry.height () + priv->geometry.border () * 2 +
+ 		     priv->border.top + priv->border.bottom);
+ }
+ 
+ CompRect
+ CompWindow::inputRect () const
+ {
+-    return CompRect (priv->geometry.x () - priv->input.left,
+-		     priv->geometry.y () - priv->input.top,
+-		     priv->geometry.width () +
++    return CompRect (priv->geometry.x () - priv->geometry.border () - priv->input.left,
++		     priv->geometry.y () - priv->geometry.border () - priv->input.top,
++		     priv->geometry.width () + priv->geometry.border () * 2 +
+ 		     priv->input.left + priv->input.right,
+-		     priv->geometry.height () +
++		     priv->geometry.height () +priv->geometry.border () * 2 +
+ 		     priv->input.top + priv->input.bottom);
+ }
+ 
+ CompRect
+ CompWindow::serverInputRect () const
+ {
+-    return CompRect (priv->serverGeometry.x () - priv->input.left,
+-		     priv->serverGeometry.y () - priv->input.top,
+-		     priv->serverGeometry.width () +
++    return CompRect (priv->serverGeometry.x () - priv->serverGeometry.border () - priv->input.left,
++		     priv->serverGeometry.y () - priv->serverGeometry.border () - priv->input.top,
++		     priv->serverGeometry.width () + priv->serverGeometry.border () * 2 +
+ 		     priv->input.left + priv->input.right,
+-		     priv->serverGeometry.height () +
++		     priv->serverGeometry.height () + priv->serverGeometry.border () * 2 +
+ 		     priv->input.top + priv->input.bottom);
+ }
+ 
+ CompRect
+ CompWindow::outputRect () const
+ {
+-    return CompRect (priv->geometry.x () - priv->output.left,
+-		     priv->geometry.y () - priv->output.top,
+-		     priv->geometry.width () +
++    return CompRect (priv->geometry.x () - priv->serverGeometry.border ()- priv->output.left,
++		     priv->geometry.y () - priv->serverGeometry.border () - priv->output.top,
++		     priv->geometry.width () + priv->serverGeometry.border () * 2 +
+ 		     priv->output.left + priv->output.right,
+-		     priv->geometry.height () +
++		     priv->geometry.height () + priv->serverGeometry.border () * 2 +
+ 		     priv->output.top + priv->output.bottom);
+ }
+ 
+ CompRect
+ CompWindow::serverOutputRect () const
+ {
+-    return CompRect (priv->serverGeometry.x () - priv->output.left,
+-		     priv->serverGeometry.y () - priv->output.top,
+-		     priv->serverGeometry.width () +
++    return CompRect (priv->serverGeometry.x () - priv->serverGeometry.border () -  priv->output.left,
++		     priv->serverGeometry.y () - priv->serverGeometry.border () - priv->output.top,
++		     priv->serverGeometry.width () + priv->serverGeometry.border () * 2 +
+ 		     priv->output.left + priv->output.right,
+-		     priv->serverGeometry.height () +
++		     priv->serverGeometry.height () + priv->serverGeometry.border () * 2 +
+ 		     priv->output.top + priv->output.bottom);
+ }

=== added file 'debian/patches/series'
--- debian/patches/series	1970-01-01 00:00:00 +0000
+++ debian/patches/series	2011-04-04 12:01:15 +0000
@@ -0,0 +1,13 @@
+01_unity_window_decorator.patch
+02_add_debug_spewer_for_apport.patch
+018_use_metacity_settings.patch
+029_default_options.patch
+030_no_fade_in_staticswicher.patch
+060_move_checks_to_compiz.patch
+065_add_bailer_and_detection_plugins.patch
+085_add_grid_plugin.patch
+086_new_grid_defaults.patch
+090_git_fix_new_invisible_windows.patch
+100_bump_core.h.patch
+101_disable_2d_decorations.patch
+102_fix_xterm.patch

=== added file 'debian/rules'
--- debian/rules	1970-01-01 00:00:00 +0000
+++ debian/rules	2011-04-04 12:01:15 +0000
@@ -0,0 +1,52 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CORE_ABIVERSION := $(shell sed -rn 's/^\#define[[:space:]]+CORE_ABIVERSION[[:space:]]+//p' include/core/core.h )
+
+# generated via:
+#  python -c "import compizconfig; print ','.join(compizconfig.Context().Plugins['core'].Display['active_plugins'].Value)"
+DEFAULT_PLUGINS = "core bailer detection composite opengl decor mousepoll vpswitch regex animation snap expo move compiztoolbox place grid imgpng gnomecompat wall ezoom workarounds staticswitcher resize fade scale session"
+
+override_dh_auto_configure:
+	# currently, segfault if CMAKE_BUILD_TYPE=Release
+	dh_auto_configure -- -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_DEFAULT_PLUGINS=\"$(DEFAULT_PLUGINS)\" -DCMAKE_BUILD_TYPE=Debug -DCOMPIZ_PACKAGING_ENABLED=TRUE
+
+override_dh_install:
+	# Language packs
+	for d in $$(find debian/tmp -type f \( -name "*.desktop" -o -name "*.directory" \) ); do \
+		sed -ri '/^(Name|GenericName|Comment|X-GNOME-FullName)\[/d' $$d; \
+		echo "X-Ubuntu-Gettext-Domain=compiz" >> $$d; \
+	done; \
+    for d in $$(find debian/tmp -type f -name "*.schemas" ); do \
+		GETTEXT_DOMAIN="compiz" perl /usr/lib/cdbs/strip-schema.pl $$d > $$d.new; mv $$d.new $$d; \
+	done;
+
+	# create compiz keybindings file based on the metacity ones
+	mkdir -p $(CURDIR)/debian/tmp/usr/share/gnome-control-center/keybindings/
+	sed 's/wm_name=\"Metacity\" package=\"metacity\"/wm_name=\"Compiz\" package=\"compiz\"/'  /usr/share/gnome-control-center/keybindings/50-metacity-desktop-key.xml > $(CURDIR)/debian/tmp/usr/share/gnome-control-center/keybindings/50-compiz-desktop-key.xml
+	sed 's/wm_name=\"Metacity\" package=\"metacity\"/wm_name=\"Compiz\" package=\"compiz\"/'  /usr/share/gnome-control-center/keybindings/50-metacity-key.xml > $(CURDIR)/debian/tmp/usr/share/gnome-control-center/keybindings/50-compiz-key.xml
+	sed -i 's#key=\"/apps/metacity/general/num_workspaces\" comparison=\"gt\"##g' $(CURDIR)/debian/tmp/usr/share/gnome-control-center/keybindings/50-compiz-key.xml
+
+	# add some selected keys
+	sed -i -f debian/compiz-keybindings.sed $(CURDIR)/debian/tmp/usr/share/gnome-control-center/keybindings/50-compiz-desktop-key.xml
+
+	# cmake findcompiz_install use COMPIZ_DESTDIR and using COMPIZ_DESTDIR and
+	# DESTDIR together is completely broken upstream
+	# So, doing the same in debian/rules to find a way to install things in the
+	# right place, sorry for the kittens
+	cmake_dir=`cmake --system-information 2> /dev/null | grep "^CMAKE_ROOT " | sed -e 's/.*"\(.*\)"/\1/'` && \
+	mkdir -p debian/tmp$${cmake_dir}/Modules && cp cmake/FindCompiz.cmake debian/tmp$${cmake_dir}/Modules
+
+	dh_install --fail-missing
+	rm debian/compiz-plugins/usr/share/compiz/core.xml
+
+override_dh_gencontrol:
+	dh_gencontrol -- -Vcoreabiversion=$(CORE_ABIVERSION)
+
+
+%:
+	dh $@
+

=== added directory 'debian/source'
=== added file 'debian/source/format'
--- debian/source/format	1970-01-01 00:00:00 +0000
+++ debian/source/format	2011-04-04 12:01:15 +0000
@@ -0,0 +1,1 @@
+3.0 (quilt)

=== added file 'debian/source_compiz.py'
--- debian/source_compiz.py	1970-01-01 00:00:00 +0000
+++ debian/source_compiz.py	2011-04-04 12:01:15 +0000
@@ -0,0 +1,34 @@
+import apport.packaging
+
+def add_info(report, ui):
+
+    # if it's a stacktrace, report it directly against the right component
+    if report.has_key("Stacktrace"):
+        for external_component in ("/usr/lib/libnux", "/usr/lib/compiz/libunityshell", "/usr/lib/libunity"):
+            for words in report["Stacktrace"].split():
+                if words.startswith(external_component):
+                    report.add_package_info(apport.packaging.get_file_package(words))
+                    return
+        report.add_hooks_info(ui, srcpackage='xorg')
+        return
+
+    
+    # ok, add maximum interesting info without too much spam
+    report['CompizPlugins'] = command_output(['gconftool-2',
+        '--get', '/apps/compiz-1/general/screen0/options/active_plugins'])
+    # User configuration
+    report['GconfCompiz'] = command_output(['gconftool-2', '-R', '/apps/compiz-1'])
+
+    unity_bug = False
+    if ui and "unity" in report['CompizPlugins'] and report['SourcePackage'] != "unity":
+        if ui.yesno("Thanks for reporting this bug. It seems you have unity running. Is the issue you are reporting is related to unity itself rather than compiz?"):
+            unity_bug = True
+            
+    if unity_bug:
+        report.add_package_info('unity')
+        report.add_hooks_info(ui, srcpackage='unity')
+        return
+
+    # add all relevant info like xorg ones
+    report.add_hooks_info(ui, srcpackage='xorg')
+    

=== added file 'debian/unity.ini'
--- debian/unity.ini	1970-01-01 00:00:00 +0000
+++ debian/unity.ini	2011-04-04 12:01:15 +0000
@@ -0,0 +1,3 @@
+[core]
+s0_active_plugins = core;bailer;detection;composite;opengl;decor;mousepoll;vpswitch;regex;animation;snap;expo;move;compiztoolbox;place;grid;imgpng;gnomecompat;wall;ezoom;workarounds;staticswitcher;resize;fade;unitymtgrabhandles;scale;session;unityshell
+

=== added file 'debian/watch'
--- debian/watch	1970-01-01 00:00:00 +0000
+++ debian/watch	2011-04-04 12:01:15 +0000
@@ -0,0 +1,3 @@
+version=3
+http://releases.compiz.org/([\d\.]+)[02468]/ compiz-(\d.*)\.tar\.gz
+