-//#include <limits.h>
-//#include <locale.h>
-//#include <sys/time.h>
-//#include <sys/types.h>
-//#include <ctype.h>
-
#define _POSIX_C_SOURCE 200809L
#define _XOPEN_SOURCE 700
#include <stdc.h>
#define INCLUDE_DEFS
#include "config.h"
+/* predeclare some things */
+void exec(char* cmd);
+void cut(char* arg);
+void paste(char* arg);
+
typedef struct {
char* tag;
void (*action)(char*);
static int Divider;
static int FontSel;
static bool SyncMouse = false;
-int SearchDir = DOWN;
-char* SearchTerm = NULL;
+static int SearchDir = DOWN;
+static char* SearchTerm = NULL;
#define PRESSED(btn) \
((KeyBtnState & (1 << (btn + 7))) == (1 << (btn + 7)))
return ((KeyBtnState & mask) == mask);
}
-bool win_sel_get(int selid, void(*cbfn)(char*)) {
- return x11_sel_get(&X, selid, cbfn);
-}
-
-bool win_sel_set(int selid, char* str) {
- return x11_sel_set(&X, selid, str);
-}
-
-void win_syncmouse(void) {
- SyncMouse = true;
-}
-
/* Tag/Cmd Execution
******************************************************************************/
static Tag* tag_lookup(char* cmd) {
select_line(arg);
/* now perform the cut */
char* str = view_getstr(view);
- win_sel_set(CLIPBOARD, str);
+ x11_sel_set(&X, CLIPBOARD, str);
if (str && *str) delete(arg);
}
void paste(char* arg) {
(void)arg;
- assert(win_sel_get(CLIPBOARD, onpaste));
+ int pasted = x11_sel_get(&X, CLIPBOARD, onpaste);
+ assert(pasted);
}
static void copy(char* arg) {
if (!view_selsize(win_view(FOCUSED)))
select_line(arg);
char* str = view_getstr(win_view(FOCUSED));
- win_sel_set(CLIPBOARD, str);
+ x11_sel_set(&X, CLIPBOARD, str);
}
static void del_to(void (*tofn)(View*, bool)) {
view_findstr(win_view(EDIT), SearchDir, str);
free(SearchTerm);
SearchTerm = str;
- win_syncmouse();
+ SyncMouse = true;
}
static void execute(char* arg) {
size_t line = strtoul(arg, NULL, 0);
if (line) {
view_setln(win_view(EDIT), line);
- win_syncmouse();
+ SyncMouse = true;
} else {
pick_symbol(arg);
}