diff --git a/src/classlib/Makefile.in b/src/classlib/Makefile.in
index 4951ab4..1733775 100644
--- a/src/classlib/Makefile.in
+++ b/src/classlib/Makefile.in
@@ -48,7 +48,7 @@ LN_S=@LN_S@
#---[ Flags ]------------------------------------------------------------------
-CFLAGS=@CFLAGS@ @DBUS_CFLAGS@ -I../include
+CFLAGS=@CFLAGS@ @DBUS_CFLAGS@ @GTK_CFLAGS@ -I../include
LIBS=@LIBS@ @LIBICONV@ @DBUS_LIBS@
DEBUG_CFLAGS=-DDEBUG=1 -g -Wall
diff --git a/src/classlib/classlib.cbp b/src/classlib/classlib.cbp
index e1dc6bc..bcc774d 100644
--- a/src/classlib/classlib.cbp
+++ b/src/classlib/classlib.cbp
@@ -33,11 +33,10 @@
-
+
-
diff --git a/src/classlib/local.cc b/src/classlib/local.cc
index bb4b809..f1f1b66 100644
--- a/src/classlib/local.cc
+++ b/src/classlib/local.cc
@@ -481,6 +481,61 @@
return _get_cursor_addr(hSession);
}
+ int enter(void)
+ {
+ return _enter(hSession);
+ }
+
+ int pfkey(int key)
+ {
+ return _pfkey(hSession,key);
+ }
+
+ int pakey(int key)
+ {
+ return _pakey(hSession,key);
+ }
+
+ int quit(void)
+ {
+ return EINVAL;
+ }
+
+ int set_toggle(LIB3270_TOGGLE ix, bool value)
+ {
+ return _set_toggle(hSession, ix, (int) value);
+ }
+
+ int emulate_input(const char *str)
+ {
+ return _emulate_input(hSession,str,-1,1);
+ }
+
+ int get_field_start(int baddr)
+ {
+ return _get_field_start(hSession,baddr);
+ }
+
+ int get_field_len(int baddr)
+ {
+ return _get_field_len(hSession,baddr);
+ }
+
+ int get_next_unprotected(int baddr)
+ {
+ return _get_next_unprotected(hSession,baddr);
+ }
+
+ int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...)
+ {
+ va_list args;
+ va_start(args, fmt);
+ _popup_va(hSession, id, title, message, fmt, args);
+ va_end(args);
+ return 0;
+ }
+
+
};
session * session::create_local(void)
diff --git a/src/classlib/remote.cc b/src/classlib/remote.cc
index eff400d..646f0e9 100644
--- a/src/classlib/remote.cc
+++ b/src/classlib/remote.cc
@@ -842,6 +842,306 @@
}
+ int enter(void)
+ {
+#if defined(WIN32)
+
+ return query_intval(HLLAPI_PACKET_ENTER);
+
+#elif defined(HAVE_DBUS)
+
+ return query_intval("enter");
+
+#else
+
+ return -1;
+
+#endif
+
+ }
+
+ int pfkey(int key)
+ {
+#if defined(WIN32)
+
+ struct hllapi_packet_keycode query = { HLLAPI_PACKET_PFKEY, (unsigned short) key };
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(query);
+ TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL);
+ return response.rc;
+
+#elif defined(HAVE_DBUS)
+
+ dbus_int32_t k = (dbus_int32_t) key;
+
+ DBusMessage * msg = create_message("pfKey");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &k, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+
+ return -1;
+
+#else
+
+ return -1;
+
+#endif
+
+ }
+
+ int pakey(int key)
+ {
+#if defined(WIN32)
+
+ struct hllapi_packet_keycode query = { HLLAPI_PACKET_PAKEY, (unsigned short) key };
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(query);
+ TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL);
+ return response.rc;
+
+#elif defined(HAVE_DBUS)
+
+ dbus_int32_t k = (dbus_int32_t) key;
+
+ DBusMessage * msg = create_message("paKey");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &k, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+ return -1;
+
+#else
+
+ return -1;
+
+#endif
+
+ }
+
+ int quit(void)
+ {
+#if defined(WIN32)
+
+ return query_intval(HLLAPI_PACKET_QUIT);
+
+#elif defined(HAVE_DBUS)
+
+ return query_intval("quit");
+
+#else
+
+ return -1;
+
+#endif
+
+ }
+
+ int set_toggle(LIB3270_TOGGLE ix, bool value)
+ {
+#if defined(WIN32)
+
+ struct hllapi_packet_set query = { HLLAPI_PACKET_SET_TOGGLE, (unsigned short) ix, (unsigned short) value };
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(query);
+ TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL);
+ return response.rc;
+
+#elif defined(HAVE_DBUS)
+
+ dbus_int32_t i = (dbus_int32_t) ix;
+ dbus_int32_t v = (dbus_int32_t) value;
+
+ DBusMessage * msg = create_message("setToggle");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &i, DBUS_TYPE_INT32, &v, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+
+ return -1;
+
+#else
+ return -1;
+
+#endif
+
+ }
+
+ int emulate_input(const char *str)
+ {
+#if defined(WIN32)
+
+ size_t len = strlen(str);
+ struct hllapi_packet_emulate_input * query;
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(struct hllapi_packet_emulate_input)+len;
+
+ query = (struct hllapi_packet_emulate_input *) malloc(cbSize);
+ query->packet_id = HLLAPI_PACKET_EMULATE_INPUT;
+ query->len = len;
+ query->pasting = 1;
+ strcpy(query->text,str);
+
+ TransactNamedPipe(hPipe,(LPVOID) query, cbSize, &response, sizeof(response), &cbSize,NULL);
+
+ free(query);
+
+ return response.rc;
+
+#elif defined(HAVE_DBUS)
+
+ DBusMessage * msg = create_message("input");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+ return -1;
+
+#else
+
+ return -1;
+
+#endif
+
+ }
+
+ int get_field_start(int baddr)
+ {
+#if defined(WIN32)
+
+ struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_START, (unsigned short) baddr };
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(query);
+ TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL);
+ return response.rc;
+
+#elif defined(HAVE_DBUS)
+
+ dbus_int32_t k = (dbus_int32_t) baddr;
+
+ DBusMessage * msg = create_message("getFieldStart");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &k, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+
+ return -1;
+
+#else
+
+ return -1;
+
+#endif
+
+ }
+
+ int get_field_len(int baddr)
+ {
+#if defined(WIN32)
+
+ struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_LEN, (unsigned short) baddr };
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(query);
+ TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL);
+ return response.rc;
+
+#elif defined(HAVE_DBUS)
+
+ dbus_int32_t k = (dbus_int32_t) baddr;
+
+ DBusMessage * msg = create_message("getFieldLength");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &k, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+
+ return -1;
+
+#else
+
+ return -1;
+
+#endif
+ }
+
+ int get_next_unprotected(int baddr)
+ {
+#if defined(WIN32)
+
+ struct hllapi_packet_addr query = { HLLAPI_PACKET_NEXT_UNPROTECTED, (unsigned short) baddr };
+ struct hllapi_packet_result response;
+ DWORD cbSize = sizeof(query);
+ TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL);
+ return response.rc;
+
+#elif defined(HAVE_DBUS)
+
+ dbus_int32_t k = (dbus_int32_t) baddr;
+
+ DBusMessage * msg = create_message("getNextUnprotected");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &k, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+
+ return -1;
+
+#else
+
+ return -1;
+
+#endif
+
+ }
+
+ int set_clipboard(const char *text)
+ {
+#if defined(WIN32)
+
+ return -1;
+
+#elif defined(HAVE_DBUS)
+
+ DBusMessage * msg = create_message("setClipboard");
+ if(msg)
+ {
+ dbus_message_append_args(msg, DBUS_TYPE_STRING, &text, DBUS_TYPE_INVALID);
+ return get_intval(call(msg));
+ }
+
+ return -1;
+
+#else
+
+ return -1;
+
+#endif
+
+ }
+
+ string * get_clipboard(void)
+ {
+#if defined(WIN32)
+
+ return NULL;
+
+#elif defined(HAVE_DBUS)
+
+ trace("%s",__FUNCTION__);
+ return query_string("getClipboard");
+
+#endif
+
+ return NULL;
+ }
+
};
session * session::create_remote(const char *session)
diff --git a/src/classlib/session.cc b/src/classlib/session.cc
index 00c79e6..a574500 100644
--- a/src/classlib/session.cc
+++ b/src/classlib/session.cc
@@ -156,7 +156,38 @@
return ETIMEDOUT;
}
+ int session::set_copy(const char *text)
+ {
+ return EINVAL;
+ }
+
+ string * session::get_copy(void)
+ {
+ errno = EINVAL;
+ return NULL;
+ }
+ string * session::get_clipboard(void)
+ {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ int session::set_clipboard(const char *text)
+ {
+ return EINVAL;
+ }
+
+
+ int session::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...)
+ {
+ return -1;
+ }
+
+ string * session::file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename)
+ {
+ return NULL;
+ }
}
diff --git a/src/include/pw3270/class.h b/src/include/pw3270/class.h
index a502e86..90ef00c 100644
--- a/src/include/pw3270/class.h
+++ b/src/include/pw3270/class.h
@@ -40,6 +40,7 @@
#include
#include
#include
+ #include
#ifdef HAVE_ICONV
#include
@@ -48,6 +49,7 @@
#include
#include
#include
+ #include
namespace pw3270
{
@@ -113,29 +115,29 @@
virtual int set_cursor_addr(int addr) = 0;
virtual int get_cursor_addr(void) = 0;
-// virtual int set_toggle(LIB3270_TOGGLE ix, bool value) = 0;
+ virtual int set_toggle(LIB3270_TOGGLE ix, bool value) = 0;
-// virtual int enter(void) = 0;
-// virtual int pfkey(int key) = 0;
-// virtual int pakey(int key) = 0;
+ virtual int enter(void) = 0;
+ virtual int pfkey(int key) = 0;
+ virtual int pakey(int key) = 0;
-// virtual int emulate_input(const char *str) = 0;
+ virtual int emulate_input(const char *str) = 0;
-// virtual int get_field_start(int baddr = -1) = 0;
-// virtual int get_field_len(int baddr = -1) = 0;
-// virtual int get_next_unprotected(int baddr = -1) = 0;
+ virtual int get_field_start(int baddr = -1) = 0;
+ virtual int get_field_len(int baddr = -1) = 0;
+ virtual int get_next_unprotected(int baddr = -1) = 0;
-// virtual int set_copy(const char *text);
-// virtual char * get_copy(void);
+ virtual int set_copy(const char *text);
+ virtual string * get_copy(void);
-// virtual char * get_clipboard(void);
-// virtual int set_clipboard(const char *text);
+ virtual string * get_clipboard(void);
+ virtual int set_clipboard(const char *text);
-// virtual int quit(void) = 0;
+ virtual int quit(void) = 0;
// Dialogs
-// virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...);
-// virtual char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename);
+ virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...);
+ virtual string * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename);
private:
--
libgit2 0.21.2