app/examples/pwfb: Add options to reduce the number of windows. This is helpful during debug to reduce the complexity.
This commit is contained in:
parent
99382df286
commit
fa05ad35e1
@ -12,8 +12,19 @@ config EXAMPLES_PWFB
|
||||
---help---
|
||||
Enable the NX per-window framebuffer example
|
||||
|
||||
WARNING: Verbose graphics debug output interferes with this
|
||||
test because it introduces some weird timing. The test probably
|
||||
should use nx_synchronize() to keep syncrhonization even with the
|
||||
added delays.
|
||||
|
||||
if EXAMPLES_PWFB
|
||||
|
||||
config EXAMPLES_PWFB_NWINDOWS
|
||||
int "Number of Windows"
|
||||
default 3
|
||||
range 0 3 if NX_SWCURSOR
|
||||
range 1 3 if !NX_SWCURSOR
|
||||
|
||||
config EXAMPLES_PWFB_DEFAULT_COLORS
|
||||
bool "Use Default Colors"
|
||||
default y
|
||||
|
@ -60,19 +60,28 @@
|
||||
/* Required NX Server Settings */
|
||||
|
||||
#ifndef CONFIG_NX
|
||||
# error "NX is not enabled (CONFIG_NX)"
|
||||
# error NX is not enabled (CONFIG_NX)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DISABLE_MQUEUE
|
||||
# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)"
|
||||
# error The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DISABLE_PTHREAD
|
||||
# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)"
|
||||
# error This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NX_BLOCKING
|
||||
# error "This example depends on CONFIG_NX_BLOCKING"
|
||||
# error This example depends on CONFIG_NX_BLOCKING
|
||||
#endif
|
||||
|
||||
/* WARNING: Verbose graphics debug output interferes with this test because
|
||||
* it introduces some weird timing. The test probably should use
|
||||
* nx_synchronize() to keep syncrhonization even with the added delays.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_GRAPHICS_INFO
|
||||
# warning Verbose graphics debug output interferes with this test.
|
||||
#endif
|
||||
|
||||
/* Task priorities */
|
||||
@ -250,7 +259,7 @@ struct pwfb_state_s
|
||||
|
||||
/* Window-specific state */
|
||||
|
||||
struct pwfb_window_s wndo[3];
|
||||
struct pwfb_window_s wndo[CONFIG_EXAMPLES_PWFB_NWINDOWS];
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -74,9 +74,15 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 0
|
||||
static const char g_wndomsg1[] = "NuttX is cool!";
|
||||
#endif
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 1
|
||||
static const char g_wndomsg2[] = "NuttX is fun!";
|
||||
#endif
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 2
|
||||
static const char g_wndomsg3[] = "NuttX is groovy!";
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
@ -425,7 +431,7 @@ static bool pwfb_configure_window(FAR struct pwfb_state_s *st, int wndx,
|
||||
*/
|
||||
|
||||
/* Create a bounding box. This is actually too large because it does not
|
||||
* account for the boarder widths. However, NX should clip the fill to
|
||||
* account for the border widths. However, NX should clip the fill to
|
||||
* stay within the frame.
|
||||
*/
|
||||
|
||||
@ -473,7 +479,10 @@ static bool pwfb_configure_window(FAR struct pwfb_state_s *st, int wndx,
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up for motion */
|
||||
/* Set up for motion.
|
||||
* REVISIT: The vertical limits, xmax andymax, seems to be off
|
||||
* by about the height of the toolbar.
|
||||
*/
|
||||
|
||||
wndo->xmax = itob16(st->xres - size->w - 1);
|
||||
wndo->ymax = itob16(st->yres - size->h - 1);
|
||||
@ -620,6 +629,7 @@ int pwfb_main(int argc, char *argv[])
|
||||
goto errout_with_fontcache;
|
||||
}
|
||||
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 0
|
||||
/* Open window 1 */
|
||||
|
||||
printf("pwfb_main: Open window 1\n");
|
||||
@ -662,7 +672,9 @@ int pwfb_main(int argc, char *argv[])
|
||||
"pwfb_configure_window failed for window 1\n");
|
||||
goto errout_with_hwnd1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 1
|
||||
/* Open window 2 */
|
||||
|
||||
printf("pwfb_main: Open window 2\n");
|
||||
@ -690,7 +702,9 @@ int pwfb_main(int argc, char *argv[])
|
||||
"pwfb_configure_window failed for window 2\n");
|
||||
goto errout_with_hwnd2;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 2
|
||||
/* Open window 3 */
|
||||
|
||||
printf("pwfb_main: Open window 3\n");
|
||||
@ -718,6 +732,7 @@ int pwfb_main(int argc, char *argv[])
|
||||
"pwfb_configure_window failed for window 2\n");
|
||||
goto errout_with_hwnd3;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NX_SWCURSOR
|
||||
/* Configure the software cursor */
|
||||
@ -729,7 +744,7 @@ int pwfb_main(int argc, char *argv[])
|
||||
{
|
||||
printf("pwfb_main: ERROR: "
|
||||
"pwfb_configure_cursor failed for window 2\n");
|
||||
goto errout_with_hwnd3;
|
||||
goto errout_with_hwnds;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -753,8 +768,11 @@ errout_with_cursor:
|
||||
/* Disable the cursor */
|
||||
|
||||
(void)nxcursor_enable(wstate.hnx, false);
|
||||
|
||||
errout_with_hwnds:
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 2
|
||||
/* Close window 3 */
|
||||
|
||||
errout_with_hwnd3:
|
||||
@ -765,7 +783,9 @@ errout_with_hwnd3:
|
||||
{
|
||||
printf("pwfb_main: ERROR: nxtk_closewindow failed: %d\n", errno);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 1
|
||||
/* Close window 2 */
|
||||
|
||||
errout_with_hwnd2:
|
||||
@ -776,9 +796,11 @@ errout_with_hwnd2:
|
||||
{
|
||||
printf("pwfb_main: ERROR: nxtk_closewindow failed: %d\n", errno);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Close window1 */
|
||||
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 0
|
||||
errout_with_hwnd1:
|
||||
printf("pwfb_main: Close window #1\n");
|
||||
|
||||
@ -787,6 +809,7 @@ errout_with_hwnd1:
|
||||
{
|
||||
printf("pwfb_main: ERROR: nxtk_closewindow failed: %d\n", errno);
|
||||
}
|
||||
#endif
|
||||
|
||||
errout_with_fontcache:
|
||||
/* Release the font cache */
|
||||
|
@ -57,6 +57,7 @@
|
||||
* Name: pwfb_move_window
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 0
|
||||
static inline bool pwfb_move_window(FAR struct pwfb_state_s *st, int wndx)
|
||||
{
|
||||
FAR struct pwfb_window_s *wndo = &st->wndo[wndx];
|
||||
@ -174,6 +175,7 @@ static inline bool pwfb_move_window(FAR struct pwfb_state_s *st, int wndx)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pwfb_move_cursor
|
||||
@ -334,11 +336,12 @@ static inline bool pwfb_move_cursor(FAR struct pwfb_state_s *st)
|
||||
|
||||
bool pwfb_motion(FAR struct pwfb_state_s *st)
|
||||
{
|
||||
#if CONFIG_EXAMPLES_PWFB_NWINDOWS > 0
|
||||
int wndx;
|
||||
|
||||
/* Move each window */
|
||||
|
||||
for (wndx = 0; wndx < 3; wndx++)
|
||||
for (wndx = 0; wndx < CONFIG_EXAMPLES_PWFB_NWINDOWS; wndx++)
|
||||
{
|
||||
if (!pwfb_move_window(st, wndx))
|
||||
{
|
||||
@ -347,6 +350,7 @@ bool pwfb_motion(FAR struct pwfb_state_s *st)
|
||||
wndx + 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NX_SWCURSOR
|
||||
/* Move the cursor */
|
||||
|
Loading…
x
Reference in New Issue
Block a user