git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@612 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-07 01:03:09 +00:00
parent 12fdfe0864
commit d710f61a6d
3 changed files with 22 additions and 22 deletions

View File

@@ -392,16 +392,16 @@ void MwLLNextEvent(MwLL handle) {
n = MwLLKeyLeftShift; n = MwLLKeyLeftShift;
} else if(strcmp(str, "Shift_R") == 0) { } else if(strcmp(str, "Shift_R") == 0) {
n = MwLLKeyRightShift; n = MwLLKeyRightShift;
} else if(strcmp(str, "Alt_L") == 0 || strcmp(str, "Alt_R") == 0){ } else if(strcmp(str, "Alt_L") == 0 || strcmp(str, "Alt_R") == 0) {
n = MwLLKeyAlt; n = MwLLKeyAlt;
} else if(strcmp(str, "Control_R") == 0 || strcmp(str, "Control_R") == 0){ } else if(strcmp(str, "Control_R") == 0 || strcmp(str, "Control_R") == 0) {
n = MwLLKeyControl; n = MwLLKeyControl;
} }
if(n != MwLLKeyControl && ev.xkey.state & ControlMask){ if(n != MwLLKeyControl && ev.xkey.state & ControlMask) {
n |= MwLLControlMask; n |= MwLLControlMask;
} }
if(n != MwLLKeyAlt && ev.xkey.state & Mod1Mask){ if(n != MwLLKeyAlt && ev.xkey.state & Mod1Mask) {
n |= MwLLAltMask; n |= MwLLAltMask;
} }
@@ -785,28 +785,28 @@ void MwLLSetClipboard(MwLL handle, const char* text) {
} }
char* MwLLGetClipboard(MwLL handle) { char* MwLLGetClipboard(MwLL handle) {
Atom clip, target, prop; Atom clip, target, prop;
XEvent ev; XEvent ev;
XEvent* queue = NULL; XEvent* queue = NULL;
char* r = NULL; char* r = NULL;
clip = XInternAtom(handle->display, "CLIPBOARD", 0); clip = XInternAtom(handle->display, "CLIPBOARD", 0);
target = XA_STRING; target = XA_STRING;
prop = XInternAtom(handle->display, "XSEL_DATA", 0); prop = XInternAtom(handle->display, "XSEL_DATA", 0);
XConvertSelection(handle->display, clip, target, prop, handle->window, CurrentTime); XConvertSelection(handle->display, clip, target, prop, handle->window, CurrentTime);
while(1){ while(1) {
XNextEvent(handle->display, &ev); XNextEvent(handle->display, &ev);
if(ev.type == SelectionNotify){ if(ev.type == SelectionNotify) {
if(ev.xselection.selection == clip && ev.xselection.property != 0){ if(ev.xselection.selection == clip && ev.xselection.property != 0) {
Atom t; Atom t;
unsigned long size, N; unsigned long size, N;
char* data; char* data;
int format; int format;
XGetWindowProperty(ev.xselection.display, ev.xselection.requestor, ev.xselection.property, 0L, (~0L), 0, AnyPropertyType, &t, &format, &size, &N, (unsigned char**)&data); XGetWindowProperty(ev.xselection.display, ev.xselection.requestor, ev.xselection.property, 0, (~0L), 0, AnyPropertyType, &t, &format, &size, &N, (unsigned char**)&data);
if(t == target){ if(t == target) {
r = MwStringDupliacte(data); r = MwStringDupliacte(data);
XFree(data); XFree(data);
} }
@@ -816,7 +816,7 @@ char* MwLLGetClipboard(MwLL handle) {
} }
} }
while(arrlen(queue) > 0){ while(arrlen(queue) > 0) {
XPutBackEvent(handle->display, &queue[0]); XPutBackEvent(handle->display, &queue[0]);
arrdel(queue, 0); arrdel(queue, 0);
} }

View File

@@ -106,9 +106,9 @@ static void key(MwWidget handle, int code) {
t->cursor++; t->cursor++;
} else if(code == MwLLKeyEnter) { } else if(code == MwLLKeyEnter) {
MwDispatchUserHandler(handle, MwNactivateHandler, NULL); MwDispatchUserHandler(handle, MwNactivateHandler, NULL);
} else if(code == (MwLLControlMask | 'v')){ } else if(code == (MwLLControlMask | 'v')) {
char* c = MwLLGetClipboard(handle->lowlevel); char* c = MwLLGetClipboard(handle->lowlevel);
if(c != NULL){ if(c != NULL) {
char* out = malloc(strlen(str) + strlen(c) + 1); char* out = malloc(strlen(str) + strlen(c) + 1);
MwUTF8Copy(str, 0, out, 0, t->cursor); MwUTF8Copy(str, 0, out, 0, t->cursor);

View File

@@ -152,7 +152,7 @@ static void tick(MwWidget handle) {
v = MwGetInteger(vp->vscroll, MwNvalue); v = MwGetInteger(vp->vscroll, MwNvalue);
mv = MwGetInteger(vp->vscroll, MwNmaxValue); mv = MwGetInteger(vp->vscroll, MwNmaxValue);
l = MwGetInteger(vp->frame, MwNheight); l = MwGetInteger(vp->frame, MwNheight);
v = (mv - l) * (double)v / mv; v = (mv - l) * (double)v / mv;
if(v < 0) v = 0; if(v < 0) v = 0;
MwVaApply(vp->inframe, MwVaApply(vp->inframe,
@@ -167,7 +167,7 @@ static void tick(MwWidget handle) {
v = MwGetInteger(vp->hscroll, MwNvalue); v = MwGetInteger(vp->hscroll, MwNvalue);
mv = MwGetInteger(vp->hscroll, MwNmaxValue); mv = MwGetInteger(vp->hscroll, MwNmaxValue);
l = MwGetInteger(vp->frame, MwNwidth); l = MwGetInteger(vp->frame, MwNwidth);
v = (mv - l) * (double)v / mv; v = (mv - l) * (double)v / mv;
if(v < 0) v = 0; if(v < 0) v = 0;
MwVaApply(vp->inframe, MwVaApply(vp->inframe,