From 72dd61aa3a3a98bf38c2cc3aa7e36f99b620be24 Mon Sep 17 00:00:00 2001 From: infirit Date: Thu, 9 Jul 2015 12:08:18 +0200 Subject: Use accessor functions instead of direct access Make Gtk2 build with GSEAL_ENABLE And cut down on ifdef hell. --- savers/floaters.c | 10 ++-- savers/gs-theme-engine.c | 34 ++++--------- savers/gs-theme-window.c | 12 ----- savers/gste-popsquares.c | 8 --- savers/gste-slideshow.c | 8 +-- src/copy-theme-dialog.c | 4 -- src/gs-grab-x11.c | 4 -- src/gs-job.c | 4 -- src/gs-lock-plug.c | 37 +++----------- src/gs-window-x11.c | 100 ++++++++----------------------------- src/mate-screensaver-dialog.c | 4 -- src/mate-screensaver-preferences.c | 6 +-- 12 files changed, 44 insertions(+), 187 deletions(-) diff --git a/savers/floaters.c b/savers/floaters.c index b693ed5..c2f4bc4 100644 --- a/savers/floaters.c +++ b/savers/floaters.c @@ -41,10 +41,6 @@ #include "gs-theme-window.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define GTK_WIDGET_REALIZED gtk_widget_get_realized -#endif - #ifndef trunc #define trunc(x) (((x) > 0.0) ? floor((x)) : -floor(-(x))) #endif @@ -1042,7 +1038,7 @@ screen_saver_on_expose_event (ScreenSaver *screen_saver, screen_saver_create_floaters (screen_saver); #if !GTK_CHECK_VERSION (3, 0, 0) - context = gdk_cairo_create (screen_saver->drawing_area->window); + context = gdk_cairo_create (gtk_widget_get_window (screen_saver->drawing_area)); cairo_rectangle (context, (double) event->area.x, @@ -1107,7 +1103,7 @@ screen_saver_update_state (ScreenSaver *screen_saver, screen_saver_floater_update_state (screen_saver, floater, time); - if (GTK_WIDGET_REALIZED (screen_saver->drawing_area) + if (gtk_widget_get_realized (screen_saver->drawing_area) && (floater->bounds.width > 0) && (floater->bounds.height > 0)) { gint size; @@ -1282,7 +1278,7 @@ main (int argc, gtk_widget_override_background_color (drawing_area, 0, &bg); gtk_widget_override_color (drawing_area, 0, &fg); #else - style = drawing_area->style; + style = gtk_widget_get_style (drawing_area); state = (GtkStateType) 0; while (state < (GtkStateType) G_N_ELEMENTS (style->bg)) { diff --git a/savers/gs-theme-engine.c b/savers/gs-theme-engine.c index 18ebfad..900d95d 100644 --- a/savers/gs-theme-engine.c +++ b/savers/gs-theme-engine.c @@ -31,10 +31,6 @@ #include "gs-theme-engine.h" #include "gs-theme-engine-marshal.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define GTK_WIDGET_VISIBLE gtk_widget_get_visible -#endif - static void gs_theme_engine_class_init (GSThemeEngineClass *klass); static void gs_theme_engine_init (GSThemeEngine *engine); static void gs_theme_engine_finalize (GObject *object); @@ -126,17 +122,13 @@ gs_theme_engine_clear (GtkWidget *widget) g_return_if_fail (GS_IS_THEME_ENGINE (widget)); - if (! GTK_WIDGET_VISIBLE (widget)) + if (! gtk_widget_get_visible (widget)) { return; } state = (GtkStateType) 0; -#if GTK_CHECK_VERSION (3, 0, 0) while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg)) -#else - while (state < (GtkStateType) G_N_ELEMENTS (widget->style->bg)) -#endif { gtk_widget_modify_bg (widget, state, &color); state++; @@ -145,10 +137,10 @@ gs_theme_engine_clear (GtkWidget *widget) #if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_background (gtk_widget_get_window (widget), &color); #else - colormap = gdk_drawable_get_colormap (widget->window); + colormap = gdk_drawable_get_colormap (gtk_widget_get_window (widget)); gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE); - gdk_window_set_background (widget->window, &color); - gdk_window_clear (widget->window); + gdk_window_set_background (gtk_widget_get_window (widget), &color); + gdk_window_clear (gtk_widget_get_window (widget)); #endif gdk_flush (); } @@ -218,24 +210,20 @@ gs_theme_engine_get_window_size (GSThemeEngine *engine, g_return_if_fail (GS_IS_THEME_ENGINE (engine)); - if (! GTK_WIDGET_VISIBLE (GTK_WIDGET (engine))) + if (! gtk_widget_get_visible (GTK_WIDGET (engine))) { return; } -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_get_geometry (gtk_widget_get_window (GTK_WIDGET (engine)), NULL, NULL, width, - height); -#else - gdk_window_get_geometry (GTK_WIDGET (engine)->window, - NULL, - NULL, - width, +#if !GTK_CHECK_VERSION (3, 0, 0) height, - NULL); + NULL); +#else + height); #endif } @@ -244,9 +232,5 @@ gs_theme_engine_get_window (GSThemeEngine *engine) { g_return_val_if_fail (GS_IS_THEME_ENGINE (engine), NULL); -#if GTK_CHECK_VERSION (3, 0, 0) return gtk_widget_get_window (GTK_WIDGET (engine)); -#else - return GTK_WIDGET (engine)->window; -#endif } diff --git a/savers/gs-theme-window.c b/savers/gs-theme-window.c index aa35476..089a7f2 100644 --- a/savers/gs-theme-window.c +++ b/savers/gs-theme-window.c @@ -178,27 +178,15 @@ gs_theme_window_real_realize (GtkWidget *widget) return; } -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_set_background (gtk_widget_get_style (widget), -#else - gtk_style_set_background (widget->style, -#endif window, GTK_STATE_NORMAL); gdk_window_set_decorations (window, (GdkWMDecoration) 0); gdk_window_set_events (window, gdk_window_get_events (window) | event_mask); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_window (widget, window); -#else - widget->window = window; -#endif gdk_window_set_user_data (window, widget); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_realized (widget, TRUE); -#else - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); -#endif #if GTK_CHECK_VERSION (3, 0, 0) gdk_window_get_geometry (window, &x, &y, &width, &height); diff --git a/savers/gste-popsquares.c b/savers/gste-popsquares.c index 200c8ad..db7c36f 100644 --- a/savers/gste-popsquares.c +++ b/savers/gste-popsquares.c @@ -323,19 +323,11 @@ set_colors (GdkWindow *window, widget = gtk_invisible_new (); -#if GTK_CHECK_VERSION (3, 0, 0) color = gtk_widget_get_style (widget)->dark [GTK_STATE_SELECTED]; -#else - color = widget->style->dark [GTK_STATE_SELECTED]; -#endif fg->red = color.red; fg->green = color.green; fg->blue = color.blue; -#if GTK_CHECK_VERSION (3, 0, 0) color = gtk_widget_get_style (widget)->bg [GTK_STATE_SELECTED]; -#else - color = widget->style->bg [GTK_STATE_SELECTED]; -#endif bg->red = color.red; bg->green = color.green; bg->blue = color.blue; diff --git a/savers/gste-slideshow.c b/savers/gste-slideshow.c index 4bc5dbb..72ca87b 100644 --- a/savers/gste-slideshow.c +++ b/savers/gste-slideshow.c @@ -194,7 +194,7 @@ start_fade (GSTESlideshow *show, gdk_pixbuf_get_height (colored), pixbuf, 0, 0); #else - pixmap = gdk_pixmap_new (NULL, ph, pw, gdk_visual_get_system ()->depth); + pixmap = gdk_pixmap_new (NULL, ph, pw, gdk_visual_get_depth (gdk_visual_get_system ())); gdk_draw_pixbuf (pixmap, NULL, colored, 0, 0, 0, 0, -1, -1, GDK_RGB_DITHER_MAX, 0, 0); gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, -1, -1); @@ -339,7 +339,7 @@ update_display (GSTESlideshow *show) gtk_widget_queue_draw (GTK_WIDGET (show)); #else /* paint the image buffer into the window */ - cr = gdk_cairo_create (GTK_WIDGET (show)->window); + cr = gdk_cairo_create (gtk_widget_get_window (GTK_WIDGET (show))); cairo_set_source_surface (cr, show->priv->surf, 0, 0); @@ -951,11 +951,7 @@ gste_slideshow_real_configure (GtkWidget *widget, cairo_surface_destroy (show->priv->surf); } -#if GTK_CHECK_VERSION (3, 0, 0) cr = gdk_cairo_create (gtk_widget_get_window (widget)); -#else - cr = gdk_cairo_create (widget->window); -#endif show->priv->surf = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR, show->priv->window_width, diff --git a/src/copy-theme-dialog.c b/src/copy-theme-dialog.c index 045674e..b594966 100644 --- a/src/copy-theme-dialog.c +++ b/src/copy-theme-dialog.c @@ -201,11 +201,7 @@ copy_theme_dialog_init (CopyThemeDialog *dlg) dlg->priv->cancellable = g_cancellable_new (); /* GUI settings */ -#if GTK_CHECK_VERSION (3, 0, 0) dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dlg)); -#else - dialog_vbox = GTK_DIALOG (dlg)->vbox; -#endif gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox), 4); diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c index 003df3b..72809d5 100644 --- a/src/gs-grab-x11.c +++ b/src/gs-grab-x11.c @@ -589,11 +589,7 @@ gs_grab_grab_offscreen (GSGrab *grab, gs_debug ("Grabbing an offscreen window"); screen = gtk_invisible_get_screen (GTK_INVISIBLE (grab->priv->invisible)); -#if GTK_CHECK_VERSION (3, 0, 0) res = gs_grab_grab_window (grab, gtk_widget_get_window (GTK_WIDGET (grab->priv->invisible)), screen, hide_cursor); -#else - res = gs_grab_grab_window (grab, grab->priv->invisible->window, screen, hide_cursor); -#endif return res; } diff --git a/src/gs-job.c b/src/gs-job.c index af77442..4296f64 100644 --- a/src/gs-job.c +++ b/src/gs-job.c @@ -80,11 +80,7 @@ widget_get_id_string (GtkWidget *widget) g_return_val_if_fail (widget != NULL, NULL); id = g_strdup_printf ("0x%X", -#if GTK_CHECK_VERSION (3, 0, 0) (guint32)GDK_WINDOW_XID (gtk_widget_get_window (widget))); -#else - (guint32)GDK_WINDOW_XID (widget->window)); -#endif return id; } diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c index 9292cbf..37ab29b 100644 --- a/src/gs-lock-plug.c +++ b/src/gs-lock-plug.c @@ -43,9 +43,6 @@ #define MATE_DESKTOP_USE_UNSTABLE_API #include #define gdk_spawn_command_line_on_screen mate_gdk_spawn_command_line_on_screen -#define GTK_WIDGET_VISIBLE gtk_widget_get_visible -#define GTK_WIDGET_IS_SENSITIVE gtk_widget_is_sensitive -#define GTK_WIDGET_HAS_FOCUS gtk_widget_has_focus #endif #ifdef WITH_KBD_LAYOUT_INDICATOR @@ -581,17 +578,13 @@ gs_lock_plug_run (GSLockPlug *plug) g_object_ref (plug); -#if GTK_CHECK_VERSION (3, 0, 0) was_modal = gtk_window_get_modal (GTK_WINDOW (plug)); -#else - was_modal = GTK_WINDOW (plug)->modal; -#endif if (!was_modal) { gtk_window_set_modal (GTK_WINDOW (plug), TRUE); } - if (!GTK_WIDGET_VISIBLE (plug)) + if (!gtk_widget_get_visible (GTK_WIDGET (plug))) { gtk_widget_show (GTK_WIDGET (plug)); } @@ -920,8 +913,8 @@ image_set_from_pixbuf (GtkImage *image, radius = w / 10; - pixmap = gdk_pixmap_new (GTK_WIDGET (image)->window, w, h, -1); - bitmask = gdk_pixmap_new (GTK_WIDGET (image)->window, w, h, 1); + pixmap = gdk_pixmap_new (gtk_widget_get_window (GTK_WIDGET (image)), w, h, -1); + bitmask = gdk_pixmap_new (gtk_widget_get_window (GTK_WIDGET (image)), w, h, 1); cr = gdk_cairo_create (pixmap); cr_mask = gdk_cairo_create (bitmask); @@ -936,7 +929,7 @@ image_set_from_pixbuf (GtkImage *image, cairo_set_source_rgb (cr_mask, 1, 1, 1); cairo_fill (cr_mask); - color = GTK_WIDGET (image)->style->bg [GTK_STATE_NORMAL]; + color = gtk_widget_get_style (GTK_WIDGET (image))->bg [GTK_STATE_NORMAL]; r = (float)color.red / 65535.0; g = (float)color.green / 65535.0; b = (float)color.blue / 65535.0; @@ -1351,11 +1344,7 @@ gs_lock_plug_close (GSLockPlug *plug) GdkEvent *event; event = gdk_event_new (GDK_DELETE); -#if GTK_CHECK_VERSION (3, 0, 0) event->any.window = g_object_ref (gtk_widget_get_window(widget)); -#else - event->any.window = g_object_ref (widget->window); -#endif event->any.send_event = TRUE; gtk_main_do_event (event); @@ -1565,11 +1554,7 @@ gs_lock_plug_set_busy (GSLockPlug *plug) cursor = gdk_cursor_new (GDK_WATCH); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_cursor (gtk_widget_get_window (top_level), cursor); -#else - gdk_window_set_cursor (top_level->window, cursor); -#endif gdk_cursor_unref (cursor); } @@ -1582,11 +1567,7 @@ gs_lock_plug_set_ready (GSLockPlug *plug) top_level = gtk_widget_get_toplevel (GTK_WIDGET (plug)); cursor = gdk_cursor_new (GDK_LEFT_PTR); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_cursor (gtk_widget_get_window (top_level), cursor); -#else - gdk_window_set_cursor (top_level->window, cursor); -#endif gdk_cursor_unref (cursor); } @@ -1608,7 +1589,7 @@ gs_lock_plug_enable_prompt (GSLockPlug *plug, gtk_widget_set_sensitive (plug->priv->auth_prompt_entry, TRUE); gtk_widget_show (plug->priv->auth_prompt_entry); - if (! GTK_WIDGET_HAS_FOCUS (plug->priv->auth_prompt_entry)) + if (! gtk_widget_has_focus (plug->priv->auth_prompt_entry)) { gtk_widget_grab_focus (plug->priv->auth_prompt_entry); } @@ -1667,8 +1648,8 @@ entry_key_press (GtkWidget *widget, /* if the input widget is visible and ready for input * then just carry on as usual */ - if (GTK_WIDGET_VISIBLE (plug->priv->auth_prompt_entry) && - GTK_WIDGET_IS_SENSITIVE (plug->priv->auth_prompt_entry)) + if (gtk_widget_get_visible (plug->priv->auth_prompt_entry) && + gtk_widget_is_sensitive (plug->priv->auth_prompt_entry)) { return FALSE; } @@ -1696,11 +1677,7 @@ gs_lock_plug_add_button (GSLockPlug *plug, button = gtk_button_new_from_stock (button_text); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_can_default (button, TRUE); -#else - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); -#endif gtk_widget_show (button); diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c index 6756780..458db44 100644 --- a/src/gs-window-x11.c +++ b/src/gs-window-x11.c @@ -32,9 +32,6 @@ #include #if GTK_CHECK_VERSION (3, 0, 0) #include -#define GTK_WIDGET_IS_SENSITIVE gtk_widget_get_sensitive -#define GTK_WIDGET_VISIBLE gtk_widget_get_visible -#define GTK_WIDGET_REALIZED gtk_widget_get_realized #endif #include "gs-window.h" @@ -216,18 +213,10 @@ gs_window_override_user_time (GSWindow *window) * NOTE: Last resort for D-BUS or other non-interactive * openings. Causes roundtrip to server. Lame. */ -#if GTK_CHECK_VERSION (3, 0, 0) ev_time = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window))); -#else - ev_time = gdk_x11_get_server_time (GTK_WIDGET (window)->window); -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) gdk_x11_window_set_user_time (gtk_widget_get_window (GTK_WIDGET (window)), ev_time); -#else - gdk_x11_window_set_user_time (GTK_WIDGET (window)->window, ev_time); -#endif } static void @@ -305,7 +294,7 @@ widget_clear_all_children (GtkWidget *widget) gdk_error_trap_push (); - w = widget->window; + w = gtk_widget_get_window (widget); clear_children (GDK_WINDOW_XID (w)); @@ -358,7 +347,7 @@ gs_window_set_background_pixmap (GSWindow *window, if (pixmap != NULL) { window->priv->background_pixmap = g_object_ref (pixmap); - gdk_window_set_back_pixmap (GTK_WIDGET (window)->window, + gdk_window_set_back_pixmap (gtk_widget_get_window (GTK_WIDGET (window)), pixmap, FALSE); } @@ -379,7 +368,7 @@ gs_window_clear_to_background_pixmap (GSWindow *window) g_return_if_fail (GS_IS_WINDOW (window)); - if (! GTK_WIDGET_VISIBLE (GTK_WIDGET (window))) + if (! gtk_widget_get_visible (GTK_WIDGET (window))) { return; } @@ -399,10 +388,10 @@ gs_window_clear_to_background_pixmap (GSWindow *window) #if GTK_CHECK_VERSION (3, 0, 0) gs_window_reset_background_surface (window); #else - style = gtk_style_copy (GTK_WIDGET (window)->style); + style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (window))); state = (GtkStateType) 0; - while (state < (GtkStateType) G_N_ELEMENTS (GTK_WIDGET (window)->style->bg_pixmap)) + while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (GTK_WIDGET (window))->bg_pixmap)) { if (style->bg_pixmap[state] != NULL) @@ -419,12 +408,12 @@ gs_window_clear_to_background_pixmap (GSWindow *window) if (window->priv->background_pixmap != NULL) { - gdk_window_set_back_pixmap (GTK_WIDGET (window)->window, + gdk_window_set_back_pixmap (gtk_widget_get_window (GTK_WIDGET (window)), window->priv->background_pixmap, FALSE); } - gdk_window_clear (GTK_WIDGET (window)->window); + gdk_window_clear (gtk_widget_get_window (GTK_WIDGET (window))); gdk_flush (); #endif @@ -453,7 +442,7 @@ clear_widget (GtkWidget *widget) gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, &rgba); gtk_widget_queue_draw (GTK_WIDGET (widget)); #else - if (! GTK_WIDGET_VISIBLE (widget)) + if (! gtk_widget_get_visible (widget)) { return; } @@ -461,16 +450,16 @@ clear_widget (GtkWidget *widget) gs_debug ("Clearing widget"); state = (GtkStateType) 0; - while (state < (GtkStateType) G_N_ELEMENTS (widget->style->bg)) + while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg)) { gtk_widget_modify_bg (widget, state, &color); state++; } - style = gtk_style_copy (widget->style); + style = gtk_style_copy (gtk_widget_get_style (widget)); state = (GtkStateType) 0; - while (state < (GtkStateType) G_N_ELEMENTS (widget->style->bg_pixmap)) + while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg_pixmap)) { if (style->bg_pixmap[state] != NULL) @@ -482,14 +471,14 @@ clear_widget (GtkWidget *widget) state++; } - colormap = gdk_drawable_get_colormap (widget->window); + colormap = gdk_drawable_get_colormap (gtk_widget_get_window (widget)); gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE); - gdk_window_set_background (widget->window, &color); + gdk_window_set_background (gtk_widget_get_window (widget), &color); gtk_widget_set_style (widget, style); g_object_unref (style); - gdk_window_clear (widget->window); + gdk_window_clear (gtk_widget_get_window (widget)); /* If a screensaver theme adds child windows we need to clear them too */ widget_clear_all_children (widget); @@ -542,7 +531,7 @@ get_outside_region (GSWindow *window) rectangle.height = geometry.height; cairo_region_union_rectangle (region, &rectangle); #else - gdk_screen_get_monitor_geometry (GTK_WINDOW (window)->screen, + gdk_screen_get_monitor_geometry (gtk_window_get_screen (GTK_WINDOW (window)), i, &geometry); gdk_region_union_with_rect (region, &geometry); #endif @@ -565,11 +554,7 @@ update_geometry (GSWindow *window) outside_region = get_outside_region (window); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (window)), -#else - gdk_screen_get_monitor_geometry (GTK_WINDOW (window)->screen, -#endif window->priv->monitor, &geometry); gs_debug ("got geometry for monitor %d: x=%d y=%d w=%d h=%d", @@ -627,13 +612,9 @@ gs_window_move_resize_window (GSWindow *window, GdkWindow *gdkwindow; widget = GTK_WIDGET (window); -#if GTK_CHECK_VERSION (3, 0, 0) gdkwindow = gtk_widget_get_window (GTK_WIDGET (window)); -#else - gdkwindow = widget->window; -#endif - g_assert (GTK_WIDGET_REALIZED (widget)); + g_assert (gtk_widget_get_realized (widget)); gs_debug ("Move and/or resize window on monitor %d: x=%d y=%d w=%d h=%d", window->priv->monitor, @@ -888,11 +869,7 @@ watchdog_timer (GSWindow *window) { GtkWidget *widget = GTK_WIDGET (window); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_focus (gtk_widget_get_window (widget), GDK_CURRENT_TIME); -#else - gdk_window_focus (widget->window, GDK_CURRENT_TIME); -#endif return TRUE; } @@ -955,11 +932,7 @@ gs_window_raise (GSWindow *window) gs_debug ("Raising screensaver window"); -#if GTK_CHECK_VERSION (3, 0, 0) win = gtk_widget_get_window (GTK_WIDGET (window)); -#else - win = GTK_WIDGET (window)->window; -#endif gdk_window_raise (win); } @@ -972,11 +945,7 @@ x11_window_is_ours (Window window) ret = FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) gwindow = gdk_x11_window_lookup_for_display (gdk_display_get_default (), window); -#else - gwindow = gdk_window_lookup (window); -#endif if (gwindow && (window != GDK_ROOT_WINDOW ())) { ret = TRUE; @@ -989,11 +958,7 @@ x11_window_is_ours (Window window) static void unshape_window (GSWindow *window) { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_shape_combine_region (gtk_widget_get_window (GTK_WIDGET (window)), -#else - gdk_window_shape_combine_region (GTK_WIDGET (window)->window, -#endif NULL, 0, 0); @@ -1117,11 +1082,7 @@ gs_window_real_show (GtkWidget *widget) gs_window_clear (GS_WINDOW (widget)); -#if GTK_CHECK_VERSION (3, 0, 0) set_invisible_cursor (gtk_widget_get_window (widget), TRUE); -#else - set_invisible_cursor (widget->window, TRUE); -#endif window = GS_WINDOW (widget); if (window->priv->timer) @@ -1271,11 +1232,7 @@ gs_window_get_gdk_window (GSWindow *window) { g_return_val_if_fail (GS_IS_WINDOW (window), NULL); -#if GTK_CHECK_VERSION (3, 0, 0) return gtk_widget_get_window (GTK_WIDGET (window)); -#else - return GTK_WIDGET (window)->window; -#endif } GtkWidget * @@ -1379,7 +1336,7 @@ spawn_on_window (GSWindow *window, &standard_error, &error); #else - result = gdk_spawn_on_screen_with_pipes (GTK_WINDOW (window)->screen, + result = gdk_spawn_on_screen_with_pipes (gtk_window_get_screen (GTK_WINDOW (window)), NULL, argv, NULL, @@ -1854,11 +1811,7 @@ popdown_dialog (GSWindow *window) gtk_widget_show (window->priv->drawing_area); gs_window_clear (window); -#if GTK_CHECK_VERSION (3, 0, 0) set_invisible_cursor (gtk_widget_get_window (GTK_WIDGET (window)), TRUE); -#else - set_invisible_cursor (GTK_WIDGET (window)->window, TRUE); -#endif window_set_dialog_up (window, FALSE); @@ -2046,11 +1999,10 @@ popup_dialog (GSWindow *window) #if GTK_CHECK_VERSION (3, 0, 0) gs_window_clear_to_background_surface (window); - set_invisible_cursor (gtk_widget_get_window (GTK_WIDGET (window)), FALSE); #else gs_window_clear_to_background_pixmap (window); - set_invisible_cursor (GTK_WIDGET (window)->window, FALSE); #endif + set_invisible_cursor (gtk_widget_get_window (GTK_WIDGET (window)), FALSE); window->priv->dialog_quit_requested = FALSE; window->priv->dialog_shake_in_progress = FALSE; @@ -2086,7 +2038,7 @@ gs_window_request_unlock (GSWindow *window) gs_debug ("Requesting unlock"); - if (! GTK_WIDGET_VISIBLE (GTK_WIDGET (window))) + if (! gtk_widget_get_visible (GTK_WIDGET (window))) { gs_debug ("Request unlock but window is not visible!"); return; @@ -2155,11 +2107,7 @@ gs_window_get_screen (GSWindow *window) { g_return_val_if_fail (GS_IS_WINDOW (window), NULL); -#if GTK_CHECK_VERSION (3, 0, 0) return gtk_widget_get_screen (GTK_WIDGET (window)); -#else - return GTK_WINDOW (window)->screen; -#endif } void @@ -2403,7 +2351,7 @@ maybe_handle_activity (GSWindow *window) /* if we already have a socket then don't bother */ if (! window->priv->lock_socket - && GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (window))) + && gtk_widget_get_sensitive (GTK_WIDGET (window))) { g_signal_emit (window, signals [ACTIVITY], 0, &handled); } @@ -2512,13 +2460,9 @@ gs_window_real_size_request (GtkWidget *widget, window = GS_WINDOW (widget); bin = GTK_BIN (widget); -#if GTK_CHECK_VERSION (3, 0, 0) child = gtk_bin_get_child (bin); -#else - child = bin->child; -#endif - if (child && GTK_WIDGET_VISIBLE (child)) + if (child && gtk_widget_get_visible (child)) { gtk_widget_size_request (child, requisition); } @@ -2530,7 +2474,7 @@ gs_window_real_size_request (GtkWidget *widget, requisition->width = window->priv->geometry.width; requisition->height = window->priv->geometry.height; - if (! GTK_WIDGET_REALIZED (widget)) + if (! gtk_widget_get_realized (widget)) { return; } diff --git a/src/mate-screensaver-dialog.c b/src/mate-screensaver-dialog.c index 79be649..1ed3a3f 100644 --- a/src/mate-screensaver-dialog.c +++ b/src/mate-screensaver-dialog.c @@ -73,11 +73,7 @@ static char* get_id_string(GtkWidget* widget) g_return_val_if_fail(widget != NULL, NULL); g_return_val_if_fail(GTK_IS_WIDGET(widget), NULL); -#if GTK_CHECK_VERSION (3, 0, 0) id = g_strdup_printf("%" G_GUINT32_FORMAT, (guint32) GDK_WINDOW_XID(gtk_widget_get_window(widget))); -#else - id = g_strdup_printf("%" G_GUINT32_FORMAT, (guint32) GDK_WINDOW_XID(widget->window)); -#endif return id; } diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c index 08ea293..b719f38 100644 --- a/src/mate-screensaver-preferences.c +++ b/src/mate-screensaver-preferences.c @@ -307,7 +307,7 @@ preview_clear (GtkWidget *widget) #if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_queue_draw (widget); #else - gdk_window_clear (widget->window); + gdk_window_clear (gtk_widget_get_window (widget)); #endif } @@ -918,11 +918,7 @@ drag_data_received_cb (GtkWidget *widget, if (!(info == TARGET_URI_LIST || info == TARGET_NS_URL)) return; -#if GTK_CHECK_VERSION (3, 0, 0) files = uri_list_parse ((char *) gtk_selection_data_get_data (selection_data)); -#else - files = uri_list_parse ((char *) selection_data->data); -#endif if (files != NULL) { GtkWidget *prefs_dialog; -- cgit v1.2.1