Commit 07f0e9594eeb302e95c5a2e80edf666f7036b118
1 parent
9858e82f
Exists in
master
and in
5 other branches
Incluindo métodos para pegar o tamanho da tela.
Showing
11 changed files
with
126 additions
and
2 deletions
Show diff stats
src/classlib/local.cc
@@ -166,6 +166,10 @@ | @@ -166,6 +166,10 @@ | ||
166 | int (*_action)(H3270 *hSession, const char *name); | 166 | int (*_action)(H3270 *hSession, const char *name); |
167 | int (*_set_unlock_delay)(H3270 *hSession, unsigned short ms); | 167 | int (*_set_unlock_delay)(H3270 *hSession, unsigned short ms); |
168 | 168 | ||
169 | + int (*_get_width)(H3270 *hSession); | ||
170 | + int (*_get_height)(H3270 *hSession); | ||
171 | + int (*_get_length)(H3270 *hSession); | ||
172 | + | ||
169 | const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); | 173 | const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); |
170 | const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); | 174 | const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); |
171 | 175 | ||
@@ -235,6 +239,10 @@ | @@ -235,6 +239,10 @@ | ||
235 | { (void **) & _action, "lib3270_action" }, | 239 | { (void **) & _action, "lib3270_action" }, |
236 | { (void **) & _set_unlock_delay, "lib3270_set_unlock_delay" }, | 240 | { (void **) & _set_unlock_delay, "lib3270_set_unlock_delay" }, |
237 | 241 | ||
242 | + { (void **) & _get_width, "lib3270_get_width" }, | ||
243 | + { (void **) & _get_height, "lib3270_get_height" }, | ||
244 | + { (void **) & _get_length, "lib3270_get_length" }, | ||
245 | + | ||
238 | }; | 246 | }; |
239 | 247 | ||
240 | for(unsigned int f = 0; f < (sizeof (call) / sizeof ((call)[0]));f++) | 248 | for(unsigned int f = 0; f < (sizeof (call) / sizeof ((call)[0]));f++) |
@@ -519,6 +527,18 @@ | @@ -519,6 +527,18 @@ | ||
519 | _set_unlock_delay(hSession,ms); | 527 | _set_unlock_delay(hSession,ms); |
520 | } | 528 | } |
521 | 529 | ||
530 | + int get_width(void) { | ||
531 | + return _get_width(hSession); | ||
532 | + } | ||
533 | + | ||
534 | + int get_height(void) { | ||
535 | + return _get_height(hSession); | ||
536 | + } | ||
537 | + | ||
538 | + int get_length(void) { | ||
539 | + return _get_length(hSession); | ||
540 | + } | ||
541 | + | ||
522 | }; | 542 | }; |
523 | 543 | ||
524 | session * session::create_local(void) throw (std::exception) | 544 | session * session::create_local(void) throw (std::exception) |
src/classlib/remote.cc
@@ -57,6 +57,9 @@ | @@ -57,6 +57,9 @@ | ||
57 | #define HLLAPI_PACKET_IS_READY "isReady" | 57 | #define HLLAPI_PACKET_IS_READY "isReady" |
58 | #define HLLAPI_PACKET_DISCONNECT "disconnect" | 58 | #define HLLAPI_PACKET_DISCONNECT "disconnect" |
59 | #define HLLAPI_PACKET_GET_CURSOR "getCursorAddress" | 59 | #define HLLAPI_PACKET_GET_CURSOR "getCursorAddress" |
60 | + #define HLLAPI_PACKET_GET_WIDTH "getScreenWidth" | ||
61 | + #define HLLAPI_PACKET_GET_HEIGHT "getScreenHeight" | ||
62 | + #define HLLAPI_PACKET_GET_LENGTH "getScreenLength" | ||
60 | #define HLLAPI_PACKET_ENTER "enter" | 63 | #define HLLAPI_PACKET_ENTER "enter" |
61 | #define HLLAPI_PACKET_QUIT "quit" | 64 | #define HLLAPI_PACKET_QUIT "quit" |
62 | #define HLLAPI_PACKET_ERASE "erase" | 65 | #define HLLAPI_PACKET_ERASE "erase" |
@@ -1139,6 +1142,17 @@ | @@ -1139,6 +1142,17 @@ | ||
1139 | return query_intval(HLLAPI_PACKET_GET_CURSOR); | 1142 | return query_intval(HLLAPI_PACKET_GET_CURSOR); |
1140 | } | 1143 | } |
1141 | 1144 | ||
1145 | + int get_width(void) { | ||
1146 | + return query_intval(HLLAPI_PACKET_GET_WIDTH); | ||
1147 | + } | ||
1148 | + | ||
1149 | + int get_height(void) { | ||
1150 | + return query_intval(HLLAPI_PACKET_GET_HEIGHT); | ||
1151 | + } | ||
1152 | + | ||
1153 | + int get_length(void) { | ||
1154 | + return query_intval(HLLAPI_PACKET_GET_LENGTH); | ||
1155 | + } | ||
1142 | 1156 | ||
1143 | int enter(void) | 1157 | int enter(void) |
1144 | { | 1158 | { |
src/include/lib3270.h
@@ -372,6 +372,16 @@ | @@ -372,6 +372,16 @@ | ||
372 | */ | 372 | */ |
373 | LIB3270_EXPORT int lib3270_get_width(H3270 *h); | 373 | LIB3270_EXPORT int lib3270_get_width(H3270 *h); |
374 | 374 | ||
375 | + /** | ||
376 | + * Get current screen width in rows. | ||
377 | + * | ||
378 | + * @param h Handle of the desired session. | ||
379 | + * | ||
380 | + * @return screen rows. | ||
381 | + * | ||
382 | + */ | ||
383 | + LIB3270_EXPORT int lib3270_get_height(H3270 *h); | ||
384 | + | ||
375 | LIB3270_EXPORT unsigned int lib3270_get_length(H3270 *h); | 385 | LIB3270_EXPORT unsigned int lib3270_get_length(H3270 *h); |
376 | 386 | ||
377 | /** | 387 | /** |
src/include/pw3270/class.h
@@ -154,6 +154,10 @@ | @@ -154,6 +154,10 @@ | ||
154 | virtual LIB3270_MESSAGE get_program_message(void) = 0; | 154 | virtual LIB3270_MESSAGE get_program_message(void) = 0; |
155 | virtual LIB3270_SSL_STATE get_secure(void) = 0; | 155 | virtual LIB3270_SSL_STATE get_secure(void) = 0; |
156 | 156 | ||
157 | + virtual int get_width(void) = 0; | ||
158 | + virtual int get_height(void) = 0; | ||
159 | + virtual int get_length(void) = 0; | ||
160 | + | ||
157 | // Misc | 161 | // Misc |
158 | virtual void set_unlock_delay(unsigned short ms) = 0; | 162 | virtual void set_unlock_delay(unsigned short ms) = 0; |
159 | 163 |
src/include/pw3270/ipcpackets.h
@@ -74,6 +74,10 @@ | @@ -74,6 +74,10 @@ | ||
74 | HLLAPI_PACKET_GET_SSL_STATE, | 74 | HLLAPI_PACKET_GET_SSL_STATE, |
75 | HLLAPI_PACKET_SET_UNLOCK_DELAY, | 75 | HLLAPI_PACKET_SET_UNLOCK_DELAY, |
76 | 76 | ||
77 | + HLLAPI_PACKET_GET_WIDTH, | ||
78 | + HLLAPI_PACKET_GET_HEIGHT, | ||
79 | + HLLAPI_PACKET_GET_LENGTH, | ||
80 | + | ||
77 | HLLAPI_PACKET_INVALID | 81 | HLLAPI_PACKET_INVALID |
78 | 82 | ||
79 | } HLLAPI_PACKET; | 83 | } HLLAPI_PACKET; |
src/lib3270/screen.c
@@ -247,6 +247,12 @@ LIB3270_EXPORT int lib3270_get_width(H3270 *h) | @@ -247,6 +247,12 @@ LIB3270_EXPORT int lib3270_get_width(H3270 *h) | ||
247 | return h->cols; | 247 | return h->cols; |
248 | } | 248 | } |
249 | 249 | ||
250 | +LIB3270_EXPORT int lib3270_get_height(H3270 *h) | ||
251 | +{ | ||
252 | + CHECK_SESSION_HANDLE(h); | ||
253 | + return h->rows; | ||
254 | +} | ||
255 | + | ||
250 | void update_model_info(H3270 *session, int model, int cols, int rows) | 256 | void update_model_info(H3270 *session, int model, int cols, int rows) |
251 | { | 257 | { |
252 | if(model == session->model_num && session->maxROWS == rows && session->maxCOLS == cols) | 258 | if(model == session->model_num && session->maxROWS == rows && session->maxCOLS == cols) |
src/plugins/dbus3270/gobject.c
@@ -367,6 +367,24 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus | @@ -367,6 +367,24 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus | ||
367 | dbus_g_method_return(context,lib3270_get_cursor_address(pw3270_dbus_get_session_handle(object))); | 367 | dbus_g_method_return(context,lib3270_get_cursor_address(pw3270_dbus_get_session_handle(object))); |
368 | } | 368 | } |
369 | 369 | ||
370 | + void pw3270_dbus_get_screen_width(PW3270Dbus *object, DBusGMethodInvocation *context) | ||
371 | + { | ||
372 | + trace("%s object=%p context=%p",__FUNCTION__,object,context); | ||
373 | + dbus_g_method_return(context,lib3270_get_width(pw3270_dbus_get_session_handle(object))); | ||
374 | + } | ||
375 | + | ||
376 | + void pw3270_dbus_get_screen_height(PW3270Dbus *object, DBusGMethodInvocation *context) | ||
377 | + { | ||
378 | + trace("%s object=%p context=%p",__FUNCTION__,object,context); | ||
379 | + dbus_g_method_return(context,lib3270_get_height(pw3270_dbus_get_session_handle(object))); | ||
380 | + } | ||
381 | + | ||
382 | + void pw3270_dbus_get_screen_length(PW3270Dbus *object, DBusGMethodInvocation *context) | ||
383 | + { | ||
384 | + trace("%s object=%p context=%p",__FUNCTION__,object,context); | ||
385 | + dbus_g_method_return(context,lib3270_get_width(pw3270_dbus_get_session_handle(object))); | ||
386 | + } | ||
387 | + | ||
370 | void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context) | 388 | void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context) |
371 | { | 389 | { |
372 | trace("%s object=%p context=%p",__FUNCTION__,object,context); | 390 | trace("%s object=%p context=%p",__FUNCTION__,object,context); |
src/plugins/dbus3270/pw3270dbus.xml
@@ -117,6 +117,18 @@ | @@ -117,6 +117,18 @@ | ||
117 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | 117 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> |
118 | <arg type="i" name="addr" direction="out" /> | 118 | <arg type="i" name="addr" direction="out" /> |
119 | </method> | 119 | </method> |
120 | + <method name="getScreenWidth"> | ||
121 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | ||
122 | + <arg type="i" name="width" direction="out" /> | ||
123 | + </method> | ||
124 | + <method name="getScreenHeight"> | ||
125 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | ||
126 | + <arg type="i" name="height" direction="out" /> | ||
127 | + </method> | ||
128 | + <method name="getScreenLength"> | ||
129 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | ||
130 | + <arg type="i" name="len" direction="out" /> | ||
131 | + </method> | ||
120 | <method name="getNextUnprotected"> | 132 | <method name="getNextUnprotected"> |
121 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | 133 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> |
122 | <arg type="i" name="addr" direction="in" /> | 134 | <arg type="i" name="addr" direction="in" /> |
src/plugins/dbus3270/service.h
@@ -85,6 +85,10 @@ | @@ -85,6 +85,10 @@ | ||
85 | void pw3270_dbus_set_cursor_address(PW3270Dbus *object, int addr, DBusGMethodInvocation *context); | 85 | void pw3270_dbus_set_cursor_address(PW3270Dbus *object, int addr, DBusGMethodInvocation *context); |
86 | void pw3270_dbus_get_cursor_address(PW3270Dbus *object, DBusGMethodInvocation *context); | 86 | void pw3270_dbus_get_cursor_address(PW3270Dbus *object, DBusGMethodInvocation *context); |
87 | 87 | ||
88 | + void pw3270_dbus_get_screen_width(PW3270Dbus *object, DBusGMethodInvocation *context); | ||
89 | + void pw3270_dbus_get_screen_height(PW3270Dbus *object, DBusGMethodInvocation *context); | ||
90 | + void pw3270_dbus_get_screen_length(PW3270Dbus *object, DBusGMethodInvocation *context); | ||
91 | + | ||
88 | void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context); | 92 | void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context); |
89 | 93 | ||
90 | void pw3270_dbus_wait_for_ready(PW3270Dbus *object, int timeout, DBusGMethodInvocation *context); | 94 | void pw3270_dbus_wait_for_ready(PW3270Dbus *object, int timeout, DBusGMethodInvocation *context); |
src/plugins/hllapi/pluginmain.c
@@ -319,8 +319,20 @@ | @@ -319,8 +319,20 @@ | ||
319 | send_result(source,lib3270_get_cursor_address(lib3270_get_default_session_handle())); | 319 | send_result(source,lib3270_get_cursor_address(lib3270_get_default_session_handle())); |
320 | break; | 320 | break; |
321 | 321 | ||
322 | - case HLLAPI_PACKET_GET_CSTATE: | ||
323 | - send_result(source,lib3270_get_connection_state(lib3270_get_default_session_handle())); | 322 | + case HLLAPI_PACKET_GET_CURSOR: |
323 | + send_result(source,lib3270_get_cursor_address(lib3270_get_default_session_handle())); | ||
324 | + break; | ||
325 | + | ||
326 | + case HLLAPI_PACKET_GET_WIDTH: | ||
327 | + send_result(source,lib3270_get_width(lib3270_get_default_session_handle())); | ||
328 | + break; | ||
329 | + | ||
330 | + case HLLAPI_PACKET_GET_HEIGHT: | ||
331 | + send_result(source,lib3270_get_height(lib3270_get_default_session_handle())); | ||
332 | + break; | ||
333 | + | ||
334 | + case HLLAPI_PACKET_GET_LENGTH: | ||
335 | + send_result(source,lib3270_get_length(lib3270_get_default_session_handle())); | ||
324 | break; | 336 | break; |
325 | 337 | ||
326 | case HLLAPI_PACKET_GET_PROGRAM_MESSAGE: | 338 | case HLLAPI_PACKET_GET_PROGRAM_MESSAGE: |
src/plugins/rx3270/pluginmain.cc
@@ -112,6 +112,7 @@ | @@ -112,6 +112,7 @@ | ||
112 | int set_cursor_position(int row, int col); | 112 | int set_cursor_position(int row, int col); |
113 | int set_cursor_addr(int addr); | 113 | int set_cursor_addr(int addr); |
114 | int get_cursor_addr(void); | 114 | int get_cursor_addr(void); |
115 | + | ||
115 | int emulate_input(const char *str); | 116 | int emulate_input(const char *str); |
116 | 117 | ||
117 | int set_toggle(LIB3270_TOGGLE ix, bool value); | 118 | int set_toggle(LIB3270_TOGGLE ix, bool value); |
@@ -146,6 +147,10 @@ | @@ -146,6 +147,10 @@ | ||
146 | string get_host_charset(void); | 147 | string get_host_charset(void); |
147 | string get_display_charset(void); | 148 | string get_display_charset(void); |
148 | 149 | ||
150 | + int get_width(void); | ||
151 | + int get_height(void); | ||
152 | + int get_length(void); | ||
153 | + | ||
149 | const char * asc2ebc(unsigned char *str, int sz = -1); | 154 | const char * asc2ebc(unsigned char *str, int sz = -1); |
150 | const char * ebc2asc(unsigned char *str, int sz = -1); | 155 | const char * ebc2asc(unsigned char *str, int sz = -1); |
151 | 156 | ||
@@ -710,6 +715,21 @@ extern "C" | @@ -710,6 +715,21 @@ extern "C" | ||
710 | return lib3270_get_cursor_address(hSession); | 715 | return lib3270_get_cursor_address(hSession); |
711 | } | 716 | } |
712 | 717 | ||
718 | + int plugin::get_width(void) | ||
719 | + { | ||
720 | + return lib3270_get_width(hSession); | ||
721 | + } | ||
722 | + | ||
723 | + int plugin::get_height(void) | ||
724 | + { | ||
725 | + return lib3270_get_height(hSession); | ||
726 | + } | ||
727 | + | ||
728 | + int plugin::get_length(void) | ||
729 | + { | ||
730 | + return lib3270_get_length(hSession); | ||
731 | + } | ||
732 | + | ||
713 | int plugin::emulate_input(const char *str) | 733 | int plugin::emulate_input(const char *str) |
714 | { | 734 | { |
715 | return lib3270_emulate_input(hSession, str, -1, 1); | 735 | return lib3270_emulate_input(hSession, str, -1, 1); |