Commit d78bc977 authored by Joaquim Rocha's avatar Joaquim Rocha

wacom: Re-write gui_gtk in Clutter to introduce animations

The name of the file was also changed to calibratorgui.c/h to avoid
it being inconsistent, this way it is no longer dependent on the
the technology.

https://bugzilla.gnome.org/show_bug.cgi?id=667797
parent 11382d24
......@@ -292,16 +292,20 @@ case $host_os in
PKG_CHECK_MODULES(WACOM_PANEL, $COMMON_MODULES
gnome-settings-daemon >= $GSD_REQUIRED_VERSION
xi >= 1.2 x11 libwacom >= $LIBWACOM_REQUIRED_VERSION
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)
AC_DEFINE(BUILD_WACOM, 1, [Define to 1 to build the Wacom panel])
have_wacom=yes
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
clutter-gtk-1.0
clutter-1.0 >= $CLUTTER_REQUIRED_VERSION, [have_wacom=yes], [have_wacom=no])
if test x${have_wacom} = xyes; then
AC_DEFINE(BUILD_WACOM, 1, [Define to 1 to build the Wacom panel])
AC_DEFINE(HAVE_WACOM, 1, [Define to 1 is Wacom is supportted])
fi
fi
;;
*)
have_wacom=no
;;
esac
AM_CONDITIONAL(BUILD_WACOM, [test x"$have_wacom" = x"yes"])
AM_CONDITIONAL(BUILD_WACOM, [test x${have_wacom} = xyes])
# Kerberos kerberos support
AC_PATH_PROG(KRB5_CONFIG, krb5-config, no)
......
......@@ -13,8 +13,12 @@ noinst_LTLIBRARIES = libwacom-calibrator.la libwacom-calibrator-test.la
libwacom_calibrator_la_SOURCES = \
calibrator.c \
calibrator.h \
gui_gtk.c \
gui_gtk.h
calibrator-gui.c \
calibrator-gui.h \
cc-clock-actor.c \
cc-clock-actor.h \
cc-target-actor.c \
cc-target-actor.h
libwacom_calibrator_la_LIBADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS)
libwacom_calibrator_la_LDFLAGS = $(PANEL_LDFLAGS)
......@@ -31,8 +35,12 @@ test_calibrator_SOURCES = \
main.c \
calibrator.c \
calibrator.h \
gui_gtk.c \
gui_gtk.h
calibrator-gui.c \
calibrator-gui.h \
cc-clock-actor.c \
cc-clock-actor.h \
cc-target-actor.c \
cc-target-actor.h
test_calibrator_CPPFLAGS = $(INCLUDES)
test_calibrator_LDADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS)
......
This diff is collapsed.
......@@ -21,8 +21,8 @@
* THE SOFTWARE.
*/
#ifndef _gui_gtk_h
#define _gui_gtk_h
#ifndef __CALIBRATOR_GUI_H__
#define __CALIBRATOR_GUI_H__
#include <gtk/gtk.h>
......@@ -53,6 +53,8 @@ gboolean calib_area_finish (CalibArea *area,
void calib_area_free (CalibArea *area);
void calib_area_get_display_size (CalibArea *area, gint *width, gint *height);
void calib_area_get_display_size (CalibArea *area,
gint *width,
gint *height);
#endif /* _gui_gtk_h */
#endif /* __CALIBRATOR_GUI_H__ */
......@@ -25,7 +25,7 @@
#define _calibrator_h
#include <glib.h>
#include "gui_gtk.h"
#include "calibrator-gui.h"
/*
* Number of blocks. We partition the screen into 'num_blocks' x 'num_blocks'
......
/*
* Copyright © 2013 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Joaquim Rocha <jrocha@redhat.com>
*/
#include <math.h>
#include "cc-clock-actor.h"
#define CLOCK_RADIUS 50
#define CLOCK_LINE_WIDTH 10
#define CLOCK_LINE_PADDING 10
#define CLOCK_SIZE_EXTRA
#define ANGLE "angle"
#define EXTRA_SPACE 2
G_DEFINE_TYPE (CcClockActor, cc_clock_actor, CLUTTER_TYPE_ACTOR);
enum {
PROP_0,
PROP_ANGLE,
N_PROPERTIES
};
static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
static void
draw_clock (ClutterCairoTexture *texture,
cairo_t *cr,
gint width,
gint height,
CcClockActor *self)
{
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
/* Draw the clock background */
cairo_arc (cr, width / 2, height / 2, CLOCK_RADIUS / 2, 0.0, 2.0 * M_PI);
cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
cairo_fill_preserve (cr);
cairo_stroke (cr);
cairo_set_line_width (cr, CLOCK_LINE_WIDTH);
cairo_arc (cr,
width / 2,
height / 2,
(CLOCK_RADIUS - CLOCK_LINE_WIDTH - CLOCK_LINE_PADDING) / 2,
3 * M_PI_2,
3 * M_PI_2 + self->angle * M_PI / 180.0);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_stroke (cr);
}
static void
cc_clock_actor_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
CcClockActor *self = CC_CLOCK_ACTOR (object);
ClutterContent *content;
content = clutter_actor_get_content (CLUTTER_ACTOR (self));
switch (property_id)
{
case PROP_ANGLE:
self->angle = g_value_get_float (value);
if (content)
clutter_content_invalidate (content);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
cc_clock_actor_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
CcClockActor *self = CC_CLOCK_ACTOR (object);
switch (property_id)
{
case PROP_ANGLE:
g_value_set_float (value, self->angle);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
cc_clock_actor_init (CcClockActor *self)
{
self->angle = 0;
ClutterContent *content;
content = clutter_canvas_new ();
/* Extra space is needed because when drawing without it,
it will miss 1 pixel in each of the edges */
clutter_canvas_set_size (CLUTTER_CANVAS (content),
CLOCK_RADIUS + EXTRA_SPACE,
CLOCK_RADIUS + EXTRA_SPACE);
clutter_actor_set_content (CLUTTER_ACTOR (self), content);
g_signal_connect (CLUTTER_CANVAS (content),
"draw",
G_CALLBACK (draw_clock),
self);
g_object_unref (content);
}
static void
cc_clock_actor_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
*min_width_p = CLOCK_RADIUS + EXTRA_SPACE;
*natural_width_p = CLOCK_RADIUS + EXTRA_SPACE;
}
static void
cc_clock_actor_get_preferred_height (ClutterActor *actor,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p)
{
*min_height_p = CLOCK_RADIUS + EXTRA_SPACE;
*natural_height_p = CLOCK_RADIUS + EXTRA_SPACE;
}
static void
cc_clock_actor_class_init (CcClockActorClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *clutter_actor_class = CLUTTER_ACTOR_CLASS (klass);
gobject_class->set_property = cc_clock_actor_set_property;
gobject_class->get_property = cc_clock_actor_get_property;
clutter_actor_class->get_preferred_width = cc_clock_actor_get_preferred_width;
clutter_actor_class->get_preferred_height = cc_clock_actor_get_preferred_height;
obj_properties[PROP_ANGLE] =
g_param_spec_float (ANGLE,
"The angle of the clock's progress",
"Set the angle of the clock's progress",
.0,
360.0,
.0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class,
N_PROPERTIES,
obj_properties);
}
ClutterActor *
cc_clock_actor_new (void)
{
return g_object_new (CC_CLOCK_ACTOR_TYPE, NULL);
}
/*
* Copyright © 2013 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Joaquim Rocha <jrocha@redhat.com>
*/
#ifndef __CC_CLOCK_ACTOR_H__
#define __CC_CLOCK_ACTOR_H__
#include <glib.h>
#include <clutter/clutter.h>
G_BEGIN_DECLS
#define CC_CLOCK_ACTOR_TYPE (cc_clock_actor_get_type ())
#define CC_CLOCK_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_CLOCK_ACTOR_TYPE, CcClockActor))
#define CC_IS_CLOCK_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_CLOCK_ACTOR_TYPE))
#define CC_CLOCK_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_CLOCK_ACTOR_TYPE, CcClockActorClass))
#define CC_IS_CLOCK_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_CLOCK_ACTOR_TYPE))
#define CC_CLOCK_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_CLOCK_ACTOR_TYPE, CcClockActorClass))
typedef struct _CcClockActor CcClockActor;
typedef struct _CcClockActorClass CcClockActorClass;
struct _CcClockActor
{
ClutterActor parent_instance;
/*< private >*/
gfloat angle;
};
struct _CcClockActorClass
{
ClutterActorClass parent_class;
};
ClutterActor * cc_clock_actor_new (void);
GType cc_clock_actor_get_type (void);
#endif /* __CC_CLOCK_ACTOR_H__ */
/*
* Copyright © 2013 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Joaquim Rocha <jrocha@redhat.com>
*/
#include <math.h>
#include "cc-target-actor.h"
#define CC_TARGET_ACTOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CC_TARGET_ACTOR_TYPE, CcTargetActorPrivate))
#define CROSS_LINES 47
#define CROSS_CIRCLE 7
#define CROSS_CIRCLE2 27
#define TARGET_SHOW_ANIMATION_DURATION 500
#define TARGET_HIDE_ANIMATION_DURATION 200
struct _CcTargetActorPrivate
{
gdouble pos_x;
gdouble pos_y;
};
G_DEFINE_TYPE (CcTargetActor, cc_target_actor, CLUTTER_TYPE_ACTOR);
static ClutterTransition *
get_target_show_animation (ClutterActor *target, const gchar *property)
{
ClutterTransition *transition;
transition = clutter_property_transition_new (property);
clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (transition),
CLUTTER_EASE_OUT_BACK);
clutter_timeline_set_duration (CLUTTER_TIMELINE (transition),
TARGET_SHOW_ANIMATION_DURATION);
clutter_transition_set_animatable (transition,
CLUTTER_ANIMATABLE (target));
clutter_transition_set_from (transition, G_TYPE_FLOAT, 0.0);
clutter_transition_set_to (transition, G_TYPE_FLOAT, 1.0);
return transition;
}
static ClutterTransition *
get_target_hide_animation (ClutterActor *target, const gchar *property)
{
ClutterTransition *transition;
transition = get_target_show_animation (target, property);
clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (transition),
CLUTTER_EASE_OUT);
clutter_timeline_set_duration (CLUTTER_TIMELINE (transition),
TARGET_HIDE_ANIMATION_DURATION);
clutter_transition_set_from (transition, G_TYPE_FLOAT, 1.0);
clutter_transition_set_to (transition, G_TYPE_FLOAT, 0.0);
return transition;
}
static void
show_target (CcTargetActor *self)
{
ClutterTransition *transition;
transition = get_target_show_animation (CLUTTER_ACTOR (self), "scale-x");
clutter_timeline_start (CLUTTER_TIMELINE (transition));
transition = get_target_show_animation (CLUTTER_ACTOR (self), "scale-y");
clutter_timeline_start (CLUTTER_TIMELINE (transition));
}
static void
on_target_animation_complete (ClutterTimeline *timeline,
CcTargetActor *self)
{
CcTargetActorPrivate *priv;
priv = CC_TARGET_ACTOR_GET_PRIVATE (self);
clutter_actor_show (CLUTTER_ACTOR (self));
clutter_actor_set_position (CLUTTER_ACTOR (self),
priv->pos_x,
priv->pos_y);
show_target (self);
}
static void
draw_target (ClutterCairoTexture *texture,
cairo_t *cr,
gint width,
gint height,
gpointer data)
{
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
cairo_set_line_width(cr, 1);
cairo_move_to(cr, 0, height / 2.0);
cairo_rel_line_to(cr, width, 0);
cairo_move_to(cr, width / 2.0, 0);
cairo_rel_line_to(cr, 0, height * 2);
cairo_stroke(cr);
cairo_set_line_width(cr, 2);
cairo_arc(cr, width / 2.0, height / 2.0, CROSS_CIRCLE, 0.0, 2.0 * M_PI);
cairo_stroke(cr);
cairo_set_line_width(cr, 5);
cairo_arc(cr, width / 2.0, height / 2.0, CROSS_CIRCLE2, 0.0, 2.0 * M_PI);
cairo_stroke(cr);
}
static void
cc_target_actor_init (CcTargetActor *self)
{
ClutterContent *content;
ClutterPoint anchor;
CcTargetActorPrivate *priv;
priv = CC_TARGET_ACTOR_GET_PRIVATE (self);
priv->pos_x = .0;
priv->pos_y = .0;
content = clutter_canvas_new ();
clutter_actor_set_content (CLUTTER_ACTOR (self), content);
g_object_unref (content);
clutter_canvas_set_size (CLUTTER_CANVAS (content),
CROSS_LINES * 2,
CROSS_LINES * 2);
g_signal_connect (CLUTTER_CANVAS (content),
"draw",
G_CALLBACK (draw_target),
self);
clutter_content_invalidate (content);
anchor.x = .5;
anchor.y = .5;
g_object_set (self, "pivot-point", &anchor, NULL);
}
static void
cc_target_actor_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
*min_width_p = CROSS_LINES * 2;
*natural_width_p = CROSS_LINES * 2;
}
static void
cc_target_actor_get_preferred_height (ClutterActor *actor,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p)
{
*min_height_p = CROSS_LINES * 2;
*natural_height_p = CROSS_LINES * 2;
}
static void
cc_target_actor_class_init (CcTargetActorClass *klass)
{
ClutterActorClass *clutter_actor_class = CLUTTER_ACTOR_CLASS (klass);
clutter_actor_class->get_preferred_width = cc_target_actor_get_preferred_width;
clutter_actor_class->get_preferred_height = cc_target_actor_get_preferred_height;
g_type_class_add_private (klass, sizeof (CcTargetActorPrivate));
}
void
cc_target_actor_move (CcTargetActor *self, gdouble x, gdouble y)
{
g_return_if_fail (CC_IS_TARGET_ACTOR (self));
CcTargetActorPrivate *priv;
ClutterTransition *transition;
gboolean target_visible;
priv = CC_TARGET_ACTOR_GET_PRIVATE (self);
priv->pos_x = x;
priv->pos_y = y;
g_object_get (self, "visible", &target_visible, NULL);
if (target_visible)
{
transition = get_target_hide_animation (CLUTTER_ACTOR (self), "scale-x");
clutter_timeline_start (CLUTTER_TIMELINE (transition));
transition = get_target_hide_animation (CLUTTER_ACTOR (self), "scale-y");
clutter_timeline_start (CLUTTER_TIMELINE (transition));
g_signal_connect (CLUTTER_TIMELINE (transition),
"completed",
G_CALLBACK (on_target_animation_complete),
self);
}
else
{
clutter_actor_show (CLUTTER_ACTOR (self));
clutter_actor_set_position (CLUTTER_ACTOR (self), x, y);
show_target (self);
}
}
ClutterActor *
cc_target_actor_new (void)
{
return g_object_new (CC_TARGET_ACTOR_TYPE, NULL);
}
/*
* Copyright © 2013 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Joaquim Rocha <jrocha@redhat.com>
*/
#ifndef __CC_TARGET_ACTOR_H__
#define __CC_TARGET_ACTOR_H__
#include <glib.h>
#include <clutter/clutter.h>
G_BEGIN_DECLS
#define CC_TARGET_ACTOR_TYPE (cc_target_actor_get_type ())
#define CC_TARGET_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TARGET_ACTOR_TYPE, CcTargetActor))
#define CC_IS_TARGET_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TARGET_ACTOR_TYPE))
#define CC_TARGET_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TARGET_ACTOR_TYPE, CcTargetActorClass))
#define CC_IS_TARGET_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TARGET_ACTOR_TYPE))
#define CC_TARGET_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TARGET_ACTOR_TYPE, CcTargetActorClass))
typedef struct _CcTargetActor CcTargetActor;
typedef struct _CcTargetActorClass CcTargetActorClass;
typedef struct _CcTargetActorPrivate CcTargetActorPrivate;
struct _CcTargetActor
{
ClutterActor parent_instance;
/*< private >*/
CcTargetActorPrivate *priv;
};
struct _CcTargetActorClass
{
ClutterActorClass parent_class;
};
ClutterActor * cc_target_actor_new (void);
void cc_target_actor_move (CcTargetActor *target,
gdouble x,
gdouble y);
GType cc_target_actor_get_type (void);
#endif /* __CC_TARGET_ACTOR_H__ */
/*
* Copyright (c) 2009 Tias Guns
* Copyright (c) 2009 Soren Hauberg
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "config.h"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <cairo.h>
#include "calibrator.h"
#include "gui_gtk.h"
struct CalibArea
{
struct Calib calibrator;
XYinfo axis;
gboolean swap;
gboolean success;
int device_id;
double X[4], Y[4];
int display_width, display_height;
int time_elapsed;
const char* message;
guint anim_id;
GtkWidget *window;
GdkPixbuf *icon_success;
FinishCallback callback;
gpointer user_data;
};
/* Window parameters */
#define WINDOW_OPACITY 0.9
/* Timeout parameters */
#define TIME_STEP 100 /* in milliseconds */
#define MAX_TIME 15000 /* 5000 = 5 sec */
#define END_TIME 750 /* 750 = 0.75 sec */
/* Clock appereance */
#define CROSS_LINES 47
#define CROSS_CIRCLE 7
#define CROSS_CIRCLE2 27
#define CLOCK_RADIUS 50
#define CLOCK_LINE_WIDTH 10
#define CLOCK_LINE_PADDING 10
/* Text printed on screen */
#define HELP_TEXT_TITLE N_("Screen Calibration")
#define HELP_TEXT_MAIN N_("Please tap the target markers as they appear on screen to calibrate the tablet.")
#define ICON_SUCCESS "emblem-ok-symbolic"
#define ICON_SIZE 300
static void
set_display_size(CalibArea *calib_area,
int width,
int height)
{
int delta_x;
int delta_y;
calib_area->display_width = width;
calib_area->display_height = height;
/* Compute absolute circle centers */
delta_x = calib_area->display_width/NUM_BLOCKS;
delta_y = calib_area->display_height/NUM_BLOCKS;
calib_area->X[UL] = delta_x;
calib_area->Y[UL] = delta_y;
calib_area->X[UR] = calib_area->display_width - delta_x - 1;
calib_area->Y[UR] = delta_y;
calib_area->X[LL] = delta_x;
calib_area->Y[LL] = calib_area->display_height - delta_y - 1;
calib_area->X[LR] = calib_area->display_width - delta_x - 1;
calib_area->Y[LR] = calib_area->display_height - delta_y - 1;