diff --git a/src/gtk/v3270/oia.c b/src/gtk/v3270/oia.c index 8c1c7aa..9e974c9 100644 --- a/src/gtk/v3270/oia.c +++ b/src/gtk/v3270/oia.c @@ -196,6 +196,30 @@ static void setup_single_char_right(GdkRectangle *rect, struct v3270_metrics *me } +static void setup_insert_position(GdkRectangle *rect, struct v3270_metrics *metrics, cairo_t *cr, H3270 *host, int cols, GdkColor *color) +{ + if(rect->width > rect->height) + { + rect->width = rect->height; + } + else if(rect->height > rect->width) + { + rect->y += (rect->height - rect->width)/2; + rect->height = rect->width; + } + + rect->x -= rect->width; + +#ifdef DEBUG + cairo_set_source_rgb(cr,0.1,0.1,0.1); + cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); + cairo_fill(cr); +#endif + +} + + + static void setup_double_char_position(GdkRectangle *rect, struct v3270_metrics *metrics, cairo_t *cr, H3270 *host, int cols, GdkColor *color) { rect->width <<= 1; @@ -429,6 +453,9 @@ static void draw_insert(cairo_t *cr, H3270 *host, GdkColor *color, GdkRectangle { double y = rect->y+(rect->height-2); + cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); + cairo_clip(cr); + gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_FOREGROUND); cairo_move_to(cr,rect->x,y); @@ -453,7 +480,7 @@ void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, struct v3270_me { V3270_OIA_LUNAME, setup_luname_position }, { V3270_OIA_PRINTER, setup_single_char_right }, { V3270_OIA_SCRIPT, setup_single_char_right }, - { V3270_OIA_INSERT, setup_single_char_right }, + { V3270_OIA_INSERT, setup_insert_position }, { V3270_OIA_TYPEAHEAD, setup_single_char_right }, { V3270_OIA_SHIFT, setup_double_char_position }, { V3270_OIA_CAPS, setup_single_char_right }, diff --git a/src/include/lib3270/popup.h b/src/include/lib3270/popup.h index 7b1eade..479349f 100644 --- a/src/include/lib3270/popup.h +++ b/src/include/lib3270/popup.h @@ -44,7 +44,7 @@ } LIB3270_NOTIFY; LIB3270_EXPORT void lib3270_set_popup_handler(int (*popup_handler)(H3270 *, LIB3270_NOTIFY, const char *, const char *, const char *, va_list)); - LIB3270_EXPORT lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); + LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); #endif // LIB3270_POPUP_INCLUDED diff --git a/src/include/lib3270/selection.h b/src/include/lib3270/selection.h index 30b07ca..54bea54 100644 --- a/src/include/lib3270/selection.h +++ b/src/include/lib3270/selection.h @@ -49,7 +49,7 @@ * @return Non 0 if there's more to paste with lib3270_pastenext * */ - LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str); + LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str); /** * Paste remaining string. diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h index eb6c4a7..b17fa50 100644 --- a/src/include/lib3270/session.h +++ b/src/include/lib3270/session.h @@ -55,81 +55,89 @@ unsigned short attr; /**< Converted character attribute (color & etc) */ }; + struct lib3270_toggle + { + char value; /**< toggle value */ + void (*upcall)(H3270 *, struct lib3270_toggle *, LIB3270_TOGGLE_TYPE); /**< change value */ + }; + struct _h3270 { - unsigned short sz; /**< Struct size */ + unsigned short sz; /**< Struct size */ // Connection info - int secure_connection; - int sock; /**< Network socket */ - int net_sock; - LIB3270_CSTATE cstate; /**< Connection state */ + int secure_connection; + int sock; /**< Network socket */ + int net_sock; + LIB3270_CSTATE cstate; /**< Connection state */ - #if defined(_WIN32) /*[*/ - HANDLE sock_handle; - #endif /*]*/ + #if defined(_WIN32) + HANDLE sock_handle; + #endif // flags - int selected : 1; + int selected : 1; + + struct lib3270_toggle toggle[LIB3270_TOGGLE_COUNT]; // Network & Termtype - char * hostname; - char * connected_type; - char * connected_lu; - char luname[LIB3270_LUNAME_LENGTH+1]; + char * hostname; + char * connected_type; + char * connected_lu; + char luname[LIB3270_LUNAME_LENGTH+1]; - char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1]; - char * model_name; - int model_num; - char * termtype; + char full_model_name[LIB3270_FULL_MODEL_NAME_LENGTH+1]; + char * model_name; + int model_num; + char * termtype; - char * current_host; /**< the hostname part, stripped of qualifiers, luname and port number */ - char * full_current_host; /**< the entire string, for use in reconnecting */ - char * reconnect_host; - char * qualified_host; - char auto_reconnect_inprogress; + char * current_host; /**< the hostname part, stripped of qualifiers, luname and port number */ + char * full_current_host; /**< the entire string, for use in reconnecting */ + char * reconnect_host; + char * qualified_host; + char auto_reconnect_inprogress; - LIB3270_MESSAGE oia_status; + LIB3270_MESSAGE oia_status; - unsigned char oia_flag[LIB3270_FLAG_COUNT]; + unsigned char oia_flag[LIB3270_FLAG_COUNT]; - unsigned short current_port; + unsigned short current_port; // screen info - char * charset; - int ov_rows; - int ov_cols; - int maxROWS; - int maxCOLS; - unsigned short rows; - unsigned short cols; - int cursor_addr; - int buffer_addr; - char flipped; - int screen_alt; /**< alternate screen? */ - int is_altbuffer; - - int formatted; /**< set in screen_disp */ + char * charset; + int ov_rows; + int ov_cols; + int maxROWS; + int maxCOLS; + unsigned short rows; + unsigned short cols; + int cursor_addr; + int buffer_addr; + char flipped; + int screen_alt; /**< alternate screen? */ + int is_altbuffer; + + int formatted; /**< set in screen_disp */ // Screen contents - void * buffer[2]; /**< Internal buffers */ - struct ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */ - struct ea * aea_buf; /** alternate 3270 extended attribute buffer */ - struct lib3270_text * text; /**< Converted 3270 chars */ + void * buffer[2]; /**< Internal buffers */ + struct ea * ea_buf; /**< 3270 device buffer. ea_buf[-1] is the dummy default field attribute */ + struct ea * aea_buf; /** alternate 3270 extended attribute buffer */ + struct lib3270_text * text; /**< Converted 3270 chars */ // host.c - char std_ds_host; - char no_login_host; - char non_tn3270e_host; - char passthru_host; - char ssl_host; - char ever_3270; + char std_ds_host; + char no_login_host; + char non_tn3270e_host; + char passthru_host; + char ssl_host; + char ever_3270; // Widget info - void * widget; + void * widget; // selection - char * paste_buffer; + char * paste_buffer; struct { int begin; @@ -137,10 +145,10 @@ } select; // xio - unsigned long ns_read_id; - unsigned long ns_exception_id; - char reading; - char excepting; + unsigned long ns_read_id; + unsigned long ns_exception_id; + char reading; + char excepting; // State change callbacks. struct lib3270_state_callback *st_callbacks[LIB3270_STATE_USER]; diff --git a/src/lib3270/ansi.c b/src/lib3270/ansi.c index 5530fef..0edae4f 100644 --- a/src/lib3270/ansi.c +++ b/src/lib3270/ansi.c @@ -1825,7 +1825,7 @@ ansi_send_pa(int nn) net_sends(fn_buf); } -void toggle_lineWrap(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE type unused) +void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type unused) { if (toggled(LIB3270_TOGGLE_LINE_WRAP)) wraparound_mode = 1; diff --git a/src/lib3270/ansic.h b/src/lib3270/ansic.h index 21343a2..9a2c19e 100644 --- a/src/lib3270/ansic.h +++ b/src/lib3270/ansic.h @@ -29,7 +29,7 @@ LIB3270_INTERNAL void ansi_send_pa(int nn); LIB3270_INTERNAL void ansi_send_pf(int nn); LIB3270_INTERNAL void ansi_send_right(void); LIB3270_INTERNAL void ansi_send_up(void); -LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE type); +LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE type); #else /*][*/ diff --git a/src/lib3270/appres.h b/src/lib3270/appres.h index cd36ff0..f3c13f8 100644 --- a/src/lib3270/appres.h +++ b/src/lib3270/appres.h @@ -24,18 +24,21 @@ /* Toggles */ +/* struct toggle { - char value; /* toggle value */ -// char changed; /* has the value changed since init */ -// Widget w[2]; /* the menu item widgets */ -// const char *label[2]; /* labels */ - void (*upcall)(H3270 *, struct toggle *, LIB3270_TOGGLE_TYPE); /* change value */ + char value; // toggle value +// char changed; // has the value changed since init +// Widget w[2]; // the menu item widgets +// const char *label[2]; // labels + void (*upcall)(H3270 *, struct toggle *, LIB3270_TOGGLE_TYPE); // change value // void (*callback)(H3270 *, int, LIB3270_TOGGLE_TYPE); }; -#define toggled(ix) (appres.toggle[ix].value) // #define toggle_toggle(t) { (t)->value = !(t)->value; } +*/ + +#define toggled(ix) lib3270_get_toggle(NULL,ix) /* Application resources */ @@ -184,7 +187,7 @@ typedef struct { char *proxy; /* Toggles */ - struct toggle toggle[N_TOGGLES]; +// struct toggle toggle[N_TOGGLES]; /* #if defined(X3270_DISPLAY) // Simple widget resources @@ -234,4 +237,4 @@ extern AppRes appres; #define N_( x ) x #define MSG_( c, s ) s -void toggle_rectselect(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt); +void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c index c111fcc..f3a0793 100644 --- a/src/lib3270/ctlr.c +++ b/src/lib3270/ctlr.c @@ -2798,30 +2798,9 @@ static void ticking_stop(H3270 *session) } /* -void toggle_showTiming(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) -{ - if (!toggled(SHOW_TIMING)) - status_untiming(&h3270); -} -*/ - - -/* * No-op toggle. */ -void -toggle_nop(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) +void toggle_nop(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused) { } -/* -int ctlr_get_rows(void) -{ - return h3270.rows; -} - -int ctlr_get_cols(void) -{ - return h3270.cols; -} -*/ diff --git a/src/lib3270/ctlrc.h b/src/lib3270/ctlrc.h index c869462..2a5b71c 100644 --- a/src/lib3270/ctlrc.h +++ b/src/lib3270/ctlrc.h @@ -62,18 +62,18 @@ LIB3270_INTERNAL void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ov LIB3270_INTERNAL void ctlr_erase(H3270 *session, int alt); LIB3270_INTERNAL void ticking_start(H3270 *session, Boolean anyway); -LIB3270_INTERNAL void toggle_nop(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE tt); -LIB3270_INTERNAL void toggle_showTiming(struct toggle *t, LIB3270_TOGGLE_TYPE tt); +LIB3270_INTERNAL void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); +LIB3270_INTERNAL void toggle_showTiming(struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); enum dbcs_state { DBCS_NONE = 0, /* position is not DBCS */ - DBCS_LEFT, /* position is left half of DBCS character */ - DBCS_RIGHT, /* position is right half of DBCS character */ - DBCS_SI, /* position is SI terminating DBCS subfield */ - DBCS_SB, /* position is SBCS character after the SI */ + DBCS_LEFT, /* position is left half of DBCS character */ + DBCS_RIGHT, /* position is right half of DBCS character */ + DBCS_SI, /* position is SI terminating DBCS subfield */ + DBCS_SB, /* position is SBCS character after the SI */ DBCS_LEFT_WRAP, /* position is left half of split DBCS */ DBCS_RIGHT_WRAP, /* position is right half of split DBCS */ - DBCS_DEAD /* position is dead left-half DBCS */ + DBCS_DEAD /* position is dead left-half DBCS */ }; #define IS_LEFT(d) ((d) == DBCS_LEFT || (d) == DBCS_LEFT_WRAP) #define IS_RIGHT(d) ((d) == DBCS_RIGHT || (d) == DBCS_RIGHT_WRAP) diff --git a/src/lib3270/glue.c b/src/lib3270/glue.c index fddd25c..ce012ca 100644 --- a/src/lib3270/glue.c +++ b/src/lib3270/glue.c @@ -127,7 +127,7 @@ static void initialize(void) h3270.selected = 0; h3270.select.begin = h3270.select.end = 0; - initialize_toggles(&h3270,appres.toggle); +// initialize_toggles(&h3270); #if defined(_WIN32) (void) get_version_info(); @@ -148,11 +148,13 @@ static void initialize(void) appres.modified_sel = False; appres.apl_mode = False; -#if defined(C3270) || defined(TCL3270) /*[*/ -// appres.scripted = False; -#else /*][*/ +/* +#if defined(C3270) || defined(TCL3270) + appres.scripted = False; +#else appres.scripted = True; -#endif /*]*/ +#endif +*/ appres.numeric_lock = False; // appres.secure = False; @@ -193,9 +195,11 @@ static void initialize(void) appres.trace_dir = "/tmp"; #endif /*]*/ -#if defined(X3270_DISPLAY) || defined(WC3270) /*[*/ +/* +#if defined(X3270_DISPLAY) || defined(WC3270) appres.trace_monitor = True; -#endif /*]*/ +#endif +*/ #endif /*]*/ @@ -227,17 +231,23 @@ static void initialize(void) appres.dft_buffer_size = DFT_BUF; #endif /*]*/ -#if defined(C3270) && !defined(LIB3270) /*[*/ +/* +#if defined(C3270) && !defined(LIB3270) appres.toggle[CURSOR_POS].value = True; -#endif /*]*/ +#endif +*/ -#if defined(X3270_SCRIPT) || defined(TCL3270) /*[*/ +/* +#if defined(X3270_SCRIPT) || defined(TCL3270) appres.toggle[AID_WAIT].value = True; -#endif /*]*/ +#endif +*/ -#if defined(C3270) && defined(X3270_SCRIPT) /*[*/ +/* +#if defined(C3270) && defined(X3270_SCRIPT) appres.plugin_command = "x3270hist.pl"; -#endif /*]*/ +#endif +*/ #if defined(C3270) && defined(_WIN32) /*[*/ appres.highlight_underline = True; diff --git a/src/lib3270/init.c b/src/lib3270/init.c index bdb35ce..2884655 100644 --- a/src/lib3270/init.c +++ b/src/lib3270/init.c @@ -49,7 +49,7 @@ void lib3270_session_free(H3270 *h) if(lib3270_connected(h)) lib3270_disconnect(h); - shutdown_toggles(h,appres.toggle); + shutdown_toggles(h); // Release state change callbacks for(f=0;fsz = sizeof(H3270); + // Initialize toggles + initialize_toggles(hSession); + // Dummy calls to avoid "ifs" hSession->update = update_char; hSession->update_model = update_model; diff --git a/src/lib3270/kybd.c b/src/lib3270/kybd.c index 07bb3ea..2fed494 100644 --- a/src/lib3270/kybd.c +++ b/src/lib3270/kybd.c @@ -2274,11 +2274,11 @@ LIB3270_ACTION( dup ) if (kybdlock) { ENQUEUE_ACTION(lib3270_enter); - return; + return 0; } #if defined(X3270_ANSI) if (IN_ANSI) - return; + return 0; #endif if (key_Character(EBC_dup, False, False, NULL)) cursor_move(next_unprotected(hSession->cursor_addr)); diff --git a/src/lib3270/lib3270.cbp b/src/lib3270/lib3270.cbp index 492c3f5..cf9c572 100644 --- a/src/lib3270/lib3270.cbp +++ b/src/lib3270/lib3270.cbp @@ -7,8 +7,8 @@