diff --git a/src/core/actions/actions.c b/src/core/actions/actions.c index 70bcb9b..3275dfa 100644 --- a/src/core/actions/actions.c +++ b/src/core/actions/actions.c @@ -105,7 +105,7 @@ LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name) return lib3270_action_activate_by_name(name,hSession); } -LIB3270_INTERNAL void lib3270_notify_actions(H3270 *hSession, LIB3270_ACTION_GROUP group) +LIB3270_EXPORT void lib3270_action_group_notify(H3270 *hSession, LIB3270_ACTION_GROUP group) { if(group < (sizeof(hSession->listeners.actions)/sizeof(hSession->listeners.actions[0]))) diff --git a/src/core/actions/table.c b/src/core/actions/table.c index 849ec5e..faf1f81 100644 --- a/src/core/actions/table.c +++ b/src/core/actions/table.c @@ -687,7 +687,7 @@ .summary = N_("Print copy (if available)"), .activate = lib3270_print_copy, - .group = LIB3270_ACTION_GROUP_ONLINE, + .group = LIB3270_ACTION_GROUP_COPY, .activatable = lib3270_is_connected }, diff --git a/src/core/ctlr.c b/src/core/ctlr.c index 6dfb38d..ca985c9 100644 --- a/src/core/ctlr.c +++ b/src/core/ctlr.c @@ -249,7 +249,7 @@ static void set_formatted(H3270 *hSession, int state) if(state != hSession->formatted) { hSession->formatted = state; - lib3270_notify_actions(hSession, LIB3270_ACTION_GROUP_LOCK_STATE); + lib3270_action_group_notify(hSession, LIB3270_ACTION_GROUP_LOCK_STATE); } } diff --git a/src/core/host.c b/src/core/host.c index edd4f2f..1dc36d7 100644 --- a/src/core/host.c +++ b/src/core/host.c @@ -138,12 +138,12 @@ int lib3270_set_cstate(H3270 *hSession, LIB3270_CSTATE cstate) if(connected != lib3270_is_connected(hSession)) { // Online state has changed, fire LIB3270_ACTION_GROUP_ONLINE - lib3270_notify_actions(hSession, LIB3270_ACTION_GROUP_ONLINE); + lib3270_action_group_notify(hSession, LIB3270_ACTION_GROUP_ONLINE); } if(disconnected != lib3270_is_disconnected(hSession)) { // Offline state has changed, fire LIB3270_ACTION_GROUP_OFFLINE - lib3270_notify_actions(hSession, LIB3270_ACTION_GROUP_OFFLINE); + lib3270_action_group_notify(hSession, LIB3270_ACTION_GROUP_OFFLINE); } return 1; diff --git a/src/core/paste.c b/src/core/paste.c index b1f5f33..d451e28 100644 --- a/src/core/paste.c +++ b/src/core/paste.c @@ -406,6 +406,7 @@ LIB3270_EXPORT int lib3270_paste_text(H3270 *hSession, const unsigned char *str) if((int) strlen((char *) str) > sz) { hSession->paste_buffer = strdup((char *) (str+sz)); + lib3270_action_group_notify(hSession, LIB3270_ACTION_GROUP_COPY); return strlen(hSession->paste_buffer); } @@ -431,5 +432,9 @@ LIB3270_EXPORT int lib3270_paste_next(H3270 *hSession) rc = lib3270_paste_text(hSession,(unsigned char *) ptr); lib3270_free(ptr); + + if(!hSession->paste_buffer) + lib3270_action_group_notify(hSession, LIB3270_ACTION_GROUP_COPY); + return rc; } diff --git a/src/core/screen.c b/src/core/screen.c index a32738b..732cf09 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -839,7 +839,7 @@ void mcursor_set(H3270 *hSession,LIB3270_POINTER m) hSession->cbk.cursor(hSession,m & 0x03); // Notify lock state change. - lib3270_notify_actions(hSession, LIB3270_ACTION_GROUP_FORMATTED); + lib3270_action_group_notify(hSession, LIB3270_ACTION_GROUP_FORMATTED); } } diff --git a/src/include/internals.h b/src/include/internals.h index dfe2b48..2fc20fd 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -877,5 +877,3 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); /// @brief Fire CState change. LIB3270_INTERNAL int lib3270_set_cstate(H3270 *hSession, LIB3270_CSTATE cstate); - /// @brief Notify actions. - LIB3270_INTERNAL void lib3270_notify_actions(H3270 *hSession, LIB3270_ACTION_GROUP group); diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 09f6ed0..a0340ca 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -368,6 +368,7 @@ LIB3270_ACTION_GROUP_SELECTION, ///< @brief Action depends on selection. LIB3270_ACTION_GROUP_LOCK_STATE, ///< @brief Action depends on keyboard lock state. LIB3270_ACTION_GROUP_FORMATTED, ///< @brief Action depends on a formatted screen. + LIB3270_ACTION_GROUP_COPY, ///< @brief Action depends on stored string. LIB3270_ACTION_GROUP_CUSTOM ///< @brief Custom group/Number of groups. } LIB3270_ACTION_GROUP; @@ -1627,6 +1628,12 @@ */ LIB3270_EXPORT int lib3270_wait_for_string_at_address(H3270 *hSession, int baddr, const char *key, int seconds); + /** + * @brief Notify action group. + * + */ + LIB3270_EXPORT void lib3270_action_group_notify(H3270 *hSession, LIB3270_ACTION_GROUP group); + #ifdef __cplusplus } #endif diff --git a/src/selection/actions.c b/src/selection/actions.c index cc1b472..eb7c93b 100644 --- a/src/selection/actions.c +++ b/src/selection/actions.c @@ -64,7 +64,7 @@ LIB3270_EXPORT int lib3270_unselect(H3270 *hSession) hSession->cbk.set_selection(hSession,0); hSession->cbk.update_selection(hSession,-1,-1); - lib3270_notify_actions(hSession,LIB3270_ACTION_GROUP_SELECTION); + lib3270_action_group_notify(hSession,LIB3270_ACTION_GROUP_SELECTION); } diff --git a/src/selection/selection.c b/src/selection/selection.c index 37ab3d8..d599068 100644 --- a/src/selection/selection.c +++ b/src/selection/selection.c @@ -193,7 +193,7 @@ void do_select(H3270 *hSession, unsigned int start, unsigned int end, unsigned i { hSession->selected = 1; hSession->cbk.set_selection(hSession,1); - lib3270_notify_actions(hSession,LIB3270_ACTION_GROUP_SELECTION); + lib3270_action_group_notify(hSession,LIB3270_ACTION_GROUP_SELECTION); } hSession->cbk.update_selection(hSession,start,end); diff --git a/src/testprogram/testprogram.c b/src/testprogram/testprogram.c index 47f1648..6a6c229 100644 --- a/src/testprogram/testprogram.c +++ b/src/testprogram/testprogram.c @@ -36,15 +36,6 @@ static void online_group_state_changed(H3270 GNUC_UNUSED(*hSession), void GNUC_U int main(int argc, char *argv[]) { - { - LIB3270_ICONV *converter = lib3270_iconv_new("iso-8859-1","utf-8"); - - lib3270_autoptr(char) text = lib3270_iconv_to_host(converter,"teste",-1); - - lib3270_iconv_free(converter); - return 0; - } - // #pragma GCC diagnostic push // #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" static struct option options[] = { -- libgit2 0.21.2