Commit 20a7ff89b2ab283e91e34f4f80a459cc03d9be2e
1 parent
d68da4e5
Exists in
master
and in
1 other branch
Passando gerência do ponteiro do mouse para a lib3270
Showing
3 changed files
with
19 additions
and
65 deletions
Show diff stats
mouse.c
@@ -224,59 +224,12 @@ gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event) | @@ -224,59 +224,12 @@ gboolean v3270_button_release_event(GtkWidget *widget, GdkEventButton*event) | ||
224 | static void update_mouse_pointer(GtkWidget *widget, int baddr) | 224 | static void update_mouse_pointer(GtkWidget *widget, int baddr) |
225 | { | 225 | { |
226 | v3270 * terminal = GTK_V3270(widget); | 226 | v3270 * terminal = GTK_V3270(widget); |
227 | - int id = 0; | 227 | +// int id = 0; |
228 | 228 | ||
229 | - if(baddr >= 0 && terminal->pointer_id == LIB3270_CURSOR_EDITABLE) | 229 | + if(baddr >= 0 && terminal->pointer_id == LIB3270_POINTER_UNLOCKED) |
230 | { | 230 | { |
231 | - | ||
232 | - switch(lib3270_get_selection_flags(terminal->host,baddr) & 0x8f) | ||
233 | - { | ||
234 | - case 0x80: | ||
235 | - id = V3270_CURSOR_MOVE_SELECTION; | ||
236 | - break; | ||
237 | - | ||
238 | - case 0x82: | ||
239 | - id = V3270_CURSOR_SELECTION_TOP; | ||
240 | - break; | ||
241 | - | ||
242 | - case 0x86: | ||
243 | - id = V3270_CURSOR_SELECTION_TOP_RIGHT; | ||
244 | - break; | ||
245 | - | ||
246 | - case 0x84: | ||
247 | - id = V3270_CURSOR_SELECTION_RIGHT; | ||
248 | - break; | ||
249 | - | ||
250 | - case 0x81: | ||
251 | - id = V3270_CURSOR_SELECTION_LEFT; | ||
252 | - break; | ||
253 | - | ||
254 | - case 0x89: | ||
255 | - id = V3270_CURSOR_SELECTION_BOTTOM_LEFT; | ||
256 | - break; | ||
257 | - | ||
258 | - case 0x88: | ||
259 | - id = V3270_CURSOR_SELECTION_BOTTOM; | ||
260 | - break; | ||
261 | - | ||
262 | - case 0x8c: | ||
263 | - id = V3270_CURSOR_SELECTION_BOTTOM_RIGHT; | ||
264 | - break; | ||
265 | - | ||
266 | - case 0x83: | ||
267 | - id = V3270_CURSOR_SELECTION_TOP_LEFT; | ||
268 | - break; | ||
269 | - | ||
270 | - default: | ||
271 | - id = lib3270_is_protected(terminal->host,baddr) ? V3270_CURSOR_PROTECTED : V3270_CURSOR_UNPROTECTED; | ||
272 | - | ||
273 | - } | ||
274 | - | ||
275 | - gdk_window_set_cursor(gtk_widget_get_window(widget),v3270_cursor[id]); | ||
276 | - | 231 | + gdk_window_set_cursor(gtk_widget_get_window(widget),v3270_cursor[lib3270_get_pointer(terminal->host,baddr)]); |
277 | } | 232 | } |
278 | - | ||
279 | - | ||
280 | } | 233 | } |
281 | 234 | ||
282 | void v3270_update_mouse_pointer(GtkWidget *widget) | 235 | void v3270_update_mouse_pointer(GtkWidget *widget) |
@@ -298,7 +251,7 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) | @@ -298,7 +251,7 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) | ||
298 | 251 | ||
299 | if(!lib3270_connected(terminal->host)) | 252 | if(!lib3270_connected(terminal->host)) |
300 | { | 253 | { |
301 | - gdk_window_set_cursor(gtk_widget_get_window(widget),v3270_cursor[V3270_CURSOR_PROTECTED]); | 254 | + gdk_window_set_cursor(gtk_widget_get_window(widget),v3270_cursor[LIB3270_POINTER_LOCKED]); |
302 | return FALSE; | 255 | return FALSE; |
303 | } | 256 | } |
304 | 257 | ||
@@ -323,30 +276,30 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) | @@ -323,30 +276,30 @@ gboolean v3270_motion_notify_event(GtkWidget *widget, GdkEventMotion *event) | ||
323 | } | 276 | } |
324 | else if(event->y >= terminal->oia_rect->y) | 277 | else if(event->y >= terminal->oia_rect->y) |
325 | { | 278 | { |
326 | - int id = V3270_CURSOR_PROTECTED; | 279 | + int id = LIB3270_POINTER_PROTECTED; |
327 | 280 | ||
328 | if(event->x >= terminal->oia_rect[V3270_OIA_SSL].x && event->x <= (terminal->oia_rect[V3270_OIA_SSL].x + terminal->oia_rect[V3270_OIA_SSL].width)) | 281 | if(event->x >= terminal->oia_rect[V3270_OIA_SSL].x && event->x <= (terminal->oia_rect[V3270_OIA_SSL].x + terminal->oia_rect[V3270_OIA_SSL].width)) |
329 | { | 282 | { |
330 | switch(lib3270_get_secure(terminal->host)) | 283 | switch(lib3270_get_secure(terminal->host)) |
331 | { | 284 | { |
332 | case LIB3270_SSL_UNSECURE: /**< No secure connection */ | 285 | case LIB3270_SSL_UNSECURE: /**< No secure connection */ |
333 | - id = V3270_CURSOR_QUESTION; | 286 | + id = LIB3270_POINTER_QUESTION; |
334 | break; | 287 | break; |
335 | 288 | ||
336 | case LIB3270_SSL_NEGOTIATING: /**< Negotiating SSL */ | 289 | case LIB3270_SSL_NEGOTIATING: /**< Negotiating SSL */ |
337 | - id = V3270_CURSOR_WAITING; | 290 | + id = LIB3270_POINTER_WAITING; |
338 | break; | 291 | break; |
339 | 292 | ||
340 | case LIB3270_SSL_NEGOTIATED: /**< Connection secure, no CA or self-signed */ | 293 | case LIB3270_SSL_NEGOTIATED: /**< Connection secure, no CA or self-signed */ |
341 | - id = V3270_CURSOR_QUESTION; | 294 | + id = LIB3270_POINTER_QUESTION; |
342 | break; | 295 | break; |
343 | 296 | ||
344 | case LIB3270_SSL_SECURE: /**< Connection secure with CA check */ | 297 | case LIB3270_SSL_SECURE: /**< Connection secure with CA check */ |
345 | - id = V3270_CURSOR_QUESTION; | 298 | + id = LIB3270_POINTER_QUESTION; |
346 | break; | 299 | break; |
347 | 300 | ||
348 | default: | 301 | default: |
349 | - id = V3270_CURSOR_LOCKED; | 302 | + id = LIB3270_POINTER_LOCKED; |
350 | } | 303 | } |
351 | } | 304 | } |
352 | 305 |
private.h
@@ -88,6 +88,7 @@ G_BEGIN_DECLS | @@ -88,6 +88,7 @@ G_BEGIN_DECLS | ||
88 | 88 | ||
89 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 89 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
90 | 90 | ||
91 | +/* | ||
91 | #define V3270_CURSOR_UNPROTECTED LIB3270_CURSOR_EDITABLE | 92 | #define V3270_CURSOR_UNPROTECTED LIB3270_CURSOR_EDITABLE |
92 | #define V3270_CURSOR_WAITING LIB3270_CURSOR_WAITING | 93 | #define V3270_CURSOR_WAITING LIB3270_CURSOR_WAITING |
93 | #define V3270_CURSOR_LOCKED LIB3270_CURSOR_LOCKED | 94 | #define V3270_CURSOR_LOCKED LIB3270_CURSOR_LOCKED |
@@ -105,7 +106,7 @@ G_BEGIN_DECLS | @@ -105,7 +106,7 @@ G_BEGIN_DECLS | ||
105 | #define V3270_CURSOR_QUESTION LIB3270_CURSOR_USER+10 | 106 | #define V3270_CURSOR_QUESTION LIB3270_CURSOR_USER+10 |
106 | 107 | ||
107 | #define V3270_CURSOR_COUNT LIB3270_CURSOR_USER+11 | 108 | #define V3270_CURSOR_COUNT LIB3270_CURSOR_USER+11 |
108 | - | 109 | +*/ |
109 | 110 | ||
110 | struct v3270_ssl_status_msg | 111 | struct v3270_ssl_status_msg |
111 | { | 112 | { |
@@ -146,7 +147,7 @@ G_BEGIN_DECLS | @@ -146,7 +147,7 @@ G_BEGIN_DECLS | ||
146 | int baddr; /**< Selection addr */ | 147 | int baddr; /**< Selection addr */ |
147 | } selection; | 148 | } selection; |
148 | 149 | ||
149 | - LIB3270_CURSOR pointer_id; | 150 | + LIB3270_POINTER pointer_id; |
150 | unsigned char pointer; /**< Mouse pointer ID */ | 151 | unsigned char pointer; /**< Mouse pointer ID */ |
151 | 152 | ||
152 | V3270_OIA_FIELD selected_field; /**< Clicked OIA field */ | 153 | V3270_OIA_FIELD selected_field; /**< Clicked OIA field */ |
@@ -226,7 +227,7 @@ G_BEGIN_DECLS | @@ -226,7 +227,7 @@ G_BEGIN_DECLS | ||
226 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 227 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
227 | 228 | ||
228 | G_GNUC_INTERNAL guint v3270_widget_signal[LAST_SIGNAL]; | 229 | G_GNUC_INTERNAL guint v3270_widget_signal[LAST_SIGNAL]; |
229 | - G_GNUC_INTERNAL GdkCursor * v3270_cursor[V3270_CURSOR_COUNT]; | 230 | + G_GNUC_INTERNAL GdkCursor * v3270_cursor[LIB3270_POINTER_COUNT]; |
230 | G_GNUC_INTERNAL GParamSpec * v3270_properties[PROP_LAST]; | 231 | G_GNUC_INTERNAL GParamSpec * v3270_properties[PROP_LAST]; |
231 | 232 | ||
232 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ | 233 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ |
widget.c
@@ -72,8 +72,8 @@ | @@ -72,8 +72,8 @@ | ||
72 | 72 | ||
73 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 73 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
74 | 74 | ||
75 | - guint v3270_widget_signal[LAST_SIGNAL] = { 0 }; | ||
76 | - GdkCursor * v3270_cursor[V3270_CURSOR_COUNT] = { 0 }; | 75 | + guint v3270_widget_signal[LAST_SIGNAL] = { 0 }; |
76 | + GdkCursor * v3270_cursor[LIB3270_POINTER_COUNT] = { 0 }; | ||
77 | 77 | ||
78 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ | 78 | /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ |
79 | 79 | ||
@@ -354,7 +354,7 @@ static void v3270_class_init(v3270Class *klass) | @@ -354,7 +354,7 @@ static void v3270_class_init(v3270Class *klass) | ||
354 | "help", // V3270_CURSOR_QUESTION | 354 | "help", // V3270_CURSOR_QUESTION |
355 | }; | 355 | }; |
356 | #else | 356 | #else |
357 | - static const int cr[V3270_CURSOR_COUNT] = | 357 | + static const int cr[LIB3270_POINTER_COUNT] = |
358 | { | 358 | { |
359 | GDK_XTERM, // V3270_CURSOR_UNPROTECTED | 359 | GDK_XTERM, // V3270_CURSOR_UNPROTECTED |
360 | GDK_WATCH, // V3270_CURSOR_WAITING | 360 | GDK_WATCH, // V3270_CURSOR_WAITING |
@@ -375,7 +375,7 @@ static void v3270_class_init(v3270Class *klass) | @@ -375,7 +375,7 @@ static void v3270_class_init(v3270Class *klass) | ||
375 | 375 | ||
376 | int f; | 376 | int f; |
377 | 377 | ||
378 | - for(f=0;f<V3270_CURSOR_COUNT;f++) | 378 | + for(f=0;f<LIB3270_POINTER_COUNT;f++) |
379 | { | 379 | { |
380 | #ifdef WIN32 | 380 | #ifdef WIN32 |
381 | v3270_cursor[f] = gdk_cursor_new_from_name(gdk_display_get_default(),cr[f]); | 381 | v3270_cursor[f] = gdk_cursor_new_from_name(gdk_display_get_default(),cr[f]); |
@@ -729,7 +729,7 @@ static void update_luname(H3270 *session, const char *name) | @@ -729,7 +729,7 @@ static void update_luname(H3270 *session, const char *name) | ||
729 | v3270_update_luname(GTK_WIDGET(lib3270_get_user_data(session)),name); | 729 | v3270_update_luname(GTK_WIDGET(lib3270_get_user_data(session)),name); |
730 | } | 730 | } |
731 | 731 | ||
732 | -static void select_cursor(H3270 *session, LIB3270_CURSOR id) | 732 | +static void select_cursor(H3270 *session, LIB3270_POINTER id) |
733 | { | 733 | { |
734 | GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); | 734 | GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); |
735 | 735 |