diff options
Diffstat (limited to 'savers')
-rw-r--r-- | savers/floaters.c | 69 | ||||
-rw-r--r-- | savers/gs-theme-engine.c | 27 | ||||
-rw-r--r-- | savers/gs-theme-window.c | 54 | ||||
-rw-r--r-- | savers/gste-popsquares.c | 116 | ||||
-rw-r--r-- | savers/gste-slideshow.c | 56 | ||||
-rw-r--r-- | savers/popsquares.c | 2 |
6 files changed, 0 insertions, 324 deletions
diff --git a/savers/floaters.c b/savers/floaters.c index d565d63..b9291dc 100644 --- a/savers/floaters.c +++ b/savers/floaters.c @@ -35,8 +35,6 @@ #include <glib/gi18n.h> #include <gdk/gdk.h> -#include <gdk/gdkx.h> - #include <gtk/gtk.h> #include "gs-theme-window.h" @@ -284,13 +282,8 @@ static void screen_saver_create_floaters (ScreenSaver *screen_saver); static void screen_saver_destroy_floaters (ScreenSaver *screen_saver); static void screen_saver_on_size_allocate (ScreenSaver *screen_saver, GtkAllocation *allocation); -#if GTK_CHECK_VERSION (3, 0, 0) static void screen_saver_on_draw (ScreenSaver *screen_saver, cairo_t *context); -#else -static void screen_saver_on_expose_event (ScreenSaver *screen_saver, - GdkEventExpose *event); -#endif static gboolean do_print_screen_saver_stats (ScreenSaver *screen_saver); static GdkPixbuf *gamma_correct (const GdkPixbuf *input_pixbuf); @@ -860,15 +853,9 @@ screen_saver_new (GtkWidget *drawing_area, G_CALLBACK (screen_saver_on_size_allocate), screen_saver); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect_swapped (G_OBJECT (drawing_area), "draw", G_CALLBACK (screen_saver_on_draw), screen_saver); -#else - g_signal_connect_swapped (G_OBJECT (drawing_area), "expose-event", - G_CALLBACK (screen_saver_on_expose_event), - screen_saver); -#endif screen_saver->first_update_time = 0.0; screen_saver->current_calculated_stats_time = 0.0; @@ -1021,59 +1008,23 @@ compare_floaters (ScreenSaverFloater *a, } static void -#if GTK_CHECK_VERSION (3, 0, 0) screen_saver_on_draw (ScreenSaver *screen_saver, cairo_t *context) -#else -screen_saver_on_expose_event (ScreenSaver *screen_saver, - GdkEventExpose *event) -#endif { GList *tmp; -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *context; -#endif if (screen_saver->floaters == NULL) screen_saver_create_floaters (screen_saver); -#if !GTK_CHECK_VERSION (3, 0, 0) - context = gdk_cairo_create (gtk_widget_get_window (screen_saver->drawing_area)); - - cairo_rectangle (context, - (double) event->area.x, - (double) event->area.y, - (double) event->area.width, - (double) event->area.height); - cairo_clip (context); -#endif - screen_saver->floaters = g_list_sort (screen_saver->floaters, (GCompareFunc)compare_floaters); for (tmp = screen_saver->floaters; tmp != NULL; tmp = tmp->next) { ScreenSaverFloater *floater; -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkRectangle rect; - gint size; -#endif floater = (ScreenSaverFloater *) tmp->data; -#if !GTK_CHECK_VERSION (3, 0, 0) - size = CLAMP ((int) (FLOATER_MAX_SIZE * floater->scale), - FLOATER_MIN_SIZE, FLOATER_MAX_SIZE); - - rect.x = (int) (floater->position.x - .5 * G_SQRT2 * size); - rect.y = (int) (floater->position.y - .5 * G_SQRT2 * size); - rect.width = G_SQRT2 * size; - rect.height = G_SQRT2 * size; - - if (!gdk_region_rect_in (event->region, &rect)) - continue; -#endif - if (!screen_saver_floater_do_draw (screen_saver, floater, context)) { gtk_main_quit (); @@ -1081,10 +1032,6 @@ screen_saver_on_expose_event (ScreenSaver *screen_saver, } } -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (context); -#endif - screen_saver->draw_ops_pending = TRUE; screen_saver->frame_count++; } @@ -1219,12 +1166,6 @@ main (int argc, ScreenSaver *screen_saver; GtkWidget *window; GtkWidget *drawing_area; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkStyle *style; - GtkStateType state; - GdkColor black = { 0, 0x0000, 0x0000, 0x0000 }; -#endif - GError *error; error = NULL; @@ -1264,16 +1205,6 @@ main (int argc, drawing_area = GTK_WIDGET (gtk_drawing_area_new ()); -#if !GTK_CHECK_VERSION (3, 0, 0) - style = gtk_widget_get_style (drawing_area); - state = (GtkStateType) 0; - while (state < (GtkStateType) G_N_ELEMENTS (style->bg)) - { - gtk_widget_modify_bg (drawing_area, state, &black); - state++; - } -#endif - gtk_widget_show (drawing_area); gtk_container_add (GTK_CONTAINER (window), drawing_area); diff --git a/savers/gs-theme-engine.c b/savers/gs-theme-engine.c index c864df6..42097df 100644 --- a/savers/gs-theme-engine.c +++ b/savers/gs-theme-engine.c @@ -110,15 +110,8 @@ gs_theme_engine_get_property (GObject *object, static void gs_theme_engine_clear (GtkWidget *widget) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color = { 0.0, 0.0, 0.0, 1.0 }; GtkStateFlags state; -#else - GdkColor color = { 0, 0x0000, 0x0000, 0x0000 }; - GdkColormap *colormap; - GtkStyle *style; - GtkStateType state; -#endif g_return_if_fail (GS_IS_THEME_ENGINE (widget)); @@ -127,24 +120,9 @@ gs_theme_engine_clear (GtkWidget *widget) return; } -#if GTK_CHECK_VERSION (3, 0, 0) state = gtk_widget_get_state_flags (widget); gtk_widget_override_background_color (widget, state, &color); gdk_window_set_background_rgba (gtk_widget_get_window (widget), &color); -#else - style = gtk_widget_get_style (widget); - state = (GtkStateType) 0; - while (state < (GtkStateType) G_N_ELEMENTS (style->bg)) - { - gtk_widget_modify_bg (widget, state, &color); - state++; - } - - colormap = gdk_drawable_get_colormap (gtk_widget_get_window (widget)); - gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE); - gdk_window_set_background (gtk_widget_get_window (widget), &color); - gdk_window_clear (gtk_widget_get_window (widget)); -#endif gdk_flush (); } @@ -222,12 +200,7 @@ gs_theme_engine_get_window_size (GSThemeEngine *engine, NULL, NULL, width, -#if !GTK_CHECK_VERSION (3, 0, 0) - height, - NULL); -#else height); -#endif } GdkWindow * diff --git a/savers/gs-theme-window.c b/savers/gs-theme-window.c index 47c731e..1000af2 100644 --- a/savers/gs-theme-window.c +++ b/savers/gs-theme-window.c @@ -62,45 +62,10 @@ gs_theme_window_class_init (GSThemeWindowClass *klass) widget_class->realize = gs_theme_window_real_realize; } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -force_no_pixmap_background (GtkWidget *widget) -{ - static gboolean first_time = TRUE; - - if (first_time) - { - gtk_rc_parse_string ("\n" - " style \"gs-theme-engine-style\"\n" - " {\n" - " bg_pixmap[NORMAL] = \"<none>\"\n" - " bg_pixmap[ACTIVE] = \"<none>\"\n" - " bg_pixmap[PRELIGHT] = \"<none>\"\n" - " bg_pixmap[SELECTED] = \"<none>\"\n" - " bg_pixmap[INSENSITIVE] = \"<none>\"\n" - " bg[NORMAL] = \"#000000\"\n" - " bg[ACTIVE] = \"#000000\"\n" - " bg[PRELIGHT] = \"#000000\"\n" - " bg[SELECTED] = \"#000000\"\n" - " bg[INSENSITIVE] = \"#000000\"\n" - " }\n" - " widget \"gs-window*\" style : highest \"gs-theme-engine-style\"\n" - "\n"); - first_time = FALSE; - } - - gtk_widget_set_name (widget, "gs-window"); -} -#endif - static void gs_theme_window_init (GSThemeWindow *window) { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); -#else - force_no_pixmap_background (GTK_WIDGET (window)); -#endif } static void @@ -144,12 +109,7 @@ gs_theme_window_real_realize (GtkWidget *widget) ((*end == ' ') || (*end == '\0')) && ((remote_xwindow < G_MAXULONG) || (errno != ERANGE))) { -#if GTK_CHECK_VERSION (3, 0, 0) window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), remote_xwindow); -#else - window = gdk_window_foreign_new (remote_xwindow); -#endif - if (window != NULL) { /* This is a kludge; we need to set the same @@ -183,14 +143,8 @@ gs_theme_window_real_realize (GtkWidget *widget) return; } -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_set_background (gtk_widget_get_style_context (widget), window); -#else - gtk_style_set_background (gtk_widget_get_style (widget), - window, - GTK_STATE_NORMAL); -#endif gdk_window_set_decorations (window, (GdkWMDecoration) 0); gdk_window_set_events (window, gdk_window_get_events (window) | event_mask); @@ -198,11 +152,7 @@ gs_theme_window_real_realize (GtkWidget *widget) gdk_window_set_user_data (window, widget); gtk_widget_set_realized (widget, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_get_geometry (window, &x, &y, &width, &height); -#else - gdk_window_get_geometry (window, &x, &y, &width, &height, NULL); -#endif if (width < MIN_SIZE || height < MIN_SIZE) { @@ -210,11 +160,7 @@ gs_theme_window_real_realize (GtkWidget *widget) exit (1); } -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_get_preferred_size (widget, &requisition, NULL); -#else - gtk_widget_size_request (widget, &requisition); -#endif allocation.x = x; allocation.y = y; allocation.width = width; diff --git a/savers/gste-popsquares.c b/savers/gste-popsquares.c index b0f8cd2..3a66c49 100644 --- a/savers/gste-popsquares.c +++ b/savers/gste-popsquares.c @@ -51,13 +51,8 @@ struct GSTEPopsquaresPrivate int ncolors; int subdivision; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *colors; -#else - GdkColor *colors; -#endif square *squares; - }; #define GSTE_POPSQUARES_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSTE_TYPE_POPSQUARES, GSTEPopsquaresPrivate)) @@ -219,28 +214,15 @@ rgb_to_hsv (double r, } static void -#if GTK_CHECK_VERSION (3, 0, 0) make_color_ramp (int h1, -#else -make_color_ramp (GdkColormap *colormap, - int h1, -#endif double s1, double v1, int h2, double s2, double v2, -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *colors, int n_colors, gboolean closed) -#else - GdkColor *colors, - int n_colors, - gboolean closed, - gboolean allocate, - gboolean writable) -#endif { double dh, ds, dv; /* deltas */ int i; @@ -273,33 +255,13 @@ make_color_ramp (GdkColormap *colormap, for (i = 0; i < ncolors; i++) { -#if !GTK_CHECK_VERSION (3, 0, 0) - double red, green, blue; - -#endif hsv_to_rgb ((int) (h1 + (i * dh)), (s1 + (i * ds)), (v1 + (i * dv)), -#if GTK_CHECK_VERSION (3, 0, 0) &colors [i].red, &colors [i].green, &colors [i].blue); colors [i].alpha = 1.0; -#else - &red, &green, &blue); - - colors [i].red = (guint16) (red * 65535.0); - colors [i].green = (guint16) (green * 65535.0); - colors [i].blue = (guint16) (blue * 65535.0); - - if (allocate) - { - gdk_colormap_alloc_color (colormap, - &colors [i], - writable, - TRUE); - } -#endif } if (closed) @@ -328,7 +290,6 @@ randomize_square_colors (square *squares, } } -#if GTK_CHECK_VERSION (3, 0, 0) static void set_colors (GtkWidget *widget, GdkRGBA *fg, @@ -357,31 +318,6 @@ set_colors (GtkWidget *widget, fg->blue = bg->blue * 0.7; fg->alpha = bg->alpha; } -#else -static void -set_colors (GtkWidget *widget, - GdkColor *fg, - GdkColor *bg) -{ - GtkWidget *style_widget; - GtkStyle *style; - GdkColor color; - - style_widget = gtk_invisible_new (); - style = gtk_widget_get_style (style_widget); - - color = style->dark [GTK_STATE_SELECTED]; - fg->red = color.red; - fg->green = color.green; - fg->blue = color.blue; - color = style->bg [GTK_STATE_SELECTED]; - bg->red = color.red; - bg->green = color.green; - bg->blue = color.blue; - - gtk_widget_destroy (style_widget); -} -#endif static void gste_popsquares_set_property (GObject *object, @@ -466,13 +402,8 @@ setup_colors (GSTEPopsquares *pop) double s1, v1, s2, v2 = 0; int h1, h2 = 0; int nsquares; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA fg; GdkRGBA bg; -#else - GdkColor fg; - GdkColor bg; -#endif GdkWindow *window; window = gs_theme_engine_get_window (GS_THEME_ENGINE (pop)); @@ -488,13 +419,8 @@ setup_colors (GSTEPopsquares *pop) { g_free (pop->priv->colors); } -#if GTK_CHECK_VERSION (3, 0, 0) pop->priv->colors = g_new0 (GdkRGBA, pop->priv->ncolors); -#else - pop->priv->colors = g_new0 (GdkColor, pop->priv->ncolors); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) rgb_to_hsv (fg.red, fg.green, fg.blue, &h1, &s1, &v1); rgb_to_hsv (bg.red, bg.green, bg.blue, &h2, &s2, &v2); @@ -503,25 +429,6 @@ setup_colors (GSTEPopsquares *pop) pop->priv->colors, pop->priv->ncolors, TRUE); -#else - rgb_to_hsv ((double) (fg.red / 65535.0), - (double) (fg.green / 65535.0), - (double) (fg.blue / 65535.0), - &h1, &s1, &v1); - rgb_to_hsv ((double) (bg.red / 65535.0), - (double) (bg.green / 65535.0), - (double) (bg.blue / 65535.0), - &h2, &s2, &v2); - - make_color_ramp (gtk_widget_get_colormap (GTK_WIDGET (pop)), - h1, s1, v1, - h2, s2, v2, - pop->priv->colors, - pop->priv->ncolors, - TRUE, - TRUE, - FALSE); -#endif nsquares = pop->priv->subdivision * pop->priv->subdivision; @@ -544,30 +451,15 @@ gste_popsquares_real_show (GtkWidget *widget) } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) gste_popsquares_real_draw (GtkWidget *widget, cairo_t *cr) { if (GTK_WIDGET_CLASS (parent_class)->draw) { GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); } -#else -gste_popsquares_real_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - cairo_t *cr; - - if (GTK_WIDGET_CLASS (parent_class)->expose_event) { - GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - } - cr = gdk_cairo_create (event->window); -#endif draw_frame (GSTE_POPSQUARES (widget), cr); -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif return TRUE; } @@ -608,11 +500,7 @@ gste_popsquares_class_init (GSTEPopsquaresClass *klass) object_class->set_property = gste_popsquares_set_property; widget_class->show = gste_popsquares_real_show; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = gste_popsquares_real_draw; -#else - widget_class->expose_event = gste_popsquares_real_expose; -#endif widget_class->configure_event = gste_popsquares_real_configure; g_type_class_add_private (klass, sizeof (GSTEPopsquaresPrivate)); @@ -652,11 +540,7 @@ draw_frame (GSTEPopsquares *pop, { square *s = (square *) &pop->priv->squares [gw * y + x]; -#if GTK_CHECK_VERSION (3, 0, 0) gdk_cairo_set_source_rgba (cr, &(pop->priv->colors [s->color])); -#else - gdk_cairo_set_source_color (cr, &(pop->priv->colors [s->color])); -#endif cairo_rectangle (cr, s->x, s->y, border ? s->w - border : s->w, border ? s->h - border : s->h); diff --git a/savers/gste-slideshow.c b/savers/gste-slideshow.c index 4c0fb99..49e742f 100644 --- a/savers/gste-slideshow.c +++ b/savers/gste-slideshow.c @@ -428,10 +428,6 @@ results_pull_func (GSTESlideshow *show) { OpResult *result; -#if !GTK_CHECK_VERSION (3, 0, 0) - GDK_THREADS_ENTER (); -#endif - g_async_queue_lock (show->priv->results_q); result = g_async_queue_try_pop_unlocked (show->priv->results_q); @@ -449,10 +445,6 @@ results_pull_func (GSTESlideshow *show) g_async_queue_unlock (show->priv->results_q); -#if !GTK_CHECK_VERSION (3, 0, 0) - GDK_THREADS_LEAVE (); -#endif - return FALSE; } @@ -689,9 +681,6 @@ op_load_image (GSTESlideshow *show, window_width, window_height); -#if !GTK_CHECK_VERSION (3, 0, 0) - GDK_THREADS_ENTER (); -#endif g_async_queue_lock (show->priv->results_q); g_async_queue_push_unlocked (show->priv->results_q, op_result); @@ -703,9 +692,6 @@ op_load_image (GSTESlideshow *show, } g_async_queue_unlock (show->priv->results_q); -#if !GTK_CHECK_VERSION (3, 0, 0) - GDK_THREADS_LEAVE (); -#endif } static gpointer @@ -874,37 +860,21 @@ gste_slideshow_real_show (GtkWidget *widget) } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) gste_slideshow_real_draw (GtkWidget *widget, cairo_t *cr) -#else -gste_slideshow_real_expose (GtkWidget *widget, - GdkEventExpose *event) -#endif { GSTESlideshow *show = GSTE_SLIDESHOW (widget); -#if GTK_CHECK_VERSION (3, 0, 0) if (GTK_WIDGET_CLASS (parent_class)->draw) { GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); } -#else - if (GTK_WIDGET_CLASS (parent_class)->expose_event) { - GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - } - cairo_t *cr = gdk_cairo_create (event->window); -#endif cairo_set_source_surface (cr, show->priv->surf, 0, 0); gs_theme_engine_profile_start ("paint surface to window"); cairo_paint (cr); gs_theme_engine_profile_end ("paint surface to window"); -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif - return TRUE; } @@ -961,11 +931,7 @@ gste_slideshow_class_init (GSTESlideshowClass *klass) object_class->set_property = gste_slideshow_set_property; widget_class->show = gste_slideshow_real_show; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = gste_slideshow_real_draw; -#else - widget_class->expose_event = gste_slideshow_real_expose; -#endif widget_class->configure_event = gste_slideshow_real_configure; g_type_class_add_private (klass, sizeof (GSTESlideshowPrivate)); @@ -1000,7 +966,6 @@ gste_slideshow_class_init (GSTESlideshowClass *klass) G_PARAM_READWRITE)); } -#if GTK_CHECK_VERSION (3, 0, 0) static void set_visual (GtkWidget *widget) { @@ -1016,23 +981,6 @@ set_visual (GtkWidget *widget) gtk_widget_set_visual (widget, visual); } -#else -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_rgb_colormap (screen); - } - - gtk_widget_set_colormap (widget, colormap); -} -#endif static void gste_slideshow_init (GSTESlideshow *show) @@ -1046,11 +994,7 @@ gste_slideshow_init (GSTESlideshow *show) g_thread_new ("loadthread", (GThreadFunc)load_threadfunc, show->priv->op_q); -#if GTK_CHECK_VERSION (3, 0, 0) set_visual (GTK_WIDGET (show)); -#else - set_colormap (GTK_WIDGET (show)); -#endif } static void diff --git a/savers/popsquares.c b/savers/popsquares.c index 8bfbc57..6b9b8f7 100644 --- a/savers/popsquares.c +++ b/savers/popsquares.c @@ -23,8 +23,6 @@ #include <stdlib.h> #include <string.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> #include <gtk/gtk.h> #include <glib/gi18n.h> |