diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2011-01-02 02:07:27 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2011-01-02 02:07:27 +0100 |
commit | 0a95e15cdc87de0136734e784d487f9b03170bbb (patch) | |
tree | adae83e51ba5b78869f51aa43cfe8ebfb762ec41 /libnsfb | |
download | nanonote-ports-0a95e15cdc87de0136734e784d487f9b03170bbb.tar.gz |
initial checkin of my nanonote ports feed, including a small README.
Diffstat (limited to 'libnsfb')
-rw-r--r-- | libnsfb/Makefile | 67 | ||||
-rw-r--r-- | libnsfb/files/kbdmouse.h | 24 | ||||
-rw-r--r-- | libnsfb/files/keyboard.c | 94 | ||||
-rw-r--r-- | libnsfb/patches/010-flags.patch | 11 | ||||
-rw-r--r-- | libnsfb/patches/020-no-cast-align-warn.patch | 11 | ||||
-rw-r--r-- | libnsfb/patches/030-remove-unused-frontends.patch | 18 | ||||
-rw-r--r-- | libnsfb/patches/200-sdl-kbdmouse.patch | 163 |
7 files changed, 388 insertions, 0 deletions
diff --git a/libnsfb/Makefile b/libnsfb/Makefile new file mode 100644 index 0000000..f78cae2 --- /dev/null +++ b/libnsfb/Makefile @@ -0,0 +1,67 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=libnsfb +PKG_VERSION:=r10875 +PKG_RELEASE:=1 + +PKG_SOURCE:=libnsfb-$(PKG_VERSION).tar.gz +#PKG_SOURCE_URL:= +PKG_MD5SUM:=9ca6a6dde2501ad77b0e3d1e88a199fc + +PKG_BUILD_DIR=$(BUILD_DIR)/libnsfb-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/libnsfb + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web + DEPENDS:=+libsdl + TITLE:=NetSurf Framebuffer Abstraction Library + URL:=http://www.netsurf-browser.org/projects/libnsfb/ +endef + +define Package/libnsfb/description +LibNSFB is a framebuffer abstraction library, written in C. +It is currently in development for use with NetSurf and is intended +to be suitable for use in other projects too. + +This package will build support for the Linux framebuffer and +SDL providers. +endef + +EXTRA_CPPFLAGS += \ + -DKBDMOUSE='\"$(SOURCE)/files/kbdmouse.h\"' + +MAKE_VARS := \ + TARGET=linux \ + PREFIX=/usr \ + COMPONENT_TYPE=lib-shared + +define Build/Configure +endef + +define Build/Compile + $(CONFIGURE_VARS) \ + $(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" \ + $(MAKE_VARS) install +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/libnsfb.h $(1)/usr/include + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/libnsfb_{plot,plot_util,event,cursor}.h $(1)/usr/include + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnsfb.so* $(1)/usr/lib + + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnsfb.pc $(1)/usr/lib/pkgconfig +endef + +define Package/libnsfb/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnsfb.so* $(1)/usr/lib +endef + +$(eval $(call BuildPackage,libnsfb)) diff --git a/libnsfb/files/kbdmouse.h b/libnsfb/files/kbdmouse.h new file mode 100644 index 0000000..408f82a --- /dev/null +++ b/libnsfb/files/kbdmouse.h @@ -0,0 +1,24 @@ +/* + * + * Keyboard Mouse Emulation Config + * + */ + +#include "keyboard.c" + +#define KBDMOUSE_TOGGLE NNKEY_QI + +#define KBDMOUSE_LEFT_CLICK NNKEY_VOLUMEDOWN +#define KBDMOUSE_RIGHT_CLICK NNKEY_VOLUMEUP + +#define KBDMOUSE_UP NNKEY_UP +#define KBDMOUSE_DOWN NNKEY_DOWN +#define KBDMOUSE_LEFT NNKEY_LEFT +#define KBDMOUSE_RIGHT NNKEY_RIGHT + +#define KBDMOUSE_QUIT_HACK NNKEY_ESCAPE + +#define KBDMOUSE_STEP 5 + +#define KBDMOUSE_REPEAT_DELAY SDL_DEFAULT_REPEAT_DELAY +#define KBDMOUSE_REPEAT_INTERVAL (SDL_DEFAULT_REPEAT_INTERVAL/2) diff --git a/libnsfb/files/keyboard.c b/libnsfb/files/keyboard.c new file mode 100644 index 0000000..cde8c0d --- /dev/null +++ b/libnsfb/files/keyboard.c @@ -0,0 +1,94 @@ +/* + keyboard.c + + Contains defines for every + key on the Ben NanoNote. + + Data collected and compiled + by xdpirate of #qi-hardware + on irc.freenode.net +*/ + +/* Function keys */ +#define NNKEY_F1 282 +#define NNKEY_F2 283 +#define NNKEY_F3 284 +#define NNKEY_F4 285 +#define NNKEY_F5 286 +#define NNKEY_F6 287 +#define NNKEY_F7 288 +#define NNKEY_F8 289 + +/* First (top) keyboard row */ +#define NNKEY_Q 113 +#define NNKEY_W 119 +#define NNKEY_E 101 +#define NNKEY_R 114 +#define NNKEY_T 116 +#define NNKEY_Y 121 +#define NNKEY_U 117 +#define NNKEY_I 105 +#define NNKEY_O 111 +#define NNKEY_P 112 + +/* Second keyboard row */ +#define NNKEY_A 97 +#define NNKEY_S 115 +#define NNKEY_D 100 +#define NNKEY_F 102 +#define NNKEY_G 103 +#define NNKEY_H 104 +#define NNKEY_J 106 +#define NNKEY_K 107 +#define NNKEY_L 108 +#define NNKEY_BACKSPACE 8 + +/* Third keyboard row */ +#define NNKEY_ESCAPE 27 +#define NNKEY_Z 122 +#define NNKEY_X 120 +#define NNKEY_C 99 +#define NNKEY_V 118 +#define NNKEY_B 98 +#define NNKEY_N 110 +#define NNKEY_M 109 +#define NNKEY_EQUALS 61 +#define NNKEY_ENTER 13 // Enter and Return are very often used interchangeably, so since there's +#define NNKEY_RETURN 13 // only one Enter key on the NN, they're both defined to the same key + +/* Fourth keyboard row, not including arrows/volume */ +#define NNKEY_TAB 9 +#define NNKEY_CAPSLOCK 301 // Same key, two constants +#define NNKEY_CAPS 301 // for simplicity +#define NNKEY_BACKSLASH 92 +#define NNKEY_APOSTROPHE 180 +#define NNKEY_COMMA 44 +#define NNKEY_PERIOD 46 +#define NNKEY_SLASH 47 + +/* Fifth (bottom) keyboard row, not including arrows/volume */ +#define NNKEY_SHIFT 304 +#define NNKEY_ALT 308 +#define NNKEY_FUNCTION 306 // Same +#define NNKEY_FN 306 // key +#define NNKEY_RED 307 // Same +#define NNKEY_ALTGR 307 // key +#define NNKEY_SPACE 32 +#define NNKEY_QI 0 // Yes, the Qi-button actually returns 0! +#define NNKEY_CTRL 305 // Same +#define NNKEY_CONTROL 305 // key + +/* Arrow keys and Volume keys */ +#define NNKEY_UP 273 +#define NNKEY_DOWN 274 +#define NNKEY_LEFT 276 +#define NNKEY_RIGHT 275 +#define NNKEY_VOLUP 292 +#define NNKEY_VOLUMEUP 292 +#define NNKEY_VOLDOWN 293 +#define NNKEY_VOLUMEDOWN 293 + +#define NNKEY_POWER 0 // NOTE: This key is only here for completeness' sake, + // the NanoNote will automatically turn off after + // pressing this key. It shares a key code with the + // Qi-button (Line 77). diff --git a/libnsfb/patches/010-flags.patch b/libnsfb/patches/010-flags.patch new file mode 100644 index 0000000..6dad1ac --- /dev/null +++ b/libnsfb/patches/010-flags.patch @@ -0,0 +1,11 @@ +--- a/Makefile 2010-10-10 05:26:39.439706253 +0200 ++++ b/Makefile 2010-10-10 05:27:16.699713741 +0200 +@@ -16,7 +16,7 @@ + -Wmissing-declarations -Wnested-externs -Werror -pedantic \ + -Wno-overlength-strings # For nsglobe.c + CFLAGS := -g -std=c99 -D_BSD_SOURCE -I$(CURDIR)/include/ \ +- -I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS) ++ -I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS) $(CPPFLAGS) + + # TODO: probably want to retrieve SDL from pkg-config + TESTLDFLAGS = -Wl,--whole-archive -l$(COMPONENT) -Wl,--no-whole-archive -lSDL -lxcb-icccm -lxcb -lxcb-image -lxcb-keysyms diff --git a/libnsfb/patches/020-no-cast-align-warn.patch b/libnsfb/patches/020-no-cast-align-warn.patch new file mode 100644 index 0000000..1ecaecd --- /dev/null +++ b/libnsfb/patches/020-no-cast-align-warn.patch @@ -0,0 +1,11 @@ +--- a/Makefile 2010-10-10 05:53:28.609713613 +0200 ++++ b/Makefile 2010-10-10 05:53:42.499719955 +0200 +@@ -11,7 +11,7 @@ + TESTRUNNER = test/runtest.sh $(BUILDDIR) $(EXEEXT) + + # Toolchain flags +-WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ ++WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith \ + -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ + -Wmissing-declarations -Wnested-externs -Werror -pedantic \ + -Wno-overlength-strings # For nsglobe.c diff --git a/libnsfb/patches/030-remove-unused-frontends.patch b/libnsfb/patches/030-remove-unused-frontends.patch new file mode 100644 index 0000000..7bf811d --- /dev/null +++ b/libnsfb/patches/030-remove-unused-frontends.patch @@ -0,0 +1,18 @@ +--- a/src/surface/Makefile 2010-10-10 06:21:54.469717609 +0200 ++++ b/src/surface/Makefile 2010-10-10 06:22:20.259716132 +0200 +@@ -1,4 +1,4 @@ + # Sources +-DIR_SOURCES := surface.c sdl.c vnc.c able.c ram.c linux.c x.c ++DIR_SOURCES := surface.c sdl.c ram.c linux.c + + include build/makefiles/Makefile.subdir +--- a/libnsfb.pc.in 2010-10-10 19:08:10.649146014 +0200 ++++ b/libnsfb.pc.in 2010-10-10 19:08:22.077902040 +0200 +@@ -6,6 +6,6 @@ + Name: libnsfb + Description: Provides framebuffer access for netsurf. + Version: VERSION +-Requires: sdl xcb xcb-icccm xcb-image xcb-keysyms ++Requires: sdl + Libs: -L${libdir} -lnsfb + Cflags: -I${includedir} diff --git a/libnsfb/patches/200-sdl-kbdmouse.patch b/libnsfb/patches/200-sdl-kbdmouse.patch new file mode 100644 index 0000000..660e220 --- /dev/null +++ b/libnsfb/patches/200-sdl-kbdmouse.patch @@ -0,0 +1,163 @@ +--- a/src/surface/sdl.c 2010-04-29 01:26:13.521908000 +0200 ++++ b/src/surface/sdl.c 2010-10-13 03:06:18.945784735 +0200 +@@ -6,6 +6,10 @@ + * http://www.opensource.org/licenses/mit-license.php + */ + ++#define _POSIX_SOURCE ++#include <sys/types.h> ++#include <unistd.h> ++#include <signal.h> + #include <stdbool.h> + #include <stdlib.h> + #include <SDL/SDL.h> +@@ -20,6 +24,10 @@ + #include "plot.h" + #include "cursor.h" + ++#ifdef KBDMOUSE ++#include KBDMOUSE ++#endif ++ + enum nsfb_key_code_e sdl_nsfb_map[] = { + NSFB_KEY_UNKNOWN, + NSFB_KEY_UNKNOWN, +@@ -470,7 +478,11 @@ + nsfb->linelen = sdl_screen->pitch; + + SDL_ShowCursor(SDL_DISABLE); ++#ifdef KBDMOUSE ++ SDL_EnableKeyRepeat(KBDMOUSE_REPEAT_DELAY, KBDMOUSE_REPEAT_INTERVAL); ++#else + SDL_EnableKeyRepeat(300, 50); ++#endif + + return 0; + } +@@ -497,6 +509,116 @@ + return 0; + } + ++#ifdef KBDMOUSE ++ ++static int keyboard_mouse(SDL_Event *event) ++{ ++ static int enabled = 1; ++ ++ SDL_Event new; ++ int x, y; ++ ++ if ((int)event->key.keysym.sym == KBDMOUSE_TOGGLE) { ++ if (event->type == SDL_KEYUP) ++ enabled = !enabled; ++ return 0; ++ } ++ ++ if (!enabled) ++ return -1; ++ ++ switch (event->type) { ++ case SDL_KEYDOWN: ++ switch ((int)event->key.keysym.sym) { ++ case KBDMOUSE_LEFT_CLICK: ++ case KBDMOUSE_RIGHT_CLICK: ++ SDL_GetMouseState(&x, &y); ++ ++ new.type = SDL_MOUSEBUTTONDOWN; ++ new.button.type = SDL_MOUSEBUTTONDOWN; ++ new.button.which = 0; ++ new.button.state = SDL_PRESSED; ++ new.button.x = (Uint16)x; ++ new.button.y = (Uint16)y; ++ ++ switch ((int)event->key.keysym.sym) { ++ case KBDMOUSE_LEFT_CLICK: new.button.button = SDL_BUTTON_LEFT; break; ++ case KBDMOUSE_RIGHT_CLICK: new.button.button = SDL_BUTTON_RIGHT; break; ++ } ++ ++ SDL_PushEvent(&new); ++ return 0; ++ ++ case KBDMOUSE_UP: ++ case KBDMOUSE_DOWN: ++ case KBDMOUSE_LEFT: ++ case KBDMOUSE_RIGHT: ++ SDL_GetMouseState(&x, &y); ++ ++ switch ((int)event->key.keysym.sym) { ++ case KBDMOUSE_UP: y -= KBDMOUSE_STEP; break; ++ case KBDMOUSE_DOWN: y += KBDMOUSE_STEP; break; ++ case KBDMOUSE_RIGHT: x += KBDMOUSE_STEP; break; ++ case KBDMOUSE_LEFT: x -= KBDMOUSE_STEP; break; ++ } ++ ++ SDL_WarpMouse((Uint16)x, (Uint16)y); ++ return 0; ++ ++ case KBDMOUSE_QUIT_HACK: ++ return 0; ++ } ++ break; ++ ++ case SDL_KEYUP: ++ switch ((int)event->key.keysym.sym) { ++ case KBDMOUSE_LEFT_CLICK: ++ case KBDMOUSE_RIGHT_CLICK: ++ SDL_GetMouseState(&x, &y); ++ ++ new.type = SDL_MOUSEBUTTONUP; ++ new.button.type = SDL_MOUSEBUTTONUP; ++ new.button.which = 0; ++ new.button.state = SDL_RELEASED; ++ new.button.x = (Uint16)x; ++ new.button.y = (Uint16)y; ++ ++ switch ((int)event->key.keysym.sym) { ++ case KBDMOUSE_LEFT_CLICK: new.button.button = SDL_BUTTON_LEFT; break; ++ case KBDMOUSE_RIGHT_CLICK: new.button.button = SDL_BUTTON_RIGHT; break; ++ } ++ ++ SDL_PushEvent(&new); ++ return 0; ++ ++ case KBDMOUSE_UP: ++ case KBDMOUSE_DOWN: ++ case KBDMOUSE_LEFT: ++ case KBDMOUSE_RIGHT: ++ return 0; ++ ++ case KBDMOUSE_QUIT_HACK: ++ kill(getpid(), SIGTERM); ++ return 0; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ return -1; ++} ++ ++#else ++ ++static int keyboard_mouse(SDL_Event *event __attribute__((unused))) ++{ ++ return -1; ++} ++ ++#endif ++ + static bool sdl_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout) + { + int got_event; +@@ -526,6 +648,9 @@ + if (got_event == 0) + return false; + ++ if (!keyboard_mouse(&sdlevent)) ++ return false; ++ + event->type = NSFB_EVENT_NONE; + + switch (sdlevent.type) { |