mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-05 15:55:56 +01:00
bug fix in wbutton.c, made mouse pointer go invisible when typing in
textfield, added option to Smooth workspaceBack
This commit is contained in:
@@ -3,7 +3,6 @@ changes since wmaker 0.53.0:
|
||||
|
||||
- added balloon help
|
||||
|
||||
|
||||
changes since wmaker 0.52.0:
|
||||
............................
|
||||
|
||||
|
||||
@@ -211,6 +211,8 @@ typedef struct W_Screen {
|
||||
|
||||
Cursor textCursor;
|
||||
|
||||
Cursor invisibleCursor;
|
||||
|
||||
Atom internalMessage; /* for ClientMessage */
|
||||
|
||||
Atom attribsAtom; /* GNUstepWindowAttributes */
|
||||
|
||||
@@ -281,6 +281,7 @@ WMSetButtonImage(WMButton *bPtr, WMPixmap *image)
|
||||
if (bPtr->dimage) {
|
||||
bPtr->dimage->pixmap = None;
|
||||
WMReleasePixmap(bPtr->dimage);
|
||||
bPtr->dimage = NULL;
|
||||
}
|
||||
|
||||
if (image) {
|
||||
|
||||
@@ -305,6 +305,7 @@ static unsigned char STIPPLE_BITS[] = {
|
||||
|
||||
|
||||
|
||||
|
||||
extern void W_ReadConfigurations(void);
|
||||
|
||||
|
||||
@@ -732,6 +733,19 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
|
||||
scrPtr->textCursor = XCreateFontCursor(display, XC_xterm);
|
||||
|
||||
{
|
||||
XColor bla;
|
||||
Pixmap blank;
|
||||
|
||||
blank = XCreatePixmap(display, scrPtr->stipple, 1, 1, 1);
|
||||
XSetForeground(display, scrPtr->monoGC, 0);
|
||||
XFillRectangle(display, blank, scrPtr->monoGC, 0, 0, 1, 1);
|
||||
|
||||
scrPtr->invisibleCursor = XCreatePixmapCursor(display, blank, blank,
|
||||
&bla, &bla, 0, 0);
|
||||
XFreePixmap(display, blank);
|
||||
}
|
||||
|
||||
scrPtr->internalMessage = XInternAtom(display, "_WINGS_MESSAGE", False);
|
||||
|
||||
scrPtr->attribsAtom = XInternAtom(display, "_GNUSTEP_WM_ATTR", False);
|
||||
|
||||
@@ -418,6 +418,7 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
testGradientButtons(scr);
|
||||
|
||||
testTextField(scr);
|
||||
#if 0
|
||||
testOpenFilePanel(scr);
|
||||
testFontPanel(scr);
|
||||
@@ -428,7 +429,6 @@ int main(int argc, char **argv)
|
||||
testColorWell(scr);
|
||||
|
||||
testSlider(scr);
|
||||
testTextField(scr);
|
||||
testPullDown(scr);
|
||||
#endif
|
||||
/*
|
||||
|
||||
@@ -61,6 +61,8 @@ typedef struct W_TextField {
|
||||
|
||||
unsigned int secure:1; /* password entry style */
|
||||
|
||||
unsigned int pointerGrabbed:1;
|
||||
|
||||
/**/
|
||||
unsigned int notIllegalMovement:1;
|
||||
} flags;
|
||||
@@ -1111,58 +1113,75 @@ handleTextFieldActionEvents(XEvent *event, void *data)
|
||||
|
||||
switch (event->type) {
|
||||
case KeyPress:
|
||||
if (tPtr->flags.enabled && tPtr->flags.focused)
|
||||
if (tPtr->flags.enabled && tPtr->flags.focused) {
|
||||
handleTextFieldKeyPress(tPtr, event);
|
||||
|
||||
XGrabPointer(WMScreenDisplay(W_VIEW(tPtr)->screen),
|
||||
W_VIEW(tPtr)->window, False,
|
||||
PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
|
||||
GrabModeAsync, GrabModeAsync, None,
|
||||
W_VIEW(tPtr)->screen->invisibleCursor,
|
||||
CurrentTime);
|
||||
tPtr->flags.pointerGrabbed = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
|
||||
if (tPtr->flags.pointerGrabbed) {
|
||||
tPtr->flags.pointerGrabbed = 0;
|
||||
XUngrabPointer(WMScreenDisplay(W_VIEW(tPtr)->screen), CurrentTime);
|
||||
}
|
||||
|
||||
if (tPtr->flags.enabled && (event->xmotion.state & Button1Mask)) {
|
||||
|
||||
|
||||
if (tPtr->viewPosition < tPtr->textLen && event->xmotion.x >
|
||||
if (tPtr->viewPosition < tPtr->textLen && event->xmotion.x >
|
||||
tPtr->usableWidth) {
|
||||
if (WMWidthOfString(tPtr->font,
|
||||
&(tPtr->text[tPtr->viewPosition]),
|
||||
tPtr->cursorPosition-tPtr->viewPosition)
|
||||
if (WMWidthOfString(tPtr->font,
|
||||
&(tPtr->text[tPtr->viewPosition]),
|
||||
tPtr->cursorPosition-tPtr->viewPosition)
|
||||
> tPtr->usableWidth) {
|
||||
tPtr->viewPosition++;
|
||||
}
|
||||
}
|
||||
else if (tPtr->viewPosition > 0 && event->xmotion.x < 0) {
|
||||
paintCursor(tPtr);
|
||||
tPtr->viewPosition--;
|
||||
}
|
||||
|
||||
if (!tPtr->selection.count) {
|
||||
tPtr->selection.position = tPtr->cursorPosition;
|
||||
}
|
||||
|
||||
tPtr->cursorPosition = pointToCursorPosition(tPtr, event->xmotion.x);
|
||||
|
||||
tPtr->selection.count = tPtr->cursorPosition - tPtr->selection.position;
|
||||
|
||||
/*
|
||||
printf("notify %d %d\n",event->xmotion.x,tPtr->usableWidth);
|
||||
*/
|
||||
|
||||
paintCursor(tPtr);
|
||||
paintTextField(tPtr);
|
||||
|
||||
tPtr->viewPosition++;
|
||||
}
|
||||
} else if (tPtr->viewPosition > 0 && event->xmotion.x < 0) {
|
||||
paintCursor(tPtr);
|
||||
tPtr->viewPosition--;
|
||||
}
|
||||
|
||||
if (!tPtr->selection.count) {
|
||||
tPtr->selection.position = tPtr->cursorPosition;
|
||||
}
|
||||
|
||||
tPtr->cursorPosition =
|
||||
pointToCursorPosition(tPtr, event->xmotion.x);
|
||||
|
||||
tPtr->selection.count = tPtr->cursorPosition - tPtr->selection.position;
|
||||
|
||||
/*
|
||||
printf("notify %d %d\n",event->xmotion.x,tPtr->usableWidth);
|
||||
*/
|
||||
|
||||
paintCursor(tPtr);
|
||||
paintTextField(tPtr);
|
||||
|
||||
}
|
||||
if (move) {
|
||||
int count;
|
||||
XSetSelectionOwner(tPtr->view->screen->display,
|
||||
XA_PRIMARY, None, CurrentTime);
|
||||
count = tPtr->selection.count < 0
|
||||
? tPtr->selection.position + tPtr->selection.count
|
||||
: tPtr->selection.position;
|
||||
XStoreBuffer(tPtr->view->screen->display,
|
||||
&tPtr->text[count] , abs(tPtr->selection.count), 0);
|
||||
int count;
|
||||
XSetSelectionOwner(tPtr->view->screen->display,
|
||||
XA_PRIMARY, None, CurrentTime);
|
||||
count = tPtr->selection.count < 0
|
||||
? tPtr->selection.position + tPtr->selection.count
|
||||
: tPtr->selection.position;
|
||||
XStoreBuffer(tPtr->view->screen->display,
|
||||
&tPtr->text[count] , abs(tPtr->selection.count), 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
if (tPtr->flags.pointerGrabbed) {
|
||||
tPtr->flags.pointerGrabbed = 0;
|
||||
XUngrabPointer(WMScreenDisplay(W_VIEW(tPtr)->screen), CurrentTime);
|
||||
}
|
||||
|
||||
move = 1;
|
||||
switch (tPtr->flags.alignment) {
|
||||
int textWidth;
|
||||
@@ -1223,6 +1242,11 @@ handleTextFieldActionEvents(XEvent *event, void *data)
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
if (tPtr->flags.pointerGrabbed) {
|
||||
tPtr->flags.pointerGrabbed = 0;
|
||||
XUngrabPointer(WMScreenDisplay(W_VIEW(tPtr)->screen), CurrentTime);
|
||||
}
|
||||
|
||||
move = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user