--- libmokoui2-0.3+bzr20080630.orig/debian/rules +++ libmokoui2-0.3+bzr20080630/debian/rules @@ -0,0 +1,20 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/rules/simple-patchsys.mk +include /usr/share/cdbs/1/class/gnome.mk + +# We need to generate configure and friends +DEB_CONFIGURE_SCRIPT := ./autogen.sh +# Optimise the linking and only depend on directly required libraries +DEB_CONFIGURE_SCRIPT_ENV += LDFLAGS="-Wl,-O1 -Wl,--as-needed" +DEB_CONFIGURE_EXTRA_FLAGS := --enable-gtk-doc --enable-python + +# Add -V to the dh_makeshlibs call +DEB_DH_MAKESHLIBS_ARGS_ALL := -V + +# Use python-central +binary-install/python-mokoui:: + dh_pycentral -p $(cdbs_curpkg) + --- libmokoui2-0.3+bzr20080630.orig/debian/changelog +++ libmokoui2-0.3+bzr20080630/debian/changelog @@ -0,0 +1,61 @@ +libmokoui2 (0.3+bzr20080630-0ubuntu2) jaunty; urgency=low + + * debian/patches/fix_FTBFS_with_gobject.patch: Update the place of h2def.py + from pygtk to gobject to fix a FTBFS + * debian/python-mokoui.install: changes site-packages to dist-packages for + python2.6 transition (LP: #344076) + + -- Fabrice Coutadeur Tue, 17 Mar 2009 05:56:48 +0000 + +libmokoui2 (0.3+bzr20080630-0ubuntu1) intrepid; urgency=low + + * New bzr snapshot. + * Add Vcs-Bzr information to control. + + -- Steve Kowalik Mon, 30 Jun 2008 16:55:58 +1000 + +libmokoui2 (0.3+bzr20080407-0ubuntu2) hardy; urgency=low + + * Add missing X[BS]-Python-Version fields. + + -- Steve Kowalik Sat, 19 Apr 2008 03:00:06 +1000 + +libmokoui2 (0.3+bzr20080407-0ubuntu1) hardy; urgency=low + + * Initial release, based off Chris Lord's excellent work, and Frank Li's + moko package. (LP: #181150) + - FFe bug is also #181150. + * Name the Python bindings package according to the Python Policy. + * Include two patches from Frank Li: + - auto_mode_better.patch: Improve moko UI experience in auto-scroll mode. + - spring2.patch: Bounce when scrolled to the end. + * Set Maintainer to Ubuntu Mobile Developers. + + -- Steve Kowalik Tue, 15 Apr 2008 23:32:40 +1000 + +libmokoui2 (1:0.3+svn20080129-1) gutsy; urgency=low + + * Add build-depends python-gnome2-dev + + -- Chris Lord Tue, 29 Jan 2008 13:34:06 +0000 + +libmokoui2 (1:0.3+svn20080129) gutsy; urgency=low + + * Update to latest upstream + * Package python bindings + * Package vala bindings + + -- Chris Lord Tue, 29 Jan 2008 11:53:45 +0000 + +libmokoui2 (1:0.3+svn20071014) gutsy; urgency=low + + * Correct version number + * Package header files + + -- Chris Lord Sun, 14 Oct 2007 16:04:11 +0100 + +libmokoui2 (0.3+svn20071410) gutsy; urgency=low + + * Initial release. + + -- Chris Lord Sun, 14 Oct 2007 14:27:50 +0100 --- libmokoui2-0.3+bzr20080630.orig/debian/libmokoui2-dev.install +++ libmokoui2-0.3+bzr20080630/debian/libmokoui2-dev.install @@ -0,0 +1,4 @@ +debian/tmp/usr/lib/lib*.a +debian/tmp/usr/lib/lib*.so +debian/tmp/usr/lib/pkgconfig/* +debian/tmp/usr/include/* --- libmokoui2-0.3+bzr20080630.orig/debian/control +++ libmokoui2-0.3+bzr20080630/debian/control @@ -0,0 +1,59 @@ +Source: libmokoui2 +Priority: optional +Section: libs +Maintainer: Ubuntu Mobile Developers +XSBC-Original-Maintainer: Chris Lord +XS-Python-Version: all +Build-Depends: debhelper (>= 4.0.0), cdbs, automake, autotools-dev, intltool, gtk-doc-tools (>= 1.8), libgtk2.0-dev (>= 2.6.0), python-central, python-all-dev, python-gobject-dev, python-gnome2-dev +Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-mobile/libmokoui2/ubuntu +Standards-Version: 3.7.2 + +Package: libmokoui2-0 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: A set of UI widgets for OpenMoko development + libmokoui2 is a set of UI widgets to ease development and integration with + the OpenMoko phone environment. + +Package: libmokoui2-dev +Section: libdevel +Architecture: any +Depends: libmokoui2-0 (= ${binary:Version}), libgtk2.0-dev +Description: A set of UI widgets for OpenMoko development + libmokoui2 is a set of UI widgets to ease development and integration with + the OpenMoko phone environment. + . + This package contains the development files. + +Package: libmokoui2-doc +Section: doc +Architecture: all +Depends: ${misc:Depends} +Suggests: devhelp +Description: A set of UI widgets for OpenMoko development + libmokoui2 is a set of UI widgets to ease development and integration with + the OpenMoko phone environment. + . + This package contains the documentation. + +Package: python-mokoui +Section: python +Architecture: any +Depends: ${shlibs:Depends}, ${python:Depends}, ${misc:Depends}, python-gtk2 +XB-Python-Version: ${python:Versions} +Description: Python bindings for libmokoui2 + libmokoui2 is a set of UI widgets to ease development and integration with + the OpenMoko phone environment. + . + This package contains the Python language bindings. + +Package: libmokoui2-vala +Section: devel +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, valac, libmokoui2-0 (>= ${source:Upstream-Version}) +Description: Vala bindings for libmokoui2 + libmokoui2 is a set of UI widgets to ease development and integration with + the OpenMoko phone environment. + . + This package contains the Vala language bindings. + --- libmokoui2-0.3+bzr20080630.orig/debian/libmokoui2-doc.install +++ libmokoui2-0.3+bzr20080630/debian/libmokoui2-doc.install @@ -0,0 +1 @@ +debian/tmp/usr/share/gtk-doc/html/libmokoui2 --- libmokoui2-0.3+bzr20080630.orig/debian/copyright +++ libmokoui2-0.3+bzr20080630/debian/copyright @@ -0,0 +1,34 @@ +This package was debianized by Chris Lord on +Tue, 18 Sep 2007 17:30:37 +0800. + +It was downloaded from http://svn.openmoko.org/trunk/src/target/OM-2007.2/libraries/libmokoui2/ + +Upstream Author: Chris Lord + +Copyright: Copyright (C) 2006-2008 OpenMoko Inc. + +License: + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the +Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +Boston, MA 02110-1301, USA. + +On Debian systems, the complete text of the GNU Library General Public +License can be found in /usr/share/common-licenses/LGPL-2.1. + +The Debian packaging is (C) 2007-2008, Chris Lord and +Steve Kowalik and is licensed under the GPL, version 2. +On Debian systems, the complete text of the GNU General Public License can be +found in /usr/share/common-licenses/GPL-2. + --- libmokoui2-0.3+bzr20080630.orig/debian/libmokoui2-0.install +++ libmokoui2-0.3+bzr20080630/debian/libmokoui2-0.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/lib*.so.* --- libmokoui2-0.3+bzr20080630.orig/debian/libmokoui2-doc.links +++ libmokoui2-0.3+bzr20080630/debian/libmokoui2-doc.links @@ -0,0 +1 @@ +usr/share/gtk-doc/html/libmokoui2 usr/share/doc/libmokoui2-doc/html --- libmokoui2-0.3+bzr20080630.orig/debian/python-mokoui.install +++ libmokoui2-0.3+bzr20080630/debian/python-mokoui.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/python*/dist-packages/* --- libmokoui2-0.3+bzr20080630.orig/debian/libmokoui2-vala.install +++ libmokoui2-0.3+bzr20080630/debian/libmokoui2-vala.install @@ -0,0 +1 @@ +debian/tmp/usr/share/vala --- libmokoui2-0.3+bzr20080630.orig/debian/patches/fix_FTBFS_with_gobject.patch +++ libmokoui2-0.3+bzr20080630/debian/patches/fix_FTBFS_with_gobject.patch @@ -0,0 +1,11 @@ +--- libmokoui2-0.3+bzr20080630.orig/bindings/python/Makefile.am ++++ libmokoui2-0.3+bzr20080630/bindings/python/Makefile.am +@@ -7,7 +7,7 @@ + mokoui.c + + mokoui.defs: ../../libmokoui/moko-finger-scroll.h +- python /usr/share/pygtk/2.0/codegen/h2def.py ../../libmokoui/moko-finger-scroll.h > mokoui.defs ++ python /usr/share/pygobject/2.0/codegen/h2def.py ../../libmokoui/moko-finger-scroll.h > mokoui.defs + + mokoui.c: mokoui.defs mokoui.override + pygtk-codegen-2.0 --prefix mokoui \ --- libmokoui2-0.3+bzr20080630.orig/debian/patches/auto_mode_better.patch +++ libmokoui2-0.3+bzr20080630/debian/patches/auto_mode_better.patch @@ -0,0 +1,30 @@ +=== modified file 'libmokoui/moko-finger-scroll.c' +--- old/libmokoui/moko-finger-scroll.c 2008-04-10 02:35:55 +0000 ++++ new/libmokoui/moko-finger-scroll.c 2008-04-10 09:27:13 +0000 +@@ -584,14 +584,14 @@ + priv->vel_x = speed_x * (gdouble)priv->sps / 1000; + priv->vel_y = speed_y * (gdouble)priv->sps / 1000; + +- /*if( ABS(priv->vel_x )<20) ++ if( ABS(priv->vel_x )<20) + { + priv->vel_x = 0; + } + if(ABS(priv->vel_y )<20) + { + priv->vel_y = 0; +- }*/ ++ } + } + + child = moko_finger_scroll_get_topmost ( +@@ -936,7 +936,7 @@ + "Scroll mode", + "Change the finger-scrolling mode.", + MOKO_TYPE_FINGER_SCROLL_MODE, +- MOKO_FINGER_SCROLL_MODE_ACCEL, ++ MOKO_FINGER_SCROLL_MODE_AUTO, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + + g_object_class_install_property ( + --- libmokoui2-0.3+bzr20080630.orig/debian/patches/spring2.patch +++ libmokoui2-0.3+bzr20080630/debian/patches/spring2.patch @@ -0,0 +1,700 @@ +=== modified file 'libmokoui/moko-finger-scroll.c' +diff -Nur -x '*.orig' -x '*~' ubuntu/libmokoui/moko-finger-scroll.c ubuntu.new/libmokoui/moko-finger-scroll.c +--- ubuntu/libmokoui/moko-finger-scroll.c 2008-06-30 16:44:09.000000000 +1000 ++++ ubuntu.new/libmokoui/moko-finger-scroll.c 2008-06-30 16:45:09.000000000 +1000 +@@ -60,6 +60,7 @@ + gdouble vmin; + gdouble vmax; + gdouble decel; ++ gdouble spring_decel; + guint sps; + gdouble vel_x; + gdouble vel_y; +@@ -73,6 +74,9 @@ + GtkWidget *align; + gboolean hscroll; + gboolean vscroll; ++ gboolean is_hscrollable; ++ gboolean is_vscrollable; ++ + GdkRectangle hscroll_rect; + GdkRectangle vscroll_rect; + guint scroll_width; +@@ -88,6 +92,14 @@ + MokoFingerScrollIndicatorMode vindicator_mode; + MokoFingerScrollIndicatorMode hindicator_mode; + ++ gboolean is_v_spring; ++ gboolean is_h_spring; ++ ++ guint v_spring; ++ guint h_spring; ++ ++ GdkGC * spring_gc; ++ GdkColor spring_color; + }; + + enum { +@@ -100,6 +112,8 @@ + PROP_VINDICATOR, + PROP_HINDICATOR, + ++ PROP_SPRING_SPEED, ++ PROP_SPRING_COLOR + }; + + static gdouble +@@ -143,6 +157,163 @@ + return ret; + } + ++static gint ++moko_finger_scroll_get_h_indicator_width (MokoFingerScroll *scroll) ++{ ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (scroll); ++ if( priv->hscroll ) ++ { ++ return priv->scroll_width; ++ } ++ return 0; ++} ++ ++static gint ++moko_finger_scroll_get_v_indicator_width (MokoFingerScroll *scroll) ++{ ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (scroll); ++ if( priv->vscroll ) ++ { ++ return priv->scroll_width; ++ } ++ return 0; ++} ++ ++ ++static gboolean ++moko_finger_scroll_is_h_normal_padding (MokoFingerScroll *scroll) ++{ ++ gint padding_top; ++ gint padding_bottom; ++ gint padding_left; ++ gint padding_right; ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (scroll); ++ ++ gtk_alignment_get_padding(GTK_ALIGNMENT(priv->align), ++ (guint*)&padding_top, ++ (guint*)&padding_bottom, ++ (guint*)&padding_left, ++ (guint*)&padding_right); ++ ++ if( padding_left == 0 && ++ (padding_right <= ++ moko_finger_scroll_get_v_indicator_width(scroll)) ) ++ return TRUE; ++ ++ return FALSE; ++} ++ ++static gboolean ++moko_finger_scroll_is_v_normal_padding (MokoFingerScroll *scroll) ++{ ++ gint padding_top; ++ gint padding_bottom; ++ gint padding_left; ++ gint padding_right; ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (scroll); ++ ++ gtk_alignment_get_padding(GTK_ALIGNMENT(priv->align), ++ (guint*)&padding_top, ++ (guint*)&padding_bottom, ++ (guint*)&padding_left, ++ (guint*)&padding_right); ++ if( padding_top ==0 && ++ (padding_bottom <= ++ moko_finger_scroll_get_h_indicator_width(scroll)) ) ++ return TRUE; ++ ++ return FALSE; ++} ++ ++static gboolean ++moko_finger_scroll_is_normal_padding (MokoFingerScroll *scroll) ++{ ++ if(moko_finger_scroll_is_h_normal_padding(scroll) && ++ moko_finger_scroll_is_v_normal_padding(scroll)) ++ return TRUE; ++ ++ return FALSE; ++} ++ ++static void ++moko_finger_scroll_spring (MokoFingerScroll *scroll, ++ double diff_top, ++ double diff_bottom, ++ double diff_left, ++ double diff_right) ++{ ++ gint padding_top; ++ gint padding_bottom; ++ gint padding_left; ++ gint padding_right; ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (scroll); ++ ++ gtk_alignment_get_padding(GTK_ALIGNMENT(priv->align), ++ (guint*)&padding_top, ++ (guint*)&padding_bottom, ++ (guint*)&padding_left, ++ (guint*)&padding_right); ++ ++ ++ padding_top += diff_top; ++ padding_bottom += diff_bottom; ++ padding_left += diff_left; ++ padding_right += diff_right; ++ ++ if(padding_top <=1) ++ padding_top =0; ++ if(padding_left<=1) ++ padding_left=0; ++ ++ if(padding_bottom<=1+moko_finger_scroll_get_h_indicator_width(scroll)) ++ padding_bottom=moko_finger_scroll_get_h_indicator_width(scroll); ++ ++ if(padding_right<=1+moko_finger_scroll_get_v_indicator_width(scroll)) ++ padding_right=moko_finger_scroll_get_v_indicator_width(scroll); ++ ++ gtk_alignment_set_padding(GTK_ALIGNMENT(priv->align), ++ padding_top, ++ padding_bottom, ++ padding_left, ++ padding_right); ++} ++ ++static void ++moko_finger_scroll_sprint_slow_down (MokoFingerScroll *scroll) ++{ ++ gint padding_top; ++ gint padding_bottom; ++ gint padding_left; ++ gint padding_right; ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (scroll); ++ ++ gtk_alignment_get_padding(GTK_ALIGNMENT(priv->align), ++ (guint*) &padding_top, ++ (guint*)&padding_bottom, ++ (guint*)&padding_left, ++ (guint*)&padding_right); ++ ++ padding_top *= priv->spring_decel; ++ padding_bottom *= priv->spring_decel; ++ padding_left *= priv->spring_decel; ++ padding_right *= priv->spring_decel; ++ ++ if(padding_top <0) ++ padding_top =0; ++ if(padding_bottomalign), ++ padding_top, ++ padding_bottom, ++ padding_left, ++ padding_right); ++} ++ + static GdkWindow * + moko_finger_scroll_get_topmost (GdkWindow *window, gint x, gint y, + gint *tx, gint *ty) +@@ -248,8 +419,8 @@ + } + + g_get_current_time (&priv->click_start); +- priv->x = event->x; +- priv->y = event->y; ++ priv->x = priv->ex = event->x; ++ priv->y = priv->ey = event->y; + priv->ix = priv->x; + priv->iy = priv->y; + /* Don't allow a click if we're still moving fast, where fast is +@@ -351,6 +522,11 @@ + priv->vadjust->page_size) ? TRUE : FALSE; + } + ++ priv->is_vscrollable = (priv->vadjust->upper - priv->vadjust->lower > ++ priv->vadjust->page_size) ? TRUE : FALSE; ++ priv->is_hscrollable = (priv->hadjust->upper - priv->hadjust->lower > ++ priv->hadjust->page_size) ? TRUE : FALSE; ++ + /* TODO: Read ltr settings to decide which corner gets scroll + * indicators? + */ +@@ -438,6 +614,13 @@ + priv->idle_id = 0; + return FALSE; + } ++ ++ if ((!priv->clicked) && ++ (!moko_finger_scroll_is_normal_padding(scroll))) { ++ moko_finger_scroll_sprint_slow_down(scroll); ++ return TRUE; ++ } ++ + if (!priv->clicked) { + /* Decelerate gradually when pointer is raised */ + priv->vel_x *= priv->decel; +@@ -455,8 +638,8 @@ + * initial scroll position to the new mouse co-ordinate. This means + * when you get to the top of the page, dragging down works immediately. + */ +- if (!sx) priv->x = priv->ex; +- if (!sy) priv->y = priv->ey; ++ //if (!sx) priv->x = priv->ex; ++ //if (!sy) priv->y = priv->ey; + + return TRUE; + } +@@ -470,6 +653,11 @@ + gint dnd_threshold; + gdouble x, y; + ++ gint padding_top; ++ gint padding_bottom; ++ gint padding_left; ++ gint padding_right; ++ + if ((!priv->enabled) || (!priv->clicked) || + ((event->time == priv->last_time) && + (priv->last_type == 2))) { +@@ -498,39 +686,91 @@ + } + + if (priv->moved) { +- switch (priv->mode) { +- case MOKO_FINGER_SCROLL_MODE_PUSH : ++ gdouble dx, dy; ++ priv->x = event->x; ++ priv->y = event->y; ++ dx = x; dy=y; ++ if (!moko_finger_scroll_is_h_normal_padding(scroll)) ++ dx =0; ++ ++ if (!moko_finger_scroll_is_v_normal_padding(scroll)) ++ dy =0; ++ ++ if (dx !=0 || dy !=0) { ++ ++ switch (priv->mode) { ++ case MOKO_FINGER_SCROLL_MODE_PUSH : + /* Scroll by the amount of pixels the cursor has moved + * since the last motion event. + */ +- moko_finger_scroll_scroll (scroll, x, y, NULL, NULL); +- priv->x = event->x; +- priv->y = event->y; +- break; +- case MOKO_FINGER_SCROLL_MODE_ACCEL : +- /* Set acceleration relative to the initial click */ +- priv->ex = event->x; +- priv->ey = event->y; +- priv->vel_x = ((x > 0) ? 1 : -1) * +- (((ABS (x) / +- (gdouble)GTK_WIDGET (scroll)-> +- allocation.width) * +- (priv->vmax-priv->vmin)) + priv->vmin); +- priv->vel_y = ((y > 0) ? 1 : -1) * +- (((ABS (y) / +- (gdouble)GTK_WIDGET (scroll)-> +- allocation.height) * +- (priv->vmax-priv->vmin)) + priv->vmin); +- break; +- case MOKO_FINGER_SCROLL_MODE_AUTO: +- moko_finger_scroll_scroll (scroll, x, y, NULL, NULL); +- priv->x = event->x; +- priv->y = event->y; +- +- break; ++ moko_finger_scroll_scroll (scroll,dx, dy, ++ NULL, NULL); ++ break; ++ case MOKO_FINGER_SCROLL_MODE_ACCEL : ++ /* Set acceleration relative to ++ the initial click */ ++ dx = event->x - priv->click_x; ++ dy = event->y - priv->click_y; ++ priv->ex = event->x; ++ priv->ey = event->y; + +- default : +- break; ++ priv->vel_x = ((dx > 0) ? 1 : -1) * ++ (((ABS (dx) / ++ (gdouble)GTK_WIDGET (scroll)-> ++ allocation.width) * ++ (priv->vmax-priv->vmin)) + priv->vmin); ++ priv->vel_y = ((dy > 0) ? 1 : -1) * ++ (((ABS (dy) / ++ (gdouble)GTK_WIDGET (scroll)-> ++ allocation.height) * ++ (priv->vmax-priv->vmin)) + priv->vmin); ++ break; ++ case MOKO_FINGER_SCROLL_MODE_AUTO: ++ moko_finger_scroll_scroll (scroll,dx, dy, ++ NULL, NULL); ++ break; ++ ++ default : ++ break; ++ } ++ } ++ ++ gtk_alignment_get_padding (GTK_ALIGNMENT(priv->align), ++ (guint*)&padding_top, ++ (guint*)&padding_bottom, ++ (guint*)&padding_left, ++ (guint*)&padding_right); ++ ++ ++ if ((priv->vadjust->value) <= (priv->vadjust->lower) || ++ (padding_top > 0)){ ++ if (priv->is_vscrollable) ++ moko_finger_scroll_spring (scroll,y/2,0,0,0); ++ ++ } else if (((priv->vadjust->value + priv->vadjust->page_size) >= ++ (priv->vadjust->upper)) || ++ (padding_bottom> ++ moko_finger_scroll_get_h_indicator_width (scroll))){ ++ if (priv->is_vscrollable) ++ moko_finger_scroll_spring(scroll,0,-y/2,0,0); ++ if (y<0) ++ moko_finger_scroll_scroll(scroll,x,y,NULL,NULL); ++ } ++ ++ if ((priv->hadjust->value) <= (priv->hadjust->lower) || ++ padding_left >0 ){ ++ if(priv->is_hscrollable) ++ moko_finger_scroll_spring(scroll,0,0,x/2,0); ++ ++ } else if (((priv->hadjust->value + priv->hadjust->page_size)>= ++ (priv->hadjust->upper)) || ++ (padding_right > ++ moko_finger_scroll_get_v_indicator_width (scroll))){ ++ if(priv->is_hscrollable) ++ moko_finger_scroll_spring (scroll,0,0,0,-x/2); ++ ++ if(x <0) ++ moko_finger_scroll_scroll(scroll,x,y,NULL,NULL); + } + } + +@@ -634,11 +874,210 @@ + + return TRUE; + } ++static gboolean ++moko_finger_scroll_draw_spring_area (GtkWidget *widget, GdkEventExpose *event) ++{ ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (widget); ++ gint padding_top; ++ gint padding_bottom; ++ gint padding_left; ++ gint padding_right; ++ GtkAllocation *allocation = &widget->allocation; ++ ++ gtk_alignment_get_padding(GTK_ALIGNMENT(priv->align), ++ (guint*)&padding_top, ++ (guint*)&padding_bottom, ++ (guint*)&padding_left, ++ (guint*)&padding_right); ++ if (moko_finger_scroll_is_normal_padding( MOKO_FINGER_SCROLL(widget))) ++ return TRUE; ++ ++ if( priv ->spring_gc == NULL) ++ priv ->spring_gc = gdk_gc_new(GTK_WIDGET(widget)->window); ++ ++ ++ gdk_gc_set_foreground(priv->spring_gc,&priv->spring_color); ++ ++ if (padding_top > 0) { ++ gdk_draw_rectangle (widget->window, ++ priv->spring_gc, ++ TRUE, ++ allocation->x, allocation->y, ++ allocation->width, padding_top ++ ); ++ } ++ ++ if (padding_left > 0) { ++ gdk_draw_rectangle (widget->window, ++ priv->spring_gc, ++ TRUE, ++ allocation->x, allocation->y, ++ padding_left, allocation->height ++ ); ++ } ++ ++ if (padding_bottom > ++ moko_finger_scroll_get_h_indicator_width( ++ MOKO_FINGER_SCROLL(widget))){ ++ ++ gdk_draw_rectangle (widget->window, ++ priv->spring_gc, ++ TRUE, ++ allocation->x, ++ allocation->y+allocation->height ++ -padding_bottom , ++ allocation->width, ++ padding_bottom- ++ moko_finger_scroll_get_h_indicator_width ( ++ MOKO_FINGER_SCROLL(widget)) ++ ); ++ ++ } ++ ++ if (padding_right > ++ moko_finger_scroll_get_v_indicator_width( ++ MOKO_FINGER_SCROLL(widget))){ ++ ++ gdk_draw_rectangle (widget->window, ++ priv->spring_gc, ++ TRUE, ++ allocation->x+allocation->width ++ -padding_right , ++ allocation->y, ++ padding_right- ++ moko_finger_scroll_get_v_indicator_width ( ++ MOKO_FINGER_SCROLL(widget)) , ++ allocation->height ++ ); ++ ++ } ++ ++ return TRUE; ++} ++ ++#define SET_COLOR(color, value) { color.red *=(value); color.green*=(value); color.blue *= (value);} + ++static void ++moko_finger_scroll_draw_shadow_line (GtkWidget *widget, ++ int x1, int y1, int x2, int y2, ++ int dx, int dy) ++{ ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (widget); ++ GdkColor color; ++ ++ priv->spring_color.red = ((priv->spring_color.pixel>>16)&(0xFF))*(65535/255); ++ priv->spring_color.green = ((priv->spring_color.pixel>>8) &0xFF)*(65535/255); ++ priv->spring_color.blue = (priv->spring_color.pixel&0xFF)*(65535/255); ++ ++ color=priv->spring_color; ++ SET_COLOR(color,0.85); ++ gdk_gc_set_rgb_fg_color(priv->spring_gc,&color); ++ gdk_draw_line(widget->window, priv->spring_gc, ++ x1+dx, y1+dy, ++ x2+dx, y2+dy); ++ ++ color=priv->spring_color; ++ SET_COLOR(color,0.90); ++ gdk_gc_set_rgb_fg_color(priv->spring_gc,&color); ++ gdk_draw_line(widget->window, priv->spring_gc, ++ x1+2*dx+dy, y1+2*dy+dx, ++ x2+2*dx+dy, y2+2*dy+dx); ++ ++ color=priv->spring_color; ++ SET_COLOR(color, 0.95); ++ gdk_gc_set_rgb_fg_color(priv->spring_gc,&color); ++ gdk_draw_line(widget->window, priv->spring_gc, ++ x1+3*dx+2*dy, y1+3*dy+2*dx, ++ x2+3*dx+2*dy, y2+3*dy+2*dx); ++ ++ color=priv->spring_color; ++ SET_COLOR(color, 0.99); ++ gdk_gc_set_rgb_fg_color(priv->spring_gc,&color); ++ gdk_draw_line(widget->window, priv->spring_gc, ++ x1+4*dx+3*dy, y1+4*dy+3*dx, ++ x2+4*dx+3*dy, y2+4*dy+3*dx); ++} ++static void ++moko_finger_scroll_draw_spring_shadow (GtkWidget *widget, GdkEventExpose *event) ++{ ++ MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (widget); ++ gint padding_top; ++ gint padding_bottom; ++ gint padding_left; ++ gint padding_right; ++ GtkAllocation *allocation = &widget->allocation; ++ ++ gtk_alignment_get_padding(GTK_ALIGNMENT(priv->align), ++ (guint*)&padding_top, ++ (guint*)&padding_bottom, ++ (guint*)&padding_left, ++ (guint*)&padding_right); ++ ++ if (moko_finger_scroll_is_normal_padding (MOKO_FINGER_SCROLL(widget))) ++ return; ++ ++ if (priv ->spring_gc == NULL) ++ priv ->spring_gc = gdk_gc_new (GTK_WIDGET(widget)->window); ++ ++ ++ if (padding_top > 0){ ++ moko_finger_scroll_draw_shadow_line (widget, ++ allocation->x + padding_left-1, ++ allocation->y+padding_top, ++ allocation->x + allocation->width ++ - padding_right, ++ allocation->y+padding_top, ++ 0, -1); ++ } ++ ++ if (padding_left > 0){ ++ moko_finger_scroll_draw_shadow_line (widget, ++ allocation->x + padding_left, ++ allocation->y+padding_top-1, ++ allocation->x + padding_left, ++ allocation->y+allocation->height ++ -padding_bottom, ++ -1, 0); ++ } ++ ++ if (padding_bottom > ++ moko_finger_scroll_get_h_indicator_width ( ++ MOKO_FINGER_SCROLL(widget))) { ++ moko_finger_scroll_draw_shadow_line (widget, ++ allocation->x + padding_left, ++ allocation->y+allocation->height ++ -padding_bottom -1, ++ allocation->x + allocation->width ++ - padding_right , ++ allocation->y+allocation->height ++ - padding_bottom -1 , ++ 0,1); ++ } ++ ++ if (padding_right > ++ moko_finger_scroll_get_v_indicator_width ( ++ MOKO_FINGER_SCROLL(widget))){ ++ ++ moko_finger_scroll_draw_shadow_line(widget, ++ allocation->x +allocation->width ++ - padding_right -1 , ++ allocation->y+padding_top, ++ allocation->x +allocation->width ++ - padding_right -1, ++ allocation->y + allocation->height ++ -padding_bottom, ++ 1,0); ++ } ++ ++ return; ++} + static gboolean + moko_finger_scroll_expose_event (GtkWidget *widget, GdkEventExpose *event) + { + MokoFingerScrollPrivate *priv = FINGER_SCROLL_PRIVATE (widget); ++ ++ moko_finger_scroll_draw_spring_area(widget, event); ++ moko_finger_scroll_draw_spring_shadow(widget, event); + + if (GTK_BIN (priv->align)->child) { + if (priv->vscroll) { +@@ -714,6 +1153,19 @@ + g_object_unref (G_OBJECT (priv->vadjust)); + priv->vadjust = NULL; + } ++ ++ if (priv->spring_gc) ++ { ++ gdk_gc_unref(priv->spring_gc); ++ priv->spring_gc = NULL; ++ } ++ ++ if (priv->idle_id ) ++ { ++ ++ g_source_remove(priv->idle_id); ++ priv->idle_id = 0; ++ } + + GTK_OBJECT_CLASS (moko_finger_scroll_parent_class)->destroy (object); + } +@@ -783,7 +1235,12 @@ + case PROP_HINDICATOR: + g_value_set_enum (value, priv->hindicator_mode); + break; +- ++ case PROP_SPRING_SPEED: ++ g_value_set_double(value, priv->spring_decel); ++ break; ++ case PROP_SPRING_COLOR: ++ g_value_set_uint (value, priv->spring_color.pixel); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +@@ -822,7 +1279,12 @@ + case PROP_HINDICATOR: + priv->hindicator_mode = g_value_get_enum (value); + break; +- ++ case PROP_SPRING_SPEED: ++ priv->spring_decel = g_value_get_double(value); ++ break; ++ case PROP_SPRING_COLOR: ++ priv->spring_color.pixel=g_value_get_uint(value ); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +@@ -973,6 +1435,7 @@ + 0, 1.0, 0.95, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + ++ + g_object_class_install_property ( + object_class, + PROP_SPS, +@@ -991,6 +1454,28 @@ + "Pixel width used to draw the scroll indicators.", + 0, G_MAXUINT, 6, + G_PARAM_READWRITE)); ++ ++ g_object_class_install_property ( ++ object_class, ++ PROP_SPRING_SPEED, ++ g_param_spec_double ( ++ "spring_speed", ++ "Deceleration spring multiplier", ++ "The multiplier used when decelerating when in spring", ++ 0, 1.0, 0.85, ++ G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); ++ ++ g_object_class_install_property ( ++ object_class, ++ PROP_SPRING_COLOR, ++ g_param_spec_uint ( ++ "spring_color", ++ "spring area color", ++ "spring area color", ++ 0, G_MAXUINT, 0xFFFFFFFF, ++ G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); ++ ++ + } + + static void +@@ -1005,6 +1490,12 @@ + priv->vscroll = TRUE; + priv->hscroll = TRUE; + priv->scroll_width = 6; ++ priv->h_spring = 0; ++ priv->v_spring = 0; ++ priv->spring_decel = 0.8; ++ ++ priv->spring_color.pixel = 0x00FFFFFF; ++ + + gtk_event_box_set_above_child (GTK_EVENT_BOX (self), TRUE); + gtk_event_box_set_visible_window (GTK_EVENT_BOX (self), FALSE);