r5375 vince - in /branches/vince/netsurf-fb/framebuffer: fb_cursor.c fb_cursor.h fb_frontend_linuxfb.c fb_gui.c fb_gui.h fb_plotters.h

netsurf at semichrome.net netsurf at semichrome.net
Fri Sep 19 14:58:44 BST 2008


Author: vince
Date: Fri Sep 19 08:58:43 2008
New Revision: 5375

URL: http://source.netsurf-browser.org?rev=5375&view=rev
Log:
Working mouse navigation

Modified:
    branches/vince/netsurf-fb/framebuffer/fb_cursor.c
    branches/vince/netsurf-fb/framebuffer/fb_cursor.h
    branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c
    branches/vince/netsurf-fb/framebuffer/fb_gui.c
    branches/vince/netsurf-fb/framebuffer/fb_gui.h
    branches/vince/netsurf-fb/framebuffer/fb_plotters.h

Modified: branches/vince/netsurf-fb/framebuffer/fb_cursor.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_cursor.c?rev=5375&r1=5374&r2=5375&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_cursor.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_cursor.c Fri Sep 19 08:58:43 2008
@@ -27,6 +27,7 @@
 #include "utils/log.h"
 #include "utils/utf8.h"
 #include "desktop/plotters.h"
+#include "desktop/browser.h"
 
 #include "framebuffer/fb_gui.h"
 #include "framebuffer/fb_plotters.h"
@@ -132,6 +133,8 @@
 void
 fb_cursor_move(framebuffer_t *fb, int x, int y)
 {
+        fb_cursor_clear(fb);
+
         fb->cursor->x += x;
         fb->cursor->y += y;
         if (fb->cursor->x < 0)
@@ -143,8 +146,6 @@
         if (fb->cursor->y > fb->height)
                 fb->cursor->y = fb->height;
 
-        fb_cursor_clear(fb);
-
 }
 
 void 
@@ -197,6 +198,18 @@
         return cursor;
 }
 
+void
+fb_cursor_click(framebuffer_t *fb, 
+                struct gui_window *g, 
+                browser_mouse_state st)
+{
+        browser_window_mouse_click(g->bw,
+                                   st,
+                                   fb->cursor->x, 
+                                   fb->cursor->y + g->scrolly);
+
+}
+
 /*
  * Local Variables:
  * c-basic-offset:8

Modified: branches/vince/netsurf-fb/framebuffer/fb_cursor.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_cursor.h?rev=5375&r1=5374&r2=5375&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_cursor.h (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_cursor.h Fri Sep 19 08:58:43 2008
@@ -25,4 +25,6 @@
 
 fb_cursor_t *fb_cursor_init(struct framebuffer_s *fb);
 
+void fb_cursor_click(framebuffer_t *fb, struct gui_window *g, browser_mouse_state st);
+
 #endif

Modified: branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c?rev=5375&r1=5374&r2=5375&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_frontend_linuxfb.c Fri Sep 19 08:58:43 2008
@@ -582,15 +582,11 @@
 
                         switch (event.code) {
                         case KEY_J:
-                                g->scrolly +=100;
-                                gui_window_redraw_window(g);
+				fb_window_scroll(g, 100);
                                 break;
 
                         case KEY_K:
-                                g->scrolly -=100;
-                                if (g->scrolly < 0)
-                                        g->scrolly = 0;
-                                gui_window_redraw_window(g);
+				fb_window_scroll(g, -100);
                                 break;
 
                         case KEY_Q:
@@ -622,14 +618,44 @@
 
         if (mousefd >= 0) {
 
-                while((amt = read(mousefd, &event, sizeof(struct input_event))) > 0) {
-                        if (event.type != EV_REL)
-                                return;
-
-                        if (event.code == 0) {
-                                fb_cursor_move(framebuffer, event.value, 0);
-                        } else { 
-                                fb_cursor_move(framebuffer, 0, event.value);
+                while((amt = read(mousefd, 
+                                  &event, 
+                                  sizeof(struct input_event))) > 0) {
+
+                        switch (event.type) {
+                        case EV_KEY:
+                                if (event.value != 0)
+                                        break;
+
+                                switch (event.code) {
+                                case BTN_LEFT:
+                                        fb_cursor_click(framebuffer,
+                                                        g, 
+                                                        BROWSER_MOUSE_CLICK_1);
+                                        break;
+                                }
+                                break;
+
+                        case EV_REL:
+				
+                                switch (event.code) {
+				case 0:
+                                        fb_cursor_move(framebuffer, 
+                                                       event.value, 
+                                                       0);
+					break;
+
+                                case 1: 
+                                        fb_cursor_move(framebuffer, 
+                                                       0, 
+                                                       event.value);
+					break;
+
+				case 8:
+					fb_window_scroll(g, event.value * -100);
+					break;
+                                }
+                                break;
                         }
                 }
         }

Modified: branches/vince/netsurf-fb/framebuffer/fb_gui.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_gui.c?rev=5375&r1=5374&r2=5375&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_gui.c (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_gui.c Fri Sep 19 08:58:43 2008
@@ -235,6 +235,14 @@
 	g->redraw_required = true;
 }
 
+void fb_window_scroll(struct gui_window *g, int scrollby)
+{
+	g->scrolly += scrollby;
+	if (g->scrolly < 0)
+		g->scrolly = 0;
+	gui_window_redraw_window(g);
+}
+
 void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
 {
 	if (!g) return;

Modified: branches/vince/netsurf-fb/framebuffer/fb_gui.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_gui.h?rev=5375&r1=5374&r2=5375&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_gui.h (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_gui.h Fri Sep 19 08:58:43 2008
@@ -52,3 +52,6 @@
 
 extern framebuffer_t *framebuffer;
 extern struct gui_window *current_window;
+
+/* scroll a window */
+void fb_window_scroll(struct gui_window *g, int scrollby);

Modified: branches/vince/netsurf-fb/framebuffer/fb_plotters.h
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fb/framebuffer/fb_plotters.h?rev=5375&r1=5374&r2=5375&view=diff
==============================================================================
--- branches/vince/netsurf-fb/framebuffer/fb_plotters.h (original)
+++ branches/vince/netsurf-fb/framebuffer/fb_plotters.h Fri Sep 19 08:58:43 2008
@@ -42,5 +42,4 @@
 bool fb_clip(int x0, int y0, int x1, int y1);
 
 
-
 #endif




More information about the netsurf-commits mailing list