Home | History | Annotate | Download | only in patches
      1 diff -Nrup -x '*.orig' -x '*.rej' -x '*.*~' gnome-control-center-2.28.0/capplets/appearance/Makefile.am ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/Makefile.am
      2 --- gnome-control-center-2.28.0/capplets/appearance/Makefile.am	2009-07-16 16:33:13.000000000 +0200
      3 +++ ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/Makefile.am	2009-10-16 09:52:28.248513437 +0200
      4 @@ -9,6 +9,8 @@ gnome_appearance_properties_SOURCES = \
      5  	appearance.h \
      6  	appearance-desktop.c \
      7  	appearance-desktop.h \
      8 +	appearance-effects.c\
      9 +	appearance-effects.h\
     10  	appearance-font.c \
     11  	appearance-font.h \
     12  	appearance-main.c \
     13 diff -Nrup -x '*.orig' -x '*.rej' -x '*.*~' gnome-control-center-2.28.0/capplets/appearance/appearance-effects.c ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/appearance-effects.c
     14 --- gnome-control-center-2.28.0/capplets/appearance/appearance-effects.c	1970-01-01 01:00:00.000000000 +0100
     15 +++ ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/appearance-effects.c	2009-10-16 09:52:50.817685824 +0200
     16 @@ -0,0 +1,1234 @@
     17 +/*
     18 + * Copyright (C) 2007 Canonical
     19 + * Written by Michael Vogt <mvo (a] ubuntu.com>
     20 + * and Mirco Mller <mirco (a] ubuntu.com>
     21 + * All Rights Reserved
     22 + *
     23 + * Based on desktop-effects.c:
     24 + *   Desktop Effects. A preference panel for compiz.
     25 + *   Copyright (C) 2006   Red Hat, Inc.
     26 + * Author: Soren Sandmann (sandmann (a] redhat.com) *
     27 + *
     28 + * This program is free software; you can redistribute it and/or modify
     29 + * it under the terms of the GNU General Public License as published by
     30 + * the Free Software Foundation; either version 2 of the License, or
     31 + * (at your option) any later version.
     32 + *
     33 + * This program is distributed in the hope that it will be useful,
     34 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
     35 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     36 + * GNU General Public License for more details.
     37 + *
     38 + * You should have received a copy of the GNU General Public License along
     39 + * with this program; if not, write to the Free Software Foundation, Inc.,
     40 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     41 + */
     42 +
     43 +#include <glib.h>
     44 +#include <glib/gstdio.h>
     45 +#include <glib/gi18n.h>
     46 +#include <X11/Xlib.h>
     47 +#include <X11/Xatom.h>
     48 +#include <gdk/gdkx.h>
     49 +#include <X11/extensions/Xcomposite.h>
     50 +#include <math.h>
     51 +
     52 +#include "appearance.h"
     53 +
     54 +#include "gconf-property-editor.h"
     55 +
     56 +typedef enum {
     57 +	COMPIZ,
     58 +	METACITY
     59 +} WindowManager;
     60 +
     61 +#define WINDOW_MANAGER_KEY "/desktop/gnome/session/required_components/windowmanager"
     62 +#define COMPIZ_BIN	   "compiz"
     63 +#define METACITY_BIN	   "metacity"
     64 +#define REVERT_COUNT	   40
     65 +#define SECONDS_WE_WILL_WAIT_FOR_COMPIZ_TO_START 8
     66 +#define PLUGIN_LIST_KEY	   "/apps/compiz/general/allscreens/options/active_plugins"
     67 +#define NUM_WORKSPACES	   "/apps/metacity/general/num_workspaces"
     68 +
     69 +/* helper structure to pass pager data around */
     70 +typedef struct _TraversalChunk {
     71 +	GConfClient *client;
     72 +	GArray	    *numRowsArray;
     73 +	gint	    rows;
     74 +} TraversalChunk;
     75 +
     76 +/* possible effects level */
     77 +enum {
     78 +	NO_EFFECTS, 
     79 +	NORMAL_EFFECTS, 
     80 +	EXTRA_EFFECTS, 
     81 +	CUSTOM_EFFECTS
     82 +};
     83 +
     84 +/* radio-button names in glade-file */
     85 +static const char *effect_choices[] =  {
     86 +	"no_effects_button",
     87 +	"normal_effects_button", 
     88 +	"extra_effects_button",
     89 +	"custom_effects_button"
     90 +};
     91 +
     92 +/* plugin-set for extra-effects level */
     93 +static const gchar* extra_effects[] = {
     94 +
     95 +"dbus",
     96 +"move",
     97 +"place",
     98 +"png",
     99 +"regex",
    100 +"resize",
    101 +"svg",
    102 +"water",
    103 +"imgjpeg",
    104 +"mousepoll",
    105 +"resizeinfo",
    106 +"session",
    107 +"text",
    108 +"thumbnail",
    109 +"workarounds",
    110 +"firepaint",
    111 +"shelf",
    112 +"decoration",
    113 +"wobbly",
    114 +"animation",
    115 +"shift",
    116 +"fade",
    117 +"group",
    118 +"cube",
    119 +"rotate",
    120 +"scale",
    121 +"3d",
    122 +"cubeaddon",
    123 +"scalefilter",
    124 +"expo",
    125 +"ezoom",
    126 +NULL
    127 +};
    128 +
    129 +static gboolean
    130 +check_compiz (void)
    131 +{
    132 +	return g_file_test ("/usr/bin/compiz", G_FILE_TEST_IS_EXECUTABLE);
    133 +}
    134 +
    135 +static gboolean
    136 +check_ccsm (void)
    137 +{
    138 +	return g_file_test ("/usr/bin/ccsm", G_FILE_TEST_IS_EXECUTABLE);
    139 +}
    140 +static void
    141 +run_ccsm (GtkButton *widget,
    142 +	  gpointer  data)
    143 +{
    144 +	g_spawn_command_line_async ("/usr/bin/ccsm", NULL);
    145 +}
    146 +static gboolean
    147 +check_compiz_configure (void)
    148 +{
    149 +	return g_file_test ("/usr/lib/compiz/compiz-configure", G_FILE_TEST_IS_EXECUTABLE);
    150 +}
    151 +static void
    152 +run_compiz_configure (GtkButton *widget,
    153 +		      gpointer  data)
    154 +{
    155 +	g_spawn_command_line_async ("/usr/lib/compiz/compiz-configure", NULL);
    156 +}
    157 +
    158 +
    159 +static GSList *
    160 +get_plugins (AppearanceData *app,
    161 +	     GError	    **err)
    162 +{
    163 +	return gconf_client_get_list (app->client,
    164 +				      PLUGIN_LIST_KEY,
    165 +				      GCONF_VALUE_STRING,
    166 +				      err);
    167 +}
    168 +
    169 +static gboolean
    170 +contains_string (GSList	     *plugins,
    171 +		 const gchar *needle)
    172 +{
    173 +	GSList *slist;
    174 +
    175 +	for (slist = plugins; slist != NULL; slist = slist->next)
    176 +	{
    177 +		const char *s = slist->data;
    178 +
    179 +		if (s && strcmp (s, needle) == 0)
    180 +			return TRUE;
    181 +	}
    182 +
    183 +	return FALSE;
    184 +}
    185 +
    186 +
    187 +static void
    188 +show_info (const char *text)
    189 +{
    190 +	GtkWidget *dialog;
    191 +
    192 +	dialog = gtk_message_dialog_new (NULL,
    193 +					 GTK_DIALOG_MODAL,
    194 +					 GTK_MESSAGE_INFO,
    195 +					 GTK_BUTTONS_OK,
    196 +					 text);
    197 +
    198 +	gtk_dialog_run (GTK_DIALOG (dialog));
    199 +	gtk_widget_destroy (dialog);
    200 +}
    201 +
    202 +static gchar*
    203 +get_string_value (GConfClient* client,
    204 +		  const gchar* key)
    205 +{
    206 +	gchar  *value = NULL;
    207 +	GError *error = NULL;
    208 +
    209 +	g_assert (client != NULL);
    210 +	g_assert (key    != NULL);
    211 +
    212 +	value = gconf_client_get_string (client, key, &error);
    213 +	if (error)
    214 +		return NULL;
    215 +
    216 +	return value;
    217 +}
    218 +
    219 +static gint
    220 +get_int_value (GConfClient* client,
    221 +	       const gchar* key)
    222 +{
    223 +	gint	value = 0;
    224 +	GError*	error = NULL;
    225 +
    226 +	g_assert (client != NULL);
    227 +	g_assert (key    != NULL);
    228 +
    229 +	value = gconf_client_get_int (client, key, &error);
    230 +	if (error)
    231 +		return 0;
    232 +
    233 +	return value;
    234 +}
    235 +
    236 +static void
    237 +check_for_wnck_entry (gpointer data,
    238 +		      gpointer user_data)
    239 +{
    240 +	gchar		*appletId	= (gchar*) data;
    241 +	TraversalChunk	*chunk		= (TraversalChunk*) user_data;
    242 +	GString		*propertyPath	= NULL;
    243 +	gchar		*value		= NULL;
    244 +	gint		rows		= 0;
    245 +	gint		position	= 0;
    246 +
    247 +	/* get bonobo-id of applet */
    248 +	propertyPath = g_string_new ("/apps/panel/applets/");
    249 +	propertyPath = g_string_append (propertyPath, appletId);
    250 +	propertyPath = g_string_append (propertyPath, "/bonobo_iid");
    251 +	value = get_string_value (chunk->client, propertyPath->str);
    252 +
    253 +	/* just exit if no bonobo-id was found */
    254 +	if (!value)
    255 +	{
    256 +		g_string_free (propertyPath, TRUE);
    257 +		return;
    258 +	}
    259 +
    260 +	/* test if it is actually a switcher */
    261 +	if (!g_ascii_strncasecmp (value,
    262 +				  "OAFIID:GNOME_WorkspaceSwitcherApplet",
    263 +				  36))
    264 +	{
    265 +		/* assemble new gconf-path for num_rows gconf-key */
    266 +		g_string_free (propertyPath, TRUE);
    267 +		propertyPath = g_string_new ("/apps/panel/applets/");
    268 +		propertyPath = g_string_append (propertyPath, appletId);
    269 +		propertyPath = g_string_append (propertyPath, "/position");
    270 +
    271 +		/* get the value of position */
    272 +		position = get_int_value (chunk->client, propertyPath->str);
    273 +
    274 +		if (position > 1)
    275 +		{
    276 +			/* assemble new gconf-path for num_rows gconf-key */
    277 +			g_string_free (propertyPath, TRUE);
    278 +			propertyPath = g_string_new ("/apps/panel/applets/");
    279 +			propertyPath = g_string_append (propertyPath, appletId);
    280 +			propertyPath = g_string_append (propertyPath,
    281 +							"/prefs/num_rows");
    282 +
    283 +			/* get the value of rows */
    284 +			rows = get_int_value (chunk->client, propertyPath->str);
    285 +
    286 +			if (!chunk->numRowsArray)
    287 +				chunk->numRowsArray = g_array_new (TRUE,
    288 +								   TRUE,
    289 +								   sizeof (gint));
    290 +
    291 +			g_array_append_val (chunk->numRowsArray, rows);
    292 +		}
    293 +	}
    294 +
    295 +	g_string_free (propertyPath, TRUE);
    296 +}
    297 +
    298 +gboolean
    299 +set_int_value (GConfClient *client,
    300 +               const gchar *key,
    301 +               gint        value)
    302 +{
    303 +	gboolean result = FALSE;
    304 +	GError   *error = NULL;
    305 +
    306 +	g_assert (client != NULL);
    307 +	g_assert (key    != NULL);
    308 +
    309 +	result = gconf_client_set_int (client,
    310 +				       key,
    311 +				       value,
    312 +				       &error);
    313 +
    314 +	if (error)
    315 +		return FALSE;
    316 +
    317 +	return result;
    318 +}
    319 +
    320 +static void
    321 +set_wnck_entry (gpointer data,
    322 +                gpointer user_data)
    323 +{
    324 +	gchar		*appletId	= (gchar*) data;
    325 +	TraversalChunk	*chunk		= (TraversalChunk*) user_data;
    326 +	GString		*propertyPath	= NULL;
    327 +	gchar		*value		= NULL;
    328 +	gint		position	= 0;
    329 +
    330 +	/* get bonobo-id of applet */
    331 +	propertyPath = g_string_new ("/apps/panel/applets/");
    332 +	propertyPath = g_string_append (propertyPath, appletId);
    333 +	propertyPath = g_string_append (propertyPath, "/bonobo_iid");
    334 +	value = get_string_value (chunk->client, propertyPath->str);
    335 +
    336 +	/* just exit if no bonobo-id was found */
    337 +	if (!value)
    338 +	{
    339 +		g_string_free (propertyPath, TRUE);
    340 +		return;
    341 +	}
    342 +
    343 +	/* test if it is actually a switcher */
    344 +	if (!g_ascii_strncasecmp (value,
    345 +				  "OAFIID:GNOME_WorkspaceSwitcherApplet",
    346 +				  36))
    347 +	{
    348 +		/* assemble new gconf-path for applets position gconf-key */
    349 +		g_string_free (propertyPath, TRUE);
    350 +		propertyPath = g_string_new ("/apps/panel/applets/");
    351 +		propertyPath = g_string_append (propertyPath, appletId);
    352 +		propertyPath = g_string_append (propertyPath, "/position");
    353 +
    354 +		/* get the value of position */
    355 +		position = get_int_value (chunk->client, propertyPath->str);
    356 +
    357 +		/* not the best way to test, if this applet is really active */
    358 +		if (position > 1)
    359 +		{
    360 +			/* assemble new gconf-path for num_rows gconf-key */
    361 +			g_string_free (propertyPath, TRUE);
    362 +			propertyPath = g_string_new ("/apps/panel/applets/");
    363 +			propertyPath = g_string_append (propertyPath, appletId);
    364 +			propertyPath = g_string_append (propertyPath,
    365 +							"/prefs/num_rows");
    366 +
    367 +			/* set the value of rows */
    368 +			set_int_value (chunk->client,
    369 +				       propertyPath->str,
    370 +				       chunk->rows);
    371 +		}
    372 +	}
    373 +
    374 +	/* cleanup */
    375 +	g_string_free (propertyPath, TRUE);
    376 +}
    377 +
    378 +static gint
    379 +get_pager_num_rows (GConfClient *client)
    380 +{
    381 +	GSList         *idList = NULL;
    382 +	TraversalChunk *chunk  = NULL;
    383 +	gint           rows    = 0;
    384 +
    385 +	/* get ids of all used applets */
    386 +	idList = gconf_client_get_list (client,
    387 +					"/apps/panel/general/applet_id_list",
    388 +					GCONF_VALUE_STRING,
    389 +					NULL);
    390 +
    391 +	if (!idList)
    392 +		return 1;
    393 +
    394 +	/* create and initialize helper-structure */
    395 +	chunk = g_new0 (TraversalChunk, 1);
    396 +	if (!chunk)
    397 +	{
    398 +		g_slist_free (idList);
    399 +		return 1;
    400 +	}
    401 +
    402 +	chunk->client = client;
    403 +
    404 +	/* search list of applets for wnck-applet */
    405 +	g_slist_foreach (idList,
    406 +			 check_for_wnck_entry,
    407 +			 (gpointer) chunk);
    408 +
    409 +	if (chunk->numRowsArray == NULL)
    410 +		rows = 1;
    411 +	else
    412 +		rows = g_array_index (chunk->numRowsArray, gint, 0);
    413 +
    414 +	/* clean up */
    415 +	g_slist_free (idList);
    416 +	g_array_free (chunk->numRowsArray, TRUE);
    417 +	g_free (chunk);
    418 +
    419 +	return rows;
    420 +}
    421 +
    422 +/* sets the number of rows of the first pager-applet found */
    423 +void static
    424 +set_pager_num_rows (GConfClient *client,
    425 +                    gint        rows)
    426 +{
    427 +	GSList         *idList = NULL;
    428 +	TraversalChunk *chunk  = NULL;
    429 +
    430 +	/* get ids of all used applets */
    431 +	idList = gconf_client_get_list (client,
    432 +					"/apps/panel/general/applet_id_list",
    433 +					GCONF_VALUE_STRING,
    434 +					NULL);
    435 +
    436 +	/* if nothing is found at least return 1 to avoid a div. by 0 later */
    437 +	if (!idList)
    438 +		return;
    439 +
    440 +	/* create and initialize helper-structure */
    441 +	chunk = g_new0 (TraversalChunk, 1);
    442 +	if (!chunk)
    443 +	{
    444 +		g_slist_free (idList);
    445 +		return;
    446 +	}
    447 +
    448 +	chunk->client = client;
    449 +	chunk->rows = rows;
    450 +
    451 +	/* search list of applets for wnck-applet */
    452 +	g_slist_foreach (idList,
    453 +			 set_wnck_entry,
    454 +			 (gpointer) chunk);
    455 +
    456 +	/* clean up */
    457 +	g_slist_free (idList);
    458 +	g_array_free (chunk->numRowsArray, TRUE);
    459 +	g_free (chunk);
    460 +}
    461 +
    462 +static void
    463 +apply_settings (AppearanceData	*app,
    464 +		gboolean	effects_enabled)
    465 +{
    466 +	const char *str = effects_enabled? COMPIZ_BIN : METACITY_BIN;
    467 +	char	   *session_file;
    468 +	gint	   vsize;
    469 +	gint	   hsize;
    470 +	gint	   workspaces;
    471 +	gint	   rows;
    472 +
    473 +	gconf_client_set_string (app->client,
    474 +				 WINDOW_MANAGER_KEY,
    475 +				 str,
    476 +				 NULL);
    477 +
    478 +	session_file = g_build_filename (g_get_home_dir (),
    479 +					 ".gnome2",
    480 +					 "session",
    481 +					 NULL);
    482 +
    483 +	g_unlink (session_file);
    484 +	g_free (session_file);
    485 +
    486 +	/* here the whole logic for mapping any N:M workspace-layout from
    487 +	 * metacity to compiz or vice versa is handled, currently only
    488 +	 * implemented for one-screen setups */
    489 +	if (effects_enabled)
    490 +	{
    491 +		workspaces = get_int_value (app->client,
    492 +				            "/apps/metacity/general/num_workspaces");
    493 +		rows = get_pager_num_rows (app->client);
    494 +		set_int_value (app->client,
    495 +			       "/apps/compiz/general/screen0/options/vsize",
    496 +			       rows);
    497 +		set_int_value (app->client,
    498 +			       "/apps/compiz/general/screen0/options/hsize",
    499 +			       (gint) ceilf ((gfloat) workspaces / (gfloat) rows));
    500 +		set_pager_num_rows (app->client, 1);
    501 +	}
    502 +	else if (app->compiz_was_running)
    503 +	{
    504 +		vsize = get_int_value (app->client,
    505 +				       "/apps/compiz/general/screen0/options/vsize");
    506 +		hsize = get_int_value (app->client,
    507 +				       "/apps/compiz/general/screen0/options/hsize");
    508 +		set_int_value (app->client,
    509 +			       "/apps/metacity/general/num_workspaces",
    510 +			       vsize * hsize);
    511 +		set_pager_num_rows (app->client, vsize);
    512 +	}
    513 +}
    514 +
    515 +static void
    516 +set_busy (GtkWidget *widget,
    517 +	  gboolean  busy)
    518 +{
    519 +	GdkCursor *cursor;
    520 +
    521 +	if (busy)
    522 +		cursor = gdk_cursor_new (GDK_WATCH);
    523 +	else
    524 +		cursor = NULL;
    525 +
    526 +	gdk_window_set_cursor (widget->window, cursor);
    527 +
    528 +	if (cursor)
    529 +		gdk_cursor_unref (cursor);
    530 +
    531 +	gdk_flush ();
    532 +}
    533 +
    534 +/* get_wm_window() and current_window_manager() are essentially cutted and
    535 + * pasted from gnome-wm.c from gnome-control-center. */
    536 +static Window
    537 +get_wm_window (void)
    538 +{
    539 +	Window	*xwindow;
    540 +	Atom	type;
    541 +	gint	format;
    542 +	gulong	nitems;
    543 +	gulong	bytes_after;
    544 +	Window	result;
    545 +
    546 +	XGetWindowProperty (GDK_DISPLAY (),
    547 +			    GDK_ROOT_WINDOW (),
    548 +			    XInternAtom (GDK_DISPLAY (),
    549 +			    		 "_NET_SUPPORTING_WM_CHECK",
    550 +			    		 False),
    551 +			    0,
    552 +			    G_MAXLONG,
    553 +			    False,
    554 +			    XA_WINDOW,
    555 +			    &type,
    556 +			    &format,
    557 +			    &nitems,
    558 +			    &bytes_after,
    559 +			    (guchar **) &xwindow);
    560 +
    561 +	if (type != XA_WINDOW)
    562 +		return None;
    563 +
    564 +	gdk_error_trap_push ();
    565 +	XSelectInput (GDK_DISPLAY (),
    566 +		      *xwindow,
    567 +		      StructureNotifyMask | PropertyChangeMask);
    568 +	XSync (GDK_DISPLAY (), False);
    569 +
    570 +	if (gdk_error_trap_pop ())
    571 +	{
    572 +		XFree (xwindow);
    573 +		return None;
    574 +	}
    575 +
    576 +	result = *xwindow;
    577 +	XFree (xwindow);
    578 +
    579 +	return result;
    580 +}
    581 +
    582 +static char*
    583 +get_current_window_manager (void)
    584 +{
    585 +	Atom	utf8_string;
    586 +	Atom	atom;
    587 +	Atom	type;
    588 +	int	result;
    589 +	char	*retval;
    590 +	int	format;
    591 +	gulong	nitems;
    592 +	gulong	bytes_after;
    593 +	gchar	*val;
    594 +	Window	wm_window = get_wm_window ();
    595 +
    596 +	utf8_string = XInternAtom (GDK_DISPLAY (), "UTF8_STRING", False);
    597 +	atom = XInternAtom (GDK_DISPLAY (), "_NET_WM_NAME", False);
    598 +
    599 +	gdk_error_trap_push ();
    600 +
    601 +	result = XGetWindowProperty (GDK_DISPLAY (),
    602 +				     wm_window,
    603 +				     atom,
    604 +				     0,
    605 +				     G_MAXLONG,
    606 +				     False,
    607 +				     utf8_string,
    608 +				     &type,
    609 +				     &format,
    610 +				     &nitems,
    611 +				     &bytes_after,
    612 +				     (guchar **)&val);
    613 +
    614 +	if (gdk_error_trap_pop () || result != Success)
    615 +		return NULL;
    616 +
    617 +	if (type != utf8_string || format != 8 || nitems == 0)
    618 +	{
    619 +		if (val)
    620 +			XFree (val);
    621 +
    622 +		return NULL;
    623 +	}
    624 +    
    625 +	if (!g_utf8_validate (val, nitems, NULL))
    626 +	{
    627 +		XFree (val);
    628 +		return NULL;
    629 +	}
    630 +
    631 +	retval = g_strndup (val, nitems);
    632 +
    633 +	XFree (val);
    634 +
    635 +	return retval;
    636 +}
    637 +
    638 +static gboolean
    639 +compiz_started (void)
    640 +{
    641 +	gboolean result;
    642 +	char	 *wm = get_current_window_manager ();
    643 +
    644 +	result = wm && strcmp (wm, "compiz") == 0;
    645 +
    646 +	g_free (wm);
    647 +
    648 +	return result;
    649 +}
    650 +
    651 +typedef struct TimedDialogInfo {
    652 +	AppearanceData	*app;
    653 +	GTimer		*timer;
    654 +	GtkWidget	*button;
    655 +} TimedDialogInfo;
    656 +
    657 +static WindowManager
    658 +current_configured_wm (AppearanceData *app,
    659 +		       GError	      **err)
    660 +{
    661 +	GError *tmp = NULL;
    662 +
    663 +	const char *str = gconf_client_get_string (app->client,
    664 +						   WINDOW_MANAGER_KEY,
    665 +						   &tmp);
    666 +
    667 +	if (tmp)
    668 +	{
    669 +		g_propagate_error (err, tmp);
    670 +		return METACITY;
    671 +	}
    672 +
    673 +	if (str && strcmp (str, COMPIZ_BIN) == 0)
    674 +		return COMPIZ;
    675 +	else
    676 +		return METACITY;
    677 +}
    678 +
    679 +static void
    680 +show_error (const GError *err)
    681 +{
    682 +	GtkWidget *dialog;
    683 +
    684 +	if (!err)
    685 +		return;
    686 +
    687 +	dialog = gtk_message_dialog_new (NULL,
    688 +					 GTK_DIALOG_DESTROY_WITH_PARENT,
    689 +					 GTK_MESSAGE_WARNING,
    690 +					 GTK_BUTTONS_OK,
    691 +					 err->message);
    692 +
    693 +	gtk_window_set_title (GTK_WINDOW (dialog), "");
    694 +
    695 +	gtk_dialog_run (GTK_DIALOG (dialog));
    696 +	gtk_widget_destroy (dialog);
    697 +}
    698 +
    699 +struct TimeoutData {
    700 +	int	  time;
    701 +	GtkLabel  *label;
    702 +	GtkDialog *dialog;
    703 +	gboolean  timed_out;
    704 +};
    705 +
    706 +static gboolean
    707 +free_at_idle (gpointer data)
    708 +{
    709 +	g_free (data);
    710 +	return FALSE;
    711 +}
    712 +
    713 +static char*
    714 +idle_free (char *str)
    715 +{
    716 +	g_idle_add (free_at_idle, str);
    717 +	return str;
    718 +}
    719 +
    720 +static char *
    721 +timeout_string (int time)
    722 +{
    723 +	/* SUN_BRANDING */
    724 +	char *str = g_strdup_printf (ngettext ("Testing the new settings. If you don't respond in %d second the previous settings will be restored.", "Testing the new settings. If you don't respond in %d seconds the previous settings will be restored.", time), time);
    725 +
    726 +	return idle_free (str);
    727 +}
    728 +
    729 +static gboolean
    730 +save_timeout_callback (gpointer data)
    731 +{
    732 +	struct TimeoutData *timeData = data;
    733 +
    734 +	timeData->time--;
    735 +
    736 +	if (timeData->time == 0)
    737 +	{
    738 +		gtk_dialog_response (timeData->dialog, GTK_RESPONSE_NO);
    739 +		timeData->timed_out = TRUE;
    740 +		return FALSE;
    741 +	}
    742 +
    743 +	gtk_label_set_text (timeData->label, timeout_string (timeData->time));
    744 +
    745 +	return TRUE;
    746 +}
    747 +
    748 +static gboolean
    749 +run_timed_dialog (AppearanceData *app)
    750 +{
    751 +	GtkWidget	   *dialog;
    752 +	GtkWidget	   *hbox;
    753 +	GtkWidget	   *vbox;
    754 +	GtkWidget	   *label;
    755 +	GtkWidget	   *label_sec;
    756 +	GtkWidget	   *image;
    757 +	int		   res;
    758 +	struct TimeoutData timeout_data;
    759 +	guint		   timeout;
    760 +
    761 +	dialog = gtk_dialog_new ();
    762 +	gtk_window_set_transient_for (GTK_WINDOW (dialog),
    763 +				      GTK_WINDOW (app->dialog));
    764 +	gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
    765 +	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
    766 +	gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
    767 +	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
    768 +	/* SUN_BRANDING */
    769 +	gtk_window_set_title (GTK_WINDOW (dialog), _("Keep Settings"));
    770 +	gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS);
    771 +
    772 +	label = gtk_label_new (NULL);
    773 +	gtk_label_set_markup (GTK_LABEL (label),
    774 +			      idle_free (g_strdup_printf ("<b>%s</b>",
    775 +							  /* SUN_BRANDING */
    776 +							  _("Do you want to keep these settings?"))));
    777 +	image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
    778 +					  GTK_ICON_SIZE_DIALOG);
    779 +	gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
    780 +
    781 +	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
    782 +	gtk_label_set_selectable (GTK_LABEL (label), TRUE);
    783 +	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
    784 +
    785 +	label_sec = gtk_label_new (timeout_string (REVERT_COUNT));
    786 +	gtk_label_set_line_wrap (GTK_LABEL (label_sec), TRUE);
    787 +	gtk_label_set_selectable (GTK_LABEL (label_sec), TRUE);
    788 +	gtk_misc_set_alignment (GTK_MISC (label_sec), 0.0, 0.5);
    789 +
    790 +	hbox = gtk_hbox_new (FALSE, 6);
    791 +	vbox = gtk_vbox_new (FALSE, 6);
    792 +
    793 +	gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
    794 +	gtk_box_pack_start (GTK_BOX (vbox), label_sec, TRUE, TRUE, 0);
    795 +	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
    796 +	gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
    797 +	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
    798 +			    hbox,
    799 +			    FALSE,
    800 +			    FALSE,
    801 +			    0);
    802 +	gtk_dialog_add_buttons (GTK_DIALOG (dialog),
    803 +				/* SUN_BRANDING */
    804 +				_("Use _previous settings"),
    805 +				GTK_RESPONSE_NO,
    806 +				/* SUN_BRANDING */
    807 +				_("_Keep settings"),
    808 +				GTK_RESPONSE_YES,
    809 +				NULL);
    810 +
    811 +	gtk_widget_show_all (hbox);
    812 +
    813 +	timeout_data.time = REVERT_COUNT;
    814 +	timeout_data.label = GTK_LABEL (label_sec);
    815 +	timeout_data.dialog = GTK_DIALOG (dialog);
    816 +	timeout_data.timed_out = FALSE;
    817 +
    818 +	timeout = g_timeout_add (1000, save_timeout_callback, &timeout_data);
    819 +	res = gtk_dialog_run (GTK_DIALOG (dialog));
    820 +
    821 +	if (!timeout_data.timed_out)
    822 +		g_source_remove (timeout);
    823 +
    824 +	gtk_widget_destroy (dialog);
    825 +
    826 +	return (res == GTK_RESPONSE_YES);
    827 +}
    828 +
    829 +static gboolean
    830 +show_dialog_timeout (gpointer data)
    831 +{
    832 +	TimedDialogInfo	*info = data;
    833 +	gboolean	has_compiz;
    834 +
    835 +	gtk_window_present (GTK_WINDOW (info->app->dialog));
    836 +
    837 +	has_compiz = compiz_started ();
    838 +
    839 +	if (has_compiz ||
    840 +	    g_timer_elapsed (info->timer,
    841 +	    		     NULL) > SECONDS_WE_WILL_WAIT_FOR_COMPIZ_TO_START)
    842 +	{
    843 +		if (has_compiz)
    844 +		{
    845 +			set_busy (info->app->dialog, FALSE);
    846 +
    847 +			if (run_timed_dialog (info->app))
    848 +				apply_settings (info->app,
    849 +						info->app->desktop_effects_level >= 1);
    850 +			else
    851 +				gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->button),
    852 +							      TRUE);
    853 +		}
    854 +		else
    855 +		{
    856 +			GtkWidget *dialog;
    857 +
    858 +			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->button),
    859 +						      TRUE);
    860 +
    861 +			set_busy (info->app->dialog, FALSE);
    862 +
    863 +			dialog = gtk_message_dialog_new ((GtkWindow*) info->app->dialog,
    864 +							 GTK_DIALOG_DESTROY_WITH_PARENT,
    865 +							 GTK_MESSAGE_WARNING,
    866 +							 GTK_BUTTONS_OK,
    867 +							 /* SUN_BRANDING */
    868 +							 _("Desktop effects could not be enabled"));
    869 +
    870 +			gtk_window_set_title (GTK_WINDOW (dialog), "");
    871 +			gtk_dialog_run (GTK_DIALOG (dialog));
    872 +			gtk_widget_destroy (dialog);
    873 +		}
    874 +
    875 +		gtk_widget_set_sensitive (info->app->dialog, TRUE);
    876 +
    877 +		g_timer_destroy (info->timer);
    878 +		g_free (info);
    879 +
    880 +		return FALSE;
    881 +	}
    882 +
    883 +	return TRUE;
    884 +}
    885 +
    886 +static gboolean
    887 +start_compiz (AppearanceData *app,
    888 +	      GError **err)
    889 +{
    890 +	if (!g_spawn_command_line_async ("compiz", err))
    891 +		return FALSE;
    892 +
    893 +	app->compiz_running = TRUE;
    894 +
    895 +	return TRUE;
    896 +}
    897 +
    898 +static gboolean
    899 +start_metacity (AppearanceData *app, GError **err)
    900 +{
    901 +	if (!g_spawn_command_line_async ("metacity --replace", err))
    902 +		return FALSE;
    903 +
    904 +	app->compiz_running = FALSE;
    905 +
    906 +	return TRUE;
    907 +}
    908 +
    909 +static gboolean 
    910 +has_texture_from_pixmap ()
    911 +{
    912 +#ifdef HAVE_GL && HAVE_GL_GLX_H
    913 +#include <GL/gl.h>
    914 +#include <GL/glx.h>
    915 +	const char  *glxServerExtensions = glXQueryServerString (GDK_DISPLAY (), 0, GLX_EXTENSIONS);
    916 +	if (glxServerExtensions == NULL || !strstr (glxServerExtensions, "GLX_EXT_texture_from_pixmap"))
    917 +	  return FALSE;
    918 +	return TRUE;
    919 +#else
    920 +	return FALSE;
    921 +#endif
    922 +}
    923 +
    924 +	
    925 +static gboolean
    926 +has_composite ()
    927 +{
    928 +	int dummy1;
    929 +	int dummy2;
    930 +
    931 +	if (XCompositeQueryExtension (GDK_DISPLAY (), &dummy1, &dummy2))
    932 +		return TRUE;
    933 +
    934 +	return FALSE;
    935 +}
    936 +
    937 +static void
    938 +show_alert (const char *text)
    939 +{
    940 +	GtkWidget *dialog;
    941 +
    942 +	dialog = gtk_message_dialog_new (NULL,
    943 +					 GTK_DIALOG_MODAL,
    944 +					 GTK_MESSAGE_ERROR,
    945 +					 GTK_BUTTONS_OK,
    946 +					 text);
    947 +
    948 +	gtk_dialog_run (GTK_DIALOG (dialog));
    949 +}
    950 +
    951 +static gboolean
    952 +are_effects_enabled (AppearanceData* app,
    953 +		     const gchar**   effects_list)
    954 +{
    955 +	int	 i;
    956 +	gboolean res = TRUE;
    957 +	GError	 *tmp = NULL;
    958 +	GSList	 *plugins;
    959 +
    960 +	plugins = get_plugins (app, &tmp);
    961 +	for (i = 0; effects_list[i] != NULL; i++)
    962 +		res &= contains_string (plugins, effects_list[i]);
    963 +
    964 +	return res;
    965 +}
    966 +
    967 +static gboolean
    968 +reset_plugins (AppearanceData *app)
    969 +{
    970 +	GError *error = NULL;
    971 +
    972 +	return gconf_client_unset (app->client, PLUGIN_LIST_KEY, &error);
    973 +}
    974 +
    975 +static gboolean
    976 +are_normal_effects_enabled (AppearanceData *app)
    977 +{
    978 +   gboolean res = TRUE;
    979 +   GError *err = NULL;
    980 +   GSList *plugins, *default_plugins;
    981 +
    982 +   default_plugins = gconf_value_get_list ( gconf_client_get_default_from_schema (app->client,  PLUGIN_LIST_KEY, &err));
    983 +
    984 +   err = NULL;
    985 +   plugins = get_plugins (app, &err);
    986 +   for(;default_plugins; default_plugins = g_slist_next(default_plugins))
    987 +      res &= contains_string(plugins, gconf_value_get_string(default_plugins->data));
    988 +
    989 +   return res;
    990 +}
    991 +
    992 +static gboolean
    993 +are_extra_effects_enabled (AppearanceData *app)
    994 +{
    995 +   return are_effects_enabled (app, extra_effects);
    996 +}
    997 +
    998 +static gint
    999 +get_effects_level (AppearanceData *data)
   1000 +{
   1001 +	if (data->compiz_running)
   1002 +	{
   1003 +	        if (are_extra_effects_enabled (data))
   1004 +		        return EXTRA_EFFECTS;
   1005 +		else if (are_normal_effects_enabled (data))
   1006 +			return NORMAL_EFFECTS;
   1007 +		else
   1008 +			return CUSTOM_EFFECTS;
   1009 +        }
   1010 +        else
   1011 +		return NO_EFFECTS;       
   1012 +}
   1013 +
   1014 +static gboolean
   1015 +enable_normal_effects (AppearanceData* app)
   1016 +{
   1017 +   return reset_plugins (app);
   1018 +}
   1019 +
   1020 +static gboolean
   1021 +enable_extra_effects (AppearanceData* app)
   1022 +{
   1023 +	GError	*err = NULL;
   1024 +	GSList	*plugins = NULL;
   1025 +	int	i;
   1026 +
   1027 +	reset_plugins (app);
   1028 +
   1029 +	for (i = 0; extra_effects[i] != NULL; i++)
   1030 +		plugins = g_slist_append (plugins,
   1031 +					  (gchar*) extra_effects[i]);
   1032 +
   1033 +	err = NULL;
   1034 +	gconf_client_set_list (app->client,
   1035 +			       PLUGIN_LIST_KEY,
   1036 +			       GCONF_VALUE_STRING,
   1037 +			       plugins,
   1038 +			       &err);
   1039 +
   1040 +	return TRUE;
   1041 +}
   1042 +
   1043 +static void
   1044 +on_effects_toggle (GtkWidget *widget,
   1045 +		   gpointer  user_data)
   1046 +{
   1047 +	AppearanceData	*appdata = user_data;
   1048 +	GtkWidget	*previously_selected_button;
   1049 +	static gint	old_effects_level;
   1050 +	static gboolean	do_init = TRUE;
   1051 +	gint		i;
   1052 +	GError		*err = NULL;
   1053 +
   1054 +	if (do_init == TRUE)
   1055 +	{
   1056 +		old_effects_level = get_effects_level (appdata);
   1057 +		do_init = FALSE;
   1058 +	}
   1059 +
   1060 +	if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) 
   1061 +		return;
   1062 +
   1063 +	previously_selected_button = appearance_capplet_get_widget(appdata,
   1064 +							   effect_choices [old_effects_level]);
   1065 +
   1066 +	/* Look for the button which has been selected */
   1067 +	for (i = 0; i < G_N_ELEMENTS (effect_choices); i++) 
   1068 +	{
   1069 +		if (widget == appearance_capplet_get_widget(appdata,
   1070 +						   effect_choices [i]))
   1071 +			break;
   1072 +	}
   1073 +
   1074 +	appdata->desktop_effects_level = i;
   1075 +
   1076 +	if (appdata->desktop_effects_level >= 1)
   1077 +	{		
   1078 +		if (!has_composite ())
   1079 +		{
   1080 +			show_alert ("The Composite extension is not available");
   1081 +			return;
   1082 +		}
   1083 +
   1084 +		if (old_effects_level == 0)
   1085 +			start_compiz (appdata, &err);
   1086 +
   1087 +		if (appdata->desktop_effects_level == NORMAL_EFFECTS)
   1088 +		        enable_normal_effects (appdata);
   1089 +
   1090 +		if (appdata->desktop_effects_level == EXTRA_EFFECTS)
   1091 +		        enable_extra_effects (appdata);
   1092 +	}
   1093 +	else 
   1094 +	{
   1095 +		apply_settings (appdata, FALSE);
   1096 +		start_metacity (appdata, &err);
   1097 +	}
   1098 +	
   1099 +	if (err)
   1100 +	{
   1101 +		show_error (err);
   1102 +		
   1103 +		g_signal_handlers_block_by_func (widget,
   1104 +						 (gpointer)on_effects_toggle,
   1105 +						 appdata);
   1106 +		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (appearance_capplet_get_widget(appdata,
   1107 +										       effect_choices [old_effects_level])),
   1108 +										       TRUE);		
   1109 +		g_signal_handlers_unblock_by_func (widget,
   1110 +						   (gpointer)on_effects_toggle,
   1111 +						   appdata);
   1112 +	}
   1113 +	else
   1114 +	{
   1115 +		if (appdata->desktop_effects_level >= 1 &&
   1116 +		    old_effects_level == 0)
   1117 +		{
   1118 +			TimedDialogInfo *info = g_new0 (TimedDialogInfo, 1);
   1119 +			
   1120 +			info->app = appdata;
   1121 +			info->button = previously_selected_button;
   1122 +			info->timer = g_timer_new ();
   1123 +			
   1124 +			set_busy (info->app->dialog, TRUE);
   1125 +			gtk_widget_set_sensitive (appdata->dialog, FALSE);
   1126 +			
   1127 +			g_timeout_add (250, show_dialog_timeout, info);
   1128 +		}
   1129 +	}
   1130 +
   1131 +	old_effects_level = i;  
   1132 +}
   1133 +
   1134 +void
   1135 +effects_init (AppearanceData *data)
   1136 +{
   1137 +	GError	      *error = NULL;
   1138 +	GtkWidget     *level_effects_button = NULL;
   1139 +	GtkWidget     *hbox_custom_effects = NULL;
   1140 +	WindowManager wm = METACITY;
   1141 +	gint	      i;
   1142 +	const char *str = get_current_window_manager ();
   1143 +	if (str && strcmp (str, "compiz") == 0)
   1144 +		wm = COMPIZ;
   1145 +
   1146 +	data->compiz_running = (wm == COMPIZ);
   1147 +	data->compiz_was_running = (wm == COMPIZ);
   1148 +	data->dialog = appearance_capplet_get_widget(data, "appearance_window");
   1149 +
   1150 +	data->desktop_effects_level = get_effects_level (data);
   1151 +
   1152 +	if (!has_composite () || !has_texture_from_pixmap () || !check_compiz ())
   1153 +	{
   1154 +	  GtkWidget *vbox = appearance_capplet_get_widget(data, "effects_vbox");
   1155 +	  GList *children = gtk_container_get_children (GTK_CONTAINER (vbox));
   1156 +	  GtkWidget *label = gtk_label_new (NULL);
   1157 +	  GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
   1158 +	  GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
   1159 +	  /* SUN_BRANDING */
   1160 +	  GString *message = g_string_new (_("<b>Visual effects cannot be enabled</b>\n\nDetails :\n"));
   1161 +
   1162 +	  gtk_container_add (GTK_CONTAINER (vbox), hbox);
   1163 +	  gtk_container_add (GTK_CONTAINER (hbox), image);
   1164 +
   1165 +	  while (children)
   1166 +	  {
   1167 +	      GtkWidget *child = (GtkWidget*) children->data;
   1168 +	      gtk_container_remove (GTK_CONTAINER (vbox), child);
   1169 +	      children = children->next;
   1170 +	  }
   1171 +	  if (!has_composite ())
   1172 +	    /* SUN_BRANDING */
   1173 +	    g_string_append (message, _("\nComposite extension is not enabled"));
   1174 +	  
   1175 +	  if (!has_texture_from_pixmap ())
   1176 +	  {
   1177 +	    #ifndef HAVE_GL && HAVE_GL_GLX_H
   1178 +	    /* SUN_BRANDING */
   1179 +	    g_string_append (message, _("\nThis application was compiled without the OpenGL extension"));
   1180 +	    #else
   1181 +	    /* SUN_BRANDING */
   1182 +	    g_string_append (message, _("\nThe OpenGL extension TextureFromPixmap is not enabled"));
   1183 +	    #endif
   1184 +	  }
   1185 +
   1186 +	  if (!check_compiz ())
   1187 +	    /* SUN_BRANDING */
   1188 +	    g_string_append (message, _("\nCompiz is not installed on the system"));
   1189 +	      
   1190 +
   1191 +	  gtk_label_set_markup (GTK_LABEL (label), message->str);
   1192 +	  gtk_container_add (GTK_CONTAINER (hbox), label);
   1193 +	  gtk_widget_show (label);
   1194 +	  g_string_free (message, TRUE);
   1195 +	  if (check_compiz_configure () && check_compiz ())
   1196 +	    {
   1197 +	      /* SUN_BRANDING */
   1198 +	      GtkWidget* button = gtk_button_new_with_label (_("Check if visual effects can be enabled"));
   1199 +	      GtkWidget* align = gtk_alignment_new (0.5, 0.5, 0, 0);
   1200 +	      g_signal_connect (button,
   1201 +				  "clicked",
   1202 +				  G_CALLBACK (run_compiz_configure),
   1203 +				  NULL);
   1204 +
   1205 +	      gtk_container_add (GTK_CONTAINER (align), button);
   1206 +	      gtk_container_add (GTK_CONTAINER (vbox), align);
   1207 +	      gtk_box_set_child_packing (GTK_BOX (vbox),
   1208 +					 button,
   1209 +					 FALSE,
   1210 +					 FALSE,
   1211 +					 0,
   1212 +					 GTK_PACK_END);
   1213 +	      gtk_widget_show (button);
   1214 +	    }
   1215 +	  return;
   1216 +	}
   1217 +
   1218 +
   1219 +	for (i = 0; i < G_N_ELEMENTS (effect_choices); i++) 
   1220 +	{
   1221 +		level_effects_button = appearance_capplet_get_widget(data,
   1222 +							     effect_choices[i]);
   1223 +		if (i == data->desktop_effects_level)
   1224 +			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (level_effects_button),
   1225 +						      TRUE);
   1226 +
   1227 +		g_signal_connect (level_effects_button,
   1228 +				  "toggled",
   1229 +				  G_CALLBACK (on_effects_toggle),
   1230 +				  data);
   1231 +	}
   1232 +
   1233 +	hbox_custom_effects = appearance_capplet_get_widget(data,
   1234 +						    "hbox_custom_effects");
   1235 +	if (check_ccsm ())
   1236 +	{
   1237 +		GtkWidget *button = NULL;
   1238 +
   1239 +		gtk_widget_show (hbox_custom_effects);
   1240 +		button = appearance_capplet_get_widget(data,
   1241 +					       "custom_effects_edit_button");
   1242 +		g_signal_connect (button,
   1243 +				  "clicked",
   1244 +				  G_CALLBACK (run_ccsm),
   1245 +				  NULL);
   1246 +	}
   1247 +	else
   1248 +		gtk_widget_hide (hbox_custom_effects);
   1249 +}
   1250 +
   1251 diff -Nrup -x '*.orig' -x '*.rej' -x '*.*~' gnome-control-center-2.28.0/capplets/appearance/appearance-effects.h ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/appearance-effects.h
   1252 --- gnome-control-center-2.28.0/capplets/appearance/appearance-effects.h	1970-01-01 01:00:00.000000000 +0100
   1253 +++ ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/appearance-effects.h	2009-10-16 09:52:28.249534159 +0200
   1254 @@ -0,0 +1,21 @@
   1255 +/*
   1256 + * Copyright (C) 2007 Canonical
   1257 + * Written by Michael Vogt <mvo (a] ubuntu.com>
   1258 + * All Rights Reserved
   1259 + *
   1260 + * This program is free software; you can redistribute it and/or modify
   1261 + * it under the terms of the GNU General Public License as published by
   1262 + * the Free Software Foundation; either version 2 of the License, or
   1263 + * (at your option) any later version.
   1264 + *
   1265 + * This program is distributed in the hope that it will be useful,
   1266 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   1267 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1268 + * GNU General Public License for more details.
   1269 + *
   1270 + * You should have received a copy of the GNU General Public License along
   1271 + * with this program; if not, write to the Free Software Foundation, Inc.,
   1272 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   1273 + */
   1274 +
   1275 +void effects_init (AppearanceData *data);
   1276 diff -Nrup -x '*.orig' -x '*.rej' -x '*.*~' gnome-control-center-2.28.0/capplets/appearance/appearance-main.c ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/appearance-main.c
   1277 --- gnome-control-center-2.28.0/capplets/appearance/appearance-main.c	2009-08-24 12:54:41.000000000 +0200
   1278 +++ ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/appearance-main.c	2009-10-16 09:52:28.249834208 +0200
   1279 @@ -166,6 +166,7 @@ main (int argc, char **argv)
   1280    g_strfreev (wallpaper_files);
   1281    font_init (data);
   1282    ui_init (data);
   1283 +  effects_init (data);
   1284  
   1285    /* prepare the main window */
   1286    w = appearance_capplet_get_widget (data, "appearance_window");
   1287 diff -Nrup -x '*.orig' -x '*.rej' -x '*.*~' gnome-control-center-2.28.0/capplets/appearance/appearance.h ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/appearance.h
   1288 --- gnome-control-center-2.28.0/capplets/appearance/appearance.h	2009-09-07 13:19:06.000000000 +0200
   1289 +++ ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/appearance.h	2009-10-16 09:52:28.250095799 +0200
   1290 @@ -75,6 +75,12 @@ typedef struct
   1291    gchar *revert_windowtitle_font;
   1292    gchar *revert_monospace_font;
   1293  
   1294 +  /* effects */
   1295 +  gboolean compiz_running;
   1296 +  gboolean compiz_was_running;
   1297 +  gint desktop_effects_level;
   1298 +  GtkWidget *dialog;
   1299 +
   1300    /* style */
   1301    GdkPixbuf *gtk_theme_icon;
   1302    GdkPixbuf *window_theme_icon;
   1303 diff -Nrup -x '*.orig' -x '*.rej' -x '*.*~' gnome-control-center-2.28.0/capplets/appearance/data/Makefile.am ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/data/Makefile.am
   1304 --- gnome-control-center-2.28.0/capplets/appearance/data/Makefile.am	2009-09-07 13:19:06.000000000 +0200
   1305 +++ ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/data/Makefile.am	2009-10-16 09:52:28.250288191 +0200
   1306 @@ -15,7 +15,11 @@ dist_pixmap_DATA = \
   1307          mouse-cursor-normal.png \
   1308          mouse-cursor-normal-large.png \
   1309          mouse-cursor-white.png \
   1310 -        mouse-cursor-white-large.png
   1311 +        mouse-cursor-white-large.png \
   1312 +	visual-effects_custom.svg \
   1313 +	visual-effects_extra.svg  \
   1314 +	visual-effects_none.svg	\
   1315 +	visual-effects_normal.svg
   1316  
   1317  cursorfontdir   = $(datadir)/gnome/cursor-fonts
   1318  dist_cursorfont_DATA = \
   1319 diff -Nrup -x '*.orig' -x '*.rej' -x '*.*~' gnome-control-center-2.28.0/capplets/appearance/data/appearance.ui ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/data/appearance.ui
   1320 --- gnome-control-center-2.28.0/capplets/appearance/data/appearance.ui	2009-09-21 12:44:55.000000000 +0200
   1321 +++ ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/capplets/appearance/data/appearance.ui	2009-10-16 09:52:28.252549269 +0200
   1322 @@ -1913,6 +1913,272 @@
   1323                  <property name="tab_fill">False</property>
   1324                </packing>
   1325              </child>
   1326 +            <child>
   1327 +              <object class="GtkVBox" id="effects_vbox">
   1328 +                <property name="visible">True</property>
   1329 +                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1330 +                <property name="border_width">6</property>
   1331 +                <property name="spacing">18</property>
   1332 +                <property name="homogeneous">True</property>
   1333 +                <child>
   1334 +                  <object class="GtkRadioButton" id="no_effects_button">
   1335 +                    <property name="visible">True</property>
   1336 +                    <property name="can_focus">True</property>
   1337 +                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1338 +                    <property name="active">True</property>
   1339 +                    <property name="draw_indicator">True</property>
   1340 +                    <accelerator key="n" modifiers="" signal="activate"/>
   1341 +                    <child>
   1342 +                      <object class="GtkHBox" id="hbox_no_effects">
   1343 +                        <property name="visible">True</property>
   1344 +                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1345 +                        <child>
   1346 +                          <object class="GtkImage" id="image_no_effects">
   1347 +                            <property name="visible">True</property>
   1348 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1349 +                            <property name="xpad">6</property>
   1350 +                            <property name="pixbuf">/usr/share/gnome-control-center/pixmaps/visual-effects_none.svg</property>
   1351 +                            <property name="icon_size">6</property>
   1352 +                          </object>
   1353 +                        </child>
   1354 +                        <child>
   1355 +                          <object class="GtkLabel" id="label_desc_no_effects">
   1356 +                            <property name="visible">True</property>
   1357 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1358 +                            <property name="xpad">6</property>
   1359 +                            <property comments="SUN_BRANDING" name="label" translatable="yes">&lt;b&gt;_None:&lt;/b&gt; Provides a simple desktop environment without any effects.</property>
   1360 +                            <property name="use_markup">True</property>
   1361 +                            <property name="use_underline">True</property>
   1362 +                            <property name="wrap">True</property>
   1363 +                          </object>
   1364 +                          <packing>
   1365 +                            <property name="position">1</property>
   1366 +                          </packing>
   1367 +                        </child>
   1368 +                      </object>
   1369 +                    </child>
   1370 +                  </object>
   1371 +                  <packing>
   1372 +                    <property name="expand">False</property>
   1373 +                    <property name="fill">False</property>
   1374 +                    <property name="padding">6</property>
   1375 +                  </packing>
   1376 +                </child>
   1377 +                <child>
   1378 +                  <object class="GtkRadioButton" id="normal_effects_button">
   1379 +                    <property name="visible">True</property>
   1380 +                    <property name="can_focus">True</property>
   1381 +                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1382 +                    <property name="active">True</property>
   1383 +                    <property name="draw_indicator">True</property>
   1384 +                    <property name="group">no_effects_button</property>
   1385 +                    <accelerator key="o" modifiers="" signal="activate"/>
   1386 +                    <child>
   1387 +                      <object class="GtkHBox" id="hbox_normal_effects">
   1388 +                        <property name="visible">True</property>
   1389 +                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1390 +                        <child>
   1391 +                          <object class="GtkImage" id="image_normal_effects">
   1392 +                            <property name="visible">True</property>
   1393 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1394 +                            <property name="xpad">6</property>
   1395 +                            <property name="pixbuf">/usr/share/gnome-control-center/pixmaps/visual-effects_normal.svg</property>
   1396 +                            <property name="icon_size">6</property>
   1397 +                          </object>
   1398 +                        </child>
   1399 +                        <child>
   1400 +                          <object class="GtkLabel" id="label_desc_normal_effects">
   1401 +                            <property name="visible">True</property>
   1402 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1403 +                            <property name="xpad">6</property>
   1404 +                            <property comments="SUN_BRANDING" name="label" translatable="yes">&lt;b&gt;N_ormal:&lt;/b&gt; Provides improved usability and good balance between attractiveness and moderate performance-requirements.</property>
   1405 +                            <property name="use_markup">True</property>
   1406 +                            <property name="use_underline">True</property>
   1407 +                            <property name="wrap">True</property>
   1408 +                          </object>
   1409 +                          <packing>
   1410 +                            <property name="position">1</property>
   1411 +                          </packing>
   1412 +                        </child>
   1413 +                      </object>
   1414 +                    </child>
   1415 +                  </object>
   1416 +                  <packing>
   1417 +                    <property name="expand">False</property>
   1418 +                    <property name="fill">False</property>
   1419 +                    <property name="padding">6</property>
   1420 +                    <property name="position">1</property>
   1421 +                  </packing>
   1422 +                </child>
   1423 +                <child>
   1424 +                  <object class="GtkRadioButton" id="extra_effects_button">
   1425 +                    <property name="visible">True</property>
   1426 +                    <property name="can_focus">True</property>
   1427 +                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1428 +                    <property name="active">True</property>
   1429 +                    <property name="draw_indicator">True</property>
   1430 +                    <property name="group">no_effects_button</property>
   1431 +                    <accelerator key="x" modifiers="" signal="activate"/>
   1432 +                    <child>
   1433 +                      <object class="GtkHBox" id="hbox_extra_effects">
   1434 +                        <property name="visible">True</property>
   1435 +                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1436 +                        <child>
   1437 +                          <object class="GtkImage" id="image_extra_effects">
   1438 +                            <property name="visible">True</property>
   1439 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1440 +                            <property name="xpad">6</property>
   1441 +                            <property name="pixbuf">/usr/share/gnome-control-center/pixmaps/visual-effects_extra.svg</property>
   1442 +                            <property name="icon_size">6</property>
   1443 +                          </object>
   1444 +                        </child>
   1445 +                        <child>
   1446 +                          <object class="GtkLabel" id="label_desc_extra_effects">
   1447 +                            <property name="visible">True</property>
   1448 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1449 +                            <property name="xpad">6</property>
   1450 +                            <property comments="SUN_BRANDING" name="label" translatable="yes">&lt;b&gt;E_xtra:&lt;/b&gt; Provides more aesthetically pleasing set of effects. Requires faster graphics-card.</property>
   1451 +                            <property name="use_markup">True</property>
   1452 +                            <property name="use_underline">True</property>
   1453 +                            <property name="wrap">True</property>
   1454 +                          </object>
   1455 +                          <packing>
   1456 +                            <property name="position">1</property>
   1457 +                          </packing>
   1458 +                        </child>
   1459 +                      </object>
   1460 +                    </child>
   1461 +                  </object>
   1462 +                  <packing>
   1463 +                    <property name="expand">False</property>
   1464 +                    <property name="fill">False</property>
   1465 +                    <property name="padding">6</property>
   1466 +                    <property name="position">2</property>
   1467 +                  </packing>
   1468 +                </child>
   1469 +                <child>
   1470 +                  <object class="GtkHBox" id="hbox_custom_effects">
   1471 +                    <property name="visible">True</property>
   1472 +                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1473 +                    <property name="no_show_all">True</property>
   1474 +                    <child>
   1475 +                      <object class="GtkRadioButton" id="custom_effects_button">
   1476 +                        <property name="visible">True</property>
   1477 +                        <property name="can_focus">True</property>
   1478 +                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1479 +                        <property name="active">True</property>
   1480 +                        <property name="draw_indicator">True</property>
   1481 +                        <property name="group">no_effects_button</property>
   1482 +                        <accelerator key="u" modifiers="" signal="activate"/>
   1483 +                        <child>
   1484 +                          <object class="GtkHBox" id="hbox_custom_effects_2">
   1485 +                            <property name="visible">True</property>
   1486 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1487 +                            <property name="spacing">6</property>
   1488 +                            <child>
   1489 +                              <object class="GtkImage" id="image_custom_effects">
   1490 +                                <property name="visible">True</property>
   1491 +                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1492 +                                <property name="xpad">6</property>
   1493 +                                <property name="pixbuf">/usr/share/gnome-control-center/pixmaps/visual-effects_custom.svg</property>
   1494 +                                <property name="icon_size">6</property>
   1495 +                              </object>
   1496 +                              <packing>
   1497 +                                <property name="expand">False</property>
   1498 +                                <property name="fill">False</property>
   1499 +                              </packing>
   1500 +                            </child>
   1501 +                            <child>
   1502 +                              <object class="GtkLabel" id="label_desc_custom_effects">
   1503 +                                <property name="visible">True</property>
   1504 +                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1505 +                                <property comments="SUN_BRANDING" name="label" translatable="yes">&lt;b&gt;C_ustom:&lt;/b&gt; Uses custom set of effects.</property>
   1506 +                                <property name="use_markup">True</property>
   1507 +                                <property name="use_underline">True</property>
   1508 +                                <property name="wrap">True</property>
   1509 +                              </object>
   1510 +                              <packing>
   1511 +                                <property name="expand">False</property>
   1512 +                                <property name="fill">False</property>
   1513 +                                <property name="position">1</property>
   1514 +                              </packing>
   1515 +                            </child>
   1516 +                          </object>
   1517 +                        </child>
   1518 +                      </object>
   1519 +                      <packing>
   1520 +                        <property name="expand">False</property>
   1521 +                        <property name="fill">False</property>
   1522 +                      </packing>
   1523 +                    </child>
   1524 +                    <child>
   1525 +                      <object class="GtkVBox" id="vbox_custom_effects">
   1526 +                        <property name="visible">True</property>
   1527 +                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1528 +                        <child>
   1529 +                          <object class="GtkLabel" id="label_dummy_1">
   1530 +                            <property name="visible">True</property>
   1531 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1532 +                          </object>
   1533 +                          <packing>
   1534 +                            <property name="expand">False</property>
   1535 +                            <property name="fill">False</property>
   1536 +                          </packing>
   1537 +                        </child>
   1538 +                        <child>
   1539 +                          <object class="GtkButton" id="custom_effects_edit_button">
   1540 +                            <property name="visible">True</property>
   1541 +                            <property name="can_focus">True</property>
   1542 +                            <property name="receives_default">True</property>
   1543 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1544 +                            <property name="label" translatable="yes">gtk-preferences</property>
   1545 +                            <property name="use_stock">True</property>
   1546 +                          </object>
   1547 +                          <packing>
   1548 +                            <property name="expand">False</property>
   1549 +                            <property name="fill">False</property>
   1550 +                            <property name="position">1</property>
   1551 +                          </packing>
   1552 +                        </child>
   1553 +                        <child>
   1554 +                          <object class="GtkLabel" id="label_dummy_2">
   1555 +                            <property name="visible">True</property>
   1556 +                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1557 +                          </object>
   1558 +                          <packing>
   1559 +                            <property name="expand">False</property>
   1560 +                            <property name="fill">False</property>
   1561 +                            <property name="position">2</property>
   1562 +                          </packing>
   1563 +                        </child>
   1564 +                      </object>
   1565 +                      <packing>
   1566 +                        <property name="expand">False</property>
   1567 +                        <property name="fill">False</property>
   1568 +                        <property name="padding">6</property>
   1569 +                        <property name="position">1</property>
   1570 +                      </packing>
   1571 +                    </child>
   1572 +                  </object>
   1573 +                  <packing>
   1574 +                    <property name="expand">False</property>
   1575 +                    <property name="fill">False</property>
   1576 +                    <property name="position">3</property>
   1577 +                  </packing>
   1578 +                </child>
   1579 +              </object>
   1580 +            </child>
   1581 +            <child type="tab">
   1582 +              <object class="GtkLabel" id="effects_label">
   1583 +                <property name="visible">True</property>
   1584 +                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
   1585 +                <property comments="SUN_BRANDING" name="label" translatable="yes">Visual Effects</property>
   1586 +              </object>
   1587 +              <packing>
   1588 +                <property name="position">4</property>
   1589 +                <property name="tab_fill">False</property>
   1590 +              </packing>
   1591 +            </child>
   1592            </object>
   1593            <packing>
   1594              <property name="position">1</property>
   1595 @@ -1964,6 +2230,11 @@
   1596        </object>
   1597      </child>
   1598      <action-widgets>
   1599 +      <action-widget response="0">no_effects_button</action-widget>
   1600 +      <action-widget response="0">normal_effects_button</action-widget>
   1601 +      <action-widget response="0">extra_effects_button</action-widget>
   1602 +      <action-widget response="0">custom_effects_button</action-widget>
   1603 +      <action-widget response="0">custom_effects_edit_button</action-widget>
   1604        <action-widget response="-11">help_button</action-widget>
   1605        <action-widget response="-7">close_button</action-widget>
   1606      </action-widgets>
   1607 diff -Nrup -x '*.orig' -x '*.rej' -x '*.*~' gnome-control-center-2.28.0/configure.in ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/configure.in
   1608 --- gnome-control-center-2.28.0/configure.in	2009-10-16 09:53:15.306099773 +0200
   1609 +++ ../SUNWgnome-desktop-prefs-2.28.0.fix/gnome-control-center-2.28.0/configure.in	2009-10-16 09:52:28.250612848 +0200
   1610 @@ -160,6 +160,22 @@ DISPLAY_CAPPLET_LIBS="$DISPLAY_CAPPLET_L
   1611  CAPPLET_LIBS="$CAPPLET_LIBS $x_libs"
   1612  GNOMECC_LIBS="$GNOMECC_LIBS $x_libs"
   1613  
   1614 +dnl 
   1615 +dnl Check for OpenGL support 
   1616 +dnl
   1617 +have_gl=0
   1618 +have_libgl=0
   1619 +AC_CHECK_HEADERS(GL/glx.h)
   1620 +if test $ac_cv_header_GL_glx_h = yes ; then
   1621 +	AC_CHECK_FUNC(glXQueryExtension,[have_gl=1],AC_CHECK_LIB(GL,glXQueryExtension,[have_gl=1;have_libgl=1]))
   1622 +fi
   1623 +if test $have_gl = 1 ; then
   1624 +	AC_DEFINE(HAVE_GL,1,[Whether we have GL and glX.])
   1625 +fi
   1626 +if test $have_libgl = 1 ; then
   1627 +	LIBS="-lGL $LIBS"
   1628 +fi
   1629 +
   1630  dnl
   1631  dnl Check for XCursor support.  If it exists, then we compile the
   1632  dnl mouse capplet with support for it turned on
   1633