commit 717493bcd0cdbce809ed3899590f6abf8f9b6f53
parent 3b4b476d19e68b3cec52ea735742481356256e77
Author: pancake <pancake@nopcode.org>
Date: Fri, 11 Jun 2010 10:46:31 +0200
added horitzontal dragging support to move column position
dim colpos range between [0:w->r.w]
sync config.n900.h
Diffstat:
4 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/TODO b/TODO
@@ -17,6 +17,12 @@ TODO
* default image path (?)
* transitions (to change from one window to another)
+absolute/relative
+=================
+ * column split position (w->colpos)
+ * scrolling box
+ * font size
+
USABILITY GUIDELINE
===================
* useful
diff --git a/config.n900.h b/config.n900.h
@@ -1,7 +1,9 @@
#define PORTRAIT 0
+#define SCROLLSPEED 2
+#define COLSPLIT 20
#define FONTBOLD 1
-#define FONTSIZE 32
+#define FONTSIZE 28
#define TOUCHSCREEN 1
#if PORTRAIT
diff --git a/gi_sdl.c b/gi_sdl.c
@@ -118,7 +118,7 @@ swk_gi_has_event(SwkWindow *w) {
SwkEvent *
swk_gi_event(SwkWindow *w, int dowait) {
- static int mousedowny, mousedown = 0;
+ static int mousedowny, mousedownx, mousedown = 0;
static int mousemoved = 0;
SDL_Event event;
SwkEvent *ret = &w->_e;
@@ -139,11 +139,12 @@ swk_gi_event(SwkWindow *w, int dowait) {
ret->data.expose.w = ret->data.expose.h = 0;
break;
case SDL_MOUSEMOTION:
+ // TODO: move this stuff into swk.c.. shoudlnt be backend dependent
//fprintf(stderr, "event: motion (%d,%d)\n", event.motion.x,event.motion.y);
if(mousedown) {
- if(mousedowny==-1) // touchscreen trick
- mousedowny = event.motion.y;
- else mousemoved = 1;
+ // touchscreen spaguetti trick
+ if(mousedowny==-1) mousedowny = event.motion.y; else mousemoved = 1;
+ if(mousedownx==-1) mousedownx = event.motion.x; else mousemoved = 1;
if(event.motion.y>mousedowny+fs) {
mousedowny = event.motion.y;
swk_scroll_up(w);
@@ -152,6 +153,14 @@ swk_gi_event(SwkWindow *w, int dowait) {
mousedowny = event.motion.y;
swk_scroll_down(w);
}
+ if(event.motion.x>mousedownx+fs) {
+ mousedownx = event.motion.x;
+ swk_column_move_right();
+ } else
+ if(event.motion.x<mousedownx-fs) {
+ mousedownx = event.motion.x;
+ swk_column_move_left();
+ }
ret->type = EExpose;
ret->data.expose.x = ret->data.expose.y = \
ret->data.expose.w = ret->data.expose.h = 0;
diff --git a/swk.c b/swk.c
@@ -106,13 +106,15 @@ swk_fontsize_decrease() {
void
swk_column_move_left() {
- w->colpos--;
+ if(w->colpos>0)
+ w->colpos--;
swk_update(w);
}
void
swk_column_move_right() {
- w->colpos++;
+ if(w->colpos<w->r.w)
+ w->colpos++;
swk_update(w);
}
@@ -160,7 +162,7 @@ swk_fit_row(SwkBox *a, SwkBox *b, int col, int y) {
static int
countrows(SwkBox *b) {
- int row = 17; // hacky value to center widgets
+ int row = 17; // XXX hacky value to center widgets
for(; b->cb; b++)
if(IS_SCROLLBOX(b))
row += (int)(size_t)b->data;