1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +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:
kojima
1999-04-28 23:50:52 +00:00
parent 5a156f9131
commit e50b7e9ca9
18 changed files with 193 additions and 70 deletions

View File

@@ -16,7 +16,11 @@ Changes since version 0.53.0:
- fixed bug with FullMaximize attribute - fixed bug with FullMaximize attribute
- GNOME: button events not bound in wmaker are proxyized (to gmc) - GNOME: button events not bound in wmaker are proxyized (to gmc)
(Paul Warren <pdw@ferret.lmh.ox.ac.uk>) (Paul Warren <pdw@ferret.lmh.ox.ac.uk>)
- fixed bug with restoration of maximized window after restart with
--enable-kde
- added high-quality filtered rescaling (smoothed rescaling) to wrlib/wmsetbg
- added SmoothWorkspaceBack
- fixed crash bug in Paths section of WPrefs
Changes since version 0.52.0: Changes since version 0.52.0:
............................. .............................

6
NEWS
View File

@@ -4,6 +4,7 @@ NEWS for veteran Window Maker users
--- 0.54.0 --- 0.54.0
New Option For setstyle New Option For setstyle
----------------------- -----------------------
@@ -25,6 +26,11 @@ WorkspaceNameDisplayPosition =
none/center/top/bottom/topleft/topright/bottomleft/bottomright none/center/top/bottom/topleft/topright/bottomleft/bottomright
SmoothWorkspaceBack = YES/NO
will enable smoothing of scaled workspace background images.
root menu root menu
--------- ---------

View File

@@ -3,7 +3,6 @@ changes since wmaker 0.53.0:
- added balloon help - added balloon help
changes since wmaker 0.52.0: changes since wmaker 0.52.0:
............................ ............................

View File

@@ -211,6 +211,8 @@ typedef struct W_Screen {
Cursor textCursor; Cursor textCursor;
Cursor invisibleCursor;
Atom internalMessage; /* for ClientMessage */ Atom internalMessage; /* for ClientMessage */
Atom attribsAtom; /* GNUstepWindowAttributes */ Atom attribsAtom; /* GNUstepWindowAttributes */

View File

@@ -281,6 +281,7 @@ WMSetButtonImage(WMButton *bPtr, WMPixmap *image)
if (bPtr->dimage) { if (bPtr->dimage) {
bPtr->dimage->pixmap = None; bPtr->dimage->pixmap = None;
WMReleasePixmap(bPtr->dimage); WMReleasePixmap(bPtr->dimage);
bPtr->dimage = NULL;
} }
if (image) { if (image) {

View File

@@ -305,6 +305,7 @@ static unsigned char STIPPLE_BITS[] = {
extern void W_ReadConfigurations(void); extern void W_ReadConfigurations(void);
@@ -732,6 +733,19 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->textCursor = XCreateFontCursor(display, XC_xterm); 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->internalMessage = XInternAtom(display, "_WINGS_MESSAGE", False);
scrPtr->attribsAtom = XInternAtom(display, "_GNUSTEP_WM_ATTR", False); scrPtr->attribsAtom = XInternAtom(display, "_GNUSTEP_WM_ATTR", False);

View File

@@ -418,6 +418,7 @@ int main(int argc, char **argv)
*/ */
testGradientButtons(scr); testGradientButtons(scr);
testTextField(scr);
#if 0 #if 0
testOpenFilePanel(scr); testOpenFilePanel(scr);
testFontPanel(scr); testFontPanel(scr);
@@ -428,7 +429,6 @@ int main(int argc, char **argv)
testColorWell(scr); testColorWell(scr);
testSlider(scr); testSlider(scr);
testTextField(scr);
testPullDown(scr); testPullDown(scr);
#endif #endif
/* /*

View File

@@ -61,6 +61,8 @@ typedef struct W_TextField {
unsigned int secure:1; /* password entry style */ unsigned int secure:1; /* password entry style */
unsigned int pointerGrabbed:1;
/**/ /**/
unsigned int notIllegalMovement:1; unsigned int notIllegalMovement:1;
} flags; } flags;
@@ -1111,58 +1113,75 @@ handleTextFieldActionEvents(XEvent *event, void *data)
switch (event->type) { switch (event->type) {
case KeyPress: case KeyPress:
if (tPtr->flags.enabled && tPtr->flags.focused) if (tPtr->flags.enabled && tPtr->flags.focused) {
handleTextFieldKeyPress(tPtr, event); 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; break;
case MotionNotify: 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->flags.enabled && (event->xmotion.state & Button1Mask)) {
if (tPtr->viewPosition < tPtr->textLen && event->xmotion.x >
if (tPtr->viewPosition < tPtr->textLen && event->xmotion.x >
tPtr->usableWidth) { tPtr->usableWidth) {
if (WMWidthOfString(tPtr->font, if (WMWidthOfString(tPtr->font,
&(tPtr->text[tPtr->viewPosition]), &(tPtr->text[tPtr->viewPosition]),
tPtr->cursorPosition-tPtr->viewPosition) tPtr->cursorPosition-tPtr->viewPosition)
> tPtr->usableWidth) { > tPtr->usableWidth) {
tPtr->viewPosition++; tPtr->viewPosition++;
} }
} } else if (tPtr->viewPosition > 0 && event->xmotion.x < 0) {
else if (tPtr->viewPosition > 0 && event->xmotion.x < 0) { paintCursor(tPtr);
paintCursor(tPtr); tPtr->viewPosition--;
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 (!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) { if (move) {
int count; int count;
XSetSelectionOwner(tPtr->view->screen->display, XSetSelectionOwner(tPtr->view->screen->display,
XA_PRIMARY, None, CurrentTime); XA_PRIMARY, None, CurrentTime);
count = tPtr->selection.count < 0 count = tPtr->selection.count < 0
? tPtr->selection.position + tPtr->selection.count ? tPtr->selection.position + tPtr->selection.count
: tPtr->selection.position; : tPtr->selection.position;
XStoreBuffer(tPtr->view->screen->display, XStoreBuffer(tPtr->view->screen->display,
&tPtr->text[count] , abs(tPtr->selection.count), 0); &tPtr->text[count] , abs(tPtr->selection.count), 0);
} }
break; break;
case ButtonPress: case ButtonPress:
if (tPtr->flags.pointerGrabbed) {
tPtr->flags.pointerGrabbed = 0;
XUngrabPointer(WMScreenDisplay(W_VIEW(tPtr)->screen), CurrentTime);
}
move = 1; move = 1;
switch (tPtr->flags.alignment) { switch (tPtr->flags.alignment) {
int textWidth; int textWidth;
@@ -1223,6 +1242,11 @@ handleTextFieldActionEvents(XEvent *event, void *data)
break; break;
case ButtonRelease: case ButtonRelease:
if (tPtr->flags.pointerGrabbed) {
tPtr->flags.pointerGrabbed = 0;
XUngrabPointer(WMScreenDisplay(W_VIEW(tPtr)->screen), CurrentTime);
}
move = 0; move = 0;
break; break;
} }

View File

@@ -1,4 +1,5 @@
{ {
SmoothWorkspaceBack = YES;
WindozeCycling = NO; WindozeCycling = NO;
PopupSwitchMenu = NO; PopupSwitchMenu = NO;
MenuStyle = normal; MenuStyle = normal;

Binary file not shown.

View File

@@ -272,6 +272,7 @@ typedef struct WPreferences {
RImage *button_images; /* titlebar button images */ RImage *button_images; /* titlebar button images */
char smooth_workspace_back;
char size_display; /* display type for resize geometry */ char size_display; /* display type for resize geometry */
char move_display; /* display type for move geometry */ char move_display; /* display type for move geometry */
char window_placement; /* window placement mode */ char window_placement; /* window placement mode */

View File

@@ -516,6 +516,9 @@ WDefaultEntry optionList[] = {
{"WorkspaceBack", "(solid, black)", NULL, {"WorkspaceBack", "(solid, black)", NULL,
NULL, getWSBackground,setWorkspaceBack NULL, getWSBackground,setWorkspaceBack
}, },
{"SmoothWorkspaceBack", "NO", NULL,
NULL, getBool, NULL
},
{"IconBack", "(solid, gray)", NULL, {"IconBack", "(solid, gray)", NULL,
NULL, getTexture, setIconTile NULL, getTexture, setIconTile
}, },
@@ -2789,7 +2792,10 @@ setWorkspaceSpecificBack(WScreen *scr, WDefaultEntry *entry, proplist_t value,
if (dup(filedes[0]) < 0) { if (dup(filedes[0]) < 0) {
wsyserror("dup() failed:can't set workspace specific background image"); wsyserror("dup() failed:can't set workspace specific background image");
} }
execlp("wmsetbg", "wmsetbg", "-helper", "-d", NULL); if (wPreferences.smooth_workspace_back)
execlp("wmsetbg", "wmsetbg", "-helper", "-S", "-d", NULL);
else
execlp("wmsetbg", "wmsetbg", "-helper", "-d", NULL);
wsyserror("could not execute wmsetbg"); wsyserror("could not execute wmsetbg");
exit(1); exit(1);
} else { } else {
@@ -2857,7 +2863,10 @@ setWorkspaceBack(WScreen *scr, WDefaultEntry *entry, proplist_t value,
SetupEnvironment(scr); SetupEnvironment(scr);
text = PLGetDescription(value); text = PLGetDescription(value);
command = wmalloc(strlen(text)+40); command = wmalloc(strlen(text)+40);
sprintf(command, "wmsetbg -d -p '%s' &", text); if (wPreferences.smooth_workspace_back)
sprintf(command, "wmsetbg -d -S -p '%s' &", text);
else
sprintf(command, "wmsetbg -d -p '%s' &", text);
free(text); free(text);
system(command); system(command);
free(command); free(command);

View File

@@ -1022,7 +1022,7 @@ makeClipOptionsMenu(WScreen *scr)
return NULL; return NULL;
} }
entry = wMenuAddCallback(menu, _("Keep on top"), entry = wMenuAddCallback(menu, _("Keep on Top"),
toggleLoweredCallback, NULL); toggleLoweredCallback, NULL);
entry->flags.indicator = 1; entry->flags.indicator = 1;
entry->flags.indicator_on = 1; entry->flags.indicator_on = 1;

View File

@@ -67,9 +67,9 @@
#define WKBD_WINDOW2 35 #define WKBD_WINDOW2 35
#define WKBD_WINDOW3 36 #define WKBD_WINDOW3 36
#define WKBD_WINDOW4 37 #define WKBD_WINDOW4 37
#define WKBD_WINDOW5 38
#define WKBD_WINDOW6 39
#ifdef EXTEND_WINDOWSHORTCUT #ifdef EXTEND_WINDOWSHORTCUT
# define WKBD_WINDOW5 38
# define WKBD_WINDOW6 39
# define WKBD_WINDOW7 40 # define WKBD_WINDOW7 40
# define WKBD_WINDOW8 41 # define WKBD_WINDOW8 41
# define WKBD_WINDOW9 42 # define WKBD_WINDOW9 42
@@ -82,10 +82,10 @@
# endif /* KEEP_XKB_LOCK_STATUS */ # endif /* KEEP_XKB_LOCK_STATUS */
#else /* !EXTEND_WINDOWSHORTCUT */ #else /* !EXTEND_WINDOWSHORTCUT */
# ifdef KEEP_XKB_LOCK_STATUS # ifdef KEEP_XKB_LOCK_STATUS
# define WKBD_TOGGLE 38 # define WKBD_TOGGLE 40
# define WKBD_LAST 39 # define WKBD_LAST 41
# else # else
# define WKBD_LAST 38 # define WKBD_LAST 42
# endif /* KEEP_XKB_LOCK_STATUS */ # endif /* KEEP_XKB_LOCK_STATUS */
#endif /* !EXTEND_WINDOWSHORTCUT */ #endif /* !EXTEND_WINDOWSHORTCUT */

View File

@@ -52,7 +52,7 @@
#include <proplist.h> #include <proplist.h>
#define PROG_VERSION "wmsetbg (Window Maker) 2.1" #define PROG_VERSION "wmsetbg (Window Maker) 2.2"
#define WORKSPACE_COUNT (MAX_WORKSPACES+1) #define WORKSPACE_COUNT (MAX_WORKSPACES+1)
@@ -65,6 +65,10 @@ int scr;
int scrWidth; int scrWidth;
int scrHeight; int scrHeight;
Bool smooth = False;
Pixmap CurrentPixmap = None; Pixmap CurrentPixmap = None;
char *PixmapPath = NULL; char *PixmapPath = NULL;
@@ -408,7 +412,10 @@ parseTexture(RContext *rc, char *text)
{ {
RImage *simage; RImage *simage;
simage = RScaleImage(image, w, h); if (smooth)
simage = RSmoothScaleImage(image, w, h);
else
simage = RScaleImage(image, w, h);
if (!simage) { if (!simage) {
wwarning("could not scale image:%s", wwarning("could not scale image:%s",
RMessageForError(RErrorCode)); RMessageForError(RErrorCode));
@@ -1142,6 +1149,7 @@ print_help(char *ProgName)
P(" -display display to use"); P(" -display display to use");
P(" -d, --dither dither image"); P(" -d, --dither dither image");
P(" -m, --match match colors"); P(" -m, --match match colors");
P(" -S, --smooth smooth scaled image");
P(" -b, --back-color <color> background color"); P(" -b, --back-color <color> background color");
P(" -t, --tile tile image"); P(" -t, --tile tile image");
P(" -e, --center center image"); P(" -e, --center center image");
@@ -1257,6 +1265,9 @@ main(int argc, char **argv)
|| strcmp(argv[i], "--match")==0) { || strcmp(argv[i], "--match")==0) {
render_mode = RM_MATCH; render_mode = RM_MATCH;
obey_user++; obey_user++;
} else if (strcmp(argv[i], "-S")==0
|| strcmp(argv[i], "--smooth")==0) {
smooth = True;
} else if (strcmp(argv[i], "-u")==0 } else if (strcmp(argv[i], "-u")==0
|| strcmp(argv[i], "--update-wmaker")==0) { || strcmp(argv[i], "--update-wmaker")==0) {
update++; update++;

View File

@@ -2,7 +2,7 @@
* *
* Raster graphics library * Raster graphics library
* *
* Copyright (c) 1997 Alfredo K. Kojima * Copyright (c) 1997, 1998, 1999 Alfredo K. Kojima
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@@ -34,6 +34,10 @@
#include "wraster.h" #include "wraster.h"
extern void _wraster_change_filter(int type);
static Bool bestContext(Display *dpy, int screen_number, RContext *context); static Bool bestContext(Display *dpy, int screen_number, RContext *context);
static RContextAttributes DEFAULT_CONTEXT_ATTRIBS = { static RContextAttributes DEFAULT_CONTEXT_ATTRIBS = {
@@ -44,7 +48,8 @@ static RContextAttributes DEFAULT_CONTEXT_ATTRIBS = {
0, 0,
0, 0,
0, 0,
True /* use_shared_memory */ True, /* use_shared_memory */
RMitchellFilter
}; };
@@ -409,7 +414,9 @@ RCreateContext(Display *dpy, int screen_number, RContextAttributes *attribs)
/* get configuration from environment variables */ /* get configuration from environment variables */
gatherconfig(context, screen_number); gatherconfig(context, screen_number);
_wraster_change_filter(context->attribs->scaling_filter);
if ((context->attribs->flags & RC_VisualID)) { if ((context->attribs->flags & RC_VisualID)) {
XVisualInfo *vinfo, templ; XVisualInfo *vinfo, templ;
int nret; int nret;

View File

@@ -275,6 +275,42 @@ double t;
return(0.0); return(0.0);
} }
static double (*filterf)() = Mitchell_filter;
static double fwidth = Mitchell_support;
void
_wraster_change_filter(int type)
{
switch (type) {
case RBoxFilter:
filterf = box_filter;
fwidth = box_support;
break;
case RTriangleFilter:
filterf = triangle_filter;
fwidth = triangle_support;
break;
case RBellFilter:
filterf = bell_filter;
fwidth = bell_support;
break;
case RBSplineFilter:
filterf = B_spline_filter;
fwidth = B_spline_support;
break;
case RLanczos3Filter:
filterf = Lanczos3_filter;
fwidth = Lanczos3_support;
break;
default:
case RMitchellFilter:
filterf = Mitchell_support;
fwidth = Mitchell_filter;
break;
}
}
/* /*
* image rescaling routine * image rescaling routine
*/ */
@@ -295,14 +331,9 @@ CLIST *contrib; /* array of contribution lists */
#define CLAMP(v,l,h) ((v)<(l) ? (l) : (v) > (h) ? (h) : v) #define CLAMP(v,l,h) ((v)<(l) ? (l) : (v) > (h) ? (h) : v)
static double (*filterf)() = Mitchell_filter;
static double fwidth = Mitchell_support;
RImage* RImage*
RSmoothScaleImage(RImage *src, int newWidth, int newHeight) RSmoothScaleImage(RImage *src, int newWidth, int newHeight)
{ {
RImage *tmp; /* intermediate image */ RImage *tmp; /* intermediate image */
double xscale, yscale; /* zoom scale factors */ double xscale, yscale; /* zoom scale factors */
int i, j, k; /* loop variables */ int i, j, k; /* loop variables */

View File

@@ -68,6 +68,9 @@
/* use default instead of best visual */ /* use default instead of best visual */
#define RC_DefaultVisual (1<<5) #define RC_DefaultVisual (1<<5)
/* filter type for smoothed scaling */
#define RC_ScalingFilter (1<<6)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
@@ -81,6 +84,7 @@ typedef struct RContextAttributes {
float bgamma; /* and blue */ float bgamma; /* and blue */
VisualID visualid; /* visual ID to use */ VisualID visualid; /* visual ID to use */
int use_shared_memory; /* True of False */ int use_shared_memory; /* True of False */
int scaling_filter;
} RContextAttributes; } RContextAttributes;
@@ -174,6 +178,25 @@ typedef struct RXImage {
#endif #endif
} RXImage; } RXImage;
/* image display modes */
enum {
RDitheredRendering = 0,
RBestMatchRendering = 1
};
/* smoothed scaling filter types */
enum {
RBoxFilter,
RTriangleFilter,
RBellFilter,
RBSplineFilter,
RLanczos3Filter,
RMitchellFilter
};
/* note that not all operations are supported in all functions */ /* note that not all operations are supported in all functions */
enum { enum {
@@ -185,16 +208,6 @@ enum {
}; };
/* image display modes */
enum {
RDitheredRendering = 0,
RBestMatchRendering = 1
};
/* bw compat */
#define RM_DITHER RDitheredRendering
#define RM_MATCH RBestMatchRendering
enum { enum {
RAbsoluteCoordinates = 0, RAbsoluteCoordinates = 0,
RRelativeCoordinates = 1 RRelativeCoordinates = 1