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 | 166 | int (*_action)(H3270 *hSession, const char *name); |
167 | 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 | 173 | const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); |
170 | 174 | const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); |
171 | 175 | |
... | ... | @@ -235,6 +239,10 @@ |
235 | 239 | { (void **) & _action, "lib3270_action" }, |
236 | 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 | 248 | for(unsigned int f = 0; f < (sizeof (call) / sizeof ((call)[0]));f++) |
... | ... | @@ -519,6 +527,18 @@ |
519 | 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 | 544 | session * session::create_local(void) throw (std::exception) | ... | ... |
src/classlib/remote.cc
... | ... | @@ -57,6 +57,9 @@ |
57 | 57 | #define HLLAPI_PACKET_IS_READY "isReady" |
58 | 58 | #define HLLAPI_PACKET_DISCONNECT "disconnect" |
59 | 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 | 63 | #define HLLAPI_PACKET_ENTER "enter" |
61 | 64 | #define HLLAPI_PACKET_QUIT "quit" |
62 | 65 | #define HLLAPI_PACKET_ERASE "erase" |
... | ... | @@ -1139,6 +1142,17 @@ |
1139 | 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 | 1157 | int enter(void) |
1144 | 1158 | { | ... | ... |
src/include/lib3270.h
... | ... | @@ -372,6 +372,16 @@ |
372 | 372 | */ |
373 | 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 | 385 | LIB3270_EXPORT unsigned int lib3270_get_length(H3270 *h); |
376 | 386 | |
377 | 387 | /** | ... | ... |
src/include/pw3270/class.h
... | ... | @@ -154,6 +154,10 @@ |
154 | 154 | virtual LIB3270_MESSAGE get_program_message(void) = 0; |
155 | 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 | 161 | // Misc |
158 | 162 | virtual void set_unlock_delay(unsigned short ms) = 0; |
159 | 163 | ... | ... |
src/include/pw3270/ipcpackets.h
src/lib3270/screen.c
... | ... | @@ -247,6 +247,12 @@ LIB3270_EXPORT int lib3270_get_width(H3270 *h) |
247 | 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 | 256 | void update_model_info(H3270 *session, int model, int cols, int rows) |
251 | 257 | { |
252 | 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 | 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 | 388 | void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context) |
371 | 389 | { |
372 | 390 | trace("%s object=%p context=%p",__FUNCTION__,object,context); | ... | ... |
src/plugins/dbus3270/pw3270dbus.xml
... | ... | @@ -117,6 +117,18 @@ |
117 | 117 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> |
118 | 118 | <arg type="i" name="addr" direction="out" /> |
119 | 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 | 132 | <method name="getNextUnprotected"> |
121 | 133 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> |
122 | 134 | <arg type="i" name="addr" direction="in" /> | ... | ... |
src/plugins/dbus3270/service.h
... | ... | @@ -85,6 +85,10 @@ |
85 | 85 | void pw3270_dbus_set_cursor_address(PW3270Dbus *object, int addr, DBusGMethodInvocation *context); |
86 | 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 | 92 | void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context); |
89 | 93 | |
90 | 94 | void pw3270_dbus_wait_for_ready(PW3270Dbus *object, int timeout, DBusGMethodInvocation *context); | ... | ... |
src/plugins/hllapi/pluginmain.c
... | ... | @@ -319,8 +319,20 @@ |
319 | 319 | send_result(source,lib3270_get_cursor_address(lib3270_get_default_session_handle())); |
320 | 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 | 336 | break; |
325 | 337 | |
326 | 338 | case HLLAPI_PACKET_GET_PROGRAM_MESSAGE: | ... | ... |
src/plugins/rx3270/pluginmain.cc
... | ... | @@ -112,6 +112,7 @@ |
112 | 112 | int set_cursor_position(int row, int col); |
113 | 113 | int set_cursor_addr(int addr); |
114 | 114 | int get_cursor_addr(void); |
115 | + | |
115 | 116 | int emulate_input(const char *str); |
116 | 117 | |
117 | 118 | int set_toggle(LIB3270_TOGGLE ix, bool value); |
... | ... | @@ -146,6 +147,10 @@ |
146 | 147 | string get_host_charset(void); |
147 | 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 | 154 | const char * asc2ebc(unsigned char *str, int sz = -1); |
150 | 155 | const char * ebc2asc(unsigned char *str, int sz = -1); |
151 | 156 | |
... | ... | @@ -710,6 +715,21 @@ extern "C" |
710 | 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 | 733 | int plugin::emulate_input(const char *str) |
714 | 734 | { |
715 | 735 | return lib3270_emulate_input(hSession, str, -1, 1); | ... | ... |