last few commits again

This commit is contained in:
speedie 2023-05-24 22:01:35 +02:00
parent 77864d43bf
commit 7ca66d674f
10 changed files with 18 additions and 20 deletions

View file

@ -159,17 +159,7 @@ void moveend(Arg *arg) {
}
void paste(Arg *arg) {
int clipboard;
if (arg->i == 1) {
clipboard = XA_PRIMARY;
} else {
clipboard = clip;
}
XConvertSelection(dpy, clipboard, utf8, utf8, win, CurrentTime);
return;
paste_x11(arg->i);
}
void viewhist(Arg *arg) {

View file

@ -1,17 +1,10 @@
/* See LICENSE file for copyright and license details. */
// declare various macros
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
#define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \
&& MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define TEXTW(X) (drw_font_getwidth(drw, (X), False) + lrpad)
#define TEXTWM(X) (drw_font_getwidth(drw, (X), True) + lrpad)
// number
#define NUMBERSMAXDIGITS 100
#define NUMBERSBUFSIZE (NUMBERSMAXDIGITS * 2) + 1
// item
#define MAXITEMLENGTH 1024

View file

@ -17,3 +17,11 @@ void pastesel_x11(void) {
// draw the menu
drawmenu();
}
int paste_x11(int sel) {
if (XConvertSelection(dpy, sel ? XA_PRIMARY : clip, utf8, utf8, win, CurrentTime)) {
return 0;
} else {
return 1;
}
}

View file

@ -1,3 +1,4 @@
/* See LICENSE file for copyright and license details. */
static void pastesel_x11(void);
static int paste_x11(int sel);

4
libs/x11/def.h Normal file
View file

@ -0,0 +1,4 @@
/* See LICENSE file for copyright and license details. */
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)

View file

@ -1,4 +1,5 @@
/* See LICENSE file for copyright and license details. */
#include "xim.c"
#include "key.c"
#include "mouse.c"
@ -6,6 +7,7 @@
#include "xrdb.c"
#include "client.h"
#include "client.c"
#include "event.c"
#include "init.c"
#include "focus.c"
#include "clipboard.c"

View file

@ -1,7 +1,9 @@
/* See LICENSE file for copyright and license details. */
#include "lib.h"
#include "def.h"
#include "init.h"
#include "event.h"
#include "xrdb.h"
#include "xim.h"
#include "key.h"

View file

@ -245,8 +245,6 @@ static char *fonts[] = { font };
#include "libs/history.c"
#include "libs/arg.c"
#include "libs/stream.c"
#include "libs/event.h"
#include "libs/event.c"
int is_selected(size_t index) {
for (int i = 0; i < sel_size; i++) {