Commit ab13066f0461eb8d8dd5e48746a2c6b835219f0d
1 parent
42eabc38
Exists in
master
and in
3 other branches
Passando gerência do ponteiro do mouse para a lib3270
Showing
7 changed files
with
55 additions
and
41 deletions
Show diff stats
... | ... | @@ -253,9 +253,9 @@ |
253 | 253 | |
254 | 254 | /* Screen processing */ |
255 | 255 | |
256 | - #define CURSOR_MODE_NORMAL LIB3270_CURSOR_EDITABLE | |
257 | - #define CURSOR_MODE_WAITING LIB3270_CURSOR_WAITING | |
258 | - #define CURSOR_MODE_LOCKED LIB3270_CURSOR_LOCKED | |
256 | +// #define CURSOR_MODE_NORMAL LIB3270_CURSOR_EDITABLE | |
257 | +// #define CURSOR_MODE_WAITING LIB3270_CURSOR_WAITING | |
258 | +// #define CURSOR_MODE_LOCKED LIB3270_CURSOR_LOCKED | |
259 | 259 | |
260 | 260 | typedef enum _SCRIPT_STATE |
261 | 261 | { | ... | ... |
private.h
resolver.c
... | ... | @@ -180,28 +180,3 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) |
180 | 180 | return 0; |
181 | 181 | } */ |
182 | 182 | |
183 | -/* | |
184 | -int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_len) | |
185 | -{ | |
186 | - int rc; | |
187 | - LIB3270_MESSAGE saved_status = hSession->oia_status; | |
188 | - struct parms p = { sizeof(struct parms), host, portname, pport, sa, sa_len, errmsg, em_len }; | |
189 | - | |
190 | - trace("Calling resolver for %s status=%d", p.host, (int) saved_status); | |
191 | - | |
192 | - status_changed(hSession,LIB3270_MESSAGE_RESOLVING); | |
193 | - hSession->cursor(hSession,CURSOR_MODE_LOCKED); | |
194 | - | |
195 | - rc = lib3270_call_thread((int (*)(H3270 *, void *)) cresolve_host_and_port,hSession,&p); | |
196 | - | |
197 | - hSession->cursor(hSession,CURSOR_MODE_NORMAL); | |
198 | - | |
199 | - if(saved_status != -1) | |
200 | - status_changed(hSession,saved_status); | |
201 | - | |
202 | - trace("Calling resolver for %s exits with %d", p.host, rc); | |
203 | - | |
204 | - return rc; | |
205 | - | |
206 | -} | |
207 | -*/ | ... | ... |
screen.c
... | ... | @@ -486,9 +486,7 @@ void status_oerr(H3270 *session, int error_type) |
486 | 486 | |
487 | 487 | void status_connecting(H3270 *session, Boolean on) |
488 | 488 | { |
489 | - if(session->cbk.cursor) | |
490 | - session->cbk.cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); | |
491 | - | |
489 | + mcursor_set(session,on ? LIB3270_POINTER_LOCKED : LIB3270_POINTER_UNLOCKED); | |
492 | 490 | status_changed(session, on ? LIB3270_MESSAGE_CONNECTING : LIB3270_MESSAGE_NONE); |
493 | 491 | } |
494 | 492 | |
... | ... | @@ -506,8 +504,7 @@ void status_reset(H3270 *session) |
506 | 504 | } |
507 | 505 | else |
508 | 506 | { |
509 | - if(session->cbk.cursor) | |
510 | - session->cbk.cursor(session,CURSOR_MODE_NORMAL); | |
507 | + mcursor_set(session,LIB3270_POINTER_UNLOCKED); | |
511 | 508 | status_changed(session,LIB3270_MESSAGE_NONE); |
512 | 509 | } |
513 | 510 | |
... | ... | @@ -736,12 +733,17 @@ void popup_system_error(H3270 *session, const char *title, const char *message, |
736 | 733 | va_end(args); |
737 | 734 | } |
738 | 735 | |
739 | -void mcursor_set(H3270 *session,LIB3270_CURSOR m) | |
736 | +void mcursor_set(H3270 *session,LIB3270_POINTER m) | |
740 | 737 | { |
741 | 738 | CHECK_SESSION_HANDLE(session); |
742 | 739 | |
743 | - if(session->cbk.cursor) | |
744 | - session->cbk.cursor(session,m); | |
740 | + if(session->pointer != ((unsigned short) m)) { | |
741 | + | |
742 | + // Pointer changed | |
743 | + session->pointer = (unsigned short) m; | |
744 | + session->cbk.cursor(session,m & 0x03); | |
745 | + | |
746 | + } | |
745 | 747 | } |
746 | 748 | |
747 | 749 | LIB3270_ACTION( testpattern ) | ... | ... |
screenc.h
... | ... | @@ -42,11 +42,11 @@ |
42 | 42 | |
43 | 43 | LIB3270_INTERNAL int screen_init(H3270 *session); |
44 | 44 | // LIB3270_INTERNAL Boolean screen_new_display_charsets(char *cslist, char *csname); |
45 | -LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_CURSOR m); | |
45 | +LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_POINTER m); | |
46 | 46 | |
47 | -#define mcursor_locked(x) mcursor_set(x,CURSOR_MODE_LOCKED) | |
48 | -#define mcursor_normal(x) mcursor_set(x,CURSOR_MODE_NORMAL) | |
49 | -#define mcursor_waiting(x) mcursor_set(x,CURSOR_MODE_WAITING) | |
47 | +#define mcursor_locked(x) mcursor_set(x,LIB3270_POINTER_LOCKED) | |
48 | +#define mcursor_normal(x) mcursor_set(x,LIB3270_POINTER_UNLOCKED) | |
49 | +#define mcursor_waiting(x) mcursor_set(x,LIB3270_POINTER_WAITING) | |
50 | 50 | |
51 | 51 | LIB3270_INTERNAL void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason); |
52 | 52 | LIB3270_INTERNAL void set_viewsize(H3270 *session, int rows, int cols); | ... | ... |
session.c
... | ... | @@ -140,7 +140,7 @@ static void update_selection(H3270 *session, int start, int end) |
140 | 140 | { |
141 | 141 | } |
142 | 142 | |
143 | -static void set_cursor(H3270 *session, LIB3270_CURSOR id) | |
143 | +static void set_cursor(H3270 *session, LIB3270_POINTER id) | |
144 | 144 | { |
145 | 145 | } |
146 | 146 | |
... | ... | @@ -241,6 +241,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char |
241 | 241 | hSession->colors = 16; |
242 | 242 | hSession->m3279 = 1; |
243 | 243 | hSession->unlock_delay_ms = 350; // 0.35s after last unlock |
244 | + hSession->pointer = (unsigned short) LIB3270_POINTER_LOCKED; | |
244 | 245 | |
245 | 246 | // CSD |
246 | 247 | for(f=0;f<4;f++) | ... | ... |
util.c
... | ... | @@ -75,6 +75,7 @@ |
75 | 75 | #include "utilc.h" |
76 | 76 | #include "popupsc.h" |
77 | 77 | #include "api.h" |
78 | +#include <lib3270/selection.h> | |
78 | 79 | |
79 | 80 | #define my_isspace(c) isspace((unsigned char)c) |
80 | 81 | |
... | ... | @@ -1013,3 +1014,37 @@ int gettimeofday(struct timeval *tv, void *ignored) |
1013 | 1014 | } |
1014 | 1015 | |
1015 | 1016 | |
1017 | + LIB3270_EXPORT LIB3270_POINTER lib3270_get_pointer(H3270 *hSession, int baddr) | |
1018 | + { | |
1019 | + static const struct _ptr { | |
1020 | + unsigned short id; | |
1021 | + LIB3270_POINTER value; | |
1022 | + } ptr[] = { | |
1023 | + { 0x80, LIB3270_POINTER_MOVE_SELECTION }, | |
1024 | + { 0x82, LIB3270_POINTER_SELECTION_TOP }, | |
1025 | + { 0x86, LIB3270_POINTER_SELECTION_TOP_RIGHT }, | |
1026 | + { 0x84, LIB3270_POINTER_SELECTION_RIGHT }, | |
1027 | + { 0x81, LIB3270_POINTER_SELECTION_LEFT }, | |
1028 | + { 0x89, LIB3270_POINTER_SELECTION_BOTTOM_LEFT }, | |
1029 | + { 0x88, LIB3270_POINTER_SELECTION_BOTTOM }, | |
1030 | + { 0x8c, LIB3270_POINTER_SELECTION_BOTTOM_RIGHT }, | |
1031 | + { 0x83, LIB3270_POINTER_SELECTION_TOP_LEFT } | |
1032 | + }; | |
1033 | + | |
1034 | + int f; | |
1035 | + unsigned short id = lib3270_get_selection_flags(hSession,baddr) & 0x8f; | |
1036 | + | |
1037 | + if(!lib3270_connected(hSession) || baddr < 0) | |
1038 | + return LIB3270_POINTER_LOCKED; | |
1039 | + | |
1040 | + for(f = 0; f < (sizeof(ptr)/sizeof(ptr[0]));f++) | |
1041 | + { | |
1042 | + if(ptr[f].id == id) | |
1043 | + { | |
1044 | + return ptr[f].value; | |
1045 | + } | |
1046 | + } | |
1047 | + | |
1048 | + return hSession->pointer; | |
1049 | + | |
1050 | + } | ... | ... |