[oe-commits] org.oe.dev merge of '0120fd2ad75a97ec542df9f008a76db1006ee24c'

thesing commit openembedded-commits at lists.openembedded.org
Tue Feb 12 12:05:48 UTC 2008


merge of '0120fd2ad75a97ec542df9f008a76db1006ee24c'
     and '9f3d06c0980328d0fb67a4c6efe474543b358c01'

Author: thesing at openembedded.org
Branch: org.openembedded.dev
Revision: f1ce41fae2ee4dc6bfc75fb8d991a37869ef24d8
ViewMTN: http://monotone.openembedded.org/revision/info/f1ce41fae2ee4dc6bfc75fb8d991a37869ef24d8
Files:
1
packages/glibc/files/glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch
packages/gcc/gcc-4.2.2/arm-softfloat.patch
packages/gcc/gcc-4.2.2/arm-thumb.patch
packages/glibc/glibc_2.6.1.bb
packages/kobodeluxe/files/buildfix.patch
packages/linux/linux-2.6.24/mpc8313e-rdb
packages/kobodeluxe/files/default-config
packages/kobodeluxe/files/kobodeluxe-dimension-autoswap.patch
packages/kobodeluxe/files/kobodeluxe-menu-pointer.patch
packages/kobodeluxe/files/kobodeluxe-putenv.patch
packages/kobodeluxe/files/kobodeluxe-sysconf-support.patch
packages/linux/linux-2.6.24/mpc8313e-rdb/defconfig
packages/logic-analyzer/files/scrolling-capture-dialog.patch
conf/machine/mpc8313e-rdb.conf
packages/kobodeluxe/kobodeluxe_0.5.1.bb
packages/linux/linux.inc
packages/linux/linux_2.6.24.bb
packages/logic-analyzer/logic-analyzer_0.8.bb
packages/meta/slugos-packages.bb
Diffs:

#
# mt diff -r0120fd2ad75a97ec542df9f008a76db1006ee24c -rf1ce41fae2ee4dc6bfc75fb8d991a37869ef24d8
#
# 
# 
# add_file "packages/glibc/files/glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch"
#  content [6e27c665fb61282ca8bf798ada77542ae0e3c4ac]
# 
# patch "packages/gcc/gcc-4.2.2/arm-softfloat.patch"
#  from [c2fcfd20cc1076a976149055efa9d3d47ccc9961]
#    to [a75dd0178c0e43be67c6e716da8c1a82a6270226]
# 
# patch "packages/gcc/gcc-4.2.2/arm-thumb.patch"
#  from [c1ab94e8925134bf5b5cae5a2689f0c7127eb008]
#    to [4e5930d45cd65afd0706edb94267818b9cd1ec05]
# 
# patch "packages/glibc/glibc_2.6.1.bb"
#  from [1f216ad18c9a31af1594aec05b31fa975613897c]
#    to [a3edca56fd29b409cf9c2080cd7c5d19362a434c]
# 
============================================================
--- packages/glibc/files/glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch	6e27c665fb61282ca8bf798ada77542ae0e3c4ac
+++ packages/glibc/files/glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch	6e27c665fb61282ca8bf798ada77542ae0e3c4ac
@@ -0,0 +1,20 @@
+Submitted By: Joe Ciccone <jciccone at linuxfromscratch.org>
+Date: 07-02-2007
+Initial Package Version: 2.6
+Origin: http://sourceware.org/ml/libc-ports/2007-05/msg00051.html
+Upstream Status: Unknown
+Description: Defines RTLD_SINGLE_THREAD_P for arm.
+
+diff -Naur glibc-2.6.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h glibc-2.6/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h
+--- glibc-2.6.orig/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h	2007-07-02 17:39:22.000000000 -0400
++++ glibc-2.6/ports/sysdeps/unix/sysv/linux/arm/nptl/sysdep-cancel.h	2007-07-02 17:39:36.000000000 -0400
+@@ -126,3 +126,9 @@
+ # define NO_CANCELLATION 1
+ 
+ #endif
++
++#ifndef __ASSEMBLER__
++# define RTLD_SINGLE_THREAD_P \
++  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
++   header.multiple_threads) == 0, 1)
++#endif 
============================================================
--- packages/gcc/gcc-4.2.2/arm-softfloat.patch	c2fcfd20cc1076a976149055efa9d3d47ccc9961
+++ packages/gcc/gcc-4.2.2/arm-softfloat.patch	a75dd0178c0e43be67c6e716da8c1a82a6270226
@@ -10,7 +10,7 @@ Index: gcc-4.0.2/gcc/config/arm/t-linux
 +LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
 +    _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
 +    _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
-+    _fixsfsi _fixunssfsi _floatdidf _floatdisf
++    _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundisf _floatundidf
  
  # MULTILIB_OPTIONS = mhard-float/msoft-float
  # MULTILIB_DIRNAMES = hard-float soft-float
============================================================
--- packages/gcc/gcc-4.2.2/arm-thumb.patch	c1ab94e8925134bf5b5cae5a2689f0c7127eb008
+++ packages/gcc/gcc-4.2.2/arm-thumb.patch	4e5930d45cd65afd0706edb94267818b9cd1ec05
@@ -59,6 +59,6 @@
      _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
      _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
 +    _call_via_rX \
-     _fixsfsi _fixunssfsi _floatdidf _floatdisf
+     _fixsfsi _fixunssfsi _floatdidf _floatdisf _floatundisf _floatundidf
  
  # MULTILIB_OPTIONS = mhard-float/msoft-float
============================================================
--- packages/glibc/glibc_2.6.1.bb	1f216ad18c9a31af1594aec05b31fa975613897c
+++ packages/glibc/glibc_2.6.1.bb	a3edca56fd29b409cf9c2080cd7c5d19362a434c
@@ -55,6 +55,7 @@ SRC_URI = "\
   file://generic-bits_time.h \
   file://etc/ld.so.conf \
   file://generate-supported.mk \
+  file://glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch;patch=1 \
 "
 
 # Build fails on sh3 and sh4 without additional patches


#
# mt diff -r9f3d06c0980328d0fb67a4c6efe474543b358c01 -rf1ce41fae2ee4dc6bfc75fb8d991a37869ef24d8
#
# 
# 
# delete "packages/kobodeluxe/files/buildfix.patch"
# 
# add_dir "packages/linux/linux-2.6.24/mpc8313e-rdb"
# 
# add_file "packages/kobodeluxe/files/default-config"
#  content [46257ad56eea9a725ce61d60791a7dc100217d6f]
# 
# add_file "packages/kobodeluxe/files/kobodeluxe-dimension-autoswap.patch"
#  content [a81da9854c43a33ce55b8bda5930b97c3432a3da]
# 
# add_file "packages/kobodeluxe/files/kobodeluxe-menu-pointer.patch"
#  content [cdf7d88a3c307e3234861a010c08d02718984c06]
# 
# add_file "packages/kobodeluxe/files/kobodeluxe-putenv.patch"
#  content [a98eaa1073b6536c57c61e4df76aace189795b2d]
# 
# add_file "packages/kobodeluxe/files/kobodeluxe-sysconf-support.patch"
#  content [1c09a303dbfdb24e5c9c15c96b075573198d7f20]
# 
# add_file "packages/linux/linux-2.6.24/mpc8313e-rdb/defconfig"
#  content [31fbac69083a743610a7b45b209c1eedf231ea8f]
# 
# add_file "packages/logic-analyzer/files/scrolling-capture-dialog.patch"
#  content [5b6ee3474dd6b3ccf6f19e551bdc91192428e179]
# 
# patch "conf/machine/mpc8313e-rdb.conf"
#  from [8d91dbc6066254429f7bb58a89ddd63064e893b6]
#    to [ab8c53a3e3d1cc19ba638ce007d8bb544e084fe6]
# 
# patch "packages/kobodeluxe/kobodeluxe_0.5.1.bb"
#  from [86d0cc4ba30bab1bfdef84b4944a8f2df96cdac3]
#    to [2040369b6c4f71d005b8c0e530e90fb9dd7efd50]
# 
# patch "packages/linux/linux.inc"
#  from [842044ba3ce2c6e2833cece5e5b577864f966d55]
#    to [50d164fb436a83e1bb06c2ef8819fc6da91f4b7c]
# 
# patch "packages/linux/linux_2.6.24.bb"
#  from [9aa2936a0674d6f62622a857a74d7637177bf26e]
#    to [bfcc7f56635a20d509535cb2e8653f0479ba726f]
# 
# patch "packages/logic-analyzer/logic-analyzer_0.8.bb"
#  from [6d578bf0553be1e28b4a10f6b80b958df29d68c8]
#    to [887bea96f05438c0a3baacddfbfcf142ec2638c8]
# 
# patch "packages/meta/slugos-packages.bb"
#  from [8e633679aa411b5325cde1efedc6e7aef639b15d]
#    to [a0f84eecde8c29aacd23f8d841a38ccb02939c65]
# 
============================================================
--- packages/kobodeluxe/files/default-config	46257ad56eea9a725ce61d60791a7dc100217d6f
+++ packages/kobodeluxe/files/default-config	46257ad56eea9a725ce61d60791a7dc100217d6f
@@ -0,0 +1,70 @@
+#--------------------------------------------
+# Kobo Deluxe 0.5.1 Configuration File
+#--------------------------------------------
+# Switches - [no]<switch>
+# Values - <key> [<value>|"<string>"]
+#--------------------------------------------
+#--- System options --------------------------
+nologfile
+logformat 0
+logverbosity 2
+#--- Input options --------------------------
+nojoystick
+joystick_no 0
+mouse
+mousemode 1
+nobroken_numdia
+dia_emphasis 0
+noalways_fire
+mousecapture
+#--- Game options ---------------------------
+scrollradar 2
+filter
+timefilter 50
+countdown 5
+starfield 2
+stars 250
+overheatloud 100
+cannonloud 100
+#--- Sound settings -------------------------
+nosound
+music
+nocached_sounds
+samplerate 8000
+latency 50
+mixquality 1
+vol 100
+intro_vol 100
+sfx_vol 100
+music_vol 30
+reverb 100
+vol_boost 0
+#--- Video settings -------------------------
+fullscreen
+videodriver 0
+width WIDTH_HERE
+height HEIGHT_HERE
+autoswap
+aspect 1
+depth 0
+maxfps 100
+maxfpsstrict 0
+buffer 0
+shadow
+videomode -1
+vsync
+videopages -1
+#--- Graphics settings ----------------------
+scalemode 0
+nodither
+dither_type 2
+nobroken_rgba8
+alpha
+brightness 100
+contrast 100
+#--- File paths -----------------------------
+files ""
+gfx ""
+sfx ""
+scores ""
+wait 30
============================================================
--- packages/kobodeluxe/files/kobodeluxe-dimension-autoswap.patch	a81da9854c43a33ce55b8bda5930b97c3432a3da
+++ packages/kobodeluxe/files/kobodeluxe-dimension-autoswap.patch	a81da9854c43a33ce55b8bda5930b97c3432a3da
@@ -0,0 +1,236 @@
+Index: KoboDeluxe-0.5.1/graphics/gfxengine.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/graphics/gfxengine.cpp	2008-02-11 13:17:27.000000000 +0100
++++ KoboDeluxe-0.5.1/graphics/gfxengine.cpp	2008-02-11 15:27:57.000000000 +0100
+@@ -135,11 +135,13 @@
+ 
+ 	_width = w;
+ 	_height = h;
++
+ 	if(csengine)
+ 		cs_engine_set_size(csengine, w, h);
+ 
+ 	if(was_showing)
+ 		show();
++
+ }
+ 
+ void gfxengine_t::centered(int c)
+@@ -759,33 +761,13 @@
+ 	Display show/hide
+ ----------------------------------------------------------*/
+ 
+-int gfxengine_t::show()
++/** Helper method that returns the flags value needed for
++ * SDL_SetVideoMode() and SDL_VideoModeOK().
++ */
++int gfxengine_t::video_flags()
+ {
+ 	int flags = 0;
+ 
+-	if(!is_open)
+-		return -1;
+-
+-	if(is_showing)
+-		return 0;
+-
+-  if(_centered && !_fullscreen)
+-#if HAVE_DECL_SDL_PUTENV
+-    SDL_putenv("SDL_VIDEO_CENTERED=1");
+-#elif defined(HAVE_PUTENV)
+-    putenv("SDL_VIDEO_CENTERED=1");
+-#else
+-    #error Neither SDL_putenv() nor putenv() are available. Fix it!
+-#endif
+-
+-	log_printf(DLOG, "Opening screen...\n");
+-	if(!SDL_WasInit(SDL_INIT_VIDEO))
+-		if(SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
+-		{
+-			log_printf(ELOG, "Failed to initialize SDL!\n");
+-			return -2;
+-		}
+-
+ 	switch(_driver)
+ 	{
+ 	  case GFX_DRIVER_SDL2D:
+@@ -830,11 +812,72 @@
+ 	glSDL_VSync(_vsync);
+ 	flags |= xflags;
+ 
++	return flags;
++}
++
++bool gfxengine_t::check_mode_autoswap(int *w, int *h)
++{
++	log_printf(VLOG, "Trying display modes %dx%d and %dx%d if the first fails.\n", *w, *h, *h, *w);
++
++	int flags = video_flags();
++
++	SDL_Surface *test_surface = NULL;
++
++	// On some platforms SDL_VideoModeOK() cannot be trusted unfortunately.
++	if(!(test_surface = SDL_SetVideoMode(*w, *h, _depth, flags)))
++	{
++		if(!(test_surface = SDL_SetVideoMode(*h, *w, _depth, flags)))
++		{
++			log_printf(ELOG, "Failed with both display mode. Giving up!\n");
++			return false;
++		}
++
++		int temp = *w;
++		*w = *h;
++		*h = temp;
++
++		log_printf(VLOG, "Display dimensions swapped. Using %dx%d!\n", *w, *h);
++	}
++	else
++		log_printf(VLOG, "Stored display dimension worked. Using %dx%d!\n", *w, *h);
++
++	SDL_FreeSurface(test_surface);
++
++	return true;
++}
++
++int gfxengine_t::show()
++{
++	if(!is_open)
++		return -1;
++
++	if(is_showing)
++		return 0;
++
++  if(_centered && !_fullscreen)
++#if HAVE_DECL_SDL_PUTENV
++    SDL_putenv("SDL_VIDEO_CENTERED=1");
++#elif defined(HAVE_PUTENV)
++    putenv("SDL_VIDEO_CENTERED=1");
++#else
++    #error Neither SDL_putenv() nor putenv() are available. Fix it!
++#endif
++
++	log_printf(DLOG, "Opening screen...\n");
++	if(!SDL_WasInit(SDL_INIT_VIDEO))
++		if(SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
++		{
++			log_printf(ELOG, "Failed to initialize SDL!\n");
++			return -2;
++		}
++
++	int flags = video_flags();
++
+ 	screen_surface = SDL_SetVideoMode(_width, _height, _depth, flags);
+ 	if(!screen_surface)
+ 	{
+-		log_printf(ELOG, "Failed to open display!\n");
+-		return -3;
++		log_printf(ELOG, "Failed to open display with %dx%d! Giving up.\n", _width, _height);
++    return -3;
+ 	}
+ 
+ 	if(_driver != GFX_DRIVER_GLSDL)
+Index: KoboDeluxe-0.5.1/graphics/gfxengine.h
+===================================================================
+--- KoboDeluxe-0.5.1.orig/graphics/gfxengine.h	2008-02-11 13:24:51.000000000 +0100
++++ KoboDeluxe-0.5.1/graphics/gfxengine.h	2008-02-11 15:15:50.000000000 +0100
+@@ -54,6 +54,9 @@
+ class gfxengine_t
+ {
+ 	friend class window_t;
++
++	int video_flags();
++
+   public:
+ 	gfxengine_t();
+ 	virtual ~gfxengine_t();
+@@ -135,6 +138,7 @@
+ 	void title(const char *win, const char *icon);
+ 
+ 	/* Display show/hide */
++	bool check_mode_autoswap(int *, int *);
+ 	int show();
+ 	void hide();
+ 
+Index: KoboDeluxe-0.5.1/kobo.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/kobo.cpp	2008-02-11 13:16:24.000000000 +0100
++++ KoboDeluxe-0.5.1/kobo.cpp	2008-02-11 14:57:29.000000000 +0100
+@@ -641,8 +641,27 @@
+ 	gengine->title("Kobo Deluxe " VERSION, "kobodl");
+ 	gengine->driver((gfx_drivers_t)p->videodriver);
+ 
++	// Initializes gfxengine with all kinds of display properties.
++	// We need this at this point to make the autoswap check work
++	// properly. Since these properties are independent of other
++	// values that is no problem.
++	gengine->mode(0, p->fullscreen);
++	gengine->doublebuffer(p->doublebuf);
++	gengine->pages(p->pages);
++	gengine->vsync(p->vsync);
++	gengine->shadow(p->shadow);
++	gengine->cursor(0);
++
++	// Do the auto swap dance only if configured so.
++	if (prefs->autoswap)
++	{
++		if (!gengine->check_mode_autoswap(&p->width, &p->height))
++			return -1;
++	}
++	
+ 	dw = p->width;
+ 	dh = p->height;
++
+ 	if(p->fullscreen)
+ 	{
+ 		// This game assumes 1:1 pixel aspect ratio, or 4:3
+@@ -696,13 +715,6 @@
+ 	yoffs = (int)((dh - gh) / 2 / gengine->yscale());
+ 	gengine->size(dw, dh);
+ 
+-	gengine->mode(0, p->fullscreen);
+-	gengine->doublebuffer(p->doublebuf);
+-	gengine->pages(p->pages);
+-	gengine->vsync(p->vsync);
+-	gengine->shadow(p->shadow);
+-	gengine->cursor(0);
+-
+ 	gengine->period(game.speed);
+ 	sound.period(game.speed);
+ 	gengine->timefilter(p->timefilter * 0.01f);
+Index: KoboDeluxe-0.5.1/prefs.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/prefs.cpp	2008-02-11 14:28:01.000000000 +0100
++++ KoboDeluxe-0.5.1/prefs.cpp	2008-02-11 14:30:15.000000000 +0100
+@@ -86,6 +86,7 @@
+ 			desc("Display Driver");
+ 	key("width", width, 640); desc("Horizontal Resolution");
+ 	key("height", height, 480); desc("Vertical Resolution");
++	yesno("autoswap", autoswap, 0); desc("Automatically swap display dimension");
+ 	key("aspect", aspect, 1000); desc("Pixel Aspect Ratio");
+ 	key("depth", depth, 0); desc("Display Depth");
+ 	key("maxfps", max_fps, 100); desc("Maximum fps");
+Index: KoboDeluxe-0.5.1/prefs.h
+===================================================================
+--- KoboDeluxe-0.5.1.orig/prefs.h	2008-02-11 14:28:01.000000000 +0100
++++ KoboDeluxe-0.5.1/prefs.h	2008-02-11 14:31:24.000000000 +0100
+@@ -76,6 +76,7 @@
+ 	int	videodriver;	//Internal video driver
+ 	int	width;		//Screen/window width
+ 	int	height;		//Screen/window height
++	int autoswap; // Automatically swap dimensions if initialization fails
+ 	int	aspect;		//Pixel aspect ratio * 1000
+ 	int	depth;		//Bits per pixel
+ 	int	max_fps;	//Maximum fps
+Index: KoboDeluxe-0.5.1/states.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/states.cpp	2008-02-11 14:32:13.000000000 +0100
++++ KoboDeluxe-0.5.1/states.cpp	2008-02-11 15:00:13.000000000 +0100
+@@ -117,6 +117,8 @@
+ 	switch (button)
+ 	{
+ 	  case BTN_EXIT:
++		gsm.push(&st_ask_exit);
++		break;
+ 	  case BTN_CLOSE:
+ 		gsm.push(&st_main_menu);
+ 		break;
============================================================
--- packages/kobodeluxe/files/kobodeluxe-menu-pointer.patch	cdf7d88a3c307e3234861a010c08d02718984c06
+++ packages/kobodeluxe/files/kobodeluxe-menu-pointer.patch	cdf7d88a3c307e3234861a010c08d02718984c06
@@ -0,0 +1,266 @@
+Index: KoboDeluxe-0.5.1/README
+===================================================================
+--- KoboDeluxe-0.5.1.orig/README	2008-02-11 01:10:23.000000000 +0100
++++ KoboDeluxe-0.5.1/README	2008-02-11 01:17:30.000000000 +0100
+@@ -39,6 +39,12 @@
+        key  diagonals.  Escape enters the meny system, from where it is possi-
+        ble to change settings, start a new game or exit the game.
+ 
++       In case the touchscreen support has been compiled in the  menu  can  be
++       controlled by clicking the frame borders. Touching the  inner  part  of
++       the  screen is like a button  press. In the game  mode a  click in  the
++       upper right corner activates pause mode and the lower right  corner es-
++       capes to the menu.
++
+ OPTIONS
+        Note that all relevant options can be also  configured  in  the  config
+        file,  which  can be edited directly, or using the options menus in the
+Index: KoboDeluxe-0.5.1/config.h
+===================================================================
+--- KoboDeluxe-0.5.1.orig/config.h	2008-02-11 00:23:20.000000000 +0100
++++ KoboDeluxe-0.5.1/config.h	2008-02-11 02:01:17.000000000 +0100
+@@ -95,6 +95,15 @@
+ #define MARGIN	8
+ 
+ /*
++ * Fraction of the screen size in which clicks are not considered
++ * clicks but movements in that direction (as regarded from the
++ * center of the screen) or other special things (pause & exit).
++ *
++ * Used only in touchscreen mode.
++ */
++#define POINTER_MARGIN_PERCENT 10
++
++/*
+  * (In XKobo, WSIZE was used where this is
+  * used now; in the game logic code.)
+  *
+Index: KoboDeluxe-0.5.1/configure.in
+===================================================================
+--- KoboDeluxe-0.5.1.orig/configure.in	2008-02-11 00:37:18.000000000 +0100
++++ KoboDeluxe-0.5.1/configure.in	2008-02-11 00:48:59.000000000 +0100
+@@ -195,6 +195,16 @@
+ 	CXXFLAGS="$CXXFLAGS -DHAVE_OPENGL"
+ fi
+ 
++AC_ARG_ENABLE(
++  touchscreen,
++  [AS_HELP_STRING(
++    [--enable-touchscreen],
++    [Compile menu control support suitable for touchscreens (default is no)])],
++  AC_DEFINE(
++    [ENABLE_TOUCHSCREEN],
++    [1],
++    [Set to 1 if the menusystem should support touchscreen input]),
++    [])
+ 
+ dnl-------------------------------------------------------
+ dnl Checks for header files.
+Index: KoboDeluxe-0.5.1/kobo.cpp
+===================================================================
+--- KoboDeluxe-0.5.1.orig/kobo.cpp	2008-02-11 00:24:57.000000000 +0100
++++ KoboDeluxe-0.5.1/kobo.cpp	2008-02-11 16:02:23.000000000 +0100
+@@ -28,6 +28,8 @@
+ // Use this to benchmark and create a new percentage table!
+ #undef	TIME_PROGRESS
+ 
++#include <aconfig.h>
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+@@ -671,6 +673,10 @@
+ 		gh = dh;
+ 	}
+ 
++#if ENABLE_TOUCHSCREEN
++	gengine->setup_pointer_margin(dw, dh);
++#endif
++
+ 	// Scaling has 16ths granularity, so tiles scale properly!
+ 	gengine->scale((int)((gw * 16 + 8) / SCREEN_WIDTH) / 16.f,
+ 			(int)((gh * 16 + 8) / SCREEN_HEIGHT) / 16.f);
+@@ -1599,6 +1605,23 @@
+ {
+ }
+ 
++#ifdef ENABLE_TOUCHSCREEN
++void kobo_gfxengine_t::setup_pointer_margin(int dw, int dh)
++{
++	// Precalculates the border ranges. Mouse clicks outside these are handled
++  // specially.
++	pointer_margin_width_min = dw * POINTER_MARGIN_PERCENT / 100;
++	pointer_margin_width_max = dw - dw * POINTER_MARGIN_PERCENT / 100;
++	pointer_margin_height_min = dh * POINTER_MARGIN_PERCENT / 100;
++	pointer_margin_height_max = dh - dh * POINTER_MARGIN_PERCENT / 100;
++
++	log_printf(VLOG, "Pointer margin range [%d, %d, %d, %d]\n",
++						 pointer_margin_width_min,
++						 pointer_margin_width_max,
++						 pointer_margin_height_min,
++						 pointer_margin_height_max);
++}
++#endif
+ 
+ void kobo_gfxengine_t::frame()
+ {
+@@ -1800,11 +1823,57 @@
+ 						mouse_y - MARGIN - WSIZE/2);
+ 			break;
+ 		  case SDL_MOUSEBUTTONDOWN:
+-			mouse_x = (int)(ev.motion.x / gengine->xscale()) - km.xoffs;
+-			mouse_y = (int)(ev.motion.y / gengine->yscale()) - km.yoffs;
+-			gsm.press(BTN_FIRE);
++			mouse_x = (int)(ev.button.x / gengine->xscale()) - km.xoffs;
++			mouse_y = (int)(ev.button.y / gengine->yscale()) - km.yoffs;
+ 			if(prefs->use_mouse)
+ 			{
++#if ENABLE_TOUCHSCREEN
++				if (ev.motion.x <= pointer_margin_width_min)
++				{
++					gsm.press(BTN_LEFT);
++					pointer_margin_used = true;
++				} else if (ev.motion.x >= pointer_margin_width_max)
++				{
++					// Upper right corner invokes pause.
++          // Lower right corner invokes exit.
++          // Otherwise it is just 'right'. :)
++					if (ev.motion.y <= pointer_margin_height_min)
++					{
++						gsm.press(BTN_PAUSE);
++						gamecontrol.press(BTN_PAUSE);
++					}
++					else
++						gsm.press((ev.motion.y >= pointer_margin_height_max
++                       ? BTN_EXIT
++                       : BTN_RIGHT));
++
++					pointer_margin_used = true;
++
++				}
++
++				if (ev.motion.y <= pointer_margin_height_min)
++				{
++					// Handle as 'up' only if it was not in the 'pause' area.
++					// Still handle as clicked, so 'fire' will not kick in.
++					if (ev.motion.x < pointer_margin_width_max)
++						gsm.press(BTN_UP);
++					pointer_margin_used = true;
++				} else if (ev.motion.y >= pointer_margin_height_max)
++				{
++					// Handle as 'down' only if it was not in the 'exit' area.
++					// Still handle as clicked, so 'fire' will not %s
>>> DIFF TRUNCATED @ 16K






More information about the Openembedded-commits mailing list