Commit 1280051c8ce9a70fdb768a01c5dfb1df1d7a260b
1 parent
179483d8
Exists in
master
and in
1 other branch
Moving class properties to the class structure.
Showing
8 changed files
with
87 additions
and
89 deletions
Show diff stats
src/include/internals.h
... | ... | @@ -37,6 +37,7 @@ |
37 | 37 | #define GETTEXT_PACKAGE PACKAGE_NAME |
38 | 38 | |
39 | 39 | #include <glib.h> |
40 | + #include <glib/gi18n.h> | |
40 | 41 | #include <gtk/gtk.h> |
41 | 42 | #include <lib3270.h> |
42 | 43 | #include <lib3270/log.h> |
... | ... | @@ -133,6 +134,7 @@ |
133 | 134 | |
134 | 135 | G_GNUC_INTERNAL gboolean v3270_draw(GtkWidget * widget, cairo_t * cr); |
135 | 136 | G_GNUC_INTERNAL void v3270_cursor_draw(v3270 *widget); |
137 | + G_GNUC_INTERNAL void v3270_set_cursor(GtkWidget *widget, LIB3270_POINTER id); | |
136 | 138 | |
137 | 139 | G_GNUC_INTERNAL void v3270_draw_oia(v3270 *terminal, cairo_t *cr, int row, int cols); |
138 | 140 | G_GNUC_INTERNAL void v3270_update_mouse_pointer(GtkWidget *widget); | ... | ... |
src/terminal/callbacks.c
... | ... | @@ -71,7 +71,8 @@ static void set_timer(H3270 *session, unsigned char on) |
71 | 71 | |
72 | 72 | static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, G_GNUC_UNUSED LIB3270_TOGGLE_TYPE reason, const char *name) |
73 | 73 | { |
74 | - GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); | |
74 | + GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); | |
75 | + v3270Class * klass = GTK_V3270_GET_CLASS(widget); | |
75 | 76 | |
76 | 77 | trace("%s(%s,%d)",__FUNCTION__,name,(int) value); |
77 | 78 | |
... | ... | @@ -133,7 +134,7 @@ static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value |
133 | 134 | |
134 | 135 | } |
135 | 136 | |
136 | - g_object_notify_by_pspec(G_OBJECT(widget), v3270_properties.toggle[ix]); | |
137 | + g_object_notify_by_pspec(G_OBJECT(widget), klass->properties.toggle[ix]); | |
137 | 138 | g_signal_emit(widget, v3270_widget_signal[V3270_SIGNAL_TOGGLE_CHANGED], 0, (guint) ix, (gboolean) (value != 0), (gchar *) name); |
138 | 139 | |
139 | 140 | } |
... | ... | @@ -226,8 +227,7 @@ static void update_connect(H3270 *session, unsigned char connected) |
226 | 227 | g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[V3270_SIGNAL_DISCONNECTED], 0); |
227 | 228 | } |
228 | 229 | |
229 | - if(v3270_properties.online) | |
230 | - g_object_notify_by_pspec(G_OBJECT(widget), v3270_properties.online); | |
230 | + g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.online); | |
231 | 231 | |
232 | 232 | widget->activity.timestamp = time(0); |
233 | 233 | |
... | ... | @@ -236,16 +236,16 @@ static void update_connect(H3270 *session, unsigned char connected) |
236 | 236 | |
237 | 237 | static void update_screen_size(H3270 *session, G_GNUC_UNUSED unsigned short rows, G_GNUC_UNUSED unsigned short cols) |
238 | 238 | { |
239 | - v3270_reload(GTK_WIDGET(lib3270_get_user_data(session))); | |
240 | - gtk_widget_queue_draw(GTK_WIDGET(lib3270_get_user_data(session))); | |
239 | + GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); | |
240 | + v3270_reload(widget); | |
241 | + gtk_widget_queue_draw(widget); | |
241 | 242 | } |
242 | 243 | |
243 | 244 | static void update_model(H3270 *session, const char *name, int model, G_GNUC_UNUSED int rows, G_GNUC_UNUSED int cols) |
244 | 245 | { |
245 | - if(v3270_properties.model) | |
246 | - g_object_notify_by_pspec(G_OBJECT(lib3270_get_user_data(session)), v3270_properties.model); | |
247 | - | |
248 | - g_signal_emit(GTK_WIDGET(lib3270_get_user_data(session)),v3270_widget_signal[V3270_SIGNAL_MODEL_CHANGED], 0, (guint) model, name); | |
246 | + GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); | |
247 | + g_object_notify_by_pspec(G_OBJECT(lib3270_get_user_data(session)), GTK_V3270_GET_CLASS(widget)->properties.model); | |
248 | + g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_MODEL_CHANGED], 0, (guint) model, name); | |
249 | 249 | } |
250 | 250 | |
251 | 251 | static void changed(H3270 *session, int offset, int len) |
... | ... | @@ -299,9 +299,7 @@ static void set_selection(H3270 *session, unsigned char status) |
299 | 299 | { |
300 | 300 | GtkWidget * widget = GTK_WIDGET(lib3270_get_user_data(session)); |
301 | 301 | |
302 | - if(v3270_properties.selection) | |
303 | - g_object_notify_by_pspec(G_OBJECT(widget), v3270_properties.selection); | |
304 | - | |
302 | + g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.selection); | |
305 | 303 | g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_SELECTING], 0, status ? TRUE : FALSE); |
306 | 304 | |
307 | 305 | } | ... | ... |
src/terminal/mouse.c
... | ... | @@ -222,7 +222,7 @@ static void update_mouse_pointer(GtkWidget *widget, int baddr) |
222 | 222 | |
223 | 223 | if(baddr >= 0 && terminal->pointer_id == LIB3270_POINTER_UNLOCKED) |
224 | 224 | { |
225 | - gdk_window_set_cursor(gtk_widget_get_window(widget),v3270_cursor[lib3270_get_pointer(terminal->host,baddr)]); | |
225 | + v3270_set_cursor(widget,lib3270_get_pointer(terminal->host,baddr)); | |
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
... | ... | @@ -240,7 +240,7 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) |
240 | 240 | |
241 | 241 | if(!lib3270_connected(terminal->host)) |
242 | 242 | { |
243 | - gdk_window_set_cursor(gtk_widget_get_window(widget),v3270_cursor[LIB3270_POINTER_LOCKED]); | |
243 | + v3270_set_cursor(widget,LIB3270_POINTER_LOCKED); | |
244 | 244 | return FALSE; |
245 | 245 | } |
246 | 246 | |
... | ... | @@ -292,7 +292,7 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) |
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | - gdk_window_set_cursor(gtk_widget_get_window(widget),v3270_cursor[id]); | |
295 | + v3270_set_cursor(widget,id); | |
296 | 296 | } |
297 | 297 | |
298 | 298 | return FALSE; | ... | ... |
src/terminal/oia.c
... | ... | @@ -721,7 +721,7 @@ void v3270_update_luname(GtkWidget *widget,const gchar *name) |
721 | 721 | v3270_queue_draw_area(GTK_WIDGET(terminal),rect->x,rect->y,rect->width,rect->height); |
722 | 722 | } |
723 | 723 | |
724 | - g_object_notify_by_pspec(G_OBJECT(widget), v3270_properties.luname); | |
724 | + g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.luname); | |
725 | 725 | |
726 | 726 | } |
727 | 727 | ... | ... |
src/terminal/private.h
... | ... | @@ -28,15 +28,8 @@ |
28 | 28 | */ |
29 | 29 | |
30 | 30 | #include <config.h> |
31 | - | |
32 | 31 | #include <internals.h> |
33 | 32 | |
34 | -#include <libintl.h> | |
35 | -#include <glib/gi18n.h> | |
36 | - | |
37 | -#include <gtk/gtk.h> | |
38 | -#include <v3270.h> | |
39 | - | |
40 | 33 | G_BEGIN_DECLS |
41 | 34 | |
42 | 35 | struct _v3270Class |
... | ... | @@ -45,12 +38,31 @@ G_BEGIN_DECLS |
45 | 38 | |
46 | 39 | // Internal properties. |
47 | 40 | struct { |
41 | + | |
48 | 42 | size_t count; // Number of properties. |
49 | 43 | |
50 | 44 | GParamSpec * font_family; |
45 | + GParamSpec * toggle[LIB3270_TOGGLE_COUNT]; // Toggle properties. | |
46 | + | |
47 | + // Signal related properties | |
48 | + GParamSpec * online; | |
49 | + GParamSpec * luname; | |
50 | + GParamSpec * model; | |
51 | + GParamSpec * selection; | |
52 | + | |
53 | + struct | |
54 | + { | |
55 | + guint toggle; | |
56 | + guint boolean; | |
57 | + guint integer; | |
58 | + guint str; | |
59 | + } type; | |
51 | 60 | |
52 | 61 | } properties; |
53 | 62 | |
63 | + // Cursors | |
64 | + GdkCursor * cursors[LIB3270_POINTER_COUNT]; | |
65 | + | |
54 | 66 | // Signals |
55 | 67 | void (*activate)(GtkWidget *widget); |
56 | 68 | void (*toggle_changed)(v3270 *widget,LIB3270_TOGGLE toggle_id,gboolean toggle_state,const gchar *toggle_name); |
... | ... | @@ -168,31 +180,4 @@ G_BEGIN_DECLS |
168 | 180 | |
169 | 181 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
170 | 182 | |
171 | - G_GNUC_INTERNAL GdkCursor * v3270_cursor[LIB3270_POINTER_COUNT]; | |
172 | - | |
173 | - G_GNUC_INTERNAL struct _v3270_properties | |
174 | - { | |
175 | - GParamSpec * toggle[LIB3270_TOGGLE_COUNT]; // Toggle properties. | |
176 | - | |
177 | - struct | |
178 | - { | |
179 | - guint toggle; | |
180 | - guint boolean; | |
181 | - guint integer; | |
182 | - guint str; | |
183 | - } type; | |
184 | - | |
185 | - /* | |
186 | - // V3270 Internal properties. | |
187 | - GParamSpec * font_family; | |
188 | - */ | |
189 | - | |
190 | - // Properties who launch signals. | |
191 | - GParamSpec * online; | |
192 | - GParamSpec * luname; | |
193 | - GParamSpec * model; | |
194 | - GParamSpec * selection; | |
195 | - | |
196 | - } v3270_properties; | |
197 | - | |
198 | 183 | G_END_DECLS | ... | ... |
src/terminal/properties.c
... | ... | @@ -51,41 +51,42 @@ |
51 | 51 | |
52 | 52 | static void v3270_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
53 | 53 | { |
54 | - v3270 *window = GTK_V3270(object); | |
54 | + v3270 * window = GTK_V3270(object); | |
55 | + v3270Class * klass = GTK_V3270_GET_CLASS(object); | |
55 | 56 | |
56 | 57 | debug("%s(%u,%s)",__FUNCTION__,prop_id,g_param_spec_get_name(pspec)); |
57 | 58 | |
58 | - if(prop_id >= v3270_properties.type.str) | |
59 | + if(prop_id >= klass->properties.type.str) | |
59 | 60 | { |
60 | - const LIB3270_STRING_PROPERTY * prop = (lib3270_get_string_properties_list()+(prop_id - v3270_properties.type.str)); | |
61 | + const LIB3270_STRING_PROPERTY * prop = (lib3270_get_string_properties_list()+(prop_id - klass->properties.type.str)); | |
61 | 62 | debug("%s.%s.%s=%s",__FUNCTION__,"string",prop->name,g_value_get_string(value)); |
62 | 63 | |
63 | 64 | if(prop->set) |
64 | 65 | prop->set(window->host,g_value_get_string(value)); |
65 | 66 | |
66 | 67 | } |
67 | - else if(prop_id >= v3270_properties.type.integer) | |
68 | + else if(prop_id >= klass->properties.type.integer) | |
68 | 69 | { |
69 | - const LIB3270_INT_PROPERTY * prop = (lib3270_get_int_properties_list()+(prop_id - v3270_properties.type.integer)); | |
70 | + const LIB3270_INT_PROPERTY * prop = (lib3270_get_int_properties_list()+(prop_id - klass->properties.type.integer)); | |
70 | 71 | debug("%s.%s.%s",__FUNCTION__,"integer",prop->name); |
71 | 72 | |
72 | 73 | if(prop->set) |
73 | 74 | prop->set(window->host,g_value_get_int(value)); |
74 | 75 | |
75 | 76 | } |
76 | - else if(prop_id >= v3270_properties.type.boolean) | |
77 | + else if(prop_id >= klass->properties.type.boolean) | |
77 | 78 | { |
78 | - const LIB3270_INT_PROPERTY * prop = (lib3270_get_boolean_properties_list()+(prop_id - v3270_properties.type.boolean)); | |
79 | + const LIB3270_INT_PROPERTY * prop = (lib3270_get_boolean_properties_list()+(prop_id - klass->properties.type.boolean)); | |
79 | 80 | debug("%s.%s.%s",__FUNCTION__,"boolean",prop->name); |
80 | 81 | |
81 | 82 | if(prop->set) |
82 | 83 | prop->set(window->host,g_value_get_boolean(value) ? 1 : 0); |
83 | 84 | |
84 | 85 | } |
85 | - else if(prop_id >= v3270_properties.type.toggle) | |
86 | + else if(prop_id >= klass->properties.type.toggle) | |
86 | 87 | { |
87 | 88 | debug("%s.%s",__FUNCTION__,"toggle"); |
88 | - lib3270_set_toggle(window->host,prop_id - v3270_properties.type.toggle, (int) g_value_get_boolean (value)); | |
89 | + lib3270_set_toggle(window->host,prop_id - klass->properties.type.toggle, (int) g_value_get_boolean (value)); | |
89 | 90 | |
90 | 91 | } |
91 | 92 | |
... | ... | @@ -104,41 +105,42 @@ |
104 | 105 | |
105 | 106 | static void v3270_get_property(GObject *object,guint prop_id, GValue *value, GParamSpec *pspec) |
106 | 107 | { |
107 | - v3270 *window = GTK_V3270(object); | |
108 | + v3270 * window = GTK_V3270(object); | |
109 | + v3270Class * klass = GTK_V3270_GET_CLASS(object); | |
108 | 110 | |
109 | 111 | debug("%s(%u,%s)",__FUNCTION__,prop_id,g_param_spec_get_name(pspec)); |
110 | 112 | |
111 | - if(prop_id >= v3270_properties.type.str) | |
113 | + if(prop_id >= klass->properties.type.str) | |
112 | 114 | { |
113 | - const LIB3270_STRING_PROPERTY * prop = (lib3270_get_string_properties_list()+(prop_id - v3270_properties.type.str)); | |
115 | + const LIB3270_STRING_PROPERTY * prop = (lib3270_get_string_properties_list()+(prop_id - klass->properties.type.str)); | |
114 | 116 | debug("%s.%s.%s",__FUNCTION__,"string",prop->name); |
115 | 117 | |
116 | 118 | if(prop->get) |
117 | 119 | g_value_set_string(value,prop->get(window->host)); |
118 | 120 | |
119 | 121 | } |
120 | - else if(prop_id >= v3270_properties.type.integer) | |
122 | + else if(prop_id >= klass->properties.type.integer) | |
121 | 123 | { |
122 | - const LIB3270_INT_PROPERTY * prop = (lib3270_get_int_properties_list()+(prop_id - v3270_properties.type.integer)); | |
124 | + const LIB3270_INT_PROPERTY * prop = (lib3270_get_int_properties_list()+(prop_id - klass->properties.type.integer)); | |
123 | 125 | debug("%s.%s.%s",__FUNCTION__,"integer",prop->name); |
124 | 126 | |
125 | 127 | if(prop->get) |
126 | 128 | g_value_set_int(value,prop->get(window->host)); |
127 | 129 | |
128 | 130 | } |
129 | - else if(prop_id >= v3270_properties.type.boolean) | |
131 | + else if(prop_id >= klass->properties.type.boolean) | |
130 | 132 | { |
131 | - const LIB3270_INT_PROPERTY * prop = (lib3270_get_boolean_properties_list()+(prop_id - v3270_properties.type.boolean)); | |
133 | + const LIB3270_INT_PROPERTY * prop = (lib3270_get_boolean_properties_list()+(prop_id - klass->properties.type.boolean)); | |
132 | 134 | debug("%s.%s.%s",__FUNCTION__,"boolean",prop->name); |
133 | 135 | |
134 | 136 | if(prop->get) |
135 | 137 | g_value_set_boolean(value,prop->get(window->host) != 0 ? TRUE : FALSE); |
136 | 138 | |
137 | 139 | } |
138 | - else if(prop_id >= v3270_properties.type.toggle) | |
140 | + else if(prop_id >= klass->properties.type.toggle) | |
139 | 141 | { |
140 | - debug("%s.%s.%s",__FUNCTION__,"toggle",lib3270_get_toggle_name(prop_id - v3270_properties.type.toggle)); | |
141 | - g_value_set_boolean(value,lib3270_get_toggle(window->host,prop_id - v3270_properties.type.toggle) ? TRUE : FALSE ); | |
142 | + debug("%s.%s.%s",__FUNCTION__,"toggle",lib3270_get_toggle_name(prop_id - klass->properties.type.toggle)); | |
143 | + g_value_set_boolean(value,lib3270_get_toggle(window->host,prop_id - klass->properties.type.toggle) ? TRUE : FALSE ); | |
142 | 144 | |
143 | 145 | } |
144 | 146 | |
... | ... | @@ -159,15 +161,17 @@ |
159 | 161 | |
160 | 162 | void v3270_install_property(GObjectClass *oclass, guint property_id, GParamSpec *pspec) |
161 | 163 | { |
162 | - static const struct | |
164 | + v3270Class * klass = GTK_V3270_CLASS(oclass); | |
165 | + | |
166 | + const struct | |
163 | 167 | { |
164 | 168 | const char *name; |
165 | 169 | GParamSpec **prop; |
166 | 170 | } properties[] = { |
167 | - { "connected", &v3270_properties.online }, | |
168 | - { "luname", &v3270_properties.luname }, | |
169 | - { "model", &v3270_properties.model }, | |
170 | - { "has-selection", &v3270_properties.selection }, | |
171 | + { "connected", &klass->properties.online }, | |
172 | + { "luname", &klass->properties.luname }, | |
173 | + { "model", &klass->properties.model }, | |
174 | + { "has-selection", &klass->properties.selection }, | |
171 | 175 | }; |
172 | 176 | |
173 | 177 | size_t ix; |
... | ... | @@ -195,7 +199,6 @@ |
195 | 199 | |
196 | 200 | debug("%s",__FUNCTION__); |
197 | 201 | |
198 | - memset(&v3270_properties,0,sizeof(v3270_properties)); | |
199 | 202 | gobject_class->set_property = v3270_set_property; |
200 | 203 | gobject_class->get_property = v3270_get_property; |
201 | 204 | |
... | ... | @@ -221,12 +224,12 @@ |
221 | 224 | // |
222 | 225 | |
223 | 226 | // Extract toggle class. |
224 | - v3270_properties.type.toggle = klass->properties.count; | |
227 | + klass->properties.type.toggle = klass->properties.count; | |
225 | 228 | for(ix = 0; ix < LIB3270_TOGGLE_COUNT; ix++) |
226 | 229 | { |
227 | - debug("Property %u=%s (Toggle)",(unsigned int) v3270_properties.type.toggle + ix, lib3270_get_toggle_name(ix)); | |
230 | + debug("Property %u=%s (Toggle)",(unsigned int) klass->properties.type.toggle + ix, lib3270_get_toggle_name(ix)); | |
228 | 231 | |
229 | - v3270_properties.toggle[ix] = | |
232 | + klass->properties.toggle[ix] = | |
230 | 233 | g_param_spec_boolean( |
231 | 234 | lib3270_get_toggle_name(ix), |
232 | 235 | lib3270_get_toggle_name(ix), |
... | ... | @@ -235,17 +238,17 @@ |
235 | 238 | G_PARAM_WRITABLE|G_PARAM_READABLE |
236 | 239 | ); |
237 | 240 | |
238 | - v3270_install_property(gobject_class, klass->properties.count++, v3270_properties.toggle[ix]); | |
241 | + v3270_install_property(gobject_class, klass->properties.count++, klass->properties.toggle[ix]); | |
239 | 242 | |
240 | 243 | } |
241 | 244 | |
242 | 245 | // Creating boolean properties. |
243 | - v3270_properties.type.boolean = klass->properties.count; | |
246 | + klass->properties.type.boolean = klass->properties.count; | |
244 | 247 | const LIB3270_INT_PROPERTY * bool_props = lib3270_get_boolean_properties_list(); |
245 | 248 | |
246 | 249 | for(ix = 0; bool_props[ix].name; ix++) |
247 | 250 | { |
248 | - debug("Property %u=%s (Boolean)",(unsigned int) v3270_properties.type.boolean + ix, bool_props[ix].name); | |
251 | + debug("Property %u=%s (Boolean)",(unsigned int) klass->properties.type.boolean + ix, bool_props[ix].name); | |
249 | 252 | spec = g_param_spec_boolean( |
250 | 253 | bool_props[ix].name, |
251 | 254 | bool_props[ix].name, |
... | ... | @@ -260,11 +263,11 @@ |
260 | 263 | |
261 | 264 | // Creating integer properties. |
262 | 265 | const LIB3270_INT_PROPERTY * int_props = lib3270_get_int_properties_list(); |
263 | - v3270_properties.type.integer = klass->properties.count; | |
266 | + klass->properties.type.integer = klass->properties.count; | |
264 | 267 | |
265 | 268 | for(ix = 0; int_props[ix].name; ix++) |
266 | 269 | { |
267 | - debug("Property %u=%s (Integer)",(unsigned int) v3270_properties.type.integer + ix, int_props[ix].name); | |
270 | + debug("Property %u=%s (Integer)",(unsigned int) klass->properties.type.integer + ix, int_props[ix].name); | |
268 | 271 | |
269 | 272 | spec = g_param_spec_int( |
270 | 273 | int_props[ix].name, |
... | ... | @@ -287,12 +290,12 @@ |
287 | 290 | |
288 | 291 | // Creating string properties. |
289 | 292 | const LIB3270_STRING_PROPERTY * str_props = lib3270_get_string_properties_list(); |
290 | - v3270_properties.type.str = klass->properties.count; | |
293 | + klass->properties.type.str = klass->properties.count; | |
291 | 294 | |
292 | 295 | for(ix = 0; str_props[ix].name; ix++) |
293 | 296 | { |
294 | 297 | |
295 | - debug("Property %u=%s (String)",(unsigned int) v3270_properties.type.str + ix, str_props[ix].name); | |
298 | + debug("Property %u=%s (String)",(unsigned int) klass->properties.type.str + ix, str_props[ix].name); | |
296 | 299 | |
297 | 300 | spec = g_param_spec_string( |
298 | 301 | str_props[ix].name, | ... | ... |
src/terminal/widget.c
... | ... | @@ -64,7 +64,6 @@ |
64 | 64 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
65 | 65 | |
66 | 66 | guint v3270_widget_signal[V3270_SIGNAL_LAST] = { 0 }; |
67 | - GdkCursor * v3270_cursor[LIB3270_POINTER_COUNT] = { 0 }; | |
68 | 67 | |
69 | 68 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ |
70 | 69 | |
... | ... | @@ -337,9 +336,9 @@ static void v3270_class_init(v3270Class *klass) |
337 | 336 | for(f=0;f<LIB3270_POINTER_COUNT;f++) |
338 | 337 | { |
339 | 338 | #ifdef WIN32 |
340 | - v3270_cursor[f] = gdk_cursor_new_from_name(gdk_display_get_default(),cr[f]); | |
339 | + klass->cursors[f] = gdk_cursor_new_from_name(gdk_display_get_default(),cr[f]); | |
341 | 340 | #else |
342 | - v3270_cursor[f] = gdk_cursor_new_for_display(gdk_display_get_default(),cr[f]); | |
341 | + klass->cursors[f] = gdk_cursor_new_for_display(gdk_display_get_default(),cr[f]); | |
343 | 342 | #endif |
344 | 343 | } |
345 | 344 | } |
... | ... | @@ -1041,3 +1040,11 @@ LIB3270_EXPORT GtkWidget * v3270_get_default_widget(void) |
1041 | 1040 | return GTK_WIDGET(widget); |
1042 | 1041 | } |
1043 | 1042 | |
1043 | +void v3270_set_cursor(GtkWidget *widget, LIB3270_POINTER id) | |
1044 | +{ | |
1045 | + gdk_window_set_cursor( | |
1046 | + gtk_widget_get_window(widget), | |
1047 | + GTK_V3270_GET_CLASS(widget)->cursors[id % LIB3270_POINTER_COUNT] | |
1048 | + ); | |
1049 | +} | |
1050 | + | ... | ... |
v3270.cbp
... | ... | @@ -172,6 +172,9 @@ |
172 | 172 | <Option compilerVar="CC" /> |
173 | 173 | </Unit> |
174 | 174 | <Unit filename="src/terminal/marshal.h" /> |
175 | + <Unit filename="src/terminal/mouse.c"> | |
176 | + <Option compilerVar="CC" /> | |
177 | + </Unit> | |
175 | 178 | <Unit filename="src/terminal/oia.c"> |
176 | 179 | <Option compilerVar="CC" /> |
177 | 180 | </Unit> | ... | ... |