diff --git a/src/classlib/local.cc b/src/classlib/local.cc index 7f5847e..1ecf97e 100644 --- a/src/classlib/local.cc +++ b/src/classlib/local.cc @@ -166,6 +166,10 @@ int (*_action)(H3270 *hSession, const char *name); int (*_set_unlock_delay)(H3270 *hSession, unsigned short ms); + int (*_get_width)(H3270 *hSession); + int (*_get_height)(H3270 *hSession); + int (*_get_length)(H3270 *hSession); + const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); @@ -235,6 +239,10 @@ { (void **) & _action, "lib3270_action" }, { (void **) & _set_unlock_delay, "lib3270_set_unlock_delay" }, + { (void **) & _get_width, "lib3270_get_width" }, + { (void **) & _get_height, "lib3270_get_height" }, + { (void **) & _get_length, "lib3270_get_length" }, + }; for(unsigned int f = 0; f < (sizeof (call) / sizeof ((call)[0]));f++) @@ -519,6 +527,18 @@ _set_unlock_delay(hSession,ms); } + int get_width(void) { + return _get_width(hSession); + } + + int get_height(void) { + return _get_height(hSession); + } + + int get_length(void) { + return _get_length(hSession); + } + }; session * session::create_local(void) throw (std::exception) diff --git a/src/classlib/remote.cc b/src/classlib/remote.cc index a2e5ee5..a9b9e73 100644 --- a/src/classlib/remote.cc +++ b/src/classlib/remote.cc @@ -57,6 +57,9 @@ #define HLLAPI_PACKET_IS_READY "isReady" #define HLLAPI_PACKET_DISCONNECT "disconnect" #define HLLAPI_PACKET_GET_CURSOR "getCursorAddress" + #define HLLAPI_PACKET_GET_WIDTH "getScreenWidth" + #define HLLAPI_PACKET_GET_HEIGHT "getScreenHeight" + #define HLLAPI_PACKET_GET_LENGTH "getScreenLength" #define HLLAPI_PACKET_ENTER "enter" #define HLLAPI_PACKET_QUIT "quit" #define HLLAPI_PACKET_ERASE "erase" @@ -1139,6 +1142,17 @@ return query_intval(HLLAPI_PACKET_GET_CURSOR); } + int get_width(void) { + return query_intval(HLLAPI_PACKET_GET_WIDTH); + } + + int get_height(void) { + return query_intval(HLLAPI_PACKET_GET_HEIGHT); + } + + int get_length(void) { + return query_intval(HLLAPI_PACKET_GET_LENGTH); + } int enter(void) { diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 68cf44e..094d156 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -372,6 +372,16 @@ */ LIB3270_EXPORT int lib3270_get_width(H3270 *h); + /** + * Get current screen width in rows. + * + * @param h Handle of the desired session. + * + * @return screen rows. + * + */ + LIB3270_EXPORT int lib3270_get_height(H3270 *h); + LIB3270_EXPORT unsigned int lib3270_get_length(H3270 *h); /** diff --git a/src/include/pw3270/class.h b/src/include/pw3270/class.h index 1d74d50..4ef83e8 100644 --- a/src/include/pw3270/class.h +++ b/src/include/pw3270/class.h @@ -154,6 +154,10 @@ virtual LIB3270_MESSAGE get_program_message(void) = 0; virtual LIB3270_SSL_STATE get_secure(void) = 0; + virtual int get_width(void) = 0; + virtual int get_height(void) = 0; + virtual int get_length(void) = 0; + // Misc virtual void set_unlock_delay(unsigned short ms) = 0; diff --git a/src/include/pw3270/ipcpackets.h b/src/include/pw3270/ipcpackets.h index d52c84f..7fca79a 100644 --- a/src/include/pw3270/ipcpackets.h +++ b/src/include/pw3270/ipcpackets.h @@ -74,6 +74,10 @@ HLLAPI_PACKET_GET_SSL_STATE, HLLAPI_PACKET_SET_UNLOCK_DELAY, + HLLAPI_PACKET_GET_WIDTH, + HLLAPI_PACKET_GET_HEIGHT, + HLLAPI_PACKET_GET_LENGTH, + HLLAPI_PACKET_INVALID } HLLAPI_PACKET; diff --git a/src/lib3270/screen.c b/src/lib3270/screen.c index 3bb9946..3538d25 100644 --- a/src/lib3270/screen.c +++ b/src/lib3270/screen.c @@ -247,6 +247,12 @@ LIB3270_EXPORT int lib3270_get_width(H3270 *h) return h->cols; } +LIB3270_EXPORT int lib3270_get_height(H3270 *h) +{ + CHECK_SESSION_HANDLE(h); + return h->rows; +} + void update_model_info(H3270 *session, int model, int cols, int rows) { if(model == session->model_num && session->maxROWS == rows && session->maxCOLS == cols) diff --git a/src/plugins/dbus3270/gobject.c b/src/plugins/dbus3270/gobject.c index 403fdac..025f338 100644 --- a/src/plugins/dbus3270/gobject.c +++ b/src/plugins/dbus3270/gobject.c @@ -367,6 +367,24 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus dbus_g_method_return(context,lib3270_get_cursor_address(pw3270_dbus_get_session_handle(object))); } + void pw3270_dbus_get_screen_width(PW3270Dbus *object, DBusGMethodInvocation *context) + { + trace("%s object=%p context=%p",__FUNCTION__,object,context); + dbus_g_method_return(context,lib3270_get_width(pw3270_dbus_get_session_handle(object))); + } + + void pw3270_dbus_get_screen_height(PW3270Dbus *object, DBusGMethodInvocation *context) + { + trace("%s object=%p context=%p",__FUNCTION__,object,context); + dbus_g_method_return(context,lib3270_get_height(pw3270_dbus_get_session_handle(object))); + } + + void pw3270_dbus_get_screen_length(PW3270Dbus *object, DBusGMethodInvocation *context) + { + trace("%s object=%p context=%p",__FUNCTION__,object,context); + dbus_g_method_return(context,lib3270_get_width(pw3270_dbus_get_session_handle(object))); + } + void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context) { trace("%s object=%p context=%p",__FUNCTION__,object,context); diff --git a/src/plugins/dbus3270/pw3270dbus.xml b/src/plugins/dbus3270/pw3270dbus.xml index acecb5c..463ce9b 100644 --- a/src/plugins/dbus3270/pw3270dbus.xml +++ b/src/plugins/dbus3270/pw3270dbus.xml @@ -117,6 +117,18 @@ + + + + + + + + + + + + diff --git a/src/plugins/dbus3270/service.h b/src/plugins/dbus3270/service.h index e6059f7..86a8e57 100644 --- a/src/plugins/dbus3270/service.h +++ b/src/plugins/dbus3270/service.h @@ -85,6 +85,10 @@ void pw3270_dbus_set_cursor_address(PW3270Dbus *object, int addr, DBusGMethodInvocation *context); void pw3270_dbus_get_cursor_address(PW3270Dbus *object, DBusGMethodInvocation *context); + void pw3270_dbus_get_screen_width(PW3270Dbus *object, DBusGMethodInvocation *context); + void pw3270_dbus_get_screen_height(PW3270Dbus *object, DBusGMethodInvocation *context); + void pw3270_dbus_get_screen_length(PW3270Dbus *object, DBusGMethodInvocation *context); + void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context); void pw3270_dbus_wait_for_ready(PW3270Dbus *object, int timeout, DBusGMethodInvocation *context); diff --git a/src/plugins/hllapi/pluginmain.c b/src/plugins/hllapi/pluginmain.c index e8f614a..70dfa99 100644 --- a/src/plugins/hllapi/pluginmain.c +++ b/src/plugins/hllapi/pluginmain.c @@ -319,8 +319,20 @@ send_result(source,lib3270_get_cursor_address(lib3270_get_default_session_handle())); break; - case HLLAPI_PACKET_GET_CSTATE: - send_result(source,lib3270_get_connection_state(lib3270_get_default_session_handle())); + case HLLAPI_PACKET_GET_CURSOR: + send_result(source,lib3270_get_cursor_address(lib3270_get_default_session_handle())); + break; + + case HLLAPI_PACKET_GET_WIDTH: + send_result(source,lib3270_get_width(lib3270_get_default_session_handle())); + break; + + case HLLAPI_PACKET_GET_HEIGHT: + send_result(source,lib3270_get_height(lib3270_get_default_session_handle())); + break; + + case HLLAPI_PACKET_GET_LENGTH: + send_result(source,lib3270_get_length(lib3270_get_default_session_handle())); break; case HLLAPI_PACKET_GET_PROGRAM_MESSAGE: diff --git a/src/plugins/rx3270/pluginmain.cc b/src/plugins/rx3270/pluginmain.cc index 08e4657..cd3fca0 100644 --- a/src/plugins/rx3270/pluginmain.cc +++ b/src/plugins/rx3270/pluginmain.cc @@ -112,6 +112,7 @@ int set_cursor_position(int row, int col); int set_cursor_addr(int addr); int get_cursor_addr(void); + int emulate_input(const char *str); int set_toggle(LIB3270_TOGGLE ix, bool value); @@ -146,6 +147,10 @@ string get_host_charset(void); string get_display_charset(void); + int get_width(void); + int get_height(void); + int get_length(void); + const char * asc2ebc(unsigned char *str, int sz = -1); const char * ebc2asc(unsigned char *str, int sz = -1); @@ -710,6 +715,21 @@ extern "C" return lib3270_get_cursor_address(hSession); } + int plugin::get_width(void) + { + return lib3270_get_width(hSession); + } + + int plugin::get_height(void) + { + return lib3270_get_height(hSession); + } + + int plugin::get_length(void) + { + return lib3270_get_length(hSession); + } + int plugin::emulate_input(const char *str) { return lib3270_emulate_input(hSession, str, -1, 1); -- libgit2 0.21.2