Commit 9699327abfe05121306b1f3519786f056e791630

Authored by Perry Werneck
1 parent 6e5a1871
Exists in master and in 1 other branch develop

Copy as text seens ok in the new clipboard system.

src/clipboard/copy.c 0 → 100644
... ... @@ -0,0 +1,86 @@
  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 - 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 + #include <clipboard.h>
  31 + #include <lib3270/selection.h>
  32 +
  33 + LIB3270_EXPORT void v3270_copy(GtkWidget *widget, V3270_SELECT_FORMAT format, gboolean cut)
  34 + {
  35 +
  36 + g_return_if_fail(GTK_IS_V3270(widget));
  37 +
  38 + v3270 * terminal = GTK_V3270(widget);
  39 +
  40 + terminal->selection.format = format;
  41 +
  42 + // Have data? Clear it?
  43 + v3270_clear_clipboard(terminal);
  44 +
  45 + // Get selection bounds.
  46 +
  47 + if(lib3270_get_selection_rectangle(terminal->host, &terminal->selection.bounds.row, &terminal->selection.bounds.col, &terminal->selection.bounds.width, &terminal->selection.bounds.height) != 0)
  48 + return;
  49 +
  50 + debug("Selecion rectangle starts on %u,%u with size of %ux%u",
  51 + terminal->selection.bounds.row, terminal->selection.bounds.col,
  52 + terminal->selection.bounds.width, terminal->selection.bounds.height
  53 + );
  54 +
  55 +
  56 + // Copy terminal buffer
  57 + unsigned int r, c;
  58 +
  59 + terminal->selection.contents = g_new0(struct v3270_character,(terminal->selection.bounds.width * terminal->selection.bounds.height));
  60 +
  61 + int pos = 0;
  62 + for(r=0;r < terminal->selection.bounds.height; r++)
  63 + {
  64 + // Get starting address.
  65 + int baddr = lib3270_translate_to_address(terminal->host, terminal->selection.bounds.row+r+1, terminal->selection.bounds.col+1);
  66 + if(baddr < 0)
  67 + {
  68 + g_message("Can't convert coordinate %u,%d",terminal->selection.bounds.row+r+1,terminal->selection.bounds.col+1);
  69 + gdk_display_beep(gdk_display_get_default());
  70 + return;
  71 + }
  72 +
  73 + for(c=0;c < terminal->selection.bounds.width; c++)
  74 + {
  75 + lib3270_get_contents(terminal->host,baddr,baddr,&terminal->selection.contents[pos].chr,&terminal->selection.contents[pos].attr);
  76 + debug("pos=%d baddr=%u char=%c",pos,baddr,terminal->selection.contents[pos].chr);
  77 + pos++;
  78 + baddr++;
  79 + }
  80 +
  81 + }
  82 +
  83 + v3270_update_system_clipboard(widget);
  84 +
  85 + }
  86 +
... ...
src/clipboard/selection.c
... ... @@ -29,41 +29,63 @@
29 29  
30 30 #include <clipboard.h>
31 31  
32   -/*--[ Globals ]--------------------------------------------------------------------------------------*/
33   -
34   -/*
35   - static const GtkTargetEntry targets[] =
36   - {
37   - { "COMPOUND_TEXT", 0, CLIPBOARD_TYPE_TEXT },
38   - { "UTF8_STRING", 0, CLIPBOARD_TYPE_TEXT },
39   - };
40   -*/
41   -
42 32 /*--[ Implement ]------------------------------------------------------------------------------------*/
43 33  
44 34 static void clipboard_clear(G_GNUC_UNUSED GtkClipboard *clipboard, G_GNUC_UNUSED GObject *obj)
45 35 {
  36 + v3270 * terminal = GTK_V3270(obj);
  37 +
  38 + if(!lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_KEEP_SELECTED))
  39 + {
  40 + v3270_unselect(GTK_WIDGET(obj));
  41 + v3270_clear_clipboard(terminal);
  42 + }
  43 +
  44 +}
  45 +
  46 +/// @brief Get formatted contents as single text.
  47 +static gchar * get_selection_as_text(v3270 * terminal)
  48 +{
  49 + // Has formatted clipboard, convert it to text.
  50 + unsigned int r, c, src = 0, dst = 0;
  51 + g_autofree char * text = g_malloc0( (terminal->selection.bounds.width * terminal->selection.bounds.height) + terminal->selection.bounds.height + 2);
  52 +
  53 + for(r=0;r < terminal->selection.bounds.height;r++)
  54 + {
  55 + for(c=0;c<terminal->selection.bounds.width;c++)
  56 + {
  57 + if(terminal->selection.contents[src].attr & LIB3270_ATTR_SELECTED)
  58 + text[dst++] = terminal->selection.contents[src].chr;
  59 +
  60 + src++;
  61 + }
  62 +
  63 + text[dst++] = '\n';
  64 + }
  65 +
  66 + return g_convert(text, -1, "UTF-8", lib3270_get_display_charset(terminal->host), NULL, NULL, NULL);
46 67 }
47 68  
48 69 static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionData *selection, guint target, GObject *obj)
49 70 {
50   - v3270 * widget = GTK_V3270(obj);
  71 + v3270 * terminal = GTK_V3270(obj);
51 72  
52   - debug("%s target=%u",__FUNCTION__,(unsigned int) target);
  73 + debug("%s target=%u selection from with %ux%u",
  74 + __FUNCTION__,
  75 + (unsigned int) target,
  76 + terminal->selection.bounds.width, terminal->selection.bounds.height
  77 + );
53 78  
54 79 switch(target)
55 80 {
56 81 case CLIPBOARD_TYPE_TEXT: /* Get clipboard contents as text */
57   - if(!widget->selection.text)
58   - {
59   - lib3270_ring_bell(widget->host);
60   - }
61   - else
62   - {
63   - gchar * text = g_convert(widget->selection.text, -1, "UTF-8", lib3270_get_display_charset(widget->host), NULL, NULL, NULL);
64   - gtk_selection_data_set_text(selection,text,-1);
65   - g_free(text);
66   - }
  82 +
  83 + if(terminal->selection.contents)
  84 + {
  85 + g_autofree gchar * converted = get_selection_as_text(terminal);
  86 + gtk_selection_data_set_text(selection,converted,-1);
  87 + }
  88 +
67 89 break;
68 90  
69 91 default:
... ... @@ -79,7 +101,15 @@ static void clipboard_get(G_GNUC_UNUSED GtkClipboard *clipboard, GtkSelectionDa
79 101 */
80 102 void v3270_clear_clipboard(v3270 *terminal)
81 103 {
82   - terminal->selection.text = lib3270_free(terminal->selection.text);
  104 + memset(&terminal->selection.bounds,0,sizeof(terminal->selection.bounds));
  105 +
  106 + if(terminal->selection.contents)
  107 + {
  108 + g_free(terminal->selection.contents);
  109 + terminal->selection.contents = NULL;
  110 + }
  111 +
  112 +// terminal->selection.text = lib3270_free(terminal->selection.text);
83 113 }
84 114  
85 115 /**
... ... @@ -106,6 +136,7 @@ LIB3270_EXPORT gchar * v3270_get_selected(GtkWidget *widget, gboolean cut)
106 136  
107 137 LIB3270_EXPORT gchar * v3270_get_copy(GtkWidget *widget)
108 138 {
  139 + /*
109 140 const char *text;
110 141 g_return_val_if_fail(GTK_IS_V3270(widget),NULL);
111 142  
... ... @@ -117,11 +148,14 @@ LIB3270_EXPORT gchar * v3270_get_copy(GtkWidget *widget)
117 148 if(text)
118 149 return g_convert(text, -1, "UTF-8", lib3270_get_display_charset(GTK_V3270(widget)->host), NULL, NULL, NULL);
119 150  
  151 + */
  152 +
120 153 return NULL;
121 154 }
122 155  
123 156 LIB3270_EXPORT void v3270_set_copy(GtkWidget *widget, const gchar *text)
124 157 {
  158 + /*
125 159 v3270 * terminal;
126 160 gchar * isotext;
127 161  
... ... @@ -132,18 +166,18 @@ LIB3270_EXPORT void v3270_set_copy(GtkWidget *widget, const gchar *text)
132 166  
133 167 if(!text)
134 168 {
135   - /* No string, signal clipboard clear and return */
  169 + // No string, signal clipboard clear and return
136 170 g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_CLIPBOARD], 0, FALSE);
137 171 return;
138 172 }
139 173  
140   - /* Received text, replace the selection buffer */
  174 + // Received text, replace the selection buffer
141 175 terminal->selection.format = V3270_SELECT_TEXT;
142 176 isotext = g_convert(text, -1, lib3270_get_display_charset(terminal->host), "UTF-8", NULL, NULL, NULL);
143 177  
144 178 if(!isotext)
145 179 {
146   - /* No string, signal clipboard clear and return */
  180 + // No string, signal clipboard clear and return
147 181 g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_CLIPBOARD], 0, FALSE);
148 182 return;
149 183 }
... ... @@ -153,59 +187,71 @@ LIB3270_EXPORT void v3270_set_copy(GtkWidget *widget, const gchar *text)
153 187 g_free(isotext);
154 188  
155 189 g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_CLIPBOARD], 0, TRUE);
  190 + */
156 191 }
157 192  
158 193 void v3270_update_system_clipboard(GtkWidget *widget)
159 194 {
160   - if(GTK_V3270(widget)->selection.text)
161   - {
162   - GtkClipboard * clipboard = gtk_widget_get_clipboard(widget,GDK_SELECTION_CLIPBOARD);
  195 + v3270 * terminal = GTK_V3270(widget);
  196 +
  197 + if(!terminal->selection.bounds.width)
  198 + {
  199 + // No clipboard data, return.
  200 + g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_CLIPBOARD], 0, FALSE);
  201 + return;
  202 + }
  203 +
  204 + // Has clipboard data, inform system.
  205 + GtkClipboard * clipboard = gtk_widget_get_clipboard(widget,GDK_SELECTION_CLIPBOARD);
163 206  
164   - // Create target list
165   - //
166   - // Reference: https://cpp.hotexamples.com/examples/-/-/g_list_insert_sorted/cpp-g_list_insert_sorted-function-examples.html
167   - //
168   - GtkTargetList * list = gtk_target_list_new(NULL, 0);
169   - GtkTargetEntry * targets;
170   - int n_targets;
  207 + // Create target list
  208 + //
  209 + // Reference: https://cpp.hotexamples.com/examples/-/-/g_list_insert_sorted/cpp-g_list_insert_sorted-function-examples.html
  210 + //
  211 + GtkTargetList * list = gtk_target_list_new(NULL, 0);
  212 + GtkTargetEntry * targets;
  213 + int n_targets;
  214 +
  215 + gtk_target_list_add_text_targets(list, CLIPBOARD_TYPE_TEXT);
  216 + targets = gtk_target_table_new_from_list(list, &n_targets);
171 217  
172   - gtk_target_list_add_text_targets(list, CLIPBOARD_TYPE_TEXT);
173   - targets = gtk_target_table_new_from_list(list, &n_targets);
174 218  
175 219 #ifdef DEBUG
176   - {
177   - int ix;
178   - for(ix = 0; ix < n_targets; ix++) {
179   - debug("target(%d)=\"%s\"",ix,targets[ix].target);
180   - }
  220 + {
  221 + int ix;
  222 + for(ix = 0; ix < n_targets; ix++) {
  223 + debug("target(%d)=\"%s\"",ix,targets[ix].target);
181 224 }
  225 + }
182 226 #endif // DEBUG
183 227  
184   - if(gtk_clipboard_set_with_owner(
185   - clipboard,
186   - targets,
187   - n_targets,
188   - (GtkClipboardGetFunc) clipboard_get,
189   - (GtkClipboardClearFunc) clipboard_clear,
190   - G_OBJECT(widget)
191   - ))
192   - {
193   - gtk_clipboard_set_can_store(clipboard,targets,1);
194   - }
  228 + if(gtk_clipboard_set_with_owner(
  229 + clipboard,
  230 + targets,
  231 + n_targets,
  232 + (GtkClipboardGetFunc) clipboard_get,
  233 + (GtkClipboardClearFunc) clipboard_clear,
  234 + G_OBJECT(widget)
  235 + ))
  236 + {
  237 + gtk_clipboard_set_can_store(clipboard,targets,1);
  238 + }
195 239  
196   - gtk_target_table_free(targets, n_targets);
197   - gtk_target_list_unref(list);
  240 + gtk_target_table_free(targets, n_targets);
  241 + gtk_target_list_unref(list);
  242 +
  243 + g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_CLIPBOARD], 0, TRUE);
198 244  
199   - g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_CLIPBOARD], 0, TRUE);
200   - }
201 245 }
202 246  
203 247 LIB3270_EXPORT void v3270_copy_text(GtkWidget *widget, V3270_SELECT_FORMAT mode, gboolean cut)
204 248 {
  249 + /*
205 250 g_return_if_fail(GTK_IS_V3270(widget));
206 251 GTK_V3270(widget)->selection.format = mode;
207 252 v3270_update_selected_text(widget,cut);
208 253 v3270_update_system_clipboard(widget);
  254 + */
209 255 }
210 256  
211 257 LIB3270_EXPORT void v3270_unselect(GtkWidget *widget)
... ...
src/clipboard/text.c
... ... @@ -32,6 +32,7 @@
32 32  
33 33 LIB3270_EXPORT void v3270_copy_text_append(GtkWidget *widget)
34 34 {
  35 + /*
35 36 v3270 * terminal;
36 37 char * str;
37 38  
... ... @@ -61,11 +62,13 @@ LIB3270_EXPORT void v3270_copy_text_append(GtkWidget *widget)
61 62 }
62 63  
63 64 v3270_update_system_clipboard(widget);
  65 + */
64 66  
65 67 }
66 68  
67 69 const char * v3270_update_selected_text(GtkWidget *widget, gboolean cut)
68 70 {
  71 + /*
69 72 char * text;
70 73 v3270 * terminal = GTK_V3270(widget);
71 74  
... ... @@ -158,6 +161,9 @@ const char * v3270_update_selected_text(GtkWidget *widget, gboolean cut)
158 161 }
159 162  
160 163 return terminal->selection.text = text;
  164 + */
  165 +
  166 + return NULL;
161 167  
162 168 }
163 169  
... ...
src/include/internals.h
... ... @@ -53,6 +53,14 @@
53 53  
54 54 G_BEGIN_DECLS
55 55  
  56 +/*--[ Structures ]-----------------------------------------------------------------------------------*/
  57 +
  58 + struct v3270_character
  59 + {
  60 + unsigned char chr; ///< @brief Character value.
  61 + unsigned short attr; ///< @brief Character attribute.
  62 + };
  63 +
56 64 /*--[ Signals ]--------------------------------------------------------------------------------------*/
57 65  
58 66 /// @brief V3270 Signal list
... ... @@ -187,7 +195,7 @@
187 195  
188 196 G_GNUC_INTERNAL void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, unsigned int width, unsigned int height);
189 197  
190   - G_GNUC_INTERNAL void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, unsigned char chr, unsigned short attr);
  198 + G_GNUC_INTERNAL void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, const struct v3270_character *element);
191 199  
192 200 G_GNUC_INTERNAL void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id);
193 201 G_GNUC_INTERNAL void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);
... ...
src/include/terminal.h
... ... @@ -115,12 +115,31 @@ G_BEGIN_DECLS
115 115 GtkIMContext * input_method;
116 116 unsigned short keyflags;
117 117  
  118 + struct {
  119 +
  120 + int baddr; ///< @brief Selection address.
  121 + V3270_SELECT_FORMAT format; ///< @brief Copy format.
  122 +
  123 + struct {
  124 + unsigned int row;
  125 + unsigned int col;
  126 + unsigned int width;
  127 + unsigned int height;
  128 +
  129 + } bounds; ///< @brief Clipboard rectangle.
  130 +
  131 + struct v3270_character * contents;
  132 +
  133 + } selection;
  134 +
  135 + /*
118 136 struct
119 137 {
120   - V3270_SELECT_FORMAT format; /**< Copy format */
121   - char * text; /**< Clipboard contents (lib3270 charset) */
122   - int baddr; /**< Selection addr */
  138 + V3270_SELECT_FORMAT format; ///< Copy format
  139 + char * text; ///< Clipboard contents (lib3270 charset)
  140 + int baddr; ///< Selection addr
123 141 } selection;
  142 + */
124 143  
125 144 LIB3270_POINTER pointer_id;
126 145 unsigned char pointer; /**< Mouse pointer ID */
... ...
src/include/v3270.h
... ... @@ -183,8 +183,9 @@
183 183 // Clipboard
184 184 typedef enum _v3270_select_format
185 185 {
186   - V3270_SELECT_TEXT,
187   - V3270_SELECT_TABLE,
  186 + V3270_SELECT_NONE, ///< @brief No selected format, use default.
  187 + V3270_SELECT_TEXT, ///< @brief Single text format, don't process.
  188 + V3270_SELECT_TABLE, ///< @brief Parse contents as table (only for text formats).
188 189  
189 190 V3270_SELECT_MAX
190 191 } V3270_SELECT_FORMAT;
... ... @@ -206,6 +207,7 @@
206 207 LIB3270_EXPORT void v3270_select_all(GtkWidget *widget);
207 208 LIB3270_EXPORT void v3270_select_region(GtkWidget *widget, gint start, gint end);
208 209  
  210 + LIB3270_EXPORT void v3270_copy(GtkWidget *widget, V3270_SELECT_FORMAT mode, gboolean cut);
209 211 LIB3270_EXPORT void v3270_copy_text(GtkWidget *widget, V3270_SELECT_FORMAT mode, gboolean cut);
210 212 LIB3270_EXPORT void v3270_copy_text_append(GtkWidget *widget);
211 213  
... ...
src/terminal/draw.c
... ... @@ -188,35 +188,7 @@ void v3270_draw_text_at(cairo_t *cr, int x, int y, v3270FontInfo *font, const ch
188 188 }
189 189  
190 190 void v3270_draw_text(cairo_t *cr, const GdkRectangle *rect, v3270FontInfo *font, const char *str) {
191   -
192 191 v3270_draw_text_at(cr,rect->x,rect->y,font,str);
193   -
194   -/*
195   - cairo_status_t status;
196   - cairo_glyph_t * glyphs = NULL;
197   - int num_glyphs = 0;
198   - cairo_text_cluster_t * clusters = NULL;
199   - int num_clusters = 0;
200   - cairo_text_cluster_flags_t cluster_flags;
201   - cairo_scaled_font_t * scaled_font = cairo_get_scaled_font (cr);
202   -
203   - status = cairo_scaled_font_text_to_glyphs(
204   - scaled_font,
205   - (double) rect->x, (double) (rect->y+font->height),
206   - str, strlen(str),
207   - &glyphs, &num_glyphs,
208   - &clusters, &num_clusters, &cluster_flags );
209   -
210   - if (status == CAIRO_STATUS_SUCCESS) {
211   - cairo_show_text_glyphs(cr,str,strlen(str),glyphs, num_glyphs,clusters, num_clusters, cluster_flags);
212   - }
213   -
214   - if(glyphs)
215   - cairo_glyph_free(glyphs);
216   -
217   - if(clusters)
218   - cairo_text_cluster_free(clusters);
219   -*/
220 192 }
221 193  
222 194 void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 *session, v3270FontInfo *font, GdkRectangle *rect, GdkRGBA *fg, GdkRGBA *bg)
... ... @@ -419,15 +391,14 @@ LIB3270_EXPORT void v3270_reload(GtkWidget *widget)
419 391  
420 392 for(c=0;c < cols;c++)
421 393 {
422   - unsigned char chr = 0;
423   - unsigned short attr;
  394 + struct v3270_character element = { 0, 0 };
424 395  
425   - lib3270_get_contents(terminal->host,addr,addr,&chr,&attr);
  396 + lib3270_get_contents(terminal->host,addr,addr,&element.chr,&element.attr);
426 397  
427 398 if(addr == cursor)
428   - v3270_update_cursor_rect(terminal,&rect,chr,attr);
  399 + v3270_update_cursor_rect(terminal,&rect,&element);
429 400  
430   - v3270_draw_element(cr,chr,attr,terminal->host,&terminal->font,&rect,terminal->color);
  401 + v3270_draw_element(cr,element.chr,element.attr,terminal->host,&terminal->font,&rect,terminal->color);
431 402  
432 403 addr++;
433 404 rect.x += rect.width;
... ... @@ -446,10 +417,14 @@ LIB3270_EXPORT void v3270_reload(GtkWidget *widget)
446 417  
447 418 void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned short attr, unsigned char cursor)
448 419 {
449   - v3270 * terminal = GTK_V3270(lib3270_get_user_data(session));
450   - cairo_t * cr;
451   - GdkRectangle rect;
452   - unsigned int rows,cols;
  420 + v3270 * terminal = GTK_V3270(lib3270_get_user_data(session));
  421 + cairo_t * cr;
  422 + GdkRectangle rect;
  423 + unsigned int rows,cols;
  424 + struct v3270_character element;
  425 +
  426 + element.chr = chr;
  427 + element.attr = attr;
453 428  
454 429 if(!(gtk_widget_get_realized(GTK_WIDGET(terminal)) && terminal->drawing))
455 430 return;
... ... @@ -473,8 +448,9 @@ void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned sho
473 448 cairo_set_scaled_font(cr,terminal->font.scaled);
474 449 v3270_draw_element(cr, chr, attr, terminal->host, &terminal->font, &rect,terminal->color);
475 450 cairo_destroy(cr);
  451 +
476 452 if(cursor)
477   - v3270_update_cursor_rect(terminal,&rect,chr,attr);
  453 + v3270_update_cursor_rect(terminal,&rect,&element);
478 454  
479 455 v3270_queue_draw_area(GTK_WIDGET(terminal),rect.x,rect.y,rect.width,rect.height);
480 456  
... ... @@ -503,13 +479,13 @@ void v3270_update_cursor_surface(v3270 *widget,unsigned char chr,unsigned short
503 479  
504 480 }
505 481  
506   -void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, unsigned char chr, unsigned short attr)
  482 +void v3270_update_cursor_rect(v3270 *widget, GdkRectangle *rect, const struct v3270_character *element)
507 483 {
508   - widget->cursor.chr = chr;
  484 + widget->cursor.chr = element->chr;
509 485 widget->cursor.rect = *rect;
510   - widget->cursor.attr = attr;
  486 + widget->cursor.attr = element->attr;
511 487 widget->cursor.rect.height = widget->font.height + widget->font.descent;
512   - v3270_update_cursor_surface(widget,chr,attr);
  488 + v3270_update_cursor_surface(widget,element->chr,element->attr);
513 489 }
514 490  
515 491 void v3270_queue_draw_area(GtkWidget *widget, gint x, gint y, gint width, gint height)
... ...
src/trace/exec.c
... ... @@ -176,17 +176,18 @@
176 176  
177 177 if(g_str_has_prefix(cmdline,"copy"))
178 178 {
  179 +
179 180 gchar * arg = cmdline+4;
180 181 g_strstrip(arg);
181 182  
182 183 if(!(*arg && g_ascii_strcasecmp(arg,"text")))
183 184 {
184 185 // No argument or "text" copy text.
185   - v3270_copy_text(widget, V3270_SELECT_TEXT, FALSE);
  186 + v3270_copy(widget, V3270_SELECT_TEXT, FALSE);
186 187 }
187 188 else if(!g_ascii_strcasecmp(arg,"table"))
188 189 {
189   - v3270_copy_text(widget, V3270_SELECT_TABLE, FALSE);
  190 + v3270_copy(widget, V3270_SELECT_TABLE, FALSE);
190 191 }
191 192  
192 193 return 0;
... ...
v3270.cbp
... ... @@ -42,6 +42,9 @@
42 42 <Add option="-fPIC" />
43 43 </Linker>
44 44 <Unit filename="configure.ac" />
  45 + <Unit filename="src/clipboard/copy.c">
  46 + <Option compilerVar="CC" />
  47 + </Unit>
45 48 <Unit filename="src/clipboard/linux/paste.c">
46 49 <Option compilerVar="CC" />
47 50 </Unit>
... ...