/* Starting mode is clock mode */
static int hvclock_mode = CLOCK_MODE;
+/* In preparation for Gtk+-3 support. */
+#define gtk_widget_get_allocated_width(_widget_) _widget_->allocation.width
+#define gtk_widget_get_allocated_height(_widget_) _widget_->allocation.height
+
static double
get_clock_face_radius(GtkWidget *clock)
{
/* Compute clock face radius */
- return (MIN(clock->allocation.width, clock->allocation.height) / 2) - 3;
+ return (MIN(gtk_widget_get_allocated_width(clock), gtk_widget_get_allocated_height(clock)) / 2) - 3;
}
static struct tm *
double radius, radius_numbers, radius_dots;
int digit;
- center_x = clock->allocation.width / 2;
- center_y = clock->allocation.height / 2;
+ center_x = gtk_widget_get_allocated_width(clock) / 2;
+ center_y = gtk_widget_get_allocated_height(clock) / 2;
radius = get_clock_face_radius(clock);
radius = get_clock_face_radius(clock);
- center_x = clock->allocation.width / 2;
- center_y = clock->allocation.height / 2;
+ center_x = gtk_widget_get_allocated_width(clock) / 2;
+ center_y = gtk_widget_get_allocated_height(clock) / 2;
sin_x = sin(angle);
cos_y = cos(angle);
ts = clock_get_time();
- center_x = clock->allocation.width / 2;
- center_y = clock->allocation.height / 2;
+ center_x = gtk_widget_get_allocated_width(clock) / 2;
+ center_y = gtk_widget_get_allocated_height(clock) / 2;
radius = get_clock_face_radius(clock);
char str[32];
diameter = 2 * get_clock_face_radius(clock);
- center_x = (clock->allocation.width / 2) - 2;
- start_y = (clock->allocation.height / 2) - (diameter / 2);
+ center_x = (gtk_widget_get_allocated_width(clock) / 2) - 2;
+ start_y = (gtk_widget_get_allocated_height(clock) / 2) - (diameter / 2);
cairo_set_font_size(cr, diameter * font_ratio);