1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

- fixed problem with WINGs based apps exiting with a "X_RotateProperties"

related error when text was selected in a textfiled (this included
  WPrefs.app and Window Maker itself).
- replaced some malloc's with wmalloc's
This commit is contained in:
dan
2001-05-19 23:07:10 +00:00
parent 60611fbd47
commit 128403b487
12 changed files with 130 additions and 65 deletions

View File

@@ -1,5 +1,9 @@
- removed FocusFollowMouse from wmaker and WPrefs - removed FocusFollowMouse from wmaker and WPrefs
- fixed problem with alpha images showing a blue tint on big endian machines - fixed problem with alpha images showing a blue tint on big endian machines
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
related error when text was selected in a textfiled (including WPrefs.app
and Window Maker itself).
Changes since version 0.64.0: Changes since version 0.64.0:
............................. .............................

View File

@@ -1,3 +1,7 @@
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
related error when text was selected in a textfiled.
Changes since wmaker 0.64.0: Changes since wmaker 0.64.0:
............................ ............................

View File

@@ -3,6 +3,7 @@
#include "WINGsP.h" #include "WINGsP.h"
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
@@ -583,7 +584,7 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
"WM_STATE" "WM_STATE"
}; };
Atom atoms[sizeof(atomNames)/sizeof(char*)]; Atom atoms[sizeof(atomNames)/sizeof(char*)];
int i = 0; int i;
if (!initialized) { if (!initialized) {
@@ -616,6 +617,45 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->fontCache = WMCreateHashTable(WMStringPointerHashCallbacks); scrPtr->fontCache = WMCreateHashTable(WMStringPointerHashCallbacks);
/* Create missing CUT_BUFFERs */
{
Atom *rootWinProps;
int exists[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int count;
rootWinProps = XListProperties(display, scrPtr->rootWin, &count);
for (i=0; i<count; i++) {
switch(rootWinProps[i]) {
case XA_CUT_BUFFER0:
exists[0] = 1; break;
case XA_CUT_BUFFER1:
exists[1] = 1; break;
case XA_CUT_BUFFER2:
exists[2] = 1; break;
case XA_CUT_BUFFER3:
exists[3] = 1; break;
case XA_CUT_BUFFER4:
exists[4] = 1; break;
case XA_CUT_BUFFER5:
exists[5] = 1; break;
case XA_CUT_BUFFER6:
exists[6] = 1; break;
case XA_CUT_BUFFER7:
exists[7] = 1; break;
default:
break;
}
}
if (rootWinProps) {
XFree(rootWinProps);
}
for (i=0; i<8; i++) {
if (!exists[i]) {
XStoreBuffer(display, "", 0, i);
}
}
}
scrPtr->ignoredModifierMask = 0; scrPtr->ignoredModifierMask = 0;
{ {
int i; int i;
@@ -816,11 +856,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
XInternAtoms(display, atomNames, sizeof(atomNames)/sizeof(char*), False, XInternAtoms(display, atomNames, sizeof(atomNames)/sizeof(char*), False,
atoms); atoms);
#else #else
{ for (i = 0; i < sizeof(atomNames)/sizeof(char*); i++) {
int i; atoms[i] = XInternAtom(display, atomNames[i], False);
for (i = 0; i < sizeof(atomNames)/sizeof(char*); i++) {
atoms[i] = XInternAtom(display, atomNames[i], False);
}
} }
#endif #endif
@@ -855,7 +892,6 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->rootView = W_CreateRootView(scrPtr); scrPtr->rootView = W_CreateRootView(scrPtr);
scrPtr->balloon = W_CreateBalloon(scrPtr); scrPtr->balloon = W_CreateBalloon(scrPtr);

View File

@@ -674,7 +674,7 @@ didResizeTextField(W_ViewDelegate *self, WMView *view)
tPtr->offsetWidth = tPtr->offsetWidth =
WMAX((tPtr->view->size.height - WMFontHeight(tPtr->font))/2, 1); WMAX((tPtr->view->size.height - WMFontHeight(tPtr->font))/2, 1);
tPtr->usableWidth = tPtr->view->size.width - 2*tPtr->offsetWidth + 2; tPtr->usableWidth = tPtr->view->size.width - 2*tPtr->offsetWidth /*+ 2*/;
} }

View File

@@ -319,7 +319,7 @@ updateDockNumbers(WScreen *scr)
numbers_gc = XCreateGC(dpy, dicon->icon->core->window, numbers_gc = XCreateGC(dpy, dicon->icon->core->window,
my_v_mask, &my_gc_values); my_v_mask, &my_gc_values);
ws_numbers = malloc(20); ws_numbers = wmalloc(20);
sprintf(ws_numbers, "%i [ %i ]", scr->current_workspace+1, sprintf(ws_numbers, "%i [ %i ]", scr->current_workspace+1,
((scr->current_workspace/10)+1)); ((scr->current_workspace/10)+1));
length = strlen(ws_numbers); length = strlen(ws_numbers);

View File

@@ -1249,7 +1249,7 @@ wClipIconPaint(WAppIcon *aicon)
wIconPaint(aicon->icon); wIconPaint(aicon->icon);
length = strlen(workspace->name); length = strlen(workspace->name);
ws_name = malloc(length + 1); ws_name = wmalloc(length + 1);
sprintf(ws_name, "%s", workspace->name); sprintf(ws_name, "%s", workspace->name);
sprintf(ws_number, "%i", scr->current_workspace + 1); sprintf(ws_number, "%i", scr->current_workspace + 1);
nlength = strlen(ws_number); nlength = strlen(ws_number);

View File

@@ -38,8 +38,8 @@ char *ProgName;
char* char*
defaultsPathForDomain(char *domain) defaultsPathForDomain(char *domain)
{ {
char path[1024]; static char path[1024];
char *gspath, *tmp; char *gspath;
gspath = getenv("GNUSTEP_USER_ROOT"); gspath = getenv("GNUSTEP_USER_ROOT");
if (gspath) { if (gspath) {
@@ -60,10 +60,7 @@ defaultsPathForDomain(char *domain)
strcat(path, "/"); strcat(path, "/");
strcat(path, domain); strcat(path, domain);
tmp = malloc(strlen(path)+2); return path;
strcpy(tmp, path);
return tmp;
} }
void void

View File

@@ -114,24 +114,19 @@ print_help()
char* char*
globalDefaultsPathForDomain(char *domain) globalDefaultsPathForDomain(char *domain)
{ {
char path[1024]; static char path[1024];
char *tmp;
sprintf(path, "%s/WindowMaker/%s", SYSCONFDIR, domain); sprintf(path, "%s/WindowMaker/%s", SYSCONFDIR, domain);
tmp = malloc(strlen(path)+2); return path;
assert(tmp!=NULL);
strcpy(tmp, path);
return tmp;
} }
char* char*
defaultsPathForDomain(char *domain) defaultsPathForDomain(char *domain)
{ {
char path[1024]; static char path[1024];
char *gspath, *tmp; char *gspath;
gspath = getenv("GNUSTEP_USER_ROOT"); gspath = getenv("GNUSTEP_USER_ROOT");
if (gspath) { if (gspath) {
@@ -152,10 +147,7 @@ defaultsPathForDomain(char *domain)
strcat(path, "/"); strcat(path, "/");
strcat(path, domain); strcat(path, domain);
tmp = malloc(strlen(path)+2); return path;
strcpy(tmp, path);
return tmp;
} }
@@ -602,7 +594,6 @@ main(int argc, char **argv)
ProgName, path); ProgName, path);
exit(1); exit(1);
} }
free(path);
/* get global value */ /* get global value */
path = globalDefaultsPathForDomain("WindowMaker"); path = globalDefaultsPathForDomain("WindowMaker");

View File

@@ -36,8 +36,8 @@ char *ProgName;
char* char*
defaultsPathForDomain(char *domain) defaultsPathForDomain(char *domain)
{ {
char path[1024]; static char path[1024];
char *gspath, *tmp; char *gspath;
gspath = getenv("GNUSTEP_USER_ROOT"); gspath = getenv("GNUSTEP_USER_ROOT");
if (gspath) { if (gspath) {
@@ -59,10 +59,7 @@ defaultsPathForDomain(char *domain)
strcat(path, "/"); strcat(path, "/");
strcat(path, domain); strcat(path, domain);
tmp = malloc(strlen(path)+2); return path;
strcpy(tmp, path);
return tmp;
} }

View File

@@ -64,8 +64,8 @@ proplist_t readBlackBoxStyle(char *path);
char* char*
defaultsPathForDomain(char *domain) defaultsPathForDomain(char *domain)
{ {
char path[1024]; static char path[1024];
char *gspath, *tmp; char *gspath;
gspath = getenv("GNUSTEP_USER_ROOT"); gspath = getenv("GNUSTEP_USER_ROOT");
if (gspath) { if (gspath) {
@@ -87,10 +87,7 @@ defaultsPathForDomain(char *domain)
strcat(path, "/"); strcat(path, "/");
strcat(path, domain); strcat(path, domain);
tmp = malloc(strlen(path)+2); return path;
strcpy(tmp, path);
return tmp;
} }

View File

@@ -1156,9 +1156,8 @@ getFullPixmapPath(char *file)
char *path = wmalloc(bsize); char *path = wmalloc(bsize);
while (!getcwd(path, bsize)) { while (!getcwd(path, bsize)) {
wfree(path);
bsize += bsize/2; bsize += bsize/2;
path = malloc(bsize); path = wrealloc(path, bsize);
} }
tmp = wstrconcat(path, "/"); tmp = wstrconcat(path, "/");

View File

@@ -136,17 +136,56 @@ main(int argc, char **argv)
XDisplayName(display_name)); XDisplayName(display_name));
exit(1); exit(1);
} }
if (buffer<0) { if (buffer<0) {
Atom *rootWinProps;
int exists[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int i, count;
/* Create missing CUT_BUFFERs */
rootWinProps = XListProperties(dpy, DefaultRootWindow(dpy), &count);
for (i=0; i<count; i++) {
switch(rootWinProps[i]) {
case XA_CUT_BUFFER0:
exists[0] = 1; break;
case XA_CUT_BUFFER1:
exists[1] = 1; break;
case XA_CUT_BUFFER2:
exists[2] = 1; break;
case XA_CUT_BUFFER3:
exists[3] = 1; break;
case XA_CUT_BUFFER4:
exists[4] = 1; break;
case XA_CUT_BUFFER5:
exists[5] = 1; break;
case XA_CUT_BUFFER6:
exists[6] = 1; break;
case XA_CUT_BUFFER7:
exists[7] = 1; break;
default:
break;
}
}
if (rootWinProps) {
XFree(rootWinProps);
}
for (i=0; i<8; i++) {
if (!exists[i]) {
XStoreBuffer(dpy, "", 0, i);
}
}
XRotateBuffers(dpy, 1); XRotateBuffers(dpy, 1);
buffer=0; buffer=0;
} }
while (!feof(file)) { while (!feof(file)) {
char *nbuf; char *nbuf;
char tmp[LINESIZE+2]; char tmp[LINESIZE+2];
int nl=0; int nl=0;
/* /*
* Use read() instead of fgets() to preserve NULs, since * Use read() instead of fgets() to preserve NULLs, since
* especially since there's no reason to read one line at a time. * especially since there's no reason to read one line at a time.
*/ */
if ((nl = fread(tmp, 1, LINESIZE, file)) <= 0) { if ((nl = fread(tmp, 1, LINESIZE, file)) <= 0) {
@@ -154,21 +193,22 @@ main(int argc, char **argv)
} }
if (buf_len == 0) { if (buf_len == 0) {
nbuf = malloc(buf_len = l+nl+1); nbuf = malloc(buf_len = l+nl+1);
} } else if (buf_len < l+nl+1) {
else { /*
if (buf_len < l+nl+1) { * To avoid terrible performance on big input buffers,
/* * grow by doubling, not by the minimum needed for the
* To avoid terrible performance on big input buffers, * current line.
* grow by doubling, not by the minimum needed for the */
* current line. buf_len = 2 * buf_len + nl + 1;
*/ /* some realloc implementations don't do malloc if buf==NULL */
buf_len = 2 * buf_len + nl + 1; if (buf == NULL) {
nbuf = realloc(buf, buf_len); nbuf = malloc(buf_len);
} } else {
else { nbuf = realloc(buf, buf_len);
nbuf = buf; }
} } else {
} nbuf = buf;
}
if (!nbuf) { if (!nbuf) {
fprintf(stderr, "%s: out of memory\n", argv[0]); fprintf(stderr, "%s: out of memory\n", argv[0]);
exit(1); exit(1);