Commit 5372b5eb092a7d531cd1b4180555b537d3a0b1f9

Authored by perry.werneck@gmail.com
1 parent 98276900

Substituindo "widget" por "user_data" na estrutura de sessão

Showing 3 changed files with 12 additions and 16 deletions   Show diff stats
@@ -51,15 +51,6 @@ static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, vo @@ -51,15 +51,6 @@ static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, vo
51 static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); 51 static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata );
52 static void internal_remove_poll(void *id); 52 static void internal_remove_poll(void *id);
53 53
54 -  
55 -/*  
56 -// fdcalls  
57 -static void internal_remove_source(void *id);  
58 -static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session));  
59 -static void * internal_add_output(int source, H3270 *session, void (*fn)(H3270 *session));  
60 -static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session));  
61 -*/  
62 -  
63 static int internal_wait(H3270 *hSession, int seconds); 54 static int internal_wait(H3270 *hSession, int seconds);
64 55
65 static int internal_event_dispatcher(H3270 *hSession, int block); 56 static int internal_event_dispatcher(H3270 *hSession, int block);
@@ -688,7 +688,7 @@ void Error(H3270 *session, const char *fmt, ...) @@ -688,7 +688,7 @@ void Error(H3270 *session, const char *fmt, ...)
688 688
689 va_start(arg_ptr, fmt); 689 va_start(arg_ptr, fmt);
690 690
691 - popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); 691 + popup_handler(session,session->user_data,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr);
692 692
693 va_end(arg_ptr); 693 va_end(arg_ptr);
694 694
@@ -703,7 +703,7 @@ void Warning(H3270 *session, const char *fmt, ...) @@ -703,7 +703,7 @@ void Warning(H3270 *session, const char *fmt, ...)
703 trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Warning",fmt); 703 trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Warning",fmt);
704 704
705 va_start(arg_ptr, fmt); 705 va_start(arg_ptr, fmt);
706 - popup_handler(session,session->widget,LIB3270_NOTIFY_WARNING, _( "3270 Warning" ),NULL,fmt,arg_ptr); 706 + popup_handler(session,session->user_data,LIB3270_NOTIFY_WARNING, _( "3270 Warning" ),NULL,fmt,arg_ptr);
707 va_end(arg_ptr); 707 va_end(arg_ptr);
708 708
709 } 709 }
@@ -718,7 +718,7 @@ void popup_an_error(H3270 *session, const char *fmt, ...) @@ -718,7 +718,7 @@ void popup_an_error(H3270 *session, const char *fmt, ...)
718 trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Error",fmt); 718 trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Error",fmt);
719 719
720 va_start(args, fmt); 720 va_start(args, fmt);
721 - popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR,_( "3270 Error" ),NULL,fmt,args); 721 + popup_handler(session,session->user_data,LIB3270_NOTIFY_ERROR,_( "3270 Error" ),NULL,fmt,args);
722 va_end(args); 722 va_end(args);
723 723
724 } 724 }
@@ -732,7 +732,7 @@ void popup_system_error(H3270 *session, const char *title, const char *message, @@ -732,7 +732,7 @@ void popup_system_error(H3270 *session, const char *title, const char *message,
732 trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message); 732 trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message);
733 733
734 va_start(args, fmt); 734 va_start(args, fmt);
735 - popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR,title ? title : _( "3270 Error" ), message,fmt,args); 735 + popup_handler(session,session->user_data,LIB3270_NOTIFY_ERROR,title ? title : _( "3270 Error" ), message,fmt,args);
736 va_end(args); 736 va_end(args);
737 } 737 }
738 738
@@ -857,7 +857,7 @@ LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const c @@ -857,7 +857,7 @@ LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const c
857 857
858 trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message); 858 trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message);
859 859
860 - popup_handler(session,session->widget,id,title ? title : _( "3270 Error" ), message,fmt,args); 860 + popup_handler(session,session->user_data,id,title ? title : _( "3270 Error" ), message,fmt,args);
861 } 861 }
862 862
863 LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr) 863 LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr)
@@ -320,9 +320,14 @@ LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) @@ -320,9 +320,14 @@ LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void)
320 return lib3270_session_new(""); 320 return lib3270_session_new("");
321 } 321 }
322 322
323 -LIB3270_EXPORT void * lib3270_get_widget(H3270 *h) 323 +LIB3270_EXPORT void lib3270_set_user_data(H3270 *h, void *ptr)
324 { 324 {
325 CHECK_SESSION_HANDLE(h); 325 CHECK_SESSION_HANDLE(h);
326 - return h->widget; 326 + h->user_data = ptr;
327 } 327 }
328 328
  329 +LIB3270_EXPORT void * lib3270_get_user_data(H3270 *h)
  330 +{
  331 + CHECK_SESSION_HANDLE(h);
  332 + return h->user_data;
  333 +}