Commit 0e329efbf8f2617bab14631c7ac5fc289b960852

Authored by perry.werneck@gmail.com
1 parent b5ae2461

Novas funções de clipboard não funcionaram legal no windows, correção feita.

src/gtk/actions.c
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 31
32 #include "globals.h" 32 #include "globals.h"
33 #include "uiparser/parser.h" 33 #include "uiparser/parser.h"
  34 + #include "v3270/v3270.h"
34 #include <lib3270/actions.h> 35 #include <lib3270/actions.h>
35 36
36 /*--[ Implement ]------------------------------------------------------------------------------------*/ 37 /*--[ Implement ]------------------------------------------------------------------------------------*/
@@ -63,7 +64,7 @@ static void activate_action(GtkAction *action, GtkWidget *widget) @@ -63,7 +64,7 @@ static void activate_action(GtkAction *action, GtkWidget *widget)
63 static void copy_action(GtkAction *action, GtkWidget *widget) 64 static void copy_action(GtkAction *action, GtkWidget *widget)
64 { 65 {
65 trace("Action %s activated on widget %p",gtk_action_get_name(action),widget); 66 trace("Action %s activated on widget %p",gtk_action_get_name(action),widget);
66 - v3270_copy(GTK_V3270(widget)); 67 + v3270_copy_clipboard(GTK_V3270(widget));
67 } 68 }
68 69
69 void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id) 70 void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id)
src/gtk/v3270/clipboard.c
@@ -41,8 +41,8 @@ @@ -41,8 +41,8 @@
41 41
42 static const GtkTargetEntry targets[] = 42 static const GtkTargetEntry targets[] =
43 { 43 {
44 - { "STRING", 0, CLIPBOARD_TYPE_TEXT },  
45 - { "text/plain", 0, CLIPBOARD_TYPE_TEXT }, 44 + { "COMPOUND_TEXT", 0, CLIPBOARD_TYPE_TEXT },
  45 + { "UTF8_STRING", 0, CLIPBOARD_TYPE_TEXT },
46 }; 46 };
47 47
48 /*--[ Implement ]------------------------------------------------------------------------------------*/ 48 /*--[ Implement ]------------------------------------------------------------------------------------*/
@@ -53,16 +53,16 @@ static void clipboard_clear(GtkClipboard *clipboard, GObject *obj) @@ -53,16 +53,16 @@ static void clipboard_clear(GtkClipboard *clipboard, GObject *obj)
53 53
54 } 54 }
55 55
56 -void clipboard_get(GtkClipboard *clipboard, GtkSelectionData *selection, guint target, GObject *obj) 56 +static void clipboard_get(GtkClipboard *clipboard, GtkSelectionData *selection, guint target, GObject *obj)
57 { 57 {
58 - v3270 *widget = GTK_V3270(obj); 58 +// v3270 *widget = GTK_V3270(obj);
59 59
60 trace("%s: widget=%p target=\"%s\"",__FUNCTION__,obj,targets[target].target); 60 trace("%s: widget=%p target=\"%s\"",__FUNCTION__,obj,targets[target].target);
61 61
62 switch(target) 62 switch(target)
63 { 63 {
64 case CLIPBOARD_TYPE_TEXT: 64 case CLIPBOARD_TYPE_TEXT:
65 - gtk_selection_data_set_text(selection,"teste",-1); 65 + gtk_selection_data_set_text(selection,"teste de clipboard",-1);
66 break; 66 break;
67 67
68 default: 68 default:
@@ -70,9 +70,10 @@ void clipboard_get(GtkClipboard *clipboard, GtkSelectionData *selection, guint t @@ -70,9 +70,10 @@ void clipboard_get(GtkClipboard *clipboard, GtkSelectionData *selection, guint t
70 } 70 }
71 } 71 }
72 72
73 -gboolean v3270_copy(v3270 *widget) 73 +void v3270_copy_clipboard(v3270 *widget)
74 { 74 {
75 - GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); 75 + GtkClipboard * clipboard = gtk_widget_get_clipboard(GTK_WIDGET(widget),GDK_SELECTION_CLIPBOARD);
  76 +
76 if(gtk_clipboard_set_with_owner( clipboard, 77 if(gtk_clipboard_set_with_owner( clipboard,
77 targets, 78 targets,
78 G_N_ELEMENTS(targets), 79 G_N_ELEMENTS(targets),
@@ -82,9 +83,6 @@ gboolean v3270_copy(v3270 *widget) @@ -82,9 +83,6 @@ gboolean v3270_copy(v3270 *widget)
82 )) 83 ))
83 { 84 {
84 gtk_clipboard_set_can_store(clipboard,targets,1); 85 gtk_clipboard_set_can_store(clipboard,targets,1);
85 - trace("%s: Clipboard set",__FUNCTION__);  
86 - return TRUE;  
87 } 86 }
88 - return FALSE;  
89 } 87 }
90 88
src/gtk/v3270/mouse.c
@@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
33 #include "v3270.h" 33 #include "v3270.h"
34 #include "private.h" 34 #include "private.h"
35 #include <lib3270/selection.h> 35 #include <lib3270/selection.h>
  36 + #include <lib3270/actions.h>
36 37
37 /*--[ Implement ]------------------------------------------------------------------------------------*/ 38 /*--[ Implement ]------------------------------------------------------------------------------------*/
38 39
src/gtk/v3270/private.h
@@ -121,10 +121,6 @@ void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id); @@ -121,10 +121,6 @@ void v3270_update_message(v3270 *widget, LIB3270_MESSAGE id);
121 void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr); 121 void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr);
122 void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on); 122 void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on);
123 123
124 -// Clipboard  
125 -void v3270_clipboard_set(v3270 *widget);  
126 -void v3270_clipboard_clear(v3270 *widget);  
127 -  
128 // Keyboard & Mouse 124 // Keyboard & Mouse
129 gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event); 125 gboolean v3270_key_press_event(GtkWidget *widget, GdkEventKey *event);
130 gboolean v3270_key_release_event(GtkWidget *widget, GdkEventKey *event); 126 gboolean v3270_key_release_event(GtkWidget *widget, GdkEventKey *event);
src/gtk/v3270/v3270.h
@@ -198,8 +198,10 @@ @@ -198,8 +198,10 @@
198 int v3270_connect(GtkWidget *widget, const gchar *host); 198 int v3270_connect(GtkWidget *widget, const gchar *host);
199 void v3270_disconnect(GtkWidget *widget); 199 void v3270_disconnect(GtkWidget *widget);
200 200
201 - // Clipboard  
202 - gboolean v3270_copy(v3270 *widget); 201 +// Clipboard
  202 + void v3270_copy_clipboard(v3270 *widget);
  203 + void v3270_paste_clipboard(v3270 *widget);
  204 +
203 205
204 G_END_DECLS 206 G_END_DECLS
205 207