Merged changes from HEAD.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/NibCompatibility@22359 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-01-26 02:49:59 +00:00
parent a178657115
commit 516441d7eb
11 changed files with 284 additions and 251 deletions

View file

@ -1,3 +1,30 @@
2006-01-23 Fred Kiefer <FredKiefer@gmx.de>
* Headers/cairo/CairoFaceInfo.h,
* Source/cairo/CairoFaceInfo.m,
* Source/cairo/CairoFontEnumerator.m,
* Source/cairo/CairoFontInfo.m:
Rewrite of all cairo font handling to work with exported cairo
functions and enumerate fonts with the font config library.
2006-01-14 Richard Frith-Macdonald <rfm@gnu.org>
* Source/gsc/GSContext.m:
* Source/x11/XGServer.m:
* Source/x11/XGServerWindow.m:
* Source/x11/XWindowBuffer.m:
* Headers/x11/XGServerWindow.h:
Some fixes for 64bit processor support. In particular, allow for
bug/feature of X that 32bit data supplied in XChangeProperty must
actually be 64bit on a 64bit machine. The X client library discards
the upper 32bits of each value when encoding the data to be sent to
the server. These changes fix WindowMaker interaction on AMD64.
2006-01-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/win32/WIN32Server.m: Attempt to terminate gracefully when
a quit message is received.
2005-12-22 Adam Fedor <fedor@gnu.org>
* Version 0.10.2

View file

@ -5,6 +5,9 @@
* August 31, 2003
* Written by Banlu Kemiyatorn <object at gmail dot com>
* Base on code by Alexander Malmberg <alexander@malmberg.org>
* Rewrite: Fred Kiefer <fredkiefer@gmx.de>
* Date: Jan 2006
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
@ -23,54 +26,35 @@
#ifndef CAIROFACEINFO_H
#define CAIROFACEINFO_H
#include <Foundation/Foundation.h>
#include <cairo.h>
#include <cairo-ft.h>
@interface CairoFaceInfo : NSObject
{
int _weight;
unsigned int _traits;
cairo_font_slant_t _c_slant;
cairo_font_weight_t _c_weight;
cairo_font_face_t *_fontFace;
FcPattern *_pattern;
NSString *_faceName;
NSString *_familyName;
NSString *_displayName;
NSString *_cairoName;
}
- (id) initWithName: (NSString *)name
familyName: (NSString *)familyName
displayName: (NSString *)displayName
cairoName: (NSString *)cairoName
weight: (int)weight
traits: (unsigned int)traits
cairoSlant: (cairo_font_slant_t)cairoSlant
cairoWeight: (cairo_font_weight_t)cairoWeight;
- (unsigned int) cacheSize;
- (id) initWithfamilyName: (NSString *)familyName
weight: (int)weight
traits: (unsigned int)traits
pattern: (FcPattern *)pattern;
- (cairo_font_weight_t) cairoWeight;
- (void) setCairoWeight: (cairo_font_weight_t) weight;
- (cairo_font_slant_t) cairoSlant;
- (void) setCairoSlant: (cairo_font_slant_t) slant;
- (unsigned int) cacheSize;
- (int) weight;
- (void) setWeight: (int)weight;
- (unsigned int) traits;
- (void) setTraits: (unsigned int)traits;
- (NSString *) displayName;
- (void) setDisplayName: (NSString *)name;
- (NSString *) familyName;
- (void) setFamilyName: (NSString *)name;
- (NSString *) name;
- (void) setName: (NSString *)name;
- (const char *) cairoCName;
- (void) setCairoName: (NSString *)name;
- (cairo_font_face_t *)fontFace;
@end
#endif

View file

@ -30,19 +30,29 @@
#undef BOOL
#include <x11/XGServer.h>
//
// WindowMaker window manager interaction
//
/*
* WindowMaker window manager interaction
*
* NB. Despite the fact that all the fields in this table are notionally
* 32bit values (WindowMaker defines them as CARD32 and Pixmap types and
* the X protocol spec says Pixmap is 32bits) they actually all have to be
* long values (64bits on a 64bit processor). This is because of a bug in
* X-windows property functions, such that they assume that where property
* data is specified as 32bit it is actually a long.
* The X headers automatically adjust the size of a Pixmap to be that of
* a long, so we can declare Pixmap fields to be that size, but we must
* explicitly use 'unsigned long' rather than CARD32 foir the others.
*/
typedef struct {
CARD32 flags;
CARD32 window_style;
CARD32 window_level;
CARD32 reserved;
unsigned long flags;
unsigned long window_style;
unsigned long window_level;
unsigned long reserved;
Pixmap miniaturize_pixmap; // pixmap for miniaturize button
Pixmap close_pixmap; // pixmap for close button
Pixmap miniaturize_mask; // miniaturize pixmap mask
Pixmap close_mask; // close pixmap mask
CARD32 extra_flags;
unsigned long extra_flags;
} GNUstepWMAttributes;
#define GSWindowStyleAttr (1<<0)

View file

@ -5,6 +5,9 @@
* August 31, 2003
* Written by Banlu Kemiyatorn <object at gmail dot com>
* Base on original code of Alex Malmberg
* Rewrite: Fred Kiefer <fredkiefer@gmx.de>
* Date: Jan 2006
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
@ -26,23 +29,17 @@
@ implementation CairoFaceInfo
- (id) initWithName: (NSString *)name
familyName: (NSString *)familyName
displayName: (NSString *)displayName
cairoName: (NSString *)cairoName
weight: (int)weight
traits: (unsigned int)traits
cairoSlant: (cairo_font_slant_t)cairoSlant
cairoWeight: (cairo_font_weight_t)cairoWeight
- (id) initWithfamilyName: (NSString *)familyName
weight: (int)weight
traits: (unsigned int)traits
pattern: (FcPattern *)pattern
{
[self setName: name];
_pattern = pattern;
FcPatternReference(_pattern);
[self setFamilyName: familyName];
[self setDisplayName: displayName];
[self setCairoName: cairoName];
[self setWeight: weight];
[self setTraits: traits];
[self setCairoSlant: cairoSlant];
[self setCairoWeight: cairoWeight];
return self;
}
@ -53,10 +50,10 @@
{
cairo_font_face_destroy(_fontFace);
}
FcPatternDestroy(_pattern);
RELEASE(_familyName);
RELEASE(_faceName);
RELEASE(_displayName);
RELEASE(_cairoName);
[super dealloc];
}
@ -65,41 +62,11 @@
ASSIGN(_familyName, name);
}
- (void) setName: (NSString *)name
{
ASSIGN(_faceName, name);
}
- (void) setDisplayName: (NSString *)name
{
ASSIGN(_displayName, name);
}
- (const char *) cairoCName
{
return [_cairoName lossyCString];
}
- (void) setCairoName: (NSString *)name
{
ASSIGN(_cairoName, name);
}
- (NSString *)familyName
{
return _familyName;
}
- (NSString *) name
{
return _faceName;
}
- (NSString *) displayName
{
return _displayName;
}
- (int) weight
{
return _weight;
@ -115,26 +82,6 @@
return _traits;
}
- (cairo_font_weight_t) cairoWeight
{
return _c_weight;
}
- (cairo_font_slant_t) cairoSlant
{
return _c_slant;
}
- (void) setCairoWeight: (cairo_font_weight_t)weight
{
_c_weight = weight;
}
- (void) setCairoSlant: (cairo_font_slant_t)slant
{
_c_slant = slant;
}
- (void) setTraits: (unsigned int)traits
{
_traits = traits;
@ -145,18 +92,27 @@
return 257;
}
extern cairo_font_face_t *
_cairo_toy_font_face_create(const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight);
- (cairo_font_face_t *)fontFace
{
if (!_fontFace)
{
// FIXME: This function is not exported by cairo
_fontFace = _cairo_toy_font_face_create([_cairoName cString],
_c_slant, _c_weight);
FcResult result;
FcPattern *resolved;
FcConfigSubstitute (NULL, _pattern, FcMatchPattern);
FcDefaultSubstitute(_pattern);
resolved = FcFontMatch(NULL, _pattern, &result);
_fontFace = cairo_ft_font_face_create_for_pattern(resolved);
FcPatternDestroy(resolved);
if ((!_fontFace) || (cairo_font_face_status(_fontFace) != CAIRO_STATUS_SUCCESS))
{
NSLog(@"Creating a font face failed %@", _familyName);
cairo_font_face_destroy(_fontFace);
_fontFace = NULL;
return NULL;
}
}
return _fontFace;

View file

@ -5,6 +5,9 @@
* August 31, 2003
* Written by Banlu Kemiyatorn <object at gmail dot com>
* Base on original code of Alex Malmberg
* Rewrite: Fred Kiefer <fredkiefer@gmx.de>
* Date: Jan 2006
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
@ -54,102 +57,149 @@ NSMutableDictionary * __allFonts;
return face;
}
// Make a GNUStep style font descriptor from a FcPattern
static NSArray *faFromFc(FcPattern *pat)
{
int weight, slant, spacing, nsweight;
unsigned int nstraits = 0;
char *family;
NSMutableString *name, *style;
if (FcPatternGetInteger(pat, FC_WEIGHT, 0, &weight) != FcResultMatch ||
FcPatternGetInteger(pat, FC_SLANT, 0, &slant) != FcResultMatch ||
FcPatternGetString(pat, FC_FAMILY, 0, (FcChar8 **)&family) != FcResultMatch)
return nil;
if (FcPatternGetInteger(pat, FC_SPACING, 0, &spacing) == FcResultMatch)
if (spacing==FC_MONO || spacing==FC_CHARCELL)
nstraits |= NSFixedPitchFontMask;
name = [NSMutableString stringWithCapacity: 100];
style = [NSMutableString stringWithCapacity: 100];
[name appendString: [NSString stringWithUTF8String: family]];
switch (weight)
{
case FC_WEIGHT_LIGHT:
[style appendString: @"Light"];
nsweight = 3;
break;
case FC_WEIGHT_MEDIUM:
nsweight = 6;
break;
case FC_WEIGHT_DEMIBOLD:
[style appendString: @"Demibold"];
nsweight = 7;
break;
case FC_WEIGHT_BOLD:
[style appendString: @"Bold"];
nsweight = 9;
nstraits |= NSBoldFontMask;
break;
case FC_WEIGHT_BLACK:
[style appendString: @"Black"];
nsweight = 12;
nstraits |= NSBoldFontMask;
break;
default:
nsweight = 6;
}
switch (slant)
{
case FC_SLANT_ROMAN:
break;
case FC_SLANT_ITALIC:
[style appendString: @"Italic"];
nstraits |= NSItalicFontMask;
break;
case FC_SLANT_OBLIQUE:
[style appendString: @"Oblique"];
nstraits |= NSItalicFontMask;
break;
}
if ([style length] > 0)
{
[name appendString: @"-"];
[name appendString: style];
}
else
{
[style appendString: @"Roman"];
}
return [NSArray arrayWithObjects: name,
style,
[NSNumber numberWithInt: nsweight],
[NSNumber numberWithUnsignedInt: nstraits],
nil];
}
- (void) enumerateFontsAndFamilies
{
static BOOL done = NO;
int i;
NSMutableDictionary *fcxft_allFontFamilies = [[NSMutableDictionary alloc] init];
NSMutableDictionary *fcxft_allFonts = [[NSMutableDictionary alloc] init];
NSMutableArray *fcxft_allFontNames = [[NSMutableArray alloc] init];
if (!done)
FcPattern *pat = FcPatternCreate();
FcObjectSet *os = FcObjectSetBuild(FC_FAMILY, FC_SLANT, FC_WEIGHT, NULL);
FcFontSet *fs = FcFontList(NULL, pat, os);
FcPatternDestroy(pat);
FcObjectSetDestroy(os);
for (i=0; i < fs->nfont; i++)
{
NSArray *fontDef;
NSMutableArray *fontDefs;
CairoFaceInfo *aFace;
char *family;
__allFonts = [[NSMutableDictionary alloc] init];
allFontFamilies =[[NSMutableDictionary alloc] init];
if (FcPatternGetString(fs->fonts[i], FC_FAMILY, 0, (FcChar8 **)&family) == FcResultMatch)
{
NSArray *fontArray;
fontDefs =[NSMutableArray arrayWithCapacity:10];
[allFontFamilies setObject: fontDefs forKey:@"Helvetica"];
if ((fontArray = faFromFc(fs->fonts[i])))
{
NSString *familyString;
NSMutableArray *familyArray;
CairoFaceInfo *aFont;
NSString *name = [fontArray objectAtIndex: 0];
fontDef =[NSArray arrayWithObjects: @"Helvetica", @"Medium",
[NSNumber numberWithInt: 5],
[NSNumber numberWithUnsignedInt:0], nil];
[fontDefs addObject:fontDef];
aFace = [[CairoFaceInfo alloc] initWithName: @"Medium"
familyName: @"Helvetica"
displayName: @"Helvetica"
cairoName: @"serif"
weight: 5
traits: 0
cairoSlant: CAIRO_FONT_SLANT_NORMAL
cairoWeight: CAIRO_FONT_WEIGHT_NORMAL];
[__allFonts setObject: aFace forKey: @"Helvetica"];
RELEASE(aFace);
fontDef =[NSArray arrayWithObjects: @"Helvetica-Bold", @"Bold",
[NSNumber numberWithInt: 9],
[NSNumber numberWithUnsignedInt:NSBoldFontMask],
nil];
[fontDefs addObject:fontDef];
aFace = [[CairoFaceInfo alloc] initWithName: @"Bold"
familyName: @"Helvetica"
displayName: @"Helvetica Bold"
cairoName: @"serif"
weight: 9
traits: NSBoldFontMask
cairoSlant: CAIRO_FONT_SLANT_NORMAL
cairoWeight: CAIRO_FONT_WEIGHT_BOLD];
[__allFonts setObject: aFace forKey: @"Helvetica-Bold"];
RELEASE(aFace);
fontDef =[NSArray arrayWithObjects: @"Helvetica-Oblique", @"Oblique",
[NSNumber numberWithInt: 5],
[NSNumber numberWithUnsignedInt:NSItalicFontMask],
nil];
[fontDefs addObject:fontDef];
aFace = [[CairoFaceInfo alloc] initWithName: @"Oblique"
familyName: @"Helvetica"
displayName: @"Helvetica Oblique"
cairoName: @"serif"
weight: 5
traits: NSItalicFontMask
cairoSlant: CAIRO_FONT_SLANT_OBLIQUE
cairoWeight: CAIRO_FONT_WEIGHT_NORMAL];
[__allFonts setObject: aFace forKey: @"Helvetica-Oblique"];
RELEASE(aFace);
fontDefs =[NSMutableArray arrayWithCapacity:10];
[allFontFamilies setObject: fontDefs forKey:@"Courier"];
fontDef =[NSArray arrayWithObjects: @"Courier", @"Medium",
[NSNumber numberWithInt: 5],
[NSNumber numberWithUnsignedInt:NSFixedPitchFontMask],
nil];
[fontDefs addObject:fontDef];
aFace = [[CairoFaceInfo alloc] initWithName: @"Medium"
familyName: @"Courier"
displayName: @"Courier"
cairoName: @"Courier"
weight: 5
traits: NSFixedPitchFontMask
cairoSlant: CAIRO_FONT_SLANT_NORMAL
cairoWeight: CAIRO_FONT_WEIGHT_NORMAL];
[__allFonts setObject: aFace forKey: @"Courier"];
RELEASE(aFace);
ASSIGN(allFontNames, [__allFonts allKeys]);
done = YES;
familyString = [NSString stringWithUTF8String: family];
if (!(familyArray = [fcxft_allFontFamilies objectForKey: familyString]))
{
NSDebugLog(@"Found font family %@", familyString);
familyArray = [[NSMutableArray alloc] init];
[fcxft_allFontFamilies setObject: familyArray forKey: familyString];
RELEASE(familyArray);
}
NSDebugLog(@"fc enumerator: adding font: %@", name);
[familyArray addObject: fontArray];
[fcxft_allFontNames addObject: name];
aFont = [[CairoFaceInfo alloc] initWithfamilyName: familyString
weight: [[fontArray objectAtIndex: 2] intValue]
traits: [[fontArray objectAtIndex: 3] unsignedIntValue]
pattern: fs->fonts[i]];
[fcxft_allFonts setObject: aFont forKey: name];
RELEASE(aFont);
}
}
}
//NSLog (@"%@", allFontNames);
FcFontSetDestroy (fs);
allFontNames = fcxft_allFontNames;
allFontFamilies = fcxft_allFontFamilies;
__allFonts = fcxft_allFonts;
}
- (NSString *) defaultSystemFontName
{
return @"Helvetica";
return @"Adobe Helvetica";
}
- (NSString *) defaultBoldSystemFontName
{
return @"Helvetica-Bold";
return @"Adobe Helvetica-Bold";
}
- (NSString *) defaultFixedPitchFontName

View file

@ -154,35 +154,6 @@
return YES;
}
// FIXME: This function is not exported by Cairo. The parameters have changed in recent cairo!!!
extern
cairo_status_t
_cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
const char *utf8,
cairo_glyph_t **glyphs,
int *num_glyphs);
static
BOOL _cairo_extents_for_text(cairo_scaled_font_t *scaled_font, const char *utf8,
cairo_text_extents_t *ctext)
{
cairo_glyph_t *glyphs = NULL;
int num_glyphs;
cairo_status_t status;
status = _cairo_scaled_font_text_to_glyphs(scaled_font, utf8,
&glyphs, &num_glyphs);
if (glyphs)
{
cairo_scaled_font_glyph_extents(scaled_font, glyphs, num_glyphs, ctext);
free(glyphs);
return YES;
}
return NO;
}
static
BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
cairo_text_extents_t *ctext)
@ -192,8 +163,9 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
// FIXME: This is wrong for none ASCII characters!
str[0] = glyph;
str[1] = 0;
return _cairo_extents_for_text(scaled_font, str, ctext);
cairo_scaled_font_text_extents(scaled_font, str, ctext);
return cairo_scaled_font_status(scaled_font) == CAIRO_STATUS_SUCCESS;
}
- (NSSize) advancementForGlyph: (NSGlyph)glyph
@ -236,7 +208,8 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
{
cairo_text_extents_t ctext;
if (_cairo_extents_for_text(_scaled, [string UTF8String], &ctext))
cairo_scaled_font_text_extents(_scaled, [string UTF8String], &ctext);
if (cairo_scaled_font_status(_scaled) == CAIRO_STATUS_SUCCESS)
{
return ctext.width;
}

View file

@ -419,7 +419,8 @@ static unsigned int unique_index = 0;
DPS_ERROR(DPSundefined, @"No gstate");
return 0;
}
NSMapInsert(gtable, (void *)++unique_index, AUTORELEASE([gstate copy]));
NSMapInsert(gtable,
(void *)(uintptr_t)++unique_index, AUTORELEASE([gstate copy]));
return unique_index;
}
@ -432,7 +433,7 @@ static unsigned int unique_index = 0;
{
if (gst <= 0)
return;
NSMapInsert(gtable, (void *)gst, AUTORELEASE([gstate copy]));
NSMapInsert(gtable, (void *)(uintptr_t)gst, AUTORELEASE([gstate copy]));
}
/* ----------------------------------------------------------------------- */
@ -864,27 +865,27 @@ static unsigned int unique_index = 0;
if (n < 0)
DPS_ERROR(DPSinvalidparam, @"Invalid userobject index");
else
NSMapInsert(gtable, (void *)n, obj);
NSMapInsert(gtable, (void *)(uintptr_t)n, obj);
}
- (void)DPSexecuserobject: (int)index
{
if (index < 0 || NSMapGet(gtable, (void *)index) == nil)
if (index < 0 || NSMapGet(gtable, (void *)(uintptr_t)index) == nil)
{
DPS_ERROR(DPSinvalidparam, @"Invalid userobject index");
return;
}
ctxt_push((id)NSMapGet(gtable, (void *)index), opstack);
ctxt_push((id)NSMapGet(gtable, (void *)(uintptr_t)index), opstack);
}
- (void)DPSundefineuserobject: (int)index
{
if (index < 0 || NSMapGet(gtable, (void *)index) == nil)
if (index < 0 || NSMapGet(gtable, (void *)(uintptr_t)index) == nil)
{
DPS_ERROR(DPSinvalidparam, @"Invalid gstate index");
return;
}
NSMapRemove(gtable, (void *)index);
NSMapRemove(gtable, (void *)(uintptr_t)index);
}
- (void)DPSclear

View file

@ -116,6 +116,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg,
if (m->message == WM_QUIT)
{
[NSApp terminate: nil];
// Exit the program
return;
}

View file

@ -452,7 +452,7 @@ _parse_display_name(NSString *name, int *dn, int *sn)
screen = [[XGScreenContext alloc] initForDisplay: dpy screen: screen_number];
AUTORELEASE(screen);
NSMapInsert(screenList, (void *)screen_number, (void *)screen);
NSMapInsert(screenList, (void *)(uintptr_t)screen_number, (void *)screen);
defScreen = screen_number;
XSetErrorHandler(XGErrorHandler);
@ -514,14 +514,14 @@ _parse_display_name(NSString *name, int *dn, int *sn)
format: @"Request for invalid screen"];
}
screen = NSMapGet(screenList, (void *)screen_number);
screen = NSMapGet(screenList, (void *)(uintptr_t)screen_number);
if (screen == NULL)
{
XGScreenContext *screen;
screen = [[XGScreenContext alloc]
initForDisplay: dpy screen: screen_number];
AUTORELEASE(screen);
NSMapInsert(screenList, (void *)screen_number, (void *)screen);
NSMapInsert(screenList, (void *)(uintptr_t)screen_number, (void *)screen);
}
return screen;
}

View file

@ -67,7 +67,7 @@ static BOOL handlesWindowDecorations = YES;
*/
static char *rootName = 0;
#define WINDOW_WITH_TAG(windowNumber) (gswindow_device_t *)NSMapGet(windowtags, (void *)windowNumber)
#define WINDOW_WITH_TAG(windowNumber) (gswindow_device_t *)NSMapGet(windowtags, (void *)(uintptr_t)windowNumber)
/* Current mouse grab window */
static gswindow_device_t *grab_window = NULL;
@ -184,7 +184,7 @@ typedef struct {
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long input_mode;
unsigned long status;
} MwmHints;
@ -245,7 +245,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
/* Get the already-set window hints */
success = XGetWindowProperty (dpy, window, mwhints_atom, 0,
sizeof (MwmHints) / sizeof (long),
sizeof (MwmHints) / sizeof (unsigned long),
False, AnyPropertyType, &type_ret, &format_ret,
&nitems_ret, &bytes_after_ret,
(unsigned char **)&hints);
@ -331,7 +331,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
/* Set the hints */
XChangeProperty (dpy, window, mwhints_atom, mwhints_atom, 32,
PropModeReplace, (unsigned char *)hints,
sizeof (MwmHints) / sizeof (long));
sizeof (MwmHints) / sizeof (unsigned long));
/* Free the hints if allocated by the X server for us */
if (needToFreeHints == YES)
@ -368,11 +368,11 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
+ (gswindow_device_t *) _windowForXParent: (Window)xWindow
{
NSMapEnumerator enumerator;
Window x;
void *key;
gswindow_device_t *d;
enumerator = NSEnumerateMapTable(windowmaps);
while (NSNextMapEnumeratorPair(&enumerator, (void**)&x, (void**)&d) == YES)
while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&d) == YES)
{
if (d->root != d->parent && d->parent == xWindow)
{
@ -877,6 +877,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
*/
win_attrs.flags = GSExtraFlagsAttr;
win_attrs.extra_flags = GSNoApplicationIconFlag;
/* Warning ... X-bug .. when we specify 32bit data X actually expects data
* of type 'long' or 'unsigned long' even on machines where those types
* hold 64bit values.
*/
XChangeProperty(dpy, ROOT,
generic.win_decor_atom, generic.win_decor_atom,
32, PropModeReplace, (unsigned char *)&win_attrs,
@ -887,8 +891,12 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
{
// Store the id of our process
Atom pid_atom = XInternAtom(dpy, "_NET_WM_PID", False);
int pid = [pInfo processIdentifier];
long pid = [pInfo processIdentifier];
/* Warning ... X-bug .. when we specify 32bit data X actually expects data
* of type 'long' or 'unsigned long' even on machines where those types
* hold 64bit values.
*/
XChangeProperty(dpy, ROOT,
pid_atom, XA_CARDINAL,
32, PropModeReplace,
@ -900,7 +908,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
this context */
- (void) _destroyServerWindows
{
int num;
void *key;
gswindow_device_t *d;
NSMapEnumerator enumerator;
NSMapTable *mapcopy;
@ -909,10 +917,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
the map table */
mapcopy = NSCopyMapTableWithZone(windowtags, [self zone]);
enumerator = NSEnumerateMapTable(mapcopy);
while (NSNextMapEnumeratorPair(&enumerator, (void**)&num, (void**)&d) == YES)
while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&d) == YES)
{
if (d->display == dpy && d->ident != d->root)
[self termwindow: num];
[self termwindow: (int)(intptr_t)key];
}
NSFreeMapTable(mapcopy);
}
@ -1077,11 +1085,13 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
if (image != nil)
{
didCreateNetIcon = YES;
[self _createNetIcon: image result: &iconPropertyData size: &iconSize];
[self _createNetIcon: image
result: &iconPropertyData
size: &iconSize];
}
}
if (iconPropertyData)
if (iconPropertyData != 0)
{
XChangeProperty(dpy, window,
icon_atom, XA_CARDINAL,
@ -1194,6 +1204,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
window->siz_hints.flags = USPosition|PPosition|USSize|PSize;
// Always send GNUstepWMAttributes
/* Warning ... X-bug .. when we specify 32bit data X actually expects data
* of type 'long' or 'unsigned long' even on machines where those types
* hold 64bit values.
*/
XChangeProperty(dpy, window->ident, generic.win_decor_atom,
generic.win_decor_atom, 32, PropModeReplace,
(unsigned char *)&window->win_attrs,
@ -1296,7 +1310,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
if (window->region)
XDestroyRegion (window->region);
RELEASE(window->exposedRects);
NSMapRemove(windowtags, (void*)win);
NSMapRemove(windowtags, (void*)(uintptr_t)win);
objc_free(window);
}
@ -1428,6 +1442,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
window->siz_hints.height = NSHeight(h);
// send to the WM window style hints
/* Warning ... X-bug .. when we specify 32bit data X actually expects data
* of type 'long' or 'unsigned long' even on machines where those types
* hold 64bit values.
*/
XChangeProperty(dpy, window->ident, generic.win_decor_atom,
generic.win_decor_atom, 32, PropModeReplace,
(unsigned char *)&window->win_attrs,
@ -1540,6 +1558,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
// send WindowMaker WM window style hints
// Always send GNUstepWMAttributes
/* Warning ... X-bug .. when we specify 32bit data X actually expects data
* of type 'long' or 'unsigned long' even on machines where those types
* hold 64bit values.
*/
XChangeProperty(dpy, window->ident,
generic.win_decor_atom, generic.win_decor_atom,
32, PropModeReplace, (unsigned char *)&window->win_attrs,
@ -2127,6 +2149,10 @@ static BOOL didCreatePixmaps;
* is not mapped, we have stored the required info for when
* the WM maps it.
*/
/* Warning ... X-bug .. when we specify 32bit data X actually expects data
* of type 'long' or 'unsigned long' even on machines where those types
* hold 64bit values.
*/
XChangeProperty(dpy, window->ident,
generic.win_decor_atom, generic.win_decor_atom,
32, PropModeReplace, (unsigned char *)&window->win_attrs,
@ -2203,6 +2229,10 @@ static BOOL didCreatePixmaps;
data[0] = generic.wintypes.win_desktop_atom;
}
/* Warning ... X-bug .. when we specify 32bit data X actually expects data
* of type 'long' or 'unsigned long' even on machines where those types
* hold 64bit values.
*/
XChangeProperty(dpy, window->ident, generic.wintypes.win_type_atom,
XA_ATOM, 32, PropModeReplace,
(unsigned char *)&data, len);
@ -2210,7 +2240,7 @@ static BOOL didCreatePixmaps;
else if ((generic.wm & XGWM_GNOME) != 0)
{
XEvent event;
int flag = WIN_LAYER_NORMAL;
long flag = WIN_LAYER_NORMAL;
if (level == NSDesktopWindowLevel)
flag = WIN_LAYER_DESKTOP;
@ -2613,7 +2643,7 @@ static BOOL didCreatePixmaps;
}
else
{
unsigned int opacity;
unsigned long opacity;
opacity = (unsigned int)(alpha * 0xffffffff);
XChangeProperty(window->display, window->ident, opacity_atom,
@ -2623,7 +2653,7 @@ static BOOL didCreatePixmaps;
{
XChangeProperty(window->display, window->parent, opacity_atom,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char*)&opacity, 1L);
(unsigned char*)&opacity, 1);
}
}
}
@ -2714,15 +2744,16 @@ static BOOL cursor_hidden = NO;
- (void) _DPSsetcursor: (Cursor)c : (BOOL)set
{
Window win;
void *key;
NSMapEnumerator enumerator;
gswindow_device_t *d;
NSDebugLLog (@"NSCursor", @"_DPSsetcursor: cursor = %p, set = %d", c, set);
enumerator = NSEnumerateMapTable (windowmaps);
while (NSNextMapEnumeratorPair (&enumerator, (void**)&win, (void**)&d) == YES)
while (NSNextMapEnumeratorPair (&enumerator, &key, (void**)&d) == YES)
{
Window win = (Window)key;
if (set)
XDefineCursor(dpy, win, c);
else

View file

@ -117,7 +117,7 @@ static void test_xshm(Display *display, int drawing_depth)
}
shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
if ((int)shminfo.shmaddr == -1 || num_xshm_test_errors)
if ((intptr_t)shminfo.shmaddr == -1 || num_xshm_test_errors)
{
NSLog(@"XShm not supported, shmat() failed: %m.");
XDestroyImage(ximage);
@ -294,7 +294,7 @@ no_xshm:
}
wi->shminfo.shmaddr = wi->ximage->data = shmat(wi->shminfo.shmid, 0, 0);
if ((int)wi->shminfo.shmaddr == -1)
if ((intptr_t)wi->shminfo.shmaddr == -1)
{
NSLog(@"Warning: shmat() failed: %m.");
NSLog(xshm_warning);