+2008-08-20 Alejandro G. Castro <alex@igalia.com>
+
+ * src/hildon-pannable-area.c,
+ (hildon_pannable_area_refresh),
+ (hildon_pannable_area_scroll),
+ (hildon_pannable_area_motion_notify_cb): Small code style change.
+
+ (hildon_pannable_area_class_init): Default initial_hint set to
+ FALSE, it is not in the specs.
+
+ (hildon_pannable_area_initial_effect),
+ (hildon_pannable_area_expose_event),
+ (hildon_pannable_area_map),
+ (hildon_pannable_area_init): Moved the launching point of the
+ initial effect, it was in map but the sizes where not correct in
+ that method so we do not know if we have the reproduce it. Now it
+ is placed in the expose_event method and uses a variable to
+ reproduce it just once.
+
2008-08-19 Alejandro G. Castro <alex@igalia.com>
* src/hildon-pannable-area.c,
gint vovershoot_max;
gint hovershoot_max;
gboolean initial_hint;
+ gboolean initial_effect;
gboolean first_drag;
gboolean hscroll;
break;
default:
hscroll = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size) ? TRUE : FALSE;
+ priv->hadjust->page_size);
}
switch (priv->vindicator_mode) {
break;
default:
vscroll = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size) ? TRUE : FALSE;
+ priv->vadjust->page_size);
}
/* Store the vscroll/hscroll areas for redrawing */
return;
vscroll = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size) ? TRUE : FALSE;
+ priv->vadjust->page_size);
hscroll = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size) ? TRUE : FALSE;
+ priv->hadjust->page_size);
sx = TRUE;
sy = TRUE;
priv->click_x, priv->click_y);
vscroll = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size) ? TRUE : FALSE;
+ priv->vadjust->page_size);
if (!((vscroll)&&
(priv->mov_mode&HILDON_MOVEMENT_MODE_VERT)))
priv->click_x, priv->click_y);
hscroll = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size) ? TRUE : FALSE;
+ priv->hadjust->page_size);
if (!((hscroll)&&
(priv->mov_mode&HILDON_MOVEMENT_MODE_HORIZ)))
cairo_destroy(cr);
}
+static void
+hildon_pannable_area_initial_effect (GtkWidget * widget)
+{
+ HildonPannableAreaPrivate *priv = PANNABLE_AREA_PRIVATE (widget);
+ gboolean hscroll, vscroll;
+
+ if (priv->initial_hint) {
+ if (((priv->vovershoot_max != 0)||(priv->hovershoot_max != 0)) &&
+ ((priv->mode == HILDON_PANNABLE_AREA_MODE_AUTO) ||
+ (priv->mode == HILDON_PANNABLE_AREA_MODE_ACCEL))) {
+ vscroll = (priv->vadjust->upper - priv->vadjust->lower >
+ priv->vadjust->page_size);
+ hscroll = (priv->hadjust->upper - priv->hadjust->lower >
+ priv->hadjust->page_size);
+ /* If scrolling is possible in both axes, only hint about scrolling in
+ the vertical one. */
+ if ((vscroll)&&(priv->vovershoot_max != 0)) {
+ priv->overshot_dist_y = priv->vovershoot_max;
+ priv->vel_y = priv->vmax * 0.1;
+ } else if ((hscroll)&&(priv->hovershoot_max != 0)) {
+ priv->overshot_dist_x = priv->hovershoot_max;
+ priv->vel_x = priv->vmax * 0.1;
+ }
+
+ if (vscroll || hscroll) {
+ priv->idle_id = g_timeout_add ((gint) (1000.0 / (gdouble) priv->sps),
+ (GSourceFunc)
+ hildon_pannable_area_timeout, widget);
+ }
+ }
+
+ if (priv->vscroll || priv->hscroll) {
+ priv->scroll_indicator_alpha = 1.0;
+
+ priv->scroll_indicator_timeout =
+ g_timeout_add ((gint) (1000.0 / (gdouble) priv->sps),
+ (GSourceFunc) hildon_pannable_area_scroll_indicator_fade,
+ widget);
+ }
+ }
+}
+
static gboolean
hildon_pannable_area_expose_event (GtkWidget * widget, GdkEventExpose * event)
{
}
+ if (G_UNLIKELY (priv->initial_effect)) {
+
+ hildon_pannable_area_initial_effect (widget);
+
+ priv->initial_effect = FALSE;
+ }
+
return GTK_WIDGET_CLASS (hildon_pannable_area_parent_class)->expose_event (widget, event);
}
hildon_pannable_area_map (GtkWidget * widget)
{
HildonPannableAreaPrivate *priv;
- gboolean hscroll, vscroll;
priv = PANNABLE_AREA_PRIVATE (widget);
if (priv->event_window != NULL && priv->enabled)
gdk_window_show (priv->event_window);
-
- if (priv->initial_hint) {
- if (((priv->vovershoot_max != 0)||(priv->hovershoot_max != 0)) &&
- ((priv->mode == HILDON_PANNABLE_AREA_MODE_AUTO) ||
- (priv->mode == HILDON_PANNABLE_AREA_MODE_ACCEL))) {
- vscroll = (priv->vadjust->upper - priv->vadjust->lower >
- priv->vadjust->page_size) ? TRUE : FALSE;
- hscroll = (priv->hadjust->upper - priv->hadjust->lower >
- priv->hadjust->page_size) ? TRUE : FALSE;
- /* If scrolling is possible in both axes, only hint about scrolling in
- the vertical one. */
- if ((vscroll)&&(priv->vovershoot_max != 0)) {
- priv->overshot_dist_y = priv->vovershoot_max;
- priv->vel_y = priv->vmax * 0.1;
- } else if ((hscroll)&&(priv->hovershoot_max != 0)) {
- priv->overshot_dist_x = priv->hovershoot_max;
- priv->vel_x = priv->vmax * 0.1;
- }
-
- if (vscroll || hscroll) {
- priv->idle_id = g_timeout_add ((gint) (1000.0 / (gdouble) priv->sps),
- (GSourceFunc)
- hildon_pannable_area_timeout, widget);
- }
- }
-
- if (priv->vscroll || priv->hscroll) {
- priv->scroll_indicator_alpha = 1.0;
-
- priv->scroll_indicator_timeout =
- g_timeout_add ((gint) (1000.0 / (gdouble) priv->sps),
- (GSourceFunc) hildon_pannable_area_scroll_indicator_fade,
- widget);
- }
- }
}
static void
g_param_spec_boolean ("initial-hint",
"Initial hint",
"Whether to hint the user about the pannability of the container.",
- TRUE,
+ FALSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
priv->scroll_to_x = -1;
priv->scroll_to_y = -1;
priv->first_drag = TRUE;
+ priv->initial_effect = TRUE;
hildon_pannable_calculate_vel_factor (self);