Commit 35b14de2fe09a4f7eeb2361558c4523f260b8e42
1 parent
e48617d5
Exists in
master
and in
1 other branch
Fixing screen resize problem.
Showing
8 changed files
with
125 additions
and
52 deletions
Show diff stats
src/terminal/callbacks.c
| @@ -72,6 +72,8 @@ static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value | @@ -72,6 +72,8 @@ static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value | ||
| 72 | { | 72 | { |
| 73 | GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); | 73 | GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); |
| 74 | 74 | ||
| 75 | + trace("%s(%s,%d)",__FUNCTION__,name,(int) value); | ||
| 76 | + | ||
| 75 | switch(ix) | 77 | switch(ix) |
| 76 | { | 78 | { |
| 77 | case LIB3270_TOGGLE_CURSOR_POS: | 79 | case LIB3270_TOGGLE_CURSOR_POS: |
| @@ -138,7 +140,7 @@ static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value | @@ -138,7 +140,7 @@ static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value | ||
| 138 | static gboolean bg_update_message(H3270 *session) | 140 | static gboolean bg_update_message(H3270 *session) |
| 139 | { | 141 | { |
| 140 | void *widget = lib3270_get_user_data(session); | 142 | void *widget = lib3270_get_user_data(session); |
| 141 | - trace("-----A %s %p",__FUNCTION__, lib3270_get_user_data(session)); | 143 | + // trace("-----A %s %p",__FUNCTION__, lib3270_get_user_data(session)); |
| 142 | 144 | ||
| 143 | g_signal_emit( | 145 | g_signal_emit( |
| 144 | GTK_WIDGET(widget), | 146 | GTK_WIDGET(widget), |
| @@ -147,7 +149,7 @@ static gboolean bg_update_message(H3270 *session) | @@ -147,7 +149,7 @@ static gboolean bg_update_message(H3270 *session) | ||
| 147 | (gint) lib3270_get_program_message(session) | 149 | (gint) lib3270_get_program_message(session) |
| 148 | ); | 150 | ); |
| 149 | 151 | ||
| 150 | - trace("-----B %s %p",__FUNCTION__, lib3270_get_user_data(session)); | 152 | + //trace("-----B %s %p",__FUNCTION__, lib3270_get_user_data(session)); |
| 151 | 153 | ||
| 152 | return FALSE; | 154 | return FALSE; |
| 153 | } | 155 | } |
| @@ -378,7 +380,7 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title | @@ -378,7 +380,7 @@ static void popup_handler(H3270 *session, LIB3270_NOTIFY type, const char *title | ||
| 378 | 380 | ||
| 379 | static gboolean bg_update_ssl(H3270 *session) | 381 | static gboolean bg_update_ssl(H3270 *session) |
| 380 | { | 382 | { |
| 381 | - trace("%s(%p,%p)",__FUNCTION__,session,lib3270_get_user_data(session)); | 383 | +// trace("%s(%p,%p)",__FUNCTION__,session,lib3270_get_user_data(session)); |
| 382 | 384 | ||
| 383 | v3270_blink_ssl(GTK_V3270(lib3270_get_user_data(session))); | 385 | v3270_blink_ssl(GTK_V3270(lib3270_get_user_data(session))); |
| 384 | 386 |
src/terminal/draw.c
| @@ -371,13 +371,8 @@ LIB3270_EXPORT void v3270_reload(GtkWidget *widget) | @@ -371,13 +371,8 @@ LIB3270_EXPORT void v3270_reload(GtkWidget *widget) | ||
| 371 | { | 371 | { |
| 372 | v3270 * terminal = GTK_V3270(widget); | 372 | v3270 * terminal = GTK_V3270(widget); |
| 373 | 373 | ||
| 374 | -#if GTK_CHECK_VERSION(3,0,0) | ||
| 375 | gint width = gtk_widget_get_allocated_width(widget); | 374 | gint width = gtk_widget_get_allocated_width(widget); |
| 376 | gint height = gtk_widget_get_allocated_height(widget); | 375 | gint height = gtk_widget_get_allocated_height(widget); |
| 377 | -#else | ||
| 378 | - gint width = terminal->width; | ||
| 379 | - gint height = terminal->height; | ||
| 380 | -#endif | ||
| 381 | 376 | ||
| 382 | GdkRectangle rect; | 377 | GdkRectangle rect; |
| 383 | int addr, cursor, r, rows, cols; | 378 | int addr, cursor, r, rows, cols; |
| @@ -385,7 +380,9 @@ LIB3270_EXPORT void v3270_reload(GtkWidget *widget) | @@ -385,7 +380,9 @@ LIB3270_EXPORT void v3270_reload(GtkWidget *widget) | ||
| 385 | cairo_t * cr; | 380 | cairo_t * cr; |
| 386 | 381 | ||
| 387 | if(!(gtk_widget_get_realized(widget) && terminal->drawing)) | 382 | if(!(gtk_widget_get_realized(widget) && terminal->drawing)) |
| 383 | + { | ||
| 388 | return; | 384 | return; |
| 385 | + } | ||
| 389 | 386 | ||
| 390 | // Create new terminal image | 387 | // Create new terminal image |
| 391 | if(terminal->surface) | 388 | if(terminal->surface) |
src/terminal/font.c
| @@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
| 36 | #define HEIGHT_IN_PIXELS(terminal,x) (x * (rows+1)) | 36 | #define HEIGHT_IN_PIXELS(terminal,x) (x * (rows+1)) |
| 37 | 37 | ||
| 38 | #define CONTENTS_WIDTH(terminal) (cols * terminal->font.width) | 38 | #define CONTENTS_WIDTH(terminal) (cols * terminal->font.width) |
| 39 | - #define CONTENTS_HEIGHT(terminal) (((rows+1) * terminal->font.spacing)+OIA_TOP_MARGIN+2) | 39 | + #define CONTENTS_HEIGHT(terminal) (((rows+2) * terminal->font.spacing)+OIA_TOP_MARGIN+2) |
| 40 | 40 | ||
| 41 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 41 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 42 | 42 | ||
| @@ -56,11 +56,12 @@ const gchar * v3270_get_default_font_name() | @@ -56,11 +56,12 @@ const gchar * v3270_get_default_font_name() | ||
| 56 | void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height) | 56 | void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height) |
| 57 | { | 57 | { |
| 58 | // update font metrics | 58 | // update font metrics |
| 59 | - int rows, cols, hFont, size; | 59 | + unsigned int rows, cols, hFont, size; |
| 60 | 60 | ||
| 61 | cairo_font_extents_t extents; | 61 | cairo_font_extents_t extents; |
| 62 | 62 | ||
| 63 | lib3270_get_screen_size(terminal->host,&rows,&cols); | 63 | lib3270_get_screen_size(terminal->host,&rows,&cols); |
| 64 | + debug("Screen_size: %ux%u Scalled=%s",rows,cols,terminal->font.scaled ? "Yes" : "No"); | ||
| 64 | 65 | ||
| 65 | terminal->font.weight = lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL; | 66 | terminal->font.weight = lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL; |
| 66 | 67 | ||
| @@ -143,7 +144,19 @@ void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int heig | @@ -143,7 +144,19 @@ void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int heig | ||
| 143 | 144 | ||
| 144 | // Center image | 145 | // Center image |
| 145 | size = CONTENTS_WIDTH(terminal); | 146 | size = CONTENTS_WIDTH(terminal); |
| 146 | - terminal->font.left = (width >> 1) - ((size) >> 1); | 147 | + |
| 148 | + if(width >= size) { | ||
| 149 | + | ||
| 150 | + terminal->font.left = ((width - size) / 2); | ||
| 151 | + | ||
| 152 | + } else { | ||
| 153 | + | ||
| 154 | + terminal->font.left = 0; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + // terminal->font.left = (width >> 1) - ((size) >> 1); | ||
| 158 | + | ||
| 159 | + debug("Width=%u size=%u left=%d",height, size, terminal->font.left); | ||
| 147 | 160 | ||
| 148 | terminal->font.spacing = height / (rows+2); | 161 | terminal->font.spacing = height / (rows+2); |
| 149 | if((int) terminal->font.spacing < hFont) | 162 | if((int) terminal->font.spacing < hFont) |
| @@ -151,7 +164,19 @@ void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int heig | @@ -151,7 +164,19 @@ void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int heig | ||
| 151 | 164 | ||
| 152 | size = CONTENTS_HEIGHT(terminal); | 165 | size = CONTENTS_HEIGHT(terminal); |
| 153 | 166 | ||
| 154 | - terminal->font.top = (height >> 1) - (size >> 1); | 167 | + if(height >= size) { |
| 168 | + | ||
| 169 | + terminal->font.top = ((height - size) /2); | ||
| 170 | + | ||
| 171 | + } else { | ||
| 172 | + | ||
| 173 | + terminal->font.top = 0; | ||
| 174 | + | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + //terminal->font.top = (height >> 1) - (size >> 1); | ||
| 178 | + | ||
| 179 | + debug("screen_height=%u content_height=%u top=%d",height, size, terminal->font.top); | ||
| 155 | 180 | ||
| 156 | } | 181 | } |
| 157 | 182 |
src/terminal/iocallback.c
| @@ -148,7 +148,7 @@ static int static_RunTask(H3270 *hSession, int(*callback)(H3270 *, void *), void | @@ -148,7 +148,7 @@ static int static_RunTask(H3270 *hSession, int(*callback)(H3270 *, void *), void | ||
| 148 | 148 | ||
| 149 | struct bgParameter p = { TRUE, hSession, -1, callback, parm }; | 149 | struct bgParameter p = { TRUE, hSession, -1, callback, parm }; |
| 150 | 150 | ||
| 151 | - trace("%s starts -------------------------------------", __FUNCTION__); | 151 | +// trace("%s starts -------------------------------------", __FUNCTION__); |
| 152 | 152 | ||
| 153 | p.running = TRUE; | 153 | p.running = TRUE; |
| 154 | 154 | ||
| @@ -167,7 +167,7 @@ static int static_RunTask(H3270 *hSession, int(*callback)(H3270 *, void *), void | @@ -167,7 +167,7 @@ static int static_RunTask(H3270 *hSession, int(*callback)(H3270 *, void *), void | ||
| 167 | 167 | ||
| 168 | g_thread_join(thread); | 168 | g_thread_join(thread); |
| 169 | 169 | ||
| 170 | - trace("%s ends ---------------------------------------", __FUNCTION__); | 170 | +// trace("%s ends ---------------------------------------", __FUNCTION__); |
| 171 | 171 | ||
| 172 | return p.rc; | 172 | return p.rc; |
| 173 | 173 |
src/terminal/oia.c
| @@ -104,7 +104,7 @@ static gint draw_spinner(cairo_t *cr, GdkRectangle *r, GdkRGBA *color, gint step | @@ -104,7 +104,7 @@ static gint draw_spinner(cairo_t *cr, GdkRectangle *r, GdkRGBA *color, gint step | ||
| 104 | step++; | 104 | step++; |
| 105 | step %= num_steps; | 105 | step %= num_steps; |
| 106 | 106 | ||
| 107 | - debug("%s step=%d",__FUNCTION__,step); | 107 | +// debug("%s step=%d",__FUNCTION__,step); |
| 108 | 108 | ||
| 109 | for (i = 0; i < ((gint) num_steps); i++) | 109 | for (i = 0; i < ((gint) num_steps); i++) |
| 110 | { | 110 | { |
| @@ -1108,7 +1108,7 @@ void v3270_update_oia(v3270 *terminal, LIB3270_FLAG id, unsigned char on) | @@ -1108,7 +1108,7 @@ void v3270_update_oia(v3270 *terminal, LIB3270_FLAG id, unsigned char on) | ||
| 1108 | switch(id) | 1108 | switch(id) |
| 1109 | { | 1109 | { |
| 1110 | case LIB3270_FLAG_BOXSOLID: | 1110 | case LIB3270_FLAG_BOXSOLID: |
| 1111 | - debug("%s LIB3270_FLAG_BOXSOLID",__FUNCTION__); | 1111 | +// debug("%s LIB3270_FLAG_BOXSOLID",__FUNCTION__); |
| 1112 | cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_CONNECTION); | 1112 | cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_CONNECTION); |
| 1113 | v3270_draw_connection(cr,terminal->host,&terminal->font,terminal->color,r); | 1113 | v3270_draw_connection(cr,terminal->host,&terminal->font,terminal->color,r); |
| 1114 | cairo_destroy(cr); | 1114 | cairo_destroy(cr); |
| @@ -1116,25 +1116,25 @@ void v3270_update_oia(v3270 *terminal, LIB3270_FLAG id, unsigned char on) | @@ -1116,25 +1116,25 @@ void v3270_update_oia(v3270 *terminal, LIB3270_FLAG id, unsigned char on) | ||
| 1116 | break; | 1116 | break; |
| 1117 | 1117 | ||
| 1118 | case LIB3270_FLAG_UNDERA: | 1118 | case LIB3270_FLAG_UNDERA: |
| 1119 | - debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); | 1119 | +// debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); |
| 1120 | cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_UNDERA); | 1120 | cr = v3270_oia_set_update_region(terminal,&r,V3270_OIA_UNDERA); |
| 1121 | - debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); | 1121 | +// debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); |
| 1122 | draw_undera(cr,terminal->host,&terminal->font,terminal->color,r); | 1122 | draw_undera(cr,terminal->host,&terminal->font,terminal->color,r); |
| 1123 | - debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); | 1123 | +// debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); |
| 1124 | cairo_destroy(cr); | 1124 | cairo_destroy(cr); |
| 1125 | - debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); | 1125 | +// debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); |
| 1126 | v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); | 1126 | v3270_queue_draw_area(GTK_WIDGET(terminal),r->x,r->y,r->width,r->height); |
| 1127 | - debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); | 1127 | +// debug("%s LIB3270_FLAG_UNDERA",__FUNCTION__); |
| 1128 | break; | 1128 | break; |
| 1129 | 1129 | ||
| 1130 | case LIB3270_FLAG_TYPEAHEAD: | 1130 | case LIB3270_FLAG_TYPEAHEAD: |
| 1131 | - debug("%s LIB3270_FLAG_TYPEAHEAD",__FUNCTION__); | 1131 | +// debug("%s LIB3270_FLAG_TYPEAHEAD",__FUNCTION__); |
| 1132 | v3270_oia_update_text_field(terminal,on,V3270_OIA_TYPEAHEAD,'T'); | 1132 | v3270_oia_update_text_field(terminal,on,V3270_OIA_TYPEAHEAD,'T'); |
| 1133 | break; | 1133 | break; |
| 1134 | 1134 | ||
| 1135 | #ifdef HAVE_PRINTER | 1135 | #ifdef HAVE_PRINTER |
| 1136 | case LIB3270_FLAG_PRINTER: | 1136 | case LIB3270_FLAG_PRINTER: |
| 1137 | - debug("%s LIB3270_FLAG_PRINTER",__FUNCTION__); | 1137 | +// debug("%s LIB3270_FLAG_PRINTER",__FUNCTION__); |
| 1138 | v3270_oia_update_text_field(terminal,on,V3270_OIA_PRINTER,'P'); | 1138 | v3270_oia_update_text_field(terminal,on,V3270_OIA_PRINTER,'P'); |
| 1139 | break; | 1139 | break; |
| 1140 | #endif // HAVE_PRINTER | 1140 | #endif // HAVE_PRINTER |
src/terminal/properties.c
| @@ -156,14 +156,14 @@ | @@ -156,14 +156,14 @@ | ||
| 156 | 156 | ||
| 157 | size_t ix; | 157 | size_t ix; |
| 158 | 158 | ||
| 159 | - debug("Property %s=%u",g_param_spec_get_name(pspec),(unsigned int) property_id); | 159 | +// debug("Property %s=%u",g_param_spec_get_name(pspec),(unsigned int) property_id); |
| 160 | g_object_class_install_property(oclass, property_id, pspec); | 160 | g_object_class_install_property(oclass, property_id, pspec); |
| 161 | 161 | ||
| 162 | for(ix = 0; ix < G_N_ELEMENTS(properties); ix++) | 162 | for(ix = 0; ix < G_N_ELEMENTS(properties); ix++) |
| 163 | { | 163 | { |
| 164 | if(!g_ascii_strcasecmp(properties[ix].name,g_param_spec_get_name(pspec))) | 164 | if(!g_ascii_strcasecmp(properties[ix].name,g_param_spec_get_name(pspec))) |
| 165 | { | 165 | { |
| 166 | - debug("Property \"%s\" is special",g_param_spec_get_name(pspec)); | 166 | +// debug("Property \"%s\" is special",g_param_spec_get_name(pspec)); |
| 167 | *properties[ix].prop = pspec; | 167 | *properties[ix].prop = pspec; |
| 168 | break; | 168 | break; |
| 169 | } | 169 | } |
| @@ -250,7 +250,7 @@ | @@ -250,7 +250,7 @@ | ||
| 250 | // Creating string properties. | 250 | // Creating string properties. |
| 251 | for(ix = 0; str_props[ix].name; ix++) | 251 | for(ix = 0; str_props[ix].name; ix++) |
| 252 | { | 252 | { |
| 253 | - debug("Property %u=%s (String)",(unsigned int) v3270_properties.type.str + ix, str_props[ix].name); | 253 | +// debug("Property %u=%s (String)",(unsigned int) v3270_properties.type.str + ix, str_props[ix].name); |
| 254 | spec = g_param_spec_string(str_props[ix].name, str_props[ix].name, str_props[ix].description, FALSE,(str_props[ix].set == NULL ? G_PARAM_READABLE : (G_PARAM_READABLE|G_PARAM_WRITABLE))); | 254 | spec = g_param_spec_string(str_props[ix].name, str_props[ix].name, str_props[ix].description, FALSE,(str_props[ix].set == NULL ? G_PARAM_READABLE : (G_PARAM_READABLE|G_PARAM_WRITABLE))); |
| 255 | v3270_install_property(gobject_class, v3270_properties.type.str + ix, spec); | 255 | v3270_install_property(gobject_class, v3270_properties.type.str + ix, spec); |
| 256 | 256 |
src/terminal/widget.c
| @@ -794,30 +794,12 @@ static void v3270_size_allocate(GtkWidget * widget, GtkAllocation * allocation) | @@ -794,30 +794,12 @@ static void v3270_size_allocate(GtkWidget * widget, GtkAllocation * allocation) | ||
| 794 | g_return_if_fail(GTK_IS_V3270(widget)); | 794 | g_return_if_fail(GTK_IS_V3270(widget)); |
| 795 | g_return_if_fail(allocation != NULL); | 795 | g_return_if_fail(allocation != NULL); |
| 796 | 796 | ||
| 797 | -#if GTK_CHECK_VERSION(2,18,0) | ||
| 798 | gtk_widget_set_allocation(widget, allocation); | 797 | gtk_widget_set_allocation(widget, allocation); |
| 799 | -#else | ||
| 800 | - widget->allocation = *allocation; | ||
| 801 | -#endif // GTK(2,18) | ||
| 802 | - | ||
| 803 | -#if !GTK_CHECK_VERSION(3,0,0) | ||
| 804 | - { | ||
| 805 | - v3270 *terminal = GTK_V3270(widget); | ||
| 806 | - | ||
| 807 | - terminal->width = allocation->width; | ||
| 808 | - terminal->height = allocation->height; | ||
| 809 | - } | ||
| 810 | -#endif | ||
| 811 | 798 | ||
| 812 | if(gtk_widget_get_realized(widget)) | 799 | if(gtk_widget_get_realized(widget)) |
| 813 | { | 800 | { |
| 814 | -#if GTK_CHECK_VERSION(2,18,0) | ||
| 815 | if(gtk_widget_get_has_window(widget)) | 801 | if(gtk_widget_get_has_window(widget)) |
| 816 | gdk_window_move_resize(gtk_widget_get_window (widget),allocation->x, allocation->y,allocation->width, allocation->height); | 802 | gdk_window_move_resize(gtk_widget_get_window (widget),allocation->x, allocation->y,allocation->width, allocation->height); |
| 817 | -#else | ||
| 818 | - if(widget->window) | ||
| 819 | - gdk_window_move_resize(widget->window,allocation->x, allocation->y,allocation->width, allocation->height); | ||
| 820 | -#endif // GTK(2,18,0) | ||
| 821 | 803 | ||
| 822 | v3270_reload(widget); | 804 | v3270_reload(widget); |
| 823 | v3270_send_configure(GTK_V3270(widget)); | 805 | v3270_send_configure(GTK_V3270(widget)); |
src/trace/exec.c
| @@ -62,8 +62,51 @@ | @@ -62,8 +62,51 @@ | ||
| 62 | return rc; | 62 | return rc; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | - static int set_property(H3270 *hSession, const gchar *name, const gchar * value) | 65 | + static int set_property(GtkWidget *widget, const gchar *name, const gchar * value) |
| 66 | { | 66 | { |
| 67 | + | ||
| 68 | + GParamSpec * spec = g_object_class_find_property(G_OBJECT_GET_CLASS(widget),name); | ||
| 69 | + | ||
| 70 | + if(!spec) { | ||
| 71 | + return errno = ENOENT; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + GValue val = G_VALUE_INIT; | ||
| 75 | + | ||
| 76 | + g_value_init(&val, spec->value_type); | ||
| 77 | + | ||
| 78 | + switch(spec->value_type) | ||
| 79 | + { | ||
| 80 | + case G_TYPE_STRING: | ||
| 81 | + { | ||
| 82 | + g_value_set_string(&val,value); | ||
| 83 | + g_object_set_property(G_OBJECT(widget),name,&val); | ||
| 84 | + } | ||
| 85 | + break; | ||
| 86 | + | ||
| 87 | + case G_TYPE_BOOLEAN: | ||
| 88 | + { | ||
| 89 | + g_value_set_boolean(&val,(atoi(value) == 0 ? FALSE : TRUE)); | ||
| 90 | + g_object_set_property(G_OBJECT(widget),name,&val); | ||
| 91 | + } | ||
| 92 | + break; | ||
| 93 | + | ||
| 94 | + case G_TYPE_INT: | ||
| 95 | + { | ||
| 96 | + g_value_set_int(&val,atoi(value)); | ||
| 97 | + g_object_set_property(G_OBJECT(widget),name,&val); | ||
| 98 | + } | ||
| 99 | + break; | ||
| 100 | + | ||
| 101 | + default: | ||
| 102 | + lib3270_write_trace(v3270_get_session(widget),"%s has an unexpected value type\n",spec->name); | ||
| 103 | + | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + g_value_unset(&val); | ||
| 107 | + return 0; | ||
| 108 | + | ||
| 109 | + /* | ||
| 67 | size_t ix; | 110 | size_t ix; |
| 68 | 111 | ||
| 69 | debug("%s=%s",name,value); | 112 | debug("%s=%s",name,value); |
| @@ -102,6 +145,7 @@ | @@ -102,6 +145,7 @@ | ||
| 102 | return sProp[ix].set(hSession,value); | 145 | return sProp[ix].set(hSession,value); |
| 103 | 146 | ||
| 104 | } | 147 | } |
| 148 | + */ | ||
| 105 | 149 | ||
| 106 | return errno = ENOENT; | 150 | return errno = ENOENT; |
| 107 | 151 | ||
| @@ -123,19 +167,19 @@ | @@ -123,19 +167,19 @@ | ||
| 123 | switch(spec->value_type) | 167 | switch(spec->value_type) |
| 124 | { | 168 | { |
| 125 | case G_TYPE_STRING: | 169 | case G_TYPE_STRING: |
| 126 | - lib3270_write_trace(v3270_get_session(widget),"%s=%s",spec->name,g_value_get_string(&val)); | 170 | + lib3270_write_trace(v3270_get_session(widget),"%s=%s\n",spec->name,g_value_get_string(&val)); |
| 127 | break; | 171 | break; |
| 128 | 172 | ||
| 129 | case G_TYPE_BOOLEAN: | 173 | case G_TYPE_BOOLEAN: |
| 130 | - lib3270_write_trace(v3270_get_session(widget),"%s=%s",spec->name,(g_value_get_boolean(&val) ? "true" : "false")); | 174 | + lib3270_write_trace(v3270_get_session(widget),"%s=%s\n",spec->name,(g_value_get_boolean(&val) ? "true" : "false")); |
| 131 | break; | 175 | break; |
| 132 | 176 | ||
| 133 | case G_TYPE_INT: | 177 | case G_TYPE_INT: |
| 134 | - lib3270_write_trace(v3270_get_session(widget),"%s=%d",spec->name,g_value_get_int(&val)); | 178 | + lib3270_write_trace(v3270_get_session(widget),"%s=%d\n",spec->name,g_value_get_int(&val)); |
| 135 | break; | 179 | break; |
| 136 | 180 | ||
| 137 | default: | 181 | default: |
| 138 | - lib3270_write_trace(v3270_get_session(widget),"%s has an unexpected value type",spec->name); | 182 | + lib3270_write_trace(v3270_get_session(widget),"%s has an unexpected value type\n",spec->name); |
| 139 | 183 | ||
| 140 | } | 184 | } |
| 141 | 185 | ||
| @@ -161,6 +205,29 @@ | @@ -161,6 +205,29 @@ | ||
| 161 | return lib3270_reconnect(hSession,0); | 205 | return lib3270_reconnect(hSession,0); |
| 162 | } | 206 | } |
| 163 | 207 | ||
| 208 | + if(g_str_has_prefix(cmdline,"reload")) | ||
| 209 | + { | ||
| 210 | + v3270_reload(widget); | ||
| 211 | + return 0; | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + if(g_str_has_suffix(cmdline,"?")) | ||
| 215 | + { | ||
| 216 | + gchar * str = strchr(cmdline,'?'); | ||
| 217 | + *str = 0; | ||
| 218 | + g_strstrip(cmdline); | ||
| 219 | + return get_property(widget,cmdline); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + if(strchr(cmdline,'=')) | ||
| 223 | + { | ||
| 224 | + gchar * value = strchr(cmdline,'='); | ||
| 225 | + *(value++) = 0; | ||
| 226 | + g_strstrip(cmdline); | ||
| 227 | + g_strstrip(value); | ||
| 228 | + return set_property(widget,cmdline,value); | ||
| 229 | + } | ||
| 230 | + | ||
| 164 | if(g_str_has_prefix(cmdline,"disconnect")) | 231 | if(g_str_has_prefix(cmdline,"disconnect")) |
| 165 | { | 232 | { |
| 166 | return lib3270_disconnect(hSession); | 233 | return lib3270_disconnect(hSession); |
| @@ -171,7 +238,7 @@ | @@ -171,7 +238,7 @@ | ||
| 171 | gchar *txtptr = cmdline+3; | 238 | gchar *txtptr = cmdline+3; |
| 172 | const gchar * name = get_word(&txtptr); | 239 | const gchar * name = get_word(&txtptr); |
| 173 | g_strstrip(txtptr); | 240 | g_strstrip(txtptr); |
| 174 | - return set_property(hSession,name,(*txtptr ? txtptr : "1")); | 241 | + return set_property(widget,name,(*txtptr ? txtptr : "1")); |
| 175 | } | 242 | } |
| 176 | 243 | ||
| 177 | if(g_str_has_prefix(cmdline,"get")) | 244 | if(g_str_has_prefix(cmdline,"get")) |
| @@ -187,14 +254,14 @@ | @@ -187,14 +254,14 @@ | ||
| 187 | gchar *txtptr = cmdline+3; | 254 | gchar *txtptr = cmdline+3; |
| 188 | const gchar * name = get_word(&txtptr); | 255 | const gchar * name = get_word(&txtptr); |
| 189 | g_strstrip(txtptr); | 256 | g_strstrip(txtptr); |
| 190 | - return set_property(hSession,name,(*txtptr ? txtptr : "0")); | 257 | + return set_property(widget,name,(*txtptr ? txtptr : "0")); |
| 191 | } | 258 | } |
| 192 | 259 | ||
| 193 | gchar * sep = strchr(cmdline,'='); | 260 | gchar * sep = strchr(cmdline,'='); |
| 194 | if(sep) | 261 | if(sep) |
| 195 | { | 262 | { |
| 196 | *(sep++) = 0; | 263 | *(sep++) = 0; |
| 197 | - return set_property(hSession,g_strstrip(cmdline),g_strstrip(sep)); | 264 | + return set_property(widget,g_strstrip(cmdline),g_strstrip(sep)); |
| 198 | } | 265 | } |
| 199 | else | 266 | else |
| 200 | { | 267 | { |