Commit 0ceb5c2742e985bfb068d45905105057802ca12a

Authored by perry.werneck@gmail.com
1 parent 0058b0cd
Exists in master

Ajustes para multi-sessão

latest/src/gtk2/action_calls.c
... ... @@ -323,7 +323,7 @@
323 323 action_group_set_sensitive(ACTION_GROUP_ONLINE,FALSE);
324 324 action_group_set_sensitive(ACTION_GROUP_OFFLINE,FALSE);
325 325 unselect();
326   - host_disconnect(hSession,0);
  326 + lib3270_disconnect(hSession);
327 327 }
328 328  
329 329 static int SaveText(const char *title, gchar *text)
... ...
latest/src/gtk2/clipboard.c
... ... @@ -113,7 +113,7 @@
113 113 action_group_set_sensitive(ACTION_GROUP_CLIPBOARD,clipboard_string != NULL);
114 114 gtk_action_set_sensitive(action_by_id[ACTION_PASTENEXT],clipboard_string != NULL);
115 115  
116   - screen_resume();
  116 + screen_resume(hSession);
117 117  
118 118 Trace("%s - ends (clipboard_string=%p)",__FUNCTION__,clipboard_string);
119 119  
... ...
latest/src/gtk2/main.c
... ... @@ -647,7 +647,7 @@ int main(int argc, char *argv[])
647 647 gtk_main_iteration();
648 648  
649 649 /* Connect to the host. */
650   - screen_suspend();
  650 + screen_suspend(hSession);
651 651  
652 652 if(cl_hostname != CN)
653 653 SetString("Network","Hostname",cl_hostname);
... ... @@ -659,7 +659,7 @@ int main(int argc, char *argv[])
659 659  
660 660 if(topwindow)
661 661 {
662   - screen_resume();
  662 + screen_resume(hSession);
663 663 screen_disp(hSession);
664 664  
665 665 // Start plugins after the creation of main loop
... ...
latest/src/include/lib3270.h
... ... @@ -131,6 +131,10 @@
131 131  
132 132 #include <lib3270/api.h>
133 133  
  134 +#ifdef __cplusplus
  135 + extern "C" {
  136 +#endif
  137 +
134 138 /**
135 139 * Get current screen size.
136 140 *
... ... @@ -192,6 +196,15 @@
192 196 */
193 197 LIB3270_EXPORT int lib3270_connect(H3270 *h,const char *n, int wait);
194 198  
  199 +
  200 + /**
  201 + * Disconnect from host.
  202 + *
  203 + * @param h Session handle.
  204 + *
  205 + */
  206 + LIB3270_EXPORT void lib3270_disconnect(H3270 *h);
  207 +
195 208 /**
196 209 * Reconnect.
197 210 *
... ... @@ -331,5 +344,8 @@
331 344 */
332 345 LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm);
333 346  
  347 +#ifdef __cplusplus
  348 + }
  349 +#endif
334 350  
335 351 #endif // LIB3270_H_INCLUDED
... ...
latest/src/include/lib3270/api.h
... ... @@ -603,8 +603,8 @@
603 603 LIB3270_EXPORT int ctlr_get_rows(void) __attribute__ ((deprecated));
604 604  
605 605 /* Screen calls */
606   - LIB3270_EXPORT void screen_resume(void);
607   - LIB3270_EXPORT void screen_suspend(void);
  606 + LIB3270_EXPORT void screen_resume(H3270 *session);
  607 + LIB3270_EXPORT void screen_suspend(H3270 *session);
608 608 LIB3270_EXPORT void screen_disp(H3270 *session);
609 609  
610 610 /* Console calls */
... ... @@ -623,8 +623,6 @@
623 623 #define host_connect(n,wait) lib3270_connect(NULL,n,wait)
624 624 #define host_reconnect(w) lib3270_reconnect(NULL,w)
625 625  
626   - LIB3270_EXPORT void host_disconnect(H3270 *h, int disable);
627   -
628 626 #define register_schange(tx,func) lib3270_register_schange(NULL,tx,func,NULL)
629 627 LIB3270_EXPORT void lib3270_register_schange(H3270 *h,LIB3270_STATE tx, void (*func)(H3270 *, int, void *),void *user_data);
630 628  
... ...
latest/src/lib/Makefile.in
... ... @@ -67,13 +67,13 @@ SDK_LDFLAGS=
67 67  
68 68 #---[ Sources ]----------------------------------------------------------------
69 69  
70   -SOURCES = version.c XtGlue.c actions.c ansi.c apl.c charset.c ctlr.c \
  70 +SOURCES = version.c XtGlue.c actions.c ansi.c charset.c ctlr.c \
71 71 ft.c ft_cut.c ft_dft.c glue.c host.c kybd.c \
72 72 print.c printer.c proxy.c resources.c rpq.c screen.c see.c \
73 73 sf.c tables.c telnet.c toggles.c trace_ds.c utf8.c util.c \
74 74 xio.c resolver.c log.c paste.c macros.c @LIB_SRCS@
75 75  
76   -# icmd.c
  76 +# icmd.c apl.c
77 77  
78 78 #---[ Rules ]------------------------------------------------------------------
79 79  
... ...
latest/src/lib/host.c
... ... @@ -689,6 +689,11 @@ static void try_reconnect(H3270 *session)
689 689 lib3270_reconnect(session,0);
690 690 }
691 691  
  692 +LIB3270_EXPORT void lib3270_disconnect(H3270 *h)
  693 +{
  694 + host_disconnect(h,0);
  695 +}
  696 +
692 697 void host_disconnect(H3270 *h, int failed)
693 698 {
694 699 CHECK_SESSION_HANDLE(h);
... ... @@ -768,24 +773,6 @@ LIB3270_EXPORT void lib3270_register_schange(H3270 *h,LIB3270_STATE_CHANGE tx, v
768 773  
769 774 }
770 775  
771   -/*
772   -void register_schange(LIB3270_STATE_CHANGE tx, void (*func)(H3270 *, int))
773   -{
774   - struct st_callback *st;
775   -
776   - st = (struct st_callback *)Malloc(sizeof(*st));
777   -
778   - st->func = func;
779   - st->next = (struct st_callback *)NULL;
780   -
781   - if (st_last[tx] != (struct st_callback *)NULL)
782   - st_last[tx]->next = st;
783   - else
784   - st_callbacks[tx] = st;
785   - st_last[tx] = st;
786   -}
787   -*/
788   -
789 776 /* Signal a state change. */
790 777 void lib3270_st_changed(H3270 *h, int tx, int mode)
791 778 {
... ...
latest/src/lib/hostc.h
... ... @@ -36,5 +36,5 @@
36 36 LIB3270_INTERNAL void hostfile_init(void);
37 37 LIB3270_INTERNAL void host_connected(H3270 *session);
38 38 LIB3270_INTERNAL void host_in3270(H3270 *session, LIB3270_CSTATE);
39   -
  39 + LIB3270_INTERNAL void host_disconnect(H3270 *h, int disable);
40 40  
... ...
latest/src/lib/kybd.c
... ... @@ -467,7 +467,7 @@ operator_error(int error_type)
467 467  
468 468 if(appres.oerr_lock) { // || sms_redirect()) {
469 469 status_oerr(NULL,error_type);
470   - mcursor_locked();
  470 + mcursor_locked(&h3270);
471 471 kybdlock_set((unsigned int)error_type, "operator_error");
472 472 (void) flush_ta();
473 473 } else {
... ... @@ -528,7 +528,7 @@ key_AID(unsigned char aid_code)
528 528 }
529 529 if (!IN_SSCP || aid_code != AID_CLEAR) {
530 530 status_twait(NULL);
531   - mcursor_waiting();
  531 + mcursor_waiting(&h3270);
532 532 set_toggle(INSERT,0);
533 533 kybdlock_set(KL_OIA_TWAIT | KL_OIA_LOCKED, "key_AID");
534 534 }
... ... @@ -1567,7 +1567,7 @@ do_reset(Boolean explicit)
1567 1567  
1568 1568 /* Clean up other modes. */
1569 1569 status_reset(NULL);
1570   - mcursor_normal();
  1570 + mcursor_normal(&h3270);
1571 1571  
1572 1572 // composing = NONE;
1573 1573 // status_compose(False, 0, KT_STD);
... ...
latest/src/lib/paste.c
... ... @@ -175,7 +175,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str)
175 175 if(kybdlock)
176 176 return -EINVAL;
177 177  
178   - screen_suspend();
  178 + screen_suspend(h);
179 179  
180 180 while(*str && last && !kybdlock && h->cursor_addr >= data.orig_addr)
181 181 {
... ... @@ -215,6 +215,6 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str)
215 215 }
216 216 }
217 217  
218   - screen_resume();
  218 + screen_resume(h);
219 219 return data.qtd;
220 220 }
... ...
latest/src/lib/screen.c
... ... @@ -187,7 +187,7 @@ int screen_init(H3270 *session)
187 187 #endif
188 188  
189 189 /* Finish screen initialization. */
190   - screen_suspend();
  190 + screen_suspend(session);
191 191  
192 192 return 0;
193 193 }
... ... @@ -449,15 +449,15 @@ void screen_disp(H3270 *session)
449 449 callbacks->display(session);
450 450 }
451 451  
452   -void screen_suspend(void)
  452 +void screen_suspend(H3270 *session)
453 453 {
454 454 if(callbacks && callbacks->set_suspended)
455 455 callbacks->set_suspended(1);
456 456 }
457 457  
458   -void screen_resume(void)
  458 +void screen_resume(H3270 *session)
459 459 {
460   - screen_disp(&h3270);
  460 + screen_disp(session);
461 461  
462 462 if(callbacks && callbacks->set_suspended)
463 463 callbacks->set_suspended(0);
... ... @@ -822,23 +822,39 @@ void Warning(const char *fmt, ...)
822 822  
823 823 }
824 824  
825   -void mcursor_locked()
  825 +void mcursor_set(H3270 *session,CURSOR_MODE m)
826 826 {
  827 + CHECK_SESSION_HANDLE(session);
  828 +
  829 + if(callbacks && callbacks->cursor)
  830 + callbacks->cursor(m);
  831 +}
  832 +
  833 +/*
  834 +void mcursor_locked(H3270 *session)
  835 +{
  836 + CHECK_SESSION_HANDLE(session);
  837 +
827 838 if(callbacks && callbacks->cursor)
828 839 callbacks->cursor(CURSOR_MODE_LOCKED);
829 840 }
830 841  
831   -extern void mcursor_normal()
  842 +extern void mcursor_normal(H3270 *session)
832 843 {
  844 + CHECK_SESSION_HANDLE(session);
  845 +
833 846 if(callbacks && callbacks->cursor)
834 847 callbacks->cursor(CURSOR_MODE_NORMAL);
835 848 }
836 849  
837   -extern void mcursor_waiting()
  850 +extern void mcursor_waiting(H3270 *session)
838 851 {
  852 + CHECK_SESSION_HANDLE(session);
  853 +
839 854 if(callbacks && callbacks->cursor)
840 855 callbacks->cursor(CURSOR_MODE_WAITING);
841 856 }
  857 +*/
842 858  
843 859 /* Pop up an error dialog. */
844 860 extern void popup_an_error(const char *fmt, ...)
... ...
latest/src/lib/screenc.h
... ... @@ -31,9 +31,18 @@ LIB3270_INTERNAL int screen_init(H3270 *session);
31 31 // LIB3270_INTERNAL void screen_flip(void);
32 32 LIB3270_INTERNAL FILE *start_pager(void);
33 33 LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname);
34   -LIB3270_INTERNAL void mcursor_locked();
35   -LIB3270_INTERNAL void mcursor_normal();
36   -LIB3270_INTERNAL void mcursor_waiting();
  34 +
  35 +LIB3270_INTERNAL void mcursor_set(H3270 *session,CURSOR_MODE m);
  36 +
  37 +#define mcursor_locked(x) mcursor_set(x,CURSOR_MODE_LOCKED)
  38 +#define mcursor_normal(x) mcursor_set(x,CURSOR_MODE_NORMAL)
  39 +#define mcursor_waiting(x) mcursor_set(x,CURSOR_MODE_WAITING)
  40 +
  41 +
  42 +//LIB3270_INTERNAL void mcursor_locked(H3270 *session);
  43 +//LIB3270_INTERNAL void mcursor_normal(H3270 *session);
  44 +//LIB3270_INTERNAL void mcursor_waiting(H3270 *session);
  45 +
37 46 LIB3270_INTERNAL void notify_toggle_changed(int ix, int value, int reason);
38 47 LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols);
39 48  
... ...
latest/src/oxt/connection.cxx
... ... @@ -33,7 +33,7 @@
33 33 #include "ooo3270.hpp"
34 34 #include <osl/thread.hxx>
35 35 #include <errno.h>
36   -#include <lib3270/api.h>
  36 +#include <lib3270.h>
37 37 #include <string.h>
38 38 #include <time.h>
39 39 #include <malloc.h>
... ... @@ -132,7 +132,7 @@ sal_Int16 SAL_CALL pw3270::uno_impl::Disconnect() throw (RuntimeException)
132 132  
133 133 yeld();
134 134  
135   - host_disconnect(this->hSession,0);
  135 + lib3270_disconnect(this->hSession);
136 136  
137 137 yeld();
138 138  
... ...
latest/src/plugins/rexx/network.c
... ... @@ -147,7 +147,7 @@
147 147 return RetValue(Retstr,ENOTCONN);
148 148 }
149 149  
150   - host_disconnect(hSession,0);
  150 + lib3270_disconnect(hSession);
151 151 return RetValue(Retstr,0);
152 152 }
153 153  
... ...