Commit a2c1ad411ef19f26fe7ea28a947aab63c7abaca1
1 parent
2a9b22c1
Exists in
master
and in
5 other branches
Android - Iniciando implementação de suporte para script de autostart
Showing
27 changed files
with
327 additions
and
221 deletions
Show diff stats
android/jni/main.cpp
... | ... | @@ -126,11 +126,6 @@ static int popuphandler(H3270 *session, void *terminal, LIB3270_NOTIFY type, con |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | -static void ctlr_done(H3270 *session) | |
130 | -{ | |
131 | - pw3270_jni_post_message(4); | |
132 | -} | |
133 | - | |
134 | 129 | void update_status(H3270 *session, LIB3270_MESSAGE id) |
135 | 130 | { |
136 | 131 | pw3270_jni_post_message(1,(int) id); |
... | ... | @@ -255,6 +250,26 @@ static void tracehandler(H3270 *session, const char *fmt, va_list args) |
255 | 250 | } |
256 | 251 | #endif // X3270_TRACE |
257 | 252 | |
253 | +static void ctlr_done(H3270 *session) | |
254 | +{ | |
255 | + __android_log_print(ANDROID_LOG_DEBUG, PACKAGE_NAME, "%s",__FUNCTION__); | |
256 | + pw3270_jni_post_message(5); | |
257 | +} | |
258 | + | |
259 | +static void autostart(H3270 *session) | |
260 | +{ | |
261 | + // pw3270_jni_post_message(10); | |
262 | + | |
263 | + { | |
264 | + char *text = lib3270_get_text(PW3270_SESSION,0,-1); | |
265 | + if(text) | |
266 | + { | |
267 | + __android_log_print(ANDROID_LOG_DEBUG, PACKAGE_NAME, "Contents:\n%s\n",text); | |
268 | + lib3270_free(text); | |
269 | + } | |
270 | + } | |
271 | +} | |
272 | + | |
258 | 273 | jint JNI_OnLoad(JavaVM *vm, void *reserved) |
259 | 274 | { |
260 | 275 | H3270 * session = lib3270_session_new(""); |
... | ... | @@ -270,11 +285,12 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) |
270 | 285 | lib3270_set_popup_handler(popuphandler); |
271 | 286 | lib3270_register_time_handlers(add_timer,remove_timer); |
272 | 287 | |
273 | - session->write = write_buffer; | |
274 | - session->changed = changed; | |
275 | - session->erase = erase; | |
276 | - session->ctlr_done = ctlr_done; | |
277 | - session->update_status = update_status; | |
288 | + session->write = write_buffer; | |
289 | + session->changed = changed; | |
290 | + session->erase = erase; | |
291 | + session->ctlr_done = ctlr_done; | |
292 | + session->update_status = update_status; | |
293 | + session->autostart = autostart; | |
278 | 294 | |
279 | 295 | return JNI_VERSION_1_4; |
280 | 296 | } | ... | ... |
android/jni/misc.cpp
... | ... | @@ -58,3 +58,13 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setToggle(JNIEnv *env, jobj |
58 | 58 | |
59 | 59 | } |
60 | 60 | |
61 | +JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_in3270 (JNIEnv *env, jobject obj) | |
62 | +{ | |
63 | + jboolean rc; | |
64 | + | |
65 | + PW3270_JNI_BEGIN | |
66 | + rc = lib3270_in_3270(PW3270_SESSION) ? JNI_TRUE : JNI_FALSE; | |
67 | + PW3270_JNI_END | |
68 | + | |
69 | + return rc; | |
70 | +} | ... | ... |
android/jni/text.cpp
... | ... | @@ -68,44 +68,33 @@ JNIEXPORT jbyteArray JNICALL Java_br_com_bb_pw3270_lib3270_getHTML(JNIEnv *env, |
68 | 68 | return ret; |
69 | 69 | } |
70 | 70 | |
71 | - | |
72 | -/* | |
73 | 71 | JNIEXPORT jbyteArray JNICALL Java_br_com_bb_pw3270_lib3270_getText(JNIEnv *env, jobject obj) |
74 | 72 | { |
75 | 73 | jbyteArray ret; |
76 | 74 | |
77 | 75 | PW3270_JNI_BEGIN |
78 | 76 | |
79 | - trace("%s starts",__FUNCTION__); | |
80 | - | |
81 | - if(session) | |
82 | - { | |
83 | - char *text = lib3270_get_text(session,0,-1); | |
77 | +// trace("%s starts",__FUNCTION__); | |
84 | 78 | |
85 | - trace("%s will return \"%s\"",__FUNCTION__,text ? text : ""); | |
79 | + char *text = lib3270_get_text(PW3270_SESSION,0,-1); | |
86 | 80 | |
87 | - if(text) | |
88 | - { | |
89 | - ret = retString(env,text); | |
90 | - lib3270_free(text); | |
91 | - } | |
92 | - else | |
93 | - { | |
94 | - ret = retString(env, ""); | |
95 | - } | |
81 | + if(text) | |
82 | + { | |
83 | + ret = retString(text); | |
84 | + lib3270_free(text); | |
96 | 85 | } |
97 | 86 | else |
98 | 87 | { |
99 | - ret = retString(env, "<b>Invalid Session ID</b>"); | |
88 | + ret = retString(""); | |
100 | 89 | } |
101 | 90 | |
102 | - trace("%s ends",__FUNCTION__); | |
91 | +// trace("%s ends",__FUNCTION__); | |
103 | 92 | |
104 | 93 | PW3270_JNI_END |
105 | 94 | |
106 | 95 | return ret; |
107 | 96 | } |
108 | -*/ | |
97 | + | |
109 | 98 | |
110 | 99 | JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setTextAt(JNIEnv *env, jobject obj, jint pos, jbyteArray inText, jint szText) |
111 | 100 | { |
... | ... | @@ -149,3 +138,17 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setTextAt(JNIEnv *env, jobj |
149 | 138 | |
150 | 139 | PW3270_JNI_END |
151 | 140 | } |
141 | + | |
142 | +JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_input(JNIEnv *env, jobject obj, jstring str, jint pasting) | |
143 | +{ | |
144 | + int rc = -1; | |
145 | + | |
146 | + PW3270_JNI_BEGIN | |
147 | + | |
148 | + if(lib3270_connected(PW3270_SESSION)) | |
149 | + rc = lib3270_emulate_input(PW3270_SESSION, env->GetStringUTFChars(str, 0), -1, (int) pasting); | |
150 | + | |
151 | + PW3270_JNI_END | |
152 | + | |
153 | + return rc; | |
154 | +} | ... | ... |
android/res/layout/menu.xml
... | ... | @@ -7,8 +7,6 @@ |
7 | 7 | android:title="Conectar" /> |
8 | 8 | <item android:id="@+id/disconnect" |
9 | 9 | android:title="Desconectar" /> |
10 | - <item android:id="@+id/reload" | |
11 | - android:title="Recarregar" /> | |
12 | 10 | <item android:id="@+id/settings" |
13 | 11 | android:title="Configurar" /> |
14 | 12 | <item android:id="@+id/about" | ... | ... |
android/res/xml/preferences.xml
... | ... | @@ -46,6 +46,13 @@ |
46 | 46 | android:defaultValue="false" |
47 | 47 | /> |
48 | 48 | |
49 | + <EditTextPreference | |
50 | + android:key="logonstring" | |
51 | + android:title="String de conexão" | |
52 | + android:summary="Define texto a enviar ao conectar" | |
53 | + android:dialogTitle="String de conexão" | |
54 | + android:dialogMessage="Informe texto a enviar logo após a conexão" | |
55 | + android:defaultValue="" /> | |
49 | 56 | |
50 | 57 | </PreferenceCategory> |
51 | 58 | ... | ... |
android/src/br/com/bb/pw3270/PW3270Activity.java
android/src/br/com/bb/pw3270/SettingsActivity.java
android/src/br/com/bb/pw3270/lib3270.java
... | ... | @@ -59,12 +59,12 @@ public abstract class lib3270 |
59 | 59 | protected int screenState = -1; |
60 | 60 | |
61 | 61 | private lib3270 hSession = this; |
62 | - | |
62 | + | |
63 | 63 | public ProgressDialog dlgSysMessage = null; |
64 | 64 | public WebView view = null; |
65 | 65 | public Resources res = null; |
66 | 66 | public Activity mainact = null; |
67 | - | |
67 | + | |
68 | 68 | private static boolean initialized = false; |
69 | 69 | private static NetworkThread mainloop = null; |
70 | 70 | private static boolean connected = false; |
... | ... | @@ -139,6 +139,25 @@ public abstract class lib3270 |
139 | 139 | new timer(((Long) msg.obj).longValue(), msg.arg1); |
140 | 140 | break; |
141 | 141 | |
142 | + case 10: // Run autostart | |
143 | + Log.v(TAG, "AAA---------------------------------------------------------------"); | |
144 | + Log.v(TAG, "In3270="+(in3270() ? "Yes" : "No")); | |
145 | + | |
146 | + /* | |
147 | + String str = settings.getString("logonstring",""); | |
148 | + Log.v(TAG, "Logon string is \"" + str + "\""); | |
149 | + if( str != "") | |
150 | + { | |
151 | + int sz = input(str,0); | |
152 | + Log.v(TAG, "Input exits with "+sz); | |
153 | + } | |
154 | + */ | |
155 | + | |
156 | + Log.v(TAG, "Contents:\n" + getText() + "\n"); | |
157 | + | |
158 | + Log.v(TAG, "AAA---------------------------------------------------------------"); | |
159 | + break; | |
160 | + | |
142 | 161 | } |
143 | 162 | } |
144 | 163 | }; |
... | ... | @@ -157,7 +176,7 @@ public abstract class lib3270 |
157 | 176 | this.screenState = -1; |
158 | 177 | |
159 | 178 | for(int f = 0; f < toggle.length; f++) |
160 | - setToggle(toggle[f],settings.getBoolean(toggle[f],false)); | |
179 | + setToggle(toggle[f],settings.getBoolean(toggle[f],true)); | |
161 | 180 | |
162 | 181 | } |
163 | 182 | |
... | ... | @@ -301,12 +320,12 @@ public abstract class lib3270 |
301 | 320 | |
302 | 321 | while (connected) |
303 | 322 | { |
304 | - byte[] in = new byte[4096]; | |
323 | + byte[] in = new byte[16384]; | |
305 | 324 | int sz = -1; |
306 | 325 | |
307 | 326 | try |
308 | 327 | { |
309 | - sz = inData.read(in, 0, 4096); | |
328 | + sz = inData.read(in, 0, 16384); | |
310 | 329 | |
311 | 330 | } catch (Exception e) |
312 | 331 | { |
... | ... | @@ -365,18 +384,18 @@ public abstract class lib3270 |
365 | 384 | msg.obj = new popupMessageInfo(title, text, info); |
366 | 385 | mHandler.sendMessage(msg); |
367 | 386 | } |
368 | - | |
387 | + | |
369 | 388 | void setActivity(Activity act) |
370 | 389 | { |
371 | 390 | this.mainact = act; |
372 | 391 | this.settings = PreferenceManager.getDefaultSharedPreferences(act); |
373 | 392 | this.res = act.getResources(); |
374 | 393 | } |
375 | - | |
394 | + | |
376 | 395 | WebView setView(WebView v) |
377 | 396 | { |
378 | 397 | this.view = v; |
379 | - | |
398 | + | |
380 | 399 | view.addJavascriptInterface(this, "pw3270"); |
381 | 400 | |
382 | 401 | view.setWebChromeClient(new WebChromeClient()); |
... | ... | @@ -388,11 +407,11 @@ public abstract class lib3270 |
388 | 407 | view.getSettings().setJavaScriptEnabled(true); |
389 | 408 | |
390 | 409 | return view; |
391 | - | |
410 | + | |
392 | 411 | } |
393 | - | |
412 | + | |
394 | 413 | public abstract String getProgramMessageText(int id); |
395 | - | |
414 | + | |
396 | 415 | /*---[ Signal methods ]--------------------------------------------------*/ |
397 | 416 | |
398 | 417 | protected void showProgramMessage(int id) |
... | ... | @@ -403,7 +422,6 @@ public abstract class lib3270 |
403 | 422 | if(screenState != 0) |
404 | 423 | { |
405 | 424 | screenState = 0; |
406 | -// Log.v(TAG, "Status changed to NONE"); | |
407 | 425 | reload(); |
408 | 426 | } |
409 | 427 | break; |
... | ... | @@ -558,8 +576,8 @@ public abstract class lib3270 |
558 | 576 | |
559 | 577 | return text; |
560 | 578 | } |
561 | - | |
562 | - | |
579 | + | |
580 | + | |
563 | 581 | /*---[ Native calls ]----------------------------------------------------*/ |
564 | 582 | private native int processEvents(); |
565 | 583 | |
... | ... | @@ -614,4 +632,7 @@ public abstract class lib3270 |
614 | 632 | |
615 | 633 | public native void setTextAt(int offset, byte[] str, int len); |
616 | 634 | |
635 | + public native int input(String text, int pasting); | |
636 | + | |
637 | + public native boolean in3270(); | |
617 | 638 | } | ... | ... |
configure.ac
pw3270.cbp
... | ... | @@ -219,7 +219,7 @@ |
219 | 219 | <Unit filename="src/pw3270/colors.c"> |
220 | 220 | <Option compilerVar="CC" /> |
221 | 221 | </Unit> |
222 | - <Unit filename="src/pw3270/common/common.h.in" /> | |
222 | + <Unit filename="src/pw3270/common/common.h" /> | |
223 | 223 | <Unit filename="src/pw3270/common/config.c"> |
224 | 224 | <Option compilerVar="CC" /> |
225 | 225 | </Unit> | ... | ... |
src/include/lib3270.h
... | ... | @@ -172,7 +172,7 @@ |
172 | 172 | LIB3270_MESSAGE_NONE, /**< No message */ |
173 | 173 | LIB3270_MESSAGE_SYSWAIT, |
174 | 174 | LIB3270_MESSAGE_TWAIT, |
175 | - LIB3270_MESSAGE_CONNECTED, | |
175 | + LIB3270_MESSAGE_CONNECTED, /**< Connected */ | |
176 | 176 | LIB3270_MESSAGE_DISCONNECTED, /**< Disconnected from host */ |
177 | 177 | LIB3270_MESSAGE_AWAITING_FIRST, |
178 | 178 | LIB3270_MESSAGE_MINUS, |
... | ... | @@ -443,7 +443,7 @@ |
443 | 443 | * |
444 | 444 | * @return The number of unprocessed characters. |
445 | 445 | */ |
446 | - LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int pasting); | |
446 | + LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, const char *s, int len, int pasting); | |
447 | 447 | |
448 | 448 | /** |
449 | 449 | * Set string at current cursor position. | ... | ... |
src/include/lib3270/log.h
... | ... | @@ -39,10 +39,14 @@ |
39 | 39 | |
40 | 40 | #include <android/log.h> |
41 | 41 | |
42 | + #define DEBUG 1 | |
43 | + | |
42 | 44 | #define lib3270_write_log(s,m,f,...) __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", __VA_ARGS__ ) |
43 | 45 | #define lib3270_write_rc(s,m,r,f,...) __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", __VA_ARGS__ ) |
44 | 46 | #define lib3270_write_va_log(s,m,f,a) __android_log_vprint(ANDROID_LOG_VERBOSE, PACKAGE_NAME, f "\n", a) |
45 | 47 | |
48 | + #define trace( fmt, ... ) __android_log_print(ANDROID_LOG_DEBUG, PACKAGE_NAME, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); | |
49 | + | |
46 | 50 | #else |
47 | 51 | |
48 | 52 | LIB3270_EXPORT void lib3270_set_log_handler(void (*loghandler)(H3270 *, const char *, int, const char *, va_list)); |
... | ... | @@ -50,13 +54,14 @@ |
50 | 54 | LIB3270_EXPORT int lib3270_write_rc(H3270 *session, const char *module, int rc, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5); |
51 | 55 | LIB3270_EXPORT void lib3270_write_va_log(H3270 *session, const char *module, const char *fmt, va_list arg); |
52 | 56 | |
57 | + #ifdef DEBUG | |
58 | + #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
59 | + #else | |
60 | + #define trace(x, ...) // __VA_ARGS__ | |
61 | + #endif | |
62 | + | |
53 | 63 | #endif // ANDROID |
54 | 64 | |
55 | - #ifdef DEBUG | |
56 | - #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
57 | - #else | |
58 | - #define trace(x, ...) // __VA_ARGS__ | |
59 | - #endif | |
60 | 65 | |
61 | 66 | #endif // LIB3270_LOG_H_INCLUDED |
62 | 67 | ... | ... |
src/include/lib3270/session.h
... | ... | @@ -110,6 +110,8 @@ |
110 | 110 | int need_tls_follows : 1; |
111 | 111 | int cut_xfer_in_progress : 1; |
112 | 112 | int auto_keymap : 1; |
113 | + int formatted : 1; /**< Formatted screen flag */ | |
114 | + int starting : 1; /**< Is starting (no first screen)? */ | |
113 | 115 | |
114 | 116 | char * oversize; |
115 | 117 | |
... | ... | @@ -162,8 +164,6 @@ |
162 | 164 | int screen_alt; /**< alternate screen? */ |
163 | 165 | int is_altbuffer; |
164 | 166 | |
165 | - int formatted; /**< set in screen_disp */ | |
166 | - | |
167 | 167 | // Screen contents |
168 | 168 | void * buffer[2]; /**< Internal buffers */ |
169 | 169 | struct lib3270_ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */ |
... | ... | @@ -401,6 +401,7 @@ |
401 | 401 | void (*update_model)(H3270 *session, const char *name, int model, int rows, int cols); |
402 | 402 | void (*update_selection)(H3270 *session, int start, int end); |
403 | 403 | void (*update_ssl)(H3270 *session, LIB3270_SSL_STATE state); |
404 | +// void (*update_formatted)(H3270 *session,int state); | |
404 | 405 | |
405 | 406 | void (*set_timer)(H3270 *session, unsigned char on); |
406 | 407 | void (*erase)(H3270 *session); |
... | ... | @@ -409,6 +410,7 @@ |
409 | 410 | void (*cursor)(H3270 *session, LIB3270_CURSOR id); |
410 | 411 | void (*set_selection)(H3270 *session, unsigned char on); |
411 | 412 | void (*ctlr_done)(H3270 *session); |
413 | + void (*autostart)(H3270 *session); | |
412 | 414 | |
413 | 415 | void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text); |
414 | 416 | ... | ... |
src/include/pw3270.h
... | ... | @@ -61,6 +61,12 @@ |
61 | 61 | LIB3270_EXPORT void pw3270_save_window_state(GtkWidget *widget, const gchar *name); |
62 | 62 | LIB3270_EXPORT void pw3270_restore_window_state(GtkWidget *widget, const gchar *name); |
63 | 63 | |
64 | +#ifdef HAVE_GTKMAC | |
65 | + LIB3270_EXPORT GtkMacBundle * pw3270_get_bundle(void); | |
66 | +#endif | |
67 | + | |
68 | + | |
69 | + | |
64 | 70 | G_END_DECLS |
65 | 71 | |
66 | 72 | #endif // PW3270_H_INCLUDED | ... | ... |
src/lib3270/ctlr.c
... | ... | @@ -67,7 +67,8 @@ |
67 | 67 | // Boolean dbcs = False; |
68 | 68 | |
69 | 69 | /* Statics */ |
70 | -static void set_formatted(H3270 *session); | |
70 | +static void update_formatted(H3270 *session); | |
71 | +static void set_formatted(H3270 *hSession, int state); | |
71 | 72 | static void ctlr_blanks(H3270 *session); |
72 | 73 | static void ctlr_half_connect(H3270 *session, int ignored, void *dunno); |
73 | 74 | static void ctlr_connect(H3270 *session, int ignored, void *dunno); |
... | ... | @@ -224,37 +225,50 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) |
224 | 225 | |
225 | 226 | set_viewsize(session,sz[idx].rows,sz[idx].cols); |
226 | 227 | |
227 | - /* | |
228 | - // Make sure that the current rows/cols are still 24x80. | |
229 | - session->cols = 80; | |
230 | - session->rows = 24; | |
231 | - session->screen_alt = 0; | |
232 | - */ | |
233 | - | |
234 | 228 | } |
235 | 229 | |
236 | - | |
230 | +static void set_formatted(H3270 *hSession, int state) | |
231 | +{ | |
232 | + hSession->formatted = state; | |
237 | 233 | /* |
238 | - * Set the formatted screen flag. A formatted screen is a screen that | |
239 | - * has at least one field somewhere on it. | |
234 | + int last = (int) hSession->formatted; | |
235 | + hSession->formatted = state; | |
236 | + | |
237 | + if( ((int) hSession->formatted) != last) | |
238 | + { | |
239 | + trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted"); | |
240 | + hSession->update_formatted(hSession,hSession->formatted); | |
241 | + } | |
242 | +*/ | |
243 | + trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted"); | |
244 | +} | |
245 | + | |
246 | +/** | |
247 | + * Update the formatted screen flag. | |
248 | + * | |
249 | + * A formatted screen is a screen that has at least one field somewhere on it. | |
250 | + * | |
251 | + * @param hSession Session Handle | |
240 | 252 | */ |
241 | -static void set_formatted(H3270 *hSession) | |
253 | +static void update_formatted(H3270 *hSession) | |
242 | 254 | { |
243 | 255 | register int baddr; |
244 | 256 | |
245 | 257 | CHECK_SESSION_HANDLE(hSession); |
246 | 258 | |
247 | - hSession->formatted = False; | |
248 | 259 | baddr = 0; |
249 | 260 | do |
250 | 261 | { |
251 | 262 | if(hSession->ea_buf[baddr].fa) |
252 | 263 | { |
253 | - hSession->formatted = True; | |
254 | - break; | |
264 | + set_formatted(hSession,1); | |
265 | + return; | |
255 | 266 | } |
256 | 267 | INC_BA(baddr); |
257 | 268 | } while (baddr != 0); |
269 | + | |
270 | + set_formatted(hSession,0); | |
271 | + | |
258 | 272 | } |
259 | 273 | |
260 | 274 | /* |
... | ... | @@ -277,6 +291,7 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) |
277 | 291 | hSession->ea_buf[-1].fa = FA_PRINTABLE | FA_MODIFY; |
278 | 292 | else |
279 | 293 | hSession->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; |
294 | + | |
280 | 295 | if (!IN_3270 || (IN_SSCP && (hSession->kybdlock & KL_OIA_TWAIT))) |
281 | 296 | { |
282 | 297 | lib3270_kybdlock_clear(hSession,KL_OIA_TWAIT); |
... | ... | @@ -292,8 +307,6 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) |
292 | 307 | hSession->crm_nattr = 0; |
293 | 308 | } |
294 | 309 | |
295 | - | |
296 | - | |
297 | 310 | LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr) |
298 | 311 | { |
299 | 312 | int sbaddr; |
... | ... | @@ -886,7 +899,8 @@ void ctlr_erase_all_unprotected(H3270 *hSession) |
886 | 899 | |
887 | 900 | kybd_inhibit(hSession,False); |
888 | 901 | |
889 | - if (hSession->formatted) { | |
902 | + if (hSession->formatted) | |
903 | + { | |
890 | 904 | /* find first field attribute */ |
891 | 905 | baddr = 0; |
892 | 906 | do { |
... | ... | @@ -975,7 +989,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
975 | 989 | ctlr_add_gr(hSession,hSession->buffer_addr, 0); \ |
976 | 990 | ctlr_add_ic(hSession,hSession->buffer_addr, 0); \ |
977 | 991 | trace_ds(hSession,"%s",see_attr(fa)); \ |
978 | - hSession->formatted = True; \ | |
992 | + set_formatted(hSession,1); \ | |
979 | 993 | } |
980 | 994 | |
981 | 995 | kybd_inhibit(hSession,False); |
... | ... | @@ -1721,7 +1735,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er |
1721 | 1735 | break; |
1722 | 1736 | } |
1723 | 1737 | } |
1724 | - set_formatted(hSession); | |
1738 | + update_formatted(hSession); | |
1725 | 1739 | END_TEXT0; |
1726 | 1740 | trace_ds(hSession,"\n"); |
1727 | 1741 | if (wcc_keyboard_restore) { |
... | ... | @@ -2196,7 +2210,7 @@ ctlr_clear(H3270 *session, Boolean can_snap) |
2196 | 2210 | cursor_move(session,0); |
2197 | 2211 | session->buffer_addr = 0; |
2198 | 2212 | lib3270_unselect(session); |
2199 | - session->formatted = False; | |
2213 | + set_formatted(session,0); | |
2200 | 2214 | session->default_fg = 0; |
2201 | 2215 | session->default_bg = 0; |
2202 | 2216 | session->default_gr = 0; |
... | ... | @@ -2225,7 +2239,7 @@ static void ctlr_blanks(H3270 *session) |
2225 | 2239 | cursor_move(session,0); |
2226 | 2240 | session->buffer_addr = 0; |
2227 | 2241 | lib3270_unselect(session); |
2228 | - session->formatted = False; | |
2242 | + set_formatted(session,0); | |
2229 | 2243 | ALL_CHANGED(session); |
2230 | 2244 | } |
2231 | 2245 | ... | ... |
src/lib3270/host.c
... | ... | @@ -706,7 +706,9 @@ void host_in3270(H3270 *hSession, LIB3270_CSTATE new_cstate) |
706 | 706 | |
707 | 707 | void lib3270_set_connected(H3270 *hSession) |
708 | 708 | { |
709 | - hSession->cstate = CONNECTED_INITIAL; | |
709 | + hSession->cstate = CONNECTED_INITIAL; | |
710 | + hSession->starting = 1; // Enable autostart | |
711 | + | |
710 | 712 | lib3270_st_changed(hSession, LIB3270_STATE_CONNECT, True); |
711 | 713 | if(hSession->update_connect) |
712 | 714 | hSession->update_connect(hSession,1); |
... | ... | @@ -716,7 +718,9 @@ void lib3270_set_disconnected(H3270 *hSession) |
716 | 718 | { |
717 | 719 | CHECK_SESSION_HANDLE(hSession); |
718 | 720 | |
719 | - hSession->cstate = NOT_CONNECTED; | |
721 | + hSession->cstate = NOT_CONNECTED; | |
722 | + hSession->starting = 0; | |
723 | + | |
720 | 724 | set_status(hSession,OIA_FLAG_UNDERA,False); |
721 | 725 | lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False); |
722 | 726 | status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); | ... | ... |
src/lib3270/kybd.c
... | ... | @@ -1209,7 +1209,8 @@ LIB3270_ACTION( firstfield ) |
1209 | 1209 | return 0; |
1210 | 1210 | } |
1211 | 1211 | #endif /*]*/ |
1212 | - if (!hSession->formatted) { | |
1212 | + if (!hSession->formatted) | |
1213 | + { | |
1213 | 1214 | cursor_move(hSession,0); |
1214 | 1215 | return 0; |
1215 | 1216 | } |
... | ... | @@ -2066,8 +2067,10 @@ LIB3270_ACTION( eraseeof ) |
2066 | 2067 | operator_error(hSession,KL_OERR_PROTECTED); |
2067 | 2068 | return -1; |
2068 | 2069 | } |
2069 | - if (hSession->formatted) { /* erase to next field attribute */ | |
2070 | - do { | |
2070 | + if (hSession->formatted) | |
2071 | + { /* erase to next field attribute */ | |
2072 | + do | |
2073 | + { | |
2071 | 2074 | ctlr_add(hSession,baddr, EBC_null, 0); |
2072 | 2075 | INC_BA(baddr); |
2073 | 2076 | } while (!hSession->ea_buf[baddr].fa); |
... | ... | @@ -2109,7 +2112,8 @@ LIB3270_ACTION( eraseinput ) |
2109 | 2112 | if (IN_ANSI) |
2110 | 2113 | return 0; |
2111 | 2114 | #endif /*]*/ |
2112 | - if (hSession->formatted) { | |
2115 | + if (hSession->formatted) | |
2116 | + { | |
2113 | 2117 | /* find first field attribute */ |
2114 | 2118 | baddr = 0; |
2115 | 2119 | do { |
... | ... | @@ -2170,7 +2174,8 @@ LIB3270_ACTION( deleteword ) |
2170 | 2174 | return 0; |
2171 | 2175 | } |
2172 | 2176 | #if defined(X3270_ANSI) /*[*/ |
2173 | - if (IN_ANSI) { | |
2177 | + if (IN_ANSI) | |
2178 | + { | |
2174 | 2179 | net_send_werase(hSession); |
2175 | 2180 | return 0; |
2176 | 2181 | } |
... | ... | @@ -2455,7 +2460,7 @@ static Boolean remargin(H3270 *hSession, int lmargin) |
2455 | 2460 | return True; |
2456 | 2461 | } |
2457 | 2462 | |
2458 | -LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int pasting) | |
2463 | +LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len, int pasting) | |
2459 | 2464 | { |
2460 | 2465 | enum { BASE, BACKSLASH, BACKX, BACKP, BACKPA, BACKPF, OCTAL, HEX, XGE } state = BASE; |
2461 | 2466 | int literal = 0; |
... | ... | @@ -2474,7 +2479,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int |
2474 | 2479 | UChar *ws; |
2475 | 2480 | #else /*][*/ |
2476 | 2481 | char c; |
2477 | - char *ws; | |
2482 | + const char *ws; | |
2478 | 2483 | #endif /*]*/ |
2479 | 2484 | |
2480 | 2485 | CHECK_SESSION_HANDLE(hSession); | ... | ... |
src/lib3270/resolver.c
... | ... | @@ -183,10 +183,10 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) |
183 | 183 | int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_len) |
184 | 184 | { |
185 | 185 | int rc; |
186 | - LIB3270_STATUS saved_status = hSession->oia_status; | |
186 | + LIB3270_MESSAGE saved_status = hSession->oia_status; | |
187 | 187 | struct parms p = { sizeof(struct parms), host, portname, pport, sa, sa_len, errmsg, em_len }; |
188 | 188 | |
189 | - trace("Calling resolver for %s", p.host); | |
189 | + trace("Calling resolver for %s status=%d", p.host, (int) saved_status); | |
190 | 190 | |
191 | 191 | status_changed(hSession,LIB3270_STATUS_RESOLVING); |
192 | 192 | hSession->cursor(hSession,CURSOR_MODE_LOCKED); |
... | ... | @@ -194,7 +194,9 @@ int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, uns |
194 | 194 | rc = lib3270_call_thread((int (*)(H3270 *, void *)) cresolve_host_and_port,hSession,&p); |
195 | 195 | |
196 | 196 | hSession->cursor(hSession,CURSOR_MODE_NORMAL); |
197 | - status_changed(hSession,saved_status); | |
197 | + | |
198 | + if(saved_status != -1) | |
199 | + status_changed(hSession,saved_status); | |
198 | 200 | |
199 | 201 | trace("Calling resolver for %s exits with %d", p.host, rc); |
200 | 202 | ... | ... |
src/lib3270/screen.c
... | ... | @@ -372,7 +372,21 @@ void screen_update(H3270 *session, int bstart, int bend) |
372 | 372 | session->changed(session,first,len); |
373 | 373 | } |
374 | 374 | |
375 | - trace("%s ends",__FUNCTION__); | |
375 | + if(session->starting && session->formatted && lib3270_in_3270(session)) | |
376 | + { | |
377 | + session->starting = 0; | |
378 | + session->autostart(session); | |
379 | +#ifdef DEBUG | |
380 | + { | |
381 | + char *text = lib3270_get_text(session,0,-1); | |
382 | + trace("First screen:\n%s\n",text); | |
383 | + lib3270_free(text); | |
384 | + } | |
385 | +#endif | |
386 | + } | |
387 | + | |
388 | +// trace("%s ends",__FUNCTION__); | |
389 | + | |
376 | 390 | } |
377 | 391 | |
378 | 392 | LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) |
... | ... | @@ -426,20 +440,20 @@ void status_ctlr_done(H3270 *session) |
426 | 440 | |
427 | 441 | void status_oerr(H3270 *session, int error_type) |
428 | 442 | { |
429 | - LIB3270_STATUS sts = LIB3270_STATUS_USER; | |
443 | + LIB3270_STATUS sts = LIB3270_MESSAGE_USER; | |
430 | 444 | |
431 | 445 | CHECK_SESSION_HANDLE(session); |
432 | 446 | |
433 | 447 | switch (error_type) |
434 | 448 | { |
435 | 449 | case KL_OERR_PROTECTED: |
436 | - sts = LIB3270_STATUS_PROTECTED; | |
450 | + sts = LIB3270_MESSAGE_PROTECTED; | |
437 | 451 | break; |
438 | 452 | case KL_OERR_NUMERIC: |
439 | - sts = LIB3270_STATUS_NUMERIC; | |
453 | + sts = LIB3270_MESSAGE_NUMERIC; | |
440 | 454 | break; |
441 | 455 | case KL_OERR_OVERFLOW: |
442 | - sts = LIB3270_STATUS_OVERFLOW; | |
456 | + sts = LIB3270_MESSAGE_OVERFLOW; | |
443 | 457 | break; |
444 | 458 | |
445 | 459 | default: |
... | ... | @@ -453,9 +467,9 @@ void status_oerr(H3270 *session, int error_type) |
453 | 467 | void status_connecting(H3270 *session, Boolean on) |
454 | 468 | { |
455 | 469 | if(session->cursor) |
456 | - session->cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); | |
470 | + session->cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); | |
457 | 471 | |
458 | - status_changed(session, on ? LIB3270_STATUS_CONNECTING : LIB3270_STATUS_BLANK); | |
472 | + status_changed(session, on ? LIB3270_MESSAGE_CONNECTING : LIB3270_MESSAGE_NONE); | |
459 | 473 | } |
460 | 474 | |
461 | 475 | void status_reset(H3270 *session) |
... | ... | @@ -464,17 +478,17 @@ void status_reset(H3270 *session) |
464 | 478 | |
465 | 479 | if (session->kybdlock & KL_ENTER_INHIBIT) |
466 | 480 | { |
467 | - status_changed(session,LIB3270_STATUS_INHIBIT); | |
481 | + status_changed(session,LIB3270_MESSAGE_INHIBIT); | |
468 | 482 | } |
469 | 483 | else if (session->kybdlock & KL_DEFERRED_UNLOCK) |
470 | 484 | { |
471 | - status_changed(session,LIB3270_STATUS_X); | |
485 | + status_changed(session,LIB3270_MESSAGE_X); | |
472 | 486 | } |
473 | 487 | else |
474 | 488 | { |
475 | 489 | if(session->cursor) |
476 | 490 | session->cursor(session,CURSOR_MODE_NORMAL); |
477 | - status_changed(session,LIB3270_STATUS_BLANK); | |
491 | + status_changed(session,LIB3270_MESSAGE_NONE); | |
478 | 492 | } |
479 | 493 | |
480 | 494 | session->display(session); |
... | ... | @@ -503,8 +517,7 @@ void status_changed(H3270 *session, LIB3270_STATUS id) |
503 | 517 | |
504 | 518 | session->oia_status = id; |
505 | 519 | |
506 | - if(session->update_status) | |
507 | - session->update_status(session,id); | |
520 | + session->update_status(session,id); | |
508 | 521 | } |
509 | 522 | |
510 | 523 | void status_twait(H3270 *session) | ... | ... |
src/lib3270/selection.c
... | ... | @@ -378,7 +378,7 @@ static char * get_text(H3270 *hSession,unsigned char all) |
378 | 378 | size_t buflen = (hSession->rows * (hSession->cols+1))+1; |
379 | 379 | size_t sz = 0; |
380 | 380 | |
381 | - if(!lib3270_connected(hSession)) | |
381 | + if(!(lib3270_connected(hSession) && hSession->text)) | |
382 | 382 | return NULL; |
383 | 383 | |
384 | 384 | ret = lib3270_malloc(buflen); | ... | ... |
src/lib3270/session.c
... | ... | @@ -160,7 +160,7 @@ static void screen_disp(H3270 *session) |
160 | 160 | screen_update(session,0,session->rows*session->cols); |
161 | 161 | } |
162 | 162 | |
163 | -static void set_width(H3270 *session, int width) | |
163 | +static void nop_int(H3270 *session, int width) | |
164 | 164 | { |
165 | 165 | return; |
166 | 166 | } |
... | ... | @@ -194,7 +194,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model) |
194 | 194 | hSession->message = message; |
195 | 195 | hSession->update_ssl = update_ssl; |
196 | 196 | hSession->display = screen_disp; |
197 | - hSession->set_width = set_width; | |
197 | + hSession->set_width = nop_int; | |
198 | + hSession->update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int; | |
199 | + hSession->autostart = nop; | |
198 | 200 | |
199 | 201 | // Set the defaults. |
200 | 202 | hSession->extended = 1; |
... | ... | @@ -425,7 +427,11 @@ void check_session_handle(H3270 **hSession) |
425 | 427 | |
426 | 428 | *hSession = lib3270_get_default_session_handle(); |
427 | 429 | |
430 | +#ifdef ANDROID | |
431 | + __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s called with empty session\n", __FUNCTION__); | |
432 | +#else | |
428 | 433 | lib3270_write_log(*hSession,"%s called with empty session",__FUNCTION__); |
434 | +#endif // ANDROID | |
429 | 435 | } |
430 | 436 | |
431 | 437 | LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) | ... | ... |
src/lib3270/telnet.c
... | ... | @@ -1300,9 +1300,11 @@ static int telnet_fsm(H3270 *hSession, unsigned char c) |
1300 | 1300 | hSession->ns_rrcvd++; |
1301 | 1301 | if (process_eor(hSession)) |
1302 | 1302 | return -1; |
1303 | - } else | |
1303 | + } | |
1304 | + else | |
1305 | + { | |
1304 | 1306 | Warning(hSession, _( "EOR received when not in 3270 mode, ignored." )); |
1305 | - | |
1307 | + } | |
1306 | 1308 | trace_dsn(hSession,"RCVD EOR\n"); |
1307 | 1309 | hSession->ibptr = hSession->ibuf; |
1308 | 1310 | hSession->telnet_state = TNS_DATA; |
... | ... | @@ -1900,6 +1902,7 @@ static void process_bind(H3270 *hSession, unsigned char *buf, int buflen) |
1900 | 1902 | static int |
1901 | 1903 | process_eor(H3270 *hSession) |
1902 | 1904 | { |
1905 | + trace("%s: syncing=%s",__FUNCTION__,hSession->syncing ? "Yes" : "No"); | |
1903 | 1906 | if (hSession->syncing || !(hSession->ibptr - hSession->ibuf)) |
1904 | 1907 | return(0); |
1905 | 1908 | ... | ... |
... | ... | @@ -0,0 +1,98 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como common.h e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | +#ifndef COMMON_H_INCLUDED | |
31 | + | |
32 | + #define COMMON_H_INCLUDED 1 | |
33 | + | |
34 | + // "PW" Standards | |
35 | + #include <gtk/gtk.h> | |
36 | + #include <errno.h> | |
37 | + #include <lib3270/config.h> | |
38 | + | |
39 | + #ifdef WIN32 | |
40 | + | |
41 | + #include <windows.h> | |
42 | + #define WIN_REGISTRY_ENABLED 1 | |
43 | + | |
44 | + #ifndef KEY_WOW64_64KEY | |
45 | + #define KEY_WOW64_64KEY 0x0100 | |
46 | + #endif // KEY_WOW64_64KEY | |
47 | + | |
48 | + #ifndef KEY_WOW64_32KEY | |
49 | + #define KEY_WOW64_32KEY 0x0200 | |
50 | + #endif // KEY_WOW64_64KEY | |
51 | + | |
52 | + #endif // WIN32 | |
53 | + | |
54 | + #define ENABLE_NLS | |
55 | + | |
56 | + #ifndef GETTEXT_PACKAGE | |
57 | + #define GETTEXT_PACKAGE PACKAGE_NAME | |
58 | + #endif | |
59 | + | |
60 | + #include <libintl.h> | |
61 | + #include <glib/gi18n.h> | |
62 | + #include <gtk/gtk.h> | |
63 | + | |
64 | + #if defined( DEBUG ) | |
65 | + #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr); | |
66 | + #else | |
67 | + #define trace(x, ...) /* */ | |
68 | + #endif | |
69 | + | |
70 | + // Configuration | |
71 | + void configuration_init(void); | |
72 | + void configuration_deinit(void); | |
73 | + | |
74 | + gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def); | |
75 | + gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def); | |
76 | + gint get_integer_from_config(const gchar *group, const gchar *key, gint def); | |
77 | + | |
78 | + void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...); | |
79 | + void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val); | |
80 | + void set_integer_to_config(const gchar *group, const gchar *key, gint val); | |
81 | + | |
82 | + gchar * build_data_filename(const gchar *first_element, ...); | |
83 | + gchar * filename_from_va(const gchar *first_element, va_list args); | |
84 | + | |
85 | + void save_window_to_config(const gchar *group, const gchar *key, GtkWidget *hwnd); | |
86 | + void restore_window_from_config(const gchar *group, const gchar *key, GtkWidget *hwnd); | |
87 | + | |
88 | +#ifdef WIN_REGISTRY_ENABLED | |
89 | + gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired); | |
90 | + void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data); | |
91 | + void registry_set_double(HKEY hKey, const gchar *key, gdouble value); | |
92 | + gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value); | |
93 | +#else | |
94 | + GKeyFile * get_application_keyfile(void); | |
95 | +#endif // WIN_REGISTRY_ENABLED | |
96 | + | |
97 | + | |
98 | +#endif | ... | ... |
src/pw3270/common/common.h.in
... | ... | @@ -1,100 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | - * | |
21 | - * Este programa está nomeado como common.h e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - */ | |
29 | - | |
30 | -#ifndef COMMON_H_INCLUDED | |
31 | - | |
32 | - #define COMMON_H_INCLUDED 1 | |
33 | - | |
34 | - // "PW" Standards | |
35 | - #include <gtk/gtk.h> | |
36 | - #include <errno.h> | |
37 | - | |
38 | - #ifdef WIN32 | |
39 | - | |
40 | - #include <windows.h> | |
41 | - #define WIN_REGISTRY_ENABLED 1 | |
42 | - | |
43 | - #ifndef KEY_WOW64_64KEY | |
44 | - #define KEY_WOW64_64KEY 0x0100 | |
45 | - #endif // KEY_WOW64_64KEY | |
46 | - | |
47 | - #ifndef KEY_WOW64_32KEY | |
48 | - #define KEY_WOW64_32KEY 0x0200 | |
49 | - #endif // KEY_WOW64_64KEY | |
50 | - | |
51 | - #endif // WIN32 | |
52 | - | |
53 | - #ifndef PACKAGE_NAME | |
54 | - #define PACKAGE_NAME "@PACKAGE_NAME@" | |
55 | - #endif | |
56 | - | |
57 | - #define ENABLE_NLS | |
58 | - | |
59 | - #ifndef GETTEXT_PACKAGE | |
60 | - #define GETTEXT_PACKAGE PACKAGE_NAME | |
61 | - #endif | |
62 | - | |
63 | - #include <libintl.h> | |
64 | - #include <glib/gi18n.h> | |
65 | - #include <gtk/gtk.h> | |
66 | - | |
67 | - #if defined( DEBUG ) | |
68 | - #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr); | |
69 | - #else | |
70 | - #define trace(x, ...) /* */ | |
71 | - #endif | |
72 | - | |
73 | - // Configuration | |
74 | - void configuration_init(void); | |
75 | - void configuration_deinit(void); | |
76 | - | |
77 | - gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def); | |
78 | - gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def); | |
79 | - gint get_integer_from_config(const gchar *group, const gchar *key, gint def); | |
80 | - | |
81 | - void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...); | |
82 | - void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val); | |
83 | - void set_integer_to_config(const gchar *group, const gchar *key, gint val); | |
84 | - | |
85 | - gchar * build_data_filename(const gchar *first_element, ...); | |
86 | - gchar * filename_from_va(const gchar *first_element, va_list args); | |
87 | - | |
88 | - void save_window_to_config(const gchar *group, const gchar *key, GtkWidget *hwnd); | |
89 | - void restore_window_from_config(const gchar *group, const gchar *key, GtkWidget *hwnd); | |
90 | - | |
91 | -#ifdef WIN_REGISTRY_ENABLED | |
92 | - gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired); | |
93 | - void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data); | |
94 | - void registry_set_double(HKEY hKey, const gchar *key, gdouble value); | |
95 | - gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value); | |
96 | -#else | |
97 | - GKeyFile * get_application_keyfile(void); | |
98 | -#endif // WIN_REGISTRY_ENABLED | |
99 | - | |
100 | -#endif |
src/pw3270/main.c
... | ... | @@ -42,7 +42,6 @@ |
42 | 42 | |
43 | 43 | #ifdef HAVE_GTKMAC |
44 | 44 | GtkOSXApplication * osxapp = NULL; |
45 | - GtkMacBundle * macbundle = NULL; | |
46 | 45 | #endif // HAVE_GTKMAC |
47 | 46 | |
48 | 47 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
... | ... | @@ -149,15 +148,13 @@ int main(int argc, char *argv[]) |
149 | 148 | } |
150 | 149 | #elif defined(HAVE_GTKMAC) |
151 | 150 | { |
152 | - osxapp = GTK_OSX_APPLICATION(g_object_new(GTK_TYPE_OSX_APPLICATION,NULL)); | |
153 | - | |
154 | - macbundle = gtk_mac_bundle_get_default(); | |
155 | - if(!macbundle) | |
156 | - macbundle = gtk_mac_bundle_new(); | |
151 | + GtkMacBundle * macbundle = gtk_mac_bundle_get_default(); | |
157 | 152 | |
158 | 153 | g_chdir(gtk_mac_bundle_get_datadir(macbundle)); |
159 | 154 | bindtextdomain(PACKAGE_NAME,gtk_mac_bundle_get_localedir(macbundle)); |
160 | - | |
155 | + | |
156 | + osxapp = GTK_OSX_APPLICATION(g_object_new(GTK_TYPE_OSX_APPLICATION,NULL)); | |
157 | + | |
161 | 158 | } |
162 | 159 | #elif defined( DATAROOTDIR ) |
163 | 160 | { | ... | ... |
src/pw3270/v3270/mouse.c
... | ... | @@ -273,7 +273,7 @@ void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, Gt |
273 | 273 | action_scroll[((int) direction) & 0x03] = action; |
274 | 274 | } |
275 | 275 | |
276 | -gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer user_data) | |
276 | +gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event) | |
277 | 277 | { |
278 | 278 | v3270 * terminal = GTK_V3270(widget); |
279 | 279 | ... | ... |
src/pw3270/v3270/private.h
... | ... | @@ -254,6 +254,6 @@ gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event); |
254 | 254 | gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event); |
255 | 255 | void v3270_emit_popup(v3270 *widget, int baddr, GdkEventButton *event); |
256 | 256 | gint v3270_get_offset_at_point(v3270 *widget, gint x, gint y); |
257 | -gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer user_data); | |
257 | +gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event); | |
258 | 258 | |
259 | 259 | G_END_DECLS | ... | ... |