exmamples/, graphics/NxWidgets: Update NX window clients so that they use the new 'event' callback (vs. the obsoluted 'blocked' callback).
This commit is contained in:
parent
fab0ac6e82
commit
11b6bc9447
@ -97,14 +97,15 @@ static void nxeg_tbmousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
|
||||
|
||||
const struct nx_callback_s g_nxcb =
|
||||
{
|
||||
nxeg_redraw, /* redraw */
|
||||
nxeg_position /* position */
|
||||
nxeg_redraw, /* redraw */
|
||||
nxeg_position /* position */
|
||||
#ifdef CONFIG_NX_XYINPUT
|
||||
, nxeg_mousein /* mousein */
|
||||
, nxeg_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nxeg_kbdin /* my kbdin */
|
||||
, nxeg_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
|
||||
@ -118,6 +119,7 @@ const struct nx_callback_s g_tbcb =
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nxeg_tbkbdin /* my kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -122,16 +122,15 @@ static void nxdemo_demo_3(NXWINDOW hwnd);
|
||||
|
||||
const struct nx_callback_s g_nxdemocb =
|
||||
{
|
||||
nxdemo_redraw, /* redraw */
|
||||
nxdemo_position /* position */
|
||||
nxdemo_redraw, /* redraw */
|
||||
nxdemo_position /* position */
|
||||
#ifdef CONFIG_NX_XYINPUT
|
||||
,
|
||||
nxdemo_mousein /* mousein */
|
||||
, nxdemo_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
,
|
||||
nxdemo_kbdin /* my kbdin */
|
||||
, nxdemo_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -124,8 +124,9 @@ const struct nx_callback_s g_nxhellocb =
|
||||
, nxhello_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nxhello_kbdin /* my kbdin */
|
||||
, nxhello_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -159,8 +159,9 @@ const struct nx_callback_s g_nximagecb =
|
||||
, nximage_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nximage_kbdin /* my kbdin */
|
||||
, nximage_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -112,8 +112,9 @@ const struct nx_callback_s g_nxlinescb =
|
||||
, nxlines_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nxlines_kbdin /* my kbdin */
|
||||
, nxlines_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -99,8 +99,9 @@ const struct nx_callback_s g_nxtoolcb =
|
||||
, nxtool_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nxtool_kbdin /* my kbdin */
|
||||
, nxtool_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -90,8 +90,9 @@ const struct nx_callback_s g_nxtermcb =
|
||||
, nxwndo_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nxwndo_kbdin /* my kbdin */
|
||||
, nxwndo_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -103,8 +103,9 @@ const struct nx_callback_s g_nxtextcb =
|
||||
, nxbg_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nxbg_kbdin /* my kbdin */
|
||||
, nxbg_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/* Background window handle */
|
||||
|
@ -97,8 +97,9 @@ static const struct nx_callback_s g_pucb =
|
||||
, nxpu_mousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, nxpu_kbdin /* my kbdin */
|
||||
, nxpu_kbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/* Pop-up state information */
|
||||
|
@ -84,6 +84,7 @@ const struct nx_callback_s g_pwfb_wncb =
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, NULL /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
const struct nx_callback_s g_pwfb_tbcb =
|
||||
@ -96,6 +97,7 @@ const struct nx_callback_s g_pwfb_tbcb =
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, NULL /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -412,6 +412,7 @@ static bool pwfb_configure_window(FAR struct pwfb_state_s *st, int wndx,
|
||||
* a command is sent to server which responds with an event. So we need
|
||||
* to be synchronized at this point or the following fill will fail because
|
||||
* it depends on current knowlede of the size and position.
|
||||
* REVISIT: Use nx_synch()!
|
||||
*/
|
||||
|
||||
/* Create a bounding box. This is actually too large because it does not
|
||||
|
@ -72,11 +72,12 @@ const struct nx_callback_s g_pwlines_wncb =
|
||||
pwlines_wndo_redraw, /* redraw */
|
||||
pwlines_wndo_position /* position */
|
||||
#ifdef CONFIG_NX_XYINPUT
|
||||
, NULL /* mousein */
|
||||
, NULL /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, NULL /* kbdin */
|
||||
, NULL /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -254,6 +254,7 @@ static bool pwlines_configure_window(FAR struct pwlines_state_s *st, int wndx,
|
||||
* a command is sent to server which responds with an event. So we need
|
||||
* to be synchronized at this point or the following fill will fail because
|
||||
* it depends on current knowlede of the size and position.
|
||||
* REVISIT: Use nx_synch()!
|
||||
*/
|
||||
|
||||
rect.pt1.x = 0;
|
||||
|
@ -83,7 +83,7 @@ CCallback::CCallback(CWidgetControl *widgetControl)
|
||||
#ifdef CONFIG_NX_KBD
|
||||
m_callbacks.kbdin = newKeyboardEvent;
|
||||
#endif
|
||||
m_callbacks.blocked = windowBlocked;
|
||||
m_callbacks.event = windowEvent;
|
||||
|
||||
// Keyboard input is initially direct to the widgets within the window
|
||||
|
||||
@ -234,34 +234,57 @@ void CCallback::newKeyboardEvent(NXHANDLE hwnd, uint8_t nCh,
|
||||
#endif // CONFIG_NX_KBD
|
||||
|
||||
/**
|
||||
* This callback is the response from nx_block (or nxtk_block). Those
|
||||
* blocking interfaces are used to assure that no further messages are
|
||||
* directed to the window. Receipt of the blocked callback signifies
|
||||
* that (1) there are no further pending callbacks and (2) that the
|
||||
* window is now 'defunct' and will receive no further callbacks.
|
||||
* This callback is used to communicate server events to the window
|
||||
* listener.
|
||||
*
|
||||
* This callback supports coordinated destruction of a window in multi-
|
||||
* user mode. In multi-use more, the client window logic must stay
|
||||
* intact until all of the queued callbacks are processed. Then the
|
||||
* window may be safely closed. Closing the window prior with pending
|
||||
* callbacks can lead to bad behavior when the callback is executed.
|
||||
* NXEVENT_BLOCKED - Window messages are blocked.
|
||||
*
|
||||
* This callback is the response from nx_block (or nxtk_block). Those
|
||||
* blocking interfaces are used to assure that no further messages are
|
||||
* directed to the window. Receipt of the blocked callback signifies
|
||||
* that (1) there are no further pending callbacks and (2) that the
|
||||
* window is now 'defunct' and will receive no further callbacks.
|
||||
*
|
||||
* This callback supports coordinated destruction of a window. In
|
||||
* the multi-user mode, the client window logic must stay intact until
|
||||
* all of the queued callbacks are processed. Then the window may be
|
||||
* safely closed. Closing the window prior with pending callbacks can
|
||||
* lead to bad behavior when the callback is executed.
|
||||
*
|
||||
* NXEVENT_SYCNCHED - Synchronization handshake
|
||||
*
|
||||
* This completes the handshake started by nx_synch(). nx_synch()
|
||||
* sends a syncrhonization messages to the NX server which responds
|
||||
* with this event. The sleeping client is awakened and continues
|
||||
* graphics processing, completing the handshake.
|
||||
*
|
||||
* Due to the highly asynchronous nature of client-server
|
||||
* communications, nx_synch() is sometimes necessary to assure that
|
||||
* the client and server are fully synchronized.
|
||||
*
|
||||
* @param hwnd. Window handle of the blocked window
|
||||
* @param event. The server event
|
||||
* @param arg1. User provided argument (see nx_openwindow, nx_requestbkgd,
|
||||
* nxtk_openwindow, or nxtk_opentoolbar)
|
||||
* @param arg2 - User provided argument (see nx_block or nxtk_block)
|
||||
*/
|
||||
|
||||
void CCallback::windowBlocked(NXWINDOW hwnd, FAR void *arg1, FAR void *arg2)
|
||||
void CCallback::windowEvent(NXWINDOW hwnd, enum nx_event_e event,
|
||||
FAR void *arg1, FAR void *arg2)
|
||||
{
|
||||
ginfo("hwnd=%p arg1=%p arg2=%p\n", hwnd, arg1, arg2);
|
||||
ginfo("hwnd=%p devent=%d arg1=%p arg2=%p\n", hwnd, event, arg1, arg2);
|
||||
|
||||
// The first argument must be the CCallback instance
|
||||
|
||||
CCallback *This = (CCallback *)arg1;
|
||||
|
||||
// Just forward the callback to the CWidgetControl::windowBlocked method
|
||||
// Check for the window blocked event
|
||||
|
||||
This->m_widgetControl->windowBlocked(arg2);
|
||||
if (event == NXEVENT_BLOCKED)
|
||||
{
|
||||
// Let the CWidgetControl::windowBlocked method handle the event.
|
||||
|
||||
This->m_widgetControl->windowBlocked(arg2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,9 @@ const struct nx_callback_s g_trv_nxcallback =
|
||||
, trv_nxmousein /* mousein */
|
||||
#endif
|
||||
#ifdef CONFIG_NX_KBD
|
||||
, trv_nxkbdin /* my kbdin */
|
||||
, trv_nxkbdin /* kbdin */
|
||||
#endif
|
||||
, NULL /* event */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -189,25 +189,43 @@ namespace NXWidgets
|
||||
#endif // CONFIG_NX_KBD
|
||||
|
||||
/**
|
||||
* This callback is the response from nx_block (or nxtk_block). Those
|
||||
* blocking interfaces are used to assure that no further messages are
|
||||
* directed to the window. Receipt of the blocked callback signifies
|
||||
* that (1) there are no further pending callbacks and (2) that the
|
||||
* window is now 'defunct' and will receive no further callbacks.
|
||||
* This callback is used to communicate server events to the window
|
||||
* listener.
|
||||
*
|
||||
* This callback supports coordinated destruction of a window in multi-
|
||||
* user mode. In multi-use mode, the client window logic must stay
|
||||
* intact until all of the queued callbacks are processed. Then the
|
||||
* window may be safely closed. Closing the window prior with pending
|
||||
* callbacks can lead to bad behavior when the callback is executed.
|
||||
* NXEVENT_BLOCKED - Window messages are blocked.
|
||||
*
|
||||
* This callback is the response from nx_block (or nxtk_block). Those
|
||||
* blocking interfaces are used to assure that no further messages are
|
||||
* directed to the window. Receipt of the blocked callback signifies
|
||||
* that (1) there are no further pending callbacks and (2) that the
|
||||
* window is now 'defunct' and will receive no further callbacks.
|
||||
*
|
||||
* This callback supports coordinated destruction of a window. In
|
||||
* the multi-user mode, the client window logic must stay intact until
|
||||
* all of the queued callbacks are processed. Then the window may be
|
||||
* safely closed. Closing the window prior with pending callbacks can
|
||||
* lead to bad behavior when the callback is executed.
|
||||
*
|
||||
* NXEVENT_SYCNCHED - Synchronization handshake
|
||||
*
|
||||
* This completes the handshake started by nx_synch(). nx_synch()
|
||||
* sends a syncrhonization messages to the NX server which responds
|
||||
* with this event. The sleeping client is awakened and continues
|
||||
* graphics processing, completing the handshake.
|
||||
*
|
||||
* Due to the highly asynchronous nature of client-server
|
||||
* communications, nx_synch() is sometimes necessary to assure that
|
||||
* the client and server are fully synchronized.
|
||||
*
|
||||
* @param hwnd. Window handle of the blocked window
|
||||
* @param event. The server event
|
||||
* @param arg1. User provided argument (see nx_openwindow, nx_requestbkgd,
|
||||
* nxtk_openwindow, or nxtk_opentoolbar)
|
||||
* @param arg2 - User provided argument (see nx_block or nxtk_block)
|
||||
*/
|
||||
|
||||
static void windowBlocked(NXWINDOW hwnd, FAR void *arg1, FAR void *arg2);
|
||||
static void windowEvent(NXWINDOW hwnd, enum nx_event_e event,
|
||||
FAR void *arg1, FAR void *arg2);
|
||||
|
||||
public:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user