Skip to content

Commit eddb9d9

Browse files
committed
CLIPBOARD: add clipboard module
1 parent 8a9ffee commit eddb9d9

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

clipboard/Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
#
44
# This program is distributed under the terms of the GPL v2.0 or later
55
# Download the GNU Public License (GPL) from www.gnu.org
6-
#
6+
#
77

88
AM_CPPFLAGS = -I../include -Wall
99
lib_LTLIBRARIES = libclipboard.la
1010
libclipboard_la_SOURCES = main.cpp clipboard.c ../include/param.cpp
11-
libclipboard_la_SOURCES_la_LDFLAGS = -module -rpath '$(libdir)'
11+
libclipboard_la_LDFLAGS = -module -rpath '$(libdir)' @CLIPBOARD_LDFLAGS@
12+

clipboard/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ void sblib_close(void) {
2323
clipboard_free(clipboard);
2424
}
2525

26-
// clipboard.paste(text)
26+
// clipboard.copy(text)
2727
int sblib_proc_count() {
2828
return 1;
2929
}
3030

3131
int sblib_proc_getname(int index, char *proc_name) {
3232
int result;
3333
if (index < sblib_proc_count()) {
34-
strcpy(proc_name, "PASTE");
34+
strcpy(proc_name, "COPY");
3535
result = 1;
3636
} else {
3737
result = 0;
@@ -42,23 +42,23 @@ int sblib_proc_getname(int index, char *proc_name) {
4242
int sblib_proc_exec(int index, int argc, slib_par_t *params, var_t *retval) {
4343
int result;
4444
if (index == 0 && argc == 1 && is_param_str(argc, params, 0)) {
45-
const char *text = get_param_str(0, params, 0, "");
46-
result = clipboard_set_text(clipboard, text);
45+
const char *text = get_param_str(argc, params, 0, "");
46+
result = clipboard_set_text_ex(clipboard, text, -1, LCB_CLIPBOARD);
4747
} else {
4848
result = 0;
4949
}
5050
return result;
5151
}
5252

53-
// let text = clipboard.copy()
53+
// let text = clipboard.paste()
5454
int sblib_func_count() {
5555
return 1;
5656
}
5757

5858
int sblib_func_getname(int index, char *proc_name) {
5959
int result;
6060
if (index < sblib_func_count()) {
61-
strcpy(proc_name, "COPY");
61+
strcpy(proc_name, "PASTE");
6262
result = 1;
6363
} else {
6464
result = 0;
@@ -69,7 +69,7 @@ int sblib_func_getname(int index, char *proc_name) {
6969
int sblib_func_exec(int index, int argc, slib_par_t *params, var_t *retval) {
7070
int result;
7171
if (index == 0 && argc == 0) {
72-
char *text = clipboard_text(clipboard);
72+
char *text = clipboard_text_ex(clipboard, NULL, LCB_CLIPBOARD);
7373
if (text != nullptr) {
7474
v_setstr(retval, text);
7575
free(text);

configure.ac

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ function checkDebugMode() {
3232
}
3333

3434
case "${host_os}" in
35-
*mingw* | pw32* | cygwin*)
35+
*mingw* | pw32* | cygwin*)
3636
AC_DEFINE(WIN32, 1, [building for win32])
37+
;;
38+
39+
*)
40+
CLIPBOARD_LDFLAGS=`pkg-config xcb --libs`
41+
AC_SUBST(CLIPBOARD_LDFLAGS)
3742
esac
3843

3944
# checks for mysql

0 commit comments

Comments
 (0)