[gnome-screensaver] Drop GdkColormap usage
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screensaver] Drop GdkColormap usage
- Date: Thu, 30 Sep 2010 06:16:23 +0000 (UTC)
commit 7ec542821936d0ac27ddb059d95d1c05ef01031a
Author: Ray Strode <rstrode redhat com>
Date: Thu Sep 30 00:01:49 2010 -0400
Drop GdkColormap usage
It's obsolete
savers/gs-theme-engine.c | 8 +-------
savers/gste-popsquares.c | 14 ++------------
savers/gste-slideshow.c | 17 -----------------
src/gnome-screensaver-preferences.c | 32 +++++++-------------------------
src/gs-window-x11.c | 32 +++++++-------------------------
5 files changed, 17 insertions(+), 86 deletions(-)
---
diff --git a/savers/gs-theme-engine.c b/savers/gs-theme-engine.c
index bf89045..7c8f83b 100644
--- a/savers/gs-theme-engine.c
+++ b/savers/gs-theme-engine.c
@@ -110,7 +110,6 @@ static void
gs_theme_engine_clear (GtkWidget *widget)
{
GdkColor color = { 0, 0x0000, 0x0000, 0x0000 };
- GdkColormap *colormap;
GtkStateType state;
GdkWindow *window;
@@ -126,12 +125,7 @@ gs_theme_engine_clear (GtkWidget *widget)
state++;
}
- window = gtk_widget_get_window (widget);
- colormap = gdk_drawable_get_colormap (window);
- gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE);
- gdk_window_set_background (window, &color);
- gdk_window_clear (window);
- gdk_flush ();
+ gtk_widget_queue_draw (widget);
}
static gboolean
diff --git a/savers/gste-popsquares.c b/savers/gste-popsquares.c
index d013a28..558a41b 100644
--- a/savers/gste-popsquares.c
+++ b/savers/gste-popsquares.c
@@ -183,8 +183,7 @@ rgb_to_hsv (unsigned short r,
}
static void
-make_color_ramp (GdkColormap *colormap,
- int h1,
+make_color_ramp (int h1,
double s1,
double v1,
int h2,
@@ -193,7 +192,6 @@ make_color_ramp (GdkColormap *colormap,
GdkColor *colors,
int n_colors,
gboolean closed,
- gboolean allocate,
gboolean writable)
{
double dh, ds, dv; /* deltas */
@@ -230,12 +228,6 @@ make_color_ramp (GdkColormap *colormap,
&colors [i].red,
&colors [i].green,
&colors [i].blue);
- if (allocate) {
- gdk_colormap_alloc_color (colormap,
- &colors [i],
- writable,
- TRUE);
- }
}
if (closed) {
@@ -382,13 +374,11 @@ setup_colors (GSTEPopsquares *pop)
rgb_to_hsv (fg.red, fg.green, fg.blue, &h1, &s1, &v1);
rgb_to_hsv (bg.red, bg.green, bg.blue, &h2, &s2, &v2);
- make_color_ramp (gtk_widget_get_colormap (GTK_WIDGET (pop)),
- h1, s1, v1,
+ make_color_ramp (h1, s1, v1,
h2, s2, v2,
pop->priv->colors,
pop->priv->ncolors,
TRUE,
- TRUE,
FALSE);
nsquares = pop->priv->subdivision * pop->priv->subdivision;
diff --git a/savers/gste-slideshow.c b/savers/gste-slideshow.c
index 083a6a2..5ae632d 100644
--- a/savers/gste-slideshow.c
+++ b/savers/gste-slideshow.c
@@ -900,21 +900,6 @@ gste_slideshow_class_init (GSTESlideshowClass *klass)
}
static void
-set_colormap (GtkWidget *widget)
-{
- GdkScreen *screen;
- GdkColormap *colormap;
-
- screen = gtk_widget_get_screen (widget);
- colormap = gdk_screen_get_rgba_colormap (screen);
- if (colormap == NULL) {
- colormap = gdk_screen_get_system_colormap (screen);
- }
-
- gtk_widget_set_colormap (widget, colormap);
-}
-
-static void
gste_slideshow_init (GSTESlideshow *show)
{
GError *error;
@@ -934,8 +919,6 @@ gste_slideshow_init (GSTESlideshow *show)
g_error_free (error);
exit (-1);
}
-
- set_colormap (GTK_WIDGET (show));
}
static void
diff --git a/src/gnome-screensaver-preferences.c b/src/gnome-screensaver-preferences.c
index 1dd3fda..e1bb1f5 100644
--- a/src/gnome-screensaver-preferences.c
+++ b/src/gnome-screensaver-preferences.c
@@ -1364,35 +1364,17 @@ get_best_visual (void)
return visual;
}
-static GdkColormap *
-get_best_colormap_for_screen (GdkScreen *screen)
-{
- GdkColormap *colormap;
- GdkVisual *visual;
-
- g_return_val_if_fail (screen != NULL, NULL);
-
- visual = get_best_visual ();
-
- colormap = NULL;
- if (visual != NULL) {
- colormap = gdk_colormap_new (visual, FALSE);
- }
-
- return colormap;
-}
-
static void
-widget_set_best_colormap (GtkWidget *widget)
+widget_set_best_visual (GtkWidget *widget)
{
- GdkColormap *colormap;
+ GdkVisual *visual;
g_return_if_fail (widget != NULL);
- colormap = get_best_colormap_for_screen (gtk_widget_get_screen (widget));
- if (colormap != NULL) {
- gtk_widget_set_colormap (widget, colormap);
- g_object_unref (colormap);
+ visual = get_best_visual ();
+ if (visual != NULL) {
+ gtk_widget_set_visual (widget, visual);
+ g_object_unref (visual);
}
}
@@ -1498,7 +1480,7 @@ init_capplet (void)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), treeview);
gtk_widget_set_no_show_all (root_warning_label, TRUE);
- widget_set_best_colormap (preview);
+ widget_set_best_visual (preview);
if (! is_program_in_path (GPM_COMMAND)) {
gtk_widget_set_no_show_all (gpm_button, TRUE);
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index d0028ad..482687b 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -560,42 +560,24 @@ get_best_visual_for_screen (GdkScreen *screen)
return visual;
}
-static GdkColormap *
-get_best_colormap_for_screen (GdkScreen *screen)
-{
- GdkColormap *colormap;
- GdkVisual *visual;
-
- g_return_val_if_fail (screen != NULL, NULL);
-
- visual = get_best_visual_for_screen (screen);
-
- colormap = NULL;
- if (visual != NULL) {
- colormap = gdk_colormap_new (visual, FALSE);
- }
-
- return colormap;
-}
-
static void
-widget_set_best_colormap (GtkWidget *widget)
+widget_set_best_visual (GtkWidget *widget)
{
- GdkColormap *colormap;
+ GdkVisual *visual;
g_return_if_fail (widget != NULL);
- colormap = get_best_colormap_for_screen (gtk_widget_get_screen (widget));
- if (colormap != NULL) {
- gtk_widget_set_colormap (widget, colormap);
- g_object_unref (colormap);
+ visual = get_best_visual_for_screen (gtk_widget_get_screen (widget));
+ if (visual != NULL) {
+ gtk_widget_set_visual (widget, visual);
+ g_object_unref (visual);
}
}
static void
gs_window_real_realize (GtkWidget *widget)
{
- widget_set_best_colormap (widget);
+ widget_set_best_visual (widget);
if (GTK_WIDGET_CLASS (gs_window_parent_class)->realize) {
GTK_WIDGET_CLASS (gs_window_parent_class)->realize (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]