顯示具有 Microwindow 標籤的文章。 顯示所有文章
顯示具有 Microwindow 標籤的文章。 顯示所有文章

2009年6月1日 星期一

PATCH microwindows-0.91 to support tslib-1.4

diff -Naur VT300/microwindows-0.91/src/config S3C2440/microwindows-0.91/src/config
--- VT300/microwindows-0.91/src/config    2009-01-23 21:29:29.000000000 +0800
+++ S3C2440/microwindows-0.91/src/config    2009-06-01 13:11:51.000000000 +0800
@@ -37,7 +37,7 @@
 # note: ELKS can't build client/server nano-X, nor widget lib
 #
 ####################################################################
-ARCH                     = LINUX-MIPS
+ARCH                     = LINUX-ARM
 BIGENDIAN                = N
 NATIVETOOLSPREFIX        =
 ARMTOOLSPREFIX           = arm-linux-
@@ -137,7 +137,7 @@
 ####################################################################
 HAVE_JPEG_SUPPORT        = Y
 INCJPEG                  = .
-LIBJPEG                  = /usr/local/MIPSEL_UCLIBC/lib/libjpeg.a
+LIBJPEG                  = /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib/libjpeg.so
 
 ####################################################################
 # PNG support via libpng and libz
@@ -145,7 +145,7 @@
 HAVE_PNG_SUPPORT         = Y
 INCPNG                   = .
 #LIBPNG                   = /usr/lib/libpng.a
-LIBPNG                   = /usr/local/MIPSEL_UCLIBC/lib/libpng.so
+LIBPNG                   = /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/libpng.so
 LIBZ                     = -lz
 
 ####################################################################
@@ -192,7 +192,7 @@
 ####################################################################
 HAVE_PCF_SUPPORT         = Y
 HAVE_PCFGZ_SUPPORT       = N
-PCF_FONT_DIR             = "/phone/lib/X11/fonts/misc"
+PCF_FONT_DIR             = "/lib/X11/fonts/misc"
 
 ####################################################################
 # Chinese Han Zi Ku loadable font support
@@ -316,7 +316,7 @@
 GPMMOUSE                 = N
 SERMOUSE                 = N
 SUNMOUSE                 = N
-NOMOUSE                  = Y
+NOMOUSE                  = N
 IPAQMOUSE                = N
 ZAURUSMOUSE              = N
 TUXMOUSE                 = N
@@ -329,15 +329,19 @@
 YOPYMOUSE                = N
 HARRIERMOUSE             = N
 LIRCMOUSE                = N
+TSLIBMOUSE               = Y
+
+INCTSLIB                 = /home/gigijoe/S3C2440/tslib/src
+LIBTS             = /home/gigijoe/S3C2440/tslib/src/.libs/libts.so
 
 # keyboard or null kbd driver
 TTYKBD                   = N
 SCANKBD                  = N
-AC494KBD         = Y
+AC494KBD         = N
 PIPEKBD                  = N
 IPAQKBD                  = N
 LIRCKBD                  = N
-NOKBD                    = N
+NOKBD                    = Y
 
 endif
 
diff -Naur VT300/microwindows-0.91/src/drivers/mou_touchscreen.c S3C2440/microwindows-0.91/src/drivers/mou_touchscreen.c
--- VT300/microwindows-0.91/src/drivers/mou_touchscreen.c    2009-01-23 21:29:29.000000000 +0800
+++ S3C2440/microwindows-0.91/src/drivers/mou_touchscreen.c    2009-06-01 14:52:17.000000000 +0800
@@ -46,15 +46,22 @@
 #include "touchscreen_ucb1x00.h"
 #endif
 
+#ifdef TOUCHSCREEN_TSLIB
+#include "touchscreen_tslib.h"
+#endif
+
+extern SCREENDEVICE scrdev;
+
+#ifndef TOUCHSCREEN_TSLIB
+
 #ifndef TS_DEVICE
 #error "You didn't define a device for the generic touchscreen driver!"
 #endif
 
 static int pd_fd = -1;
-extern SCREENDEVICE scrdev;
 
 static int PD_Open(MOUSEDEVICE *pmd)
-{           
+{
     if((pd_fd = open(TS_DEVICE_FILE, O_NONBLOCK)) < 0) {
         EPRINTF("Error %d opening %s touchscreen device [%s]\n",
             errno, TS_DEVICE, TS_DEVICE_FILE);
@@ -123,6 +130,84 @@
     return 2;
 }
 
+#else
+
+static struct tsdev *ts = 0;
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+    char *tsdevice=NULL;
+
+      if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL ) {
+          ts = ts_open(tsdevice,0);
+      } else {
+          if (!(ts = ts_open("/dev/input/event0", 0)))
+                ts = ts_open("/dev/touchscreen/ucb1x00", 0);
+        }
+
+      if (!ts) {
+          perror("ts_open");
+            return -1;
+        }
+
+      if (ts_config(ts)) {
+            perror("ts_config");
+        ts_close(ts);
+        ts = 0;
+            return -1;
+        }
+
+    GdHideCursor(&scrdev);  
+
+    return ts_fd(ts);
+}
+
+static void PD_Close(void)
+{
+    if(ts)
+        ts_close(ts);
+    ts = 0;
+}
+
+static int PD_GetButtonInfo(void)
+{
+    /* get "mouse" buttons supported */
+    return MWBUTTON_L;
+}
+
+static void PD_GetDefaultAccel(int *pscale,int *pthresh)
+{
+    *pscale = 3;
+    *pthresh = 5;
+}
+
+static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb, int mode)
+{
+    struct ts_sample samp;
+    int ret;
+
+    ret = ts_read(ts, &samp, 1);
+
+      if (ret < 0) {
+          perror("ts_read");
+            return 0;
+        }
+
+    if(ret != 1)    /*EAGAIN*/
+        return 0;
+printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, samp.x, samp.y, samp.pressure);
+    *px = samp.x;
+    *py = samp.y;
+    *pb = (samp.pressure) ? MWBUTTON_L : 0;
+    *pz = samp.pressure;
+
+    if(!*pb)
+        return 3;
+    return 2;
+}
+
+#endif
+
 MOUSEDEVICE mousedev = {
     PD_Open,
     PD_Close,
diff -Naur VT300/microwindows-0.91/src/drivers/Objects.rules S3C2440/microwindows-0.91/src/drivers/Objects.rules
--- VT300/microwindows-0.91/src/drivers/Objects.rules    2009-01-23 21:29:29.000000000 +0800
+++ S3C2440/microwindows-0.91/src/drivers/Objects.rules    2009-05-27 22:36:54.000000000 +0800
@@ -221,6 +221,12 @@
 MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/mou_null.o
 endif
 
+### Touchscreen handle by tslib
+ifeq ($(TSLIBMOUSE), Y)
+CFLAGS += -DTOUCHSCREEN_TSLIB=1
+MW_CORE_OBJS += $(MW_DIR_OBJ)/drivers/mou_touchscreen.o
+endif
+
 #
 # Keyboard driver specific for every system
 #
diff -Naur VT300/microwindows-0.91/src/drivers/touchscreen_tslib.h S3C2440/microwindows-0.91/src/drivers/touchscreen_tslib.h
--- VT300/microwindows-0.91/src/drivers/touchscreen_tslib.h    1970-01-01 08:00:00.000000000 +0800
+++ S3C2440/microwindows-0.91/src/drivers/touchscreen_tslib.h    2009-05-27 22:38:02.000000000 +0800
@@ -0,0 +1 @@
+#include "tslib.h"
diff -Naur VT300/microwindows-0.91/src/Makefile.rules S3C2440/microwindows-0.91/src/Makefile.rules
--- VT300/microwindows-0.91/src/Makefile.rules    2009-01-23 21:29:29.000000000 +0800
+++ S3C2440/microwindows-0.91/src/Makefile.rules    2009-05-27 23:24:19.000000000 +0800
@@ -278,6 +278,14 @@
 DEFINES += -DMW_LIRC_MOUSE=1
 endif
 
+ifeq ($(TSLIBMOUSE), Y)
+ifneq ($(INCTSLIB),)
+INCLUDEDIRS += -I$(INCTSLIB)
+endif
+LDFLAGS += -lts
+MW_CORE_LIBS += $(LIBTS)
+endif
+
 ifeq ($(LIRCKBD2), Y)
 DEFINES += -DMW_FEATURE_TWO_KEYBOARDS=1
 endif
@@ -332,7 +340,7 @@
 ifneq ($(ARCH), TRIMEDIA)
 
 ifeq ($(SHAREDLIBS), Y)
-CFLAGS += -fpic
+CFLAGS += -fomit-frame-pointer -march=armv4
 endif
 
 ifeq ($(OPTIMIZE), Y)
@@ -356,7 +364,7 @@
 MAKEDEPCFLAGS :=
 HOSTCFLAGS :=
 CPPFLAGS += $(DEFINES)
-LDFLAGS += -L$(MW_DIR_LIB)
+LDFLAGS += -L$(MW_DIR_LIB) -lgcc_s
 ifeq ($(ARCH), TRIMEDIA)
 ARFLAGS = r
 else
diff -Naur VT300/microwindows-0.91/src/nanox/clientfb.c S3C2440/microwindows-0.91/src/nanox/clientfb.c
--- VT300/microwindows-0.91/src/nanox/clientfb.c    2009-01-23 21:29:30.000000000 +0800
+++ S3C2440/microwindows-0.91/src/nanox/clientfb.c    2009-05-20 17:10:45.000000000 +0800
@@ -10,7 +10,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
+#if 0
 #include <asm/page.h>        /* For definition of PAGE_SIZE */
+#endif
 #include <linux/fb.h>
 #endif
 #include "nano-X.h"
@@ -18,7 +20,7 @@
 
 #define CG6_RAM        0x70016000    /* for Sun systems*/
 
-#ifdef LINUX-MIPS
+#ifdef LINUX-ARM
 /* PAGE_SHIFT determines the page size */
 #define PAGE_SHIFT      12
 #define PAGE_SIZE       (1UL << PAGE_SHIFT)
diff -Naur VT300/microwindows-0.91/src/nanox/nxutil.c S3C2440/microwindows-0.91/src/nanox/nxutil.c
--- VT300/microwindows-0.91/src/nanox/nxutil.c    2009-01-23 21:29:30.000000000 +0800
+++ S3C2440/microwindows-0.91/src/nanox/nxutil.c    2009-05-20 18:34:54.000000000 +0800
@@ -11,6 +11,19 @@
 #include "nano-X.h"
 #include "device.h"
 
+#if 0
+extern unsigned int __aeabi_uidivmod(unsigned numerator, unsigned denominator);
+int __aeabi_idiv(int numerator, int denominator)
+     {
+      int neg_result = (numerator ^ denominator) & 0x80000000;
+      int result = __aeabi_uidivmod ((numerator < 0) ? -numerator : numerator, (denominator < 0) ? -denominator : denominator);
+      return neg_result ? -result : result; }
+unsigned __aeabi_uidiv(unsigned numerator, unsigned denominator)
+     {
+      return __aeabi_uidivmod (numerator, denominator);
+     }
+#endif
+
 /*
  * Create new window with passed style, title and location.
  */


2008年1月15日 星期二

Build nxlib-0.45

1.Modify Makefile

MWIN=../microwindows-0.91/src

X11_INCLUDE=$(X11)/include

CC = mipsel-linux-gcc

CFLAGS += -G 0 -Wall $(DEBUG) -I$(MWIN_INCLUDE) -I$(X11_INCLUDE)

xCFLAGS += -G 0 -O2 -fno-strength-reduce

libnx11.a: keysymstr.h $(OBJS)
mipsel-linux-ar r libnx11.a $(OBJS)


Add Selection.o to $OBJS


Modify


#      perl ./keymap.pl $(X11_INCLUDE)/X11 > ./keysymstr.h


         perl ./keymap.pl . > ./keysymstr.h



2. CFLAGS="-D_XP_PRINT_SERVER_" make


3.http://www.linuxhacker.org/cgi-bin/ezmlm-cgi/5/11115


 




 


FLTK with nxlib and nano-X

1.Modify configure.in
# LIBS="$LIBS -lXext -lX11 $X_EXTRA_LIBS"

If static link
LIBS="$LIBS -lnx11 -lnano-X $X_EXTRA_LIBS"

If dynamic link
LIBS="$LIBS -lX11 -lnano-X $X_EXTRA_LIBS"


2.Fix
Compiling Fl_x.cxx...
Fl_x.cxx: In function `int fl_wait(double)':
Fl_x.cxx:238: error: impossible constraint in `asm'
Fl_x.cxx:239: error: impossible constraint in `asm'
Fl_x.cxx:240: error: impossible constraint in `asm'
make[1]: *** [Fl_x.o] Error 1

The problem casue by reference to host header file.
Remove -I/usr/include to solve it.

Because we need X header files
cp -a /usr/include/X11 /usr/local/MIPSEL/mipsel-linux/include/

Add config param --x-include=-Iinclude

3.Configure
CFLAGS="-G 0" CXXFLAGS="-G 0" LDFLAGS="-s -L$PWD/../nxlib-0.45 -L$PWD/../microwindows-0.91/src/lib" ./configure --host=mipsel-linux --target=mipsel-linux --enable-shared --with-x --disable-gl --disable-cygwin --x-includes=include/ --x-libraries=$PWD/../nxlib-0.45 --cache-file=/dev/null

Fix ar in makeinclude
LIBCOMMAND = mipsel-linux-ar cr
Fix strip in makeinclude
STRIP = mipsel-linux-strip

4.make

5.Fix
Linking fluid...
../lib/libfltk.a(Fl_x.o)(.text+0x1420): In function `Fl::paste(Fl_Widget&, int)':
: undefined reference to `XConvertSelection'
../lib/libfltk.a(Fl_x.o)(.text+0x1624): In function `Fl::copy(char const*, int, int)':
: undefined reference to `XSetSelectionOwner'
../lib/libfltk.a(Fl_x.o)(.text+0x22c4): In function `fl_handle(_XEvent const&)':
: undefined reference to `XConvertSelection'
../lib/libfltk.a(fl_dnd.o)(.text+0x29c): In function `Fl::dnd()':
: undefined reference to `XSetSelectionOwner'
collect2: ld returned 1 exit status

Append the following to nxlib-0.45/stub.c
/* required for FLTK 1.1.7*/
int XConvertSelection() { printf("XConvertSelection called\n"); return 0; }
int XSetSelectionOwner() { printf("XSetSelectionOwner called\n"); return 0; }

6.vi test/Makefile

Mark following item

# fast_slow(EXEEXT) \
# keyboard$(EXEEXT) \
# mandelbrot$(EXEEXT) \
# preferences$(EXEEXT) \
# radio$(EXEEXT) \
# resize$(EXEEXT) \
# sudoku$(EXEEXT) \
# tabs$(EXEEXT) \
# valuators$(EXEEXT)

7.Copy shared library to lib/
cp src/*.so.*  lib/

8.make again to let demo programs on test/ as dynamic link

9.Library needed
/tmp # /lib/ld-2.2.5.so --list ./utf8
        libfltk-utf8.so.1.1 => /phone/lib/libfltk-utf8.so.1.1 (0x2aaa9000)
        libm.so.6 => /lib/libm.so.6 (0x2aba3000)
        libX11.so.6 => /phone/lib/libX11.so.6 (0x2ac65000)
        libnano-X.so => /usr/lib/libnano-X.so (0x2acdf000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ad31000)
        libc.so.6 => /lib/libc.so.6 (0x2ad82000)
        /lib/ld.so.1 => /lib/ld-2.2.5.so (0x55550000)







2008年1月6日 星期日

microwindew True Type Fonts support


http://tw.myblog.yahoo.com/jw!GdTvlQ.YCR8E9rpahh6eqfZX9g--/article?mid=128&prev=132&next=126&l=f&fid=17

1.Set ttf font environment, if *.ttf at /tmp

 
export MWFONTS=/tmp

2.Load ttf font

  GR_FONT_ID ttf_font;
 
  ttf_font = GrCreateFont("kaiu", 12, NULL);
  GrSetFontAttr(ttf_font, GR_TFANTIALIAS|GR_TFKERNING, 0);

3.Show ttf font

  GrSetGCFont(w->gid, ttf_font);
 
  GrText(w->wid, w->gid, 20, 20, "ABCDEFGHIJK", 8, GR_TFASCII | GR_TFTOP);

microwindew 中文顯示 with build-in font

1.Enable chinese big5 support from microwindow config file

####################################################################
# Chinese BIG5 compiled in font support (big5font.c)
####################################################################
HAVE_BIG5_SUPPORT = Y

2.Get big5font.c

ftp://microwindows.censoft.com/pub/microwindows/microwindows-fonts-0.91.tar.gz

3.Put on

microwindow-0.91/src/fonts/chinese/big5font.c

4.make & install

5.Test it

Show 中華電信
GrText(w->wid, w->gid, 20, 20, "\244\244\265\330\271\161\253\110", 8, MWTF_DBCS_BIG5);
6. \XXX

XXX 為八進位數值