Use function to get widget's window for Gtk+-3 support
authorHugo Villeneuve <hugo@hugovil.com>
Sun, 21 Dec 2014 19:33:33 +0000 (14:33 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Sun, 24 Apr 2016 22:31:09 +0000 (18:31 -0400)
src/clock.c
src/dockapp.c

index 5615d56..b26d125 100644 (file)
@@ -382,7 +382,7 @@ hvclock_expose(GtkWidget *clock, GdkEventExpose *event)
        cairo_t *cr;
 
        /* Get a cairo_t */
-       cr = gdk_cairo_create(clock->window);
+       cr = gdk_cairo_create(gtk_widget_get_window(clock));
 
        cairo_rectangle(cr, event->area.x, event->area.y,
                        event->area.width, event->area.height);
@@ -407,13 +407,13 @@ hvclock_redraw_canvas(GtkWidget *widget)
 {
        GdkRegion *region;
 
-       if (!widget->window)
+       if (!gtk_widget_get_window(widget))
                return;
 
-       region = gdk_drawable_get_clip_region(widget->window);
+       region = gdk_drawable_get_clip_region(gtk_widget_get_window(widget));
        /* redraw the cairo canvas completely by exposing it */
-       gdk_window_invalidate_region(widget->window, region, TRUE);
-       gdk_window_process_updates(widget->window, TRUE);
+       gdk_window_invalidate_region(gtk_widget_get_window(widget), region, TRUE);
+       gdk_window_process_updates(gtk_widget_get_window(widget), TRUE);
 
        gdk_region_destroy(region);
 }
index 4dfe77b..8ded719 100644 (file)
@@ -72,7 +72,7 @@ dockapp_gtk_withdrawn_hack(GtkWidget *dockwin, GtkWidget *iconwin)
        (void) iconwin; /* Unused parameter. */
 
        d = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
-       win_orig = GDK_WINDOW_XID(dockwin->window);
+       win_orig = GDK_WINDOW_XID(gtk_widget_get_window(dockwin));
 
        XQueryTree(d, win_orig, &root, &p, &children, &nchildren);
 
@@ -146,7 +146,7 @@ dockapp_init(int argc, char *argv[])
        g_signal_connect(dockwin, "destroy", G_CALLBACK(gtk_main_quit), NULL);
 
        /* Sets the icon of dockwin as iconwin. */
-       gdk_window_set_icon(dockwin->window, iconwin->window, NULL, NULL);
+       gdk_window_set_icon(gtk_widget_get_window(dockwin), gtk_widget_get_window(iconwin), NULL, NULL);
 
        hvclock_init(iconwin);
        gtk_widget_show(iconwin);
@@ -155,6 +155,6 @@ dockapp_init(int argc, char *argv[])
        dockapp_gtk_withdrawn_hack(dockwin, iconwin);
 #else
        gtk_widget_show(dockwin);
-       gdk_window_withdraw(dockwin->window);
+       gdk_window_withdraw(gtk_widget_get_window(dockwin));
 #endif
 }