Commit d39e8d2effeccbfdbe7a5121b86716f05770565d

Authored by perry.werneck@gmail.com
1 parent 0d7ac68c

Corrigindo tratamento da tecla F10

src/include/pw3270.h
... ... @@ -42,15 +42,6 @@
42 42 #include <gtk/gtk.h>
43 43 #include <lib3270.h>
44 44  
45   - // Trace
46   - #include <stdio.h>
47   -
48   - #if defined( DEBUG )
49   - #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr);
50   - #else
51   - #define trace(x, ...) /* */
52   - #endif
53   -
54 45 // Error management
55 46 #include <errno.h>
56 47  
... ...
src/lib3270/api.h
... ... @@ -88,16 +88,6 @@
88 88 #define CN ((char *) NULL)
89 89 #endif
90 90  
91   - /* Debug & log */ /*
92   - #if defined( DEBUG )
93   - #define Trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr);
94   - #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr);
95   - #elif !defined(Trace)
96   - #define Trace( fmt, ... ) // __VA_ARGS__
97   - #define trace( fmt, ... ) // __VA_ARGS__
98   - #endif
99   -*/
100   -
101 91 #include <lib3270/log.h>
102 92  
103 93 // #define WriteLog(module,fmt, ...) lib3270_write_log(NULL,module,fmt,__VA_ARGS__)
... ...
src/lib3270/ft.c
... ... @@ -207,7 +207,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
207 207  
208 208 unsigned int flen;
209 209  
210   -// Trace("%s(%s)",__FUNCTION__,local);
  210 +// trace("%s(%s)",__FUNCTION__,local);
211 211 if(!lib3270_connected(session))
212 212 {
213 213 *msg = N_( "Disconnected from host" );
... ... @@ -331,7 +331,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
331 331 return NULL;
332 332 }
333 333  
334   - Trace("Command: \"%s\"",buffer);
  334 + trace("Command: \"%s\"",buffer);
335 335  
336 336 (void) lib3270_emulate_input(NULL, buffer, strlen(buffer), False);
337 337  
... ...
src/lib3270/glue.c
... ... @@ -119,7 +119,7 @@ static void initialize(void)
119 119  
120 120 #ifdef DEBUG
121 121 init_calls++;
122   - Trace("Initializing library (calls: %d)",init_calls);
  122 + trace("Initializing library (calls: %d)",init_calls);
123 123 #endif
124 124  
125 125 h3270.selected = 0;
... ... @@ -130,7 +130,7 @@ static void initialize(void)
130 130 (void) get_version_info();
131 131 #endif
132 132  
133   - Trace("%s (init_calls: %d)",__FUNCTION__,init_calls);
  133 + trace("%s (init_calls: %d)",__FUNCTION__,init_calls);
134 134  
135 135 /* Set the defaults. */
136 136 // appres.mono = False;
... ...
src/lib3270/paste.c
... ... @@ -155,7 +155,7 @@
155 155  
156 156 if(BA_TO_ROW(session->cursor_addr) != data->row)
157 157 {
158   - Trace("Row changed from %d to %d",data->row,BA_TO_ROW(session->cursor_addr));
  158 + trace("Row changed from %d to %d",data->row,BA_TO_ROW(session->cursor_addr));
159 159 if(!remargin(session,data->orig_col))
160 160 return 0;
161 161 data->row = BA_TO_ROW(session->cursor_addr);
... ...
src/lib3270/screenc.h
... ... @@ -51,21 +51,6 @@ LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols);
51 51  
52 52 LIB3270_INTERNAL Boolean escaped;
53 53  
54   -/*
55   -LIB3270_INTERNAL void Escape_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated));
56   -LIB3270_INTERNAL void Help_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated));
57   -LIB3270_INTERNAL void Redraw_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated));
58   -LIB3270_INTERNAL void Trace_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated));
59   -LIB3270_INTERNAL void Show_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated));
60   -*/
61   -
62   -/*
63   -#if defined(WC3270)
64   -LIB3270_INTERNAL void Paste_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated));
65   -LIB3270_INTERNAL void Title_action(Widget w, XEvent *event, String *params, Cardinal *num_params) __attribute__ ((deprecated));
66   -LIB3270_INTERNAL int windows_cp;
67   -#endif
68   -*/
69 54  
70 55 LIB3270_INTERNAL void screen_title(char *text);
71 56  
... ...
src/lib3270/utf8.c
... ... @@ -337,156 +337,6 @@ static char *utf8_tab[U_MAX][96] = {
337 337 };
338 338  
339 339 /*
340   - * Save the codeset from the locale, and set globals based on known values.
341   - */ /*
342   -void
343   -set_codeset(char *codeset_name)
344   -{
345   - char *new_codeset;
346   -
347   -#if defined(X3270_DBCS)
348   - is_gb18030 = !strcasecmp(codeset_name, "gb18030");
349   -#endif
350   -
351   -#if !defined(TCL3270)
352   - is_utf8 = (!strcasecmp(codeset_name, "utf-8") ||
353   - !strcasecmp(codeset_name, "utf8") ||
354   - !strcasecmp(codeset_name, "utf_8"));
355   -#else
356   - //
357   - // tcl3270 is always in UTF-8 mode, because it needs to
358   - // supply UTF-8 strings to libtcl.
359   - //
360   - is_utf8 = 1;
361   -#endif
362   -
363   - Trace("%s locale_codeset: %p new_codeset: %p (%s)",__FUNCTION__,locale_codeset,codeset_name,codeset_name);
364   - new_codeset = NewString(codeset_name);
365   - Replace(locale_codeset, new_codeset);
366   - Trace("%s",__FUNCTION__);
367   -}
368   -*/
369   -
370   -/*
371   - * Set globals based on an x3270 character set list.
372   - *
373   - * This defines the 'implied' 8-bit character set for code points 0xa0..0xff,
374   - * used by utf8_expand() below.
375   - *
376   - * set_codeset, above, must be called _before_ this function.
377   - */ /*
378   -Boolean
379   -utf8_set_display_charsets(char *cslist, char *csname)
380   -{
381   - char *dup;
382   - char *ptr;
383   - char *tok;
384   - int i;
385   -
386   - utf8_ix = -1;
387   -
388   -#if defined(X3270_DBCS)
389   - if (strchr(cslist, '+') != CN)
390   - dbcs = True;
391   -#endif
392   -
393   - if (!is_utf8) {
394   -#if defined(X3270_DBCS)
395   - if (is_gb18030) {
396   - //
397   - // A convenient lie.
398   - // If the locale is GB18030, use the UTF-8
399   - // expansion mechanism to translate 0xa0 through
400   - // 0xff, using a table entry that expands to GB18030
401   - // multi-byte sequences rather than UTF-8.
402   - //
403   - // Note that there appears to be a bug in ncursesw
404   - // (or something it depends on) that turns these
405   - // characters into garbage. Hopefully this bug will
406   - // be fixed and this code will start working properly.
407   - //
408   - // As a workarond, everything works properly in a
409   - // Chinese UTF-8 locale.
410   - //
411   - utf8_ix = PSEUDO_GB18030;
412   - }
413   -#endif
414   - return True;
415   - }
416   -
417   -#if defined(X3270_DBCS)
418   - // For DBCS, map 0xa0..0xff as Latin-1.
419   - if (dbcs) {
420   - utf8_ix = U_ISO8859_1;
421   - return True;
422   - }
423   -#endif
424   -
425   - // Skip 3270cg sets.
426   - ptr = dup = NewString(cslist);
427   - while ((tok = strtok(ptr, ",")) != CN) {
428   - ptr = NULL;
429   - if (!strncasecmp(tok, "3270cg", 6))
430   - continue;
431   - break;
432   - }
433   - if (tok == CN) {
434   - popup_an_error(NULL,"Invalid displayCharset specification");
435   - lib3270_free(dup);
436   - return False;
437   - }
438   -
439   - // Look up the charset.
440   - for (i = 0; dcs[i] != CN; i++) {
441   - if (!strcasecmp(dcs[i], tok))
442   - break;
443   - }
444   - if (dcs[i] == CN) {
445   - popup_an_error(NULL,"Unknown displayCharset specification '%s'",
446   - csname);
447   - lib3270_free(dup);
448   - return False;
449   - }
450   - utf8_ix = i;
451   - lib3270_free(dup);
452   - return True;
453   -}
454   -*/
455   -/* Expand an 8-bit character in the 'implied' character set. */
456   -/*
457   -char * utf8_expand(unsigned char c)
458   -{
459   - static char nox[2];
460   -
461   - if (c & 0x80)
462   - {
463   - if (utf8_ix >= 0)
464   - {
465   - if (c >= 0xa0)
466   - return utf8_tab[utf8_ix][c - 0xa0];
467   - else
468   - return " ";
469   - }
470   -#if defined(X3270_DBCS)
471   - else if (dbcs)
472   - {
473   - //
474   - // GB18030 it treated as a special case of UTF-8,
475   - // above. GB2312 does not support these characters.
476   - // Other DBCS encodings will need to be added as they
477   - // are better understood.
478   - //
479   - return " ";
480   - }
481   -#endif
482   - }
483   - nox[0] = c;
484   - nox[1] = '\0';
485   - return nox;
486   -}
487   -*/
488   -
489   -/*
490 340 * Look up a multi-byte UTF-8 string and return its value in the 'implied'
491 341 * character set.
492 342 * Returns 0 if the lookup fails.
... ... @@ -496,42 +346,5 @@ unsigned char utf8_lookup(char *mbs, enum ulfail *fail, int *consumed)
496 346 if (fail != NULL)
497 347 *fail = ULFAIL_NOUTF8;
498 348  
499   -/*
500   - int i;
501   - int mblen = strlen(mbs);
502   -
503   - if (utf8_ix < 0)
504   - {
505   - if (fail != NULL)
506   - *fail = ULFAIL_NOUTF8;
507   - return 0;
508   - }
509   -
510   - for (i = 0; i < HI_SIZE; i++)
511   - {
512   - int tlen = strlen(utf8_tab[utf8_ix][i]);
513   -
514   - // Check for dummy " " entry.
515   - if (tlen == 1)
516   - continue;
517   -
518   - // Check for incomplete string.
519   - if (mblen < tlen)
520   - {
521   - if (fail != NULL)
522   - *fail = ULFAIL_INCOMPLETE;
523   - return 0;
524   - }
525   -
526   - if (!strncmp(mbs, utf8_tab[utf8_ix][i], tlen))
527   - {
528   - if (consumed != NULL)
529   - *consumed = tlen;
530   - return 0xa0 + i;
531   - }
532   - }
533   - if (fail != NULL)
534   - *fail = ULFAIL_INVALID;
535   -*/
536 349 return 0;
537 350 }
... ...
src/pw3270/main.c
... ... @@ -137,7 +137,6 @@ int main(int argc, char *argv[])
137 137 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
138 138 textdomain(PACKAGE_NAME);
139 139  
140   -
141 140 // Process command-line options
142 141 {
143 142 static const GOptionEntry app_options[] =
... ... @@ -188,8 +187,14 @@ int main(int argc, char *argv[])
188 187 rc = initialize();
189 188 if(!rc)
190 189 {
  190 + GtkSettings *settings = gtk_settings_get_default();
191 191 configuration_init();
192 192  
  193 + if(settings)
  194 + {
  195 + gtk_settings_set_string_property(settings,"gtk-menu-bar-accel","Menu","");
  196 + }
  197 +
193 198 toplevel = pw3270_new(host);
194 199  
195 200 toplevel_setup(GTK_WINDOW(toplevel));
... ...
src/pw3270/v3270/accessible.c
... ... @@ -37,7 +37,7 @@
37 37 #include <glib/gi18n.h>
38 38  
39 39 #include <pw3270.h>
40   -// #include <malloc.h>
  40 + #include <lib3270/log.h>
41 41 #include "v3270.h"
42 42 #include "private.h"
43 43 #include "accessible.h"
... ...
src/pw3270/v3270/keyboard.c
... ... @@ -33,6 +33,7 @@
33 33 #include <pw3270.h>
34 34 #include <lib3270.h>
35 35 #include <lib3270/actions.h>
  36 + #include <lib3270/log.h>
36 37 #include <gtk/gtk.h>
37 38 #include <string.h>
38 39 #include <gdk/gdk.h>
... ... @@ -138,6 +139,9 @@
138 139 if(event->keyval >= GDK_F1 && event->keyval <= GDK_F12 && !(state & (GDK_CONTROL_MASK|GDK_ALT_MASK)))
139 140 {
140 141 int pfcode = (event->keyval - GDK_F1) + ((state & GDK_SHIFT_MASK) ? 13 : 1);
  142 +
  143 + trace("PF%02d",pfcode);
  144 +
141 145 if(pfcode > 0 && pfcode < 25)
142 146 {
143 147 lib3270_pfkey(widget->host,pfcode);
... ...
src/pw3270/v3270/mouse.c
... ... @@ -34,6 +34,7 @@
34 34 #include "private.h"
35 35 #include <lib3270/selection.h>
36 36 #include <lib3270/actions.h>
  37 + #include <lib3270/log.h>
37 38  
38 39 /*--[ Implement ]------------------------------------------------------------------------------------*/
39 40  
... ...
src/pw3270/v3270/oia.c
... ... @@ -30,6 +30,7 @@
30 30 #include <pw3270.h>
31 31 #include <lib3270.h>
32 32 #include <lib3270/session.h>
  33 + #include <lib3270/log.h>
33 34 #include <lib3270/config.h>
34 35 #include <gtk/gtk.h>
35 36 #include <string.h>
... ...
src/pw3270/v3270/selection.c
... ... @@ -29,10 +29,10 @@
29 29  
30 30 #include <gtk/gtk.h>
31 31 #include <pw3270.h>
32   -// #include <malloc.h>
33 32 #include "v3270.h"
34 33 #include "private.h"
35 34 #include <lib3270/selection.h>
  35 + #include <lib3270/log.h>
36 36  
37 37 /*--[ Globals ]--------------------------------------------------------------------------------------*/
38 38  
... ... @@ -52,7 +52,6 @@
52 52 static void clipboard_clear(GtkClipboard *clipboard, GObject *obj)
53 53 {
54 54 trace("%s widget=%p",__FUNCTION__,obj);
55   -
56 55 }
57 56  
58 57 static void clipboard_get(GtkClipboard *clipboard, GtkSelectionData *selection, guint target, GObject *obj)
... ...
src/pw3270/v3270/widget.c
... ... @@ -39,6 +39,12 @@
39 39 #include "accessible.h"
40 40 #include "marshal.h"
41 41  
  42 +#if GTK_CHECK_VERSION(3,0,0)
  43 + #include <gdk/gdkkeysyms-compat.h>
  44 +#else
  45 + #include <gdk/gdkkeysyms.h>
  46 +#endif
  47 +
42 48 #define WIDTH_IN_PIXELS(terminal,x) (x * cols)
43 49 #define HEIGHT_IN_PIXELS(terminal,x) (x * (rows+1))
44 50  
... ... @@ -264,6 +270,10 @@ static void v3270_class_init(v3270Class *klass)
264 270 {
265 271 GObjectClass * gobject_class = G_OBJECT_CLASS(klass);
266 272 GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass);
  273 + GtkBindingSet * binding = gtk_binding_set_by_class(klass);
  274 +
  275 + // Setup widget key bindings
  276 + gtk_binding_entry_skip(binding,GDK_F10,0);
267 277  
268 278 lib3270_set_log_handler(loghandler);
269 279  
... ...
src/pw3270/window.c
... ... @@ -151,6 +151,7 @@
151 151 GObjectClass * gobject_class = G_OBJECT_CLASS(klass);
152 152 GtkWidgetClass * widget_class = GTK_WIDGET_CLASS(klass);
153 153  
  154 +
154 155 #if GTK_CHECK_VERSION(3,0,0)
155 156 widget_class->destroy = pw3270_destroy;
156 157 #else
... ...