Change X11 event loop initialization
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3991 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
d7c70249f7
commit
f745f9fe31
@ -88,18 +88,25 @@ SRCS = $(ASRCS) $(CSRCS) $(HOSTSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS) $(HOSTOBJS)
|
||||
|
||||
LDFLAGS = $(ARCHSCRIPT)
|
||||
|
||||
# Determine which standard libraries will need to be linked in
|
||||
|
||||
ifeq ($(CONFIG_SIM_X11FB),y)
|
||||
STDLIBS = -lX11 -lXext -lc
|
||||
else
|
||||
STDLIBS = -lc
|
||||
STDLIBS += -lX11 -lXext
|
||||
ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
|
||||
STDLIBS += -lpthread
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_FS_FAT),y)
|
||||
STDLIBS += -lz
|
||||
STDLIBS += -lz
|
||||
endif
|
||||
|
||||
STDLIBS += -lc
|
||||
|
||||
LINKOBJS = up_head$(OBJEXT)
|
||||
LINKLIBS =
|
||||
LDPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
|
||||
all: up_head$(OBJEXT) libarch$(LIBEXT)
|
||||
|
@ -63,18 +63,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SIM_TOUCHSCREEN
|
||||
# ifndef CONFIG_SIM_EVLOOPPRIORITY
|
||||
# define CONFIG_SIM_EVLOOPPRIORITY 50
|
||||
# endif
|
||||
# ifndef CONFIG_SIM_EVLOOPSTACKSIZE
|
||||
# define CONFIG_SIM_EVLOOPSTACKSIZE 4096
|
||||
# endif
|
||||
#else
|
||||
# undef CONFIG_SIM_EVLOOPPRIORITY
|
||||
# undef CONFIG_SIM_EVLOOPSTACKSIZE
|
||||
#endif
|
||||
|
||||
/* Context Switching Definitions ******************************************/
|
||||
/* Storage order: %ebx, $esi, %edi, %ebp, sp, and return PC */
|
||||
|
||||
@ -174,7 +162,7 @@ extern int up_x11cmap(unsigned short first, unsigned short len,
|
||||
|
||||
#ifdef CONFIG_SIM_X11FB
|
||||
#ifdef CONFIG_SIM_TOUCHSCREEN
|
||||
extern int up_x11eventloop(int argc, char *argv[]);
|
||||
extern int up_x11eventloop(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -58,7 +58,6 @@
|
||||
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -107,7 +106,6 @@ struct up_dev_s
|
||||
bool penchange; /* An unreported event is buffered */
|
||||
sem_t devsem; /* Manages exclusive access to this structure */
|
||||
sem_t waitsem; /* Used to wait for the availability of data */
|
||||
pid_t eventloop; /* PID of the eventloop */
|
||||
|
||||
struct up_sample_s sample; /* Last sampled touch point data */
|
||||
|
||||
@ -631,7 +629,7 @@ int up_simtouchscreen(int minor)
|
||||
|
||||
/* Debug-only sanity checks */
|
||||
|
||||
DEBUGASSERT(minor >= 0 && minor < 100 && priv->eventloop == 0);
|
||||
DEBUGASSERT(minor >= 0 && minor < 100);
|
||||
|
||||
/* Initialize the touchscreen device driver instance */
|
||||
|
||||
@ -641,15 +639,12 @@ int up_simtouchscreen(int minor)
|
||||
|
||||
/* Start the X11 event loop */
|
||||
|
||||
ret = KERNEL_THREAD("evloop", CONFIG_SIM_EVLOOPPRIORITY,
|
||||
CONFIG_SIM_EVLOOPSTACKSIZE,
|
||||
(main_t)up_x11eventloop, (const char **)NULL);
|
||||
ret = up_x11eventloop();
|
||||
if (ret < 0)
|
||||
{
|
||||
idbg("Failed to start event loop: %d\n", ret);
|
||||
goto errout_with_priv;
|
||||
}
|
||||
priv->eventloop = ret;
|
||||
|
||||
/* Register the device as an input device */
|
||||
|
||||
|
@ -38,6 +38,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
/****************************************************************************
|
||||
@ -68,6 +70,8 @@ extern int up_tcleave(int x, int y, int buttons);
|
||||
extern Display *g_display;
|
||||
extern Window g_window;
|
||||
|
||||
pthread_t g_eventloop;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
@ -108,15 +112,11 @@ static int up_buttonmap(int state)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
***************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_x11eventloop
|
||||
***************************************************************************/
|
||||
|
||||
int up_x11eventloop(int argc, char *argv[])
|
||||
static void *up_x11eventthread(void *arg)
|
||||
{
|
||||
XEvent event;
|
||||
int ret;
|
||||
@ -164,5 +164,18 @@ int up_x11eventloop(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_x11eventloop
|
||||
***************************************************************************/
|
||||
|
||||
int up_x11eventloop(void)
|
||||
{
|
||||
/* Start the X11 event loop */
|
||||
|
||||
return pthread_create(&g_eventloop, 0, up_x11eventthread, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -266,6 +266,18 @@ nx11
|
||||
CONFIG_INPUT=y
|
||||
CONFIG_SIM_TOUCHSCREEN=y
|
||||
|
||||
Then you must also have some application logic that will call
|
||||
up_simtouchscreen(0) to register the touchscreen driver.
|
||||
|
||||
NOTES:
|
||||
1. If you do not have this call, the build will mysteriously
|
||||
fail claiming that is can't find up_tcenter(0 and up_tcleave().
|
||||
That is a consequence of the crazy way that the simulation is
|
||||
built and can only be eliminated by call up_simtouchscreen(0)
|
||||
from your application.
|
||||
|
||||
2. You must first call
|
||||
|
||||
X11 Build Issues
|
||||
----------------
|
||||
To get the system to compile under various X11 installations
|
||||
|
Loading…
Reference in New Issue
Block a user