mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
More 64bit fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@22311 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fe123cdc96
commit
783e7162c7
3 changed files with 68 additions and 26 deletions
|
@ -4,8 +4,12 @@
|
||||||
* Source/x11/XGServer.m:
|
* Source/x11/XGServer.m:
|
||||||
* Source/x11/XGServerWindow.m:
|
* Source/x11/XGServerWindow.m:
|
||||||
* Source/x11/XWindowBuffer.m:
|
* Source/x11/XWindowBuffer.m:
|
||||||
Some fixes for 64bit processor support (that doesn't mean it's
|
* Headers/x11/XGServerWindow.h:
|
||||||
working yet).
|
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>
|
2006-01-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -30,19 +30,29 @@
|
||||||
#undef BOOL
|
#undef BOOL
|
||||||
#include <x11/XGServer.h>
|
#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 {
|
typedef struct {
|
||||||
CARD32 flags;
|
unsigned long flags;
|
||||||
CARD32 window_style;
|
unsigned long window_style;
|
||||||
CARD32 window_level;
|
unsigned long window_level;
|
||||||
CARD32 reserved;
|
unsigned long reserved;
|
||||||
Pixmap miniaturize_pixmap; // pixmap for miniaturize button
|
Pixmap miniaturize_pixmap; // pixmap for miniaturize button
|
||||||
Pixmap close_pixmap; // pixmap for close button
|
Pixmap close_pixmap; // pixmap for close button
|
||||||
Pixmap miniaturize_mask; // miniaturize pixmap mask
|
Pixmap miniaturize_mask; // miniaturize pixmap mask
|
||||||
Pixmap close_mask; // close pixmap mask
|
Pixmap close_mask; // close pixmap mask
|
||||||
CARD32 extra_flags;
|
unsigned long extra_flags;
|
||||||
} GNUstepWMAttributes;
|
} GNUstepWMAttributes;
|
||||||
|
|
||||||
#define GSWindowStyleAttr (1<<0)
|
#define GSWindowStyleAttr (1<<0)
|
||||||
|
|
|
@ -181,11 +181,11 @@ setNormalHints(Display *d, gswindow_device_t *w)
|
||||||
|
|
||||||
/* Motif window hints struct */
|
/* Motif window hints struct */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t flags;
|
unsigned long flags;
|
||||||
uint32_t functions;
|
unsigned long functions;
|
||||||
uint32_t decorations;
|
unsigned long decorations;
|
||||||
int32_t input_mode;
|
unsigned long input_mode;
|
||||||
uint32_t status;
|
unsigned long status;
|
||||||
} MwmHints;
|
} MwmHints;
|
||||||
|
|
||||||
/* Number of entries in the struct */
|
/* Number of entries in the struct */
|
||||||
|
@ -245,7 +245,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
||||||
|
|
||||||
/* Get the already-set window hints */
|
/* Get the already-set window hints */
|
||||||
success = XGetWindowProperty (dpy, window, mwhints_atom, 0,
|
success = XGetWindowProperty (dpy, window, mwhints_atom, 0,
|
||||||
sizeof (MwmHints) / sizeof (uint32_t),
|
sizeof (MwmHints) / sizeof (unsigned long),
|
||||||
False, AnyPropertyType, &type_ret, &format_ret,
|
False, AnyPropertyType, &type_ret, &format_ret,
|
||||||
&nitems_ret, &bytes_after_ret,
|
&nitems_ret, &bytes_after_ret,
|
||||||
(unsigned char **)&hints);
|
(unsigned char **)&hints);
|
||||||
|
@ -331,7 +331,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
|
||||||
/* Set the hints */
|
/* Set the hints */
|
||||||
XChangeProperty (dpy, window, mwhints_atom, mwhints_atom, 32,
|
XChangeProperty (dpy, window, mwhints_atom, mwhints_atom, 32,
|
||||||
PropModeReplace, (unsigned char *)hints,
|
PropModeReplace, (unsigned char *)hints,
|
||||||
sizeof (MwmHints) / sizeof (uint32_t));
|
sizeof (MwmHints) / sizeof (unsigned long));
|
||||||
|
|
||||||
/* Free the hints if allocated by the X server for us */
|
/* Free the hints if allocated by the X server for us */
|
||||||
if (needToFreeHints == YES)
|
if (needToFreeHints == YES)
|
||||||
|
@ -877,6 +877,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
||||||
*/
|
*/
|
||||||
win_attrs.flags = GSExtraFlagsAttr;
|
win_attrs.flags = GSExtraFlagsAttr;
|
||||||
win_attrs.extra_flags = GSNoApplicationIconFlag;
|
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,
|
XChangeProperty(dpy, ROOT,
|
||||||
generic.win_decor_atom, generic.win_decor_atom,
|
generic.win_decor_atom, generic.win_decor_atom,
|
||||||
32, PropModeReplace, (unsigned char *)&win_attrs,
|
32, PropModeReplace, (unsigned char *)&win_attrs,
|
||||||
|
@ -887,8 +891,12 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
||||||
{
|
{
|
||||||
// Store the id of our process
|
// Store the id of our process
|
||||||
Atom pid_atom = XInternAtom(dpy, "_NET_WM_PID", False);
|
Atom pid_atom = XInternAtom(dpy, "_NET_WM_PID", False);
|
||||||
int32_t 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,
|
XChangeProperty(dpy, ROOT,
|
||||||
pid_atom, XA_CARDINAL,
|
pid_atom, XA_CARDINAL,
|
||||||
32, PropModeReplace,
|
32, PropModeReplace,
|
||||||
|
@ -957,14 +965,14 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
-(BOOL) _createNetIcon: (NSImage*)image
|
-(BOOL) _createNetIcon: (NSImage*)image
|
||||||
result: (int32_t**)pixeldata
|
result: (long**)pixeldata
|
||||||
size: (int*)size
|
size: (int*)size
|
||||||
{
|
{
|
||||||
NSBitmapImageRep *rep;
|
NSBitmapImageRep *rep;
|
||||||
int i, j, w, h, samples;
|
int i, j, w, h, samples;
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
int index;
|
int index;
|
||||||
int32_t *iconPropertyData;
|
long *iconPropertyData;
|
||||||
int iconSize;
|
int iconSize;
|
||||||
|
|
||||||
rep = (NSBitmapImageRep *)[image bestRepresentationForDevice:nil];
|
rep = (NSBitmapImageRep *)[image bestRepresentationForDevice:nil];
|
||||||
|
@ -989,14 +997,14 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
||||||
data = [rep bitmapData];
|
data = [rep bitmapData];
|
||||||
|
|
||||||
iconSize = 2 + w * h;
|
iconSize = 2 + w * h;
|
||||||
iconPropertyData = (int32_t *)objc_malloc(sizeof(int32_t) * iconSize);
|
iconPropertyData = (long *)objc_malloc(sizeof(long) * iconSize);
|
||||||
if (iconPropertyData == NULL)
|
if (iconPropertyData == NULL)
|
||||||
{
|
{
|
||||||
NSLog(@"No memory for WM icon");
|
NSLog(@"No memory for WM icon");
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(iconPropertyData, 0, sizeof(int32_t)*iconSize);
|
memset(iconPropertyData, 0, sizeof(long)*iconSize);
|
||||||
index = 0;
|
index = 0;
|
||||||
iconPropertyData[index++] = w;
|
iconPropertyData[index++] = w;
|
||||||
iconPropertyData[index++] = h;
|
iconPropertyData[index++] = h;
|
||||||
|
@ -1058,7 +1066,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
||||||
// but currently this image is not available in the backend.
|
// but currently this image is not available in the backend.
|
||||||
static Atom icon_atom = None;
|
static Atom icon_atom = None;
|
||||||
static BOOL didCreateNetIcon = NO;
|
static BOOL didCreateNetIcon = NO;
|
||||||
static int32_t *iconPropertyData = NULL;
|
static long *iconPropertyData = NULL;
|
||||||
static int iconSize;
|
static int iconSize;
|
||||||
NSImage *image;
|
NSImage *image;
|
||||||
|
|
||||||
|
@ -1196,6 +1204,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
||||||
window->siz_hints.flags = USPosition|PPosition|USSize|PSize;
|
window->siz_hints.flags = USPosition|PPosition|USSize|PSize;
|
||||||
|
|
||||||
// Always send GNUstepWMAttributes
|
// 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,
|
XChangeProperty(dpy, window->ident, generic.win_decor_atom,
|
||||||
generic.win_decor_atom, 32, PropModeReplace,
|
generic.win_decor_atom, 32, PropModeReplace,
|
||||||
(unsigned char *)&window->win_attrs,
|
(unsigned char *)&window->win_attrs,
|
||||||
|
@ -1430,6 +1442,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
||||||
window->siz_hints.height = NSHeight(h);
|
window->siz_hints.height = NSHeight(h);
|
||||||
|
|
||||||
// send to the WM window style hints
|
// 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,
|
XChangeProperty(dpy, window->ident, generic.win_decor_atom,
|
||||||
generic.win_decor_atom, 32, PropModeReplace,
|
generic.win_decor_atom, 32, PropModeReplace,
|
||||||
(unsigned char *)&window->win_attrs,
|
(unsigned char *)&window->win_attrs,
|
||||||
|
@ -1542,6 +1558,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
|
||||||
|
|
||||||
// send WindowMaker WM window style hints
|
// send WindowMaker WM window style hints
|
||||||
// Always send GNUstepWMAttributes
|
// 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,
|
XChangeProperty(dpy, window->ident,
|
||||||
generic.win_decor_atom, generic.win_decor_atom,
|
generic.win_decor_atom, generic.win_decor_atom,
|
||||||
32, PropModeReplace, (unsigned char *)&window->win_attrs,
|
32, PropModeReplace, (unsigned char *)&window->win_attrs,
|
||||||
|
@ -2129,6 +2149,10 @@ static BOOL didCreatePixmaps;
|
||||||
* is not mapped, we have stored the required info for when
|
* is not mapped, we have stored the required info for when
|
||||||
* the WM maps it.
|
* 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,
|
XChangeProperty(dpy, window->ident,
|
||||||
generic.win_decor_atom, generic.win_decor_atom,
|
generic.win_decor_atom, generic.win_decor_atom,
|
||||||
32, PropModeReplace, (unsigned char *)&window->win_attrs,
|
32, PropModeReplace, (unsigned char *)&window->win_attrs,
|
||||||
|
@ -2152,7 +2176,7 @@ static BOOL didCreatePixmaps;
|
||||||
if ((generic.wm & XGWM_EWMH) != 0)
|
if ((generic.wm & XGWM_EWMH) != 0)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int32_t data[2];
|
long data[2];
|
||||||
|
|
||||||
data[0] = generic.wintypes.win_normal_atom;
|
data[0] = generic.wintypes.win_normal_atom;
|
||||||
data[1] = None;
|
data[1] = None;
|
||||||
|
@ -2205,6 +2229,10 @@ static BOOL didCreatePixmaps;
|
||||||
data[0] = generic.wintypes.win_desktop_atom;
|
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,
|
XChangeProperty(dpy, window->ident, generic.wintypes.win_type_atom,
|
||||||
XA_ATOM, 32, PropModeReplace,
|
XA_ATOM, 32, PropModeReplace,
|
||||||
(unsigned char *)&data, len);
|
(unsigned char *)&data, len);
|
||||||
|
@ -2212,7 +2240,7 @@ static BOOL didCreatePixmaps;
|
||||||
else if ((generic.wm & XGWM_GNOME) != 0)
|
else if ((generic.wm & XGWM_GNOME) != 0)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
int32_t flag = WIN_LAYER_NORMAL;
|
long flag = WIN_LAYER_NORMAL;
|
||||||
|
|
||||||
if (level == NSDesktopWindowLevel)
|
if (level == NSDesktopWindowLevel)
|
||||||
flag = WIN_LAYER_DESKTOP;
|
flag = WIN_LAYER_DESKTOP;
|
||||||
|
@ -2615,7 +2643,7 @@ static BOOL didCreatePixmaps;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t opacity;
|
unsigned long opacity;
|
||||||
|
|
||||||
opacity = (unsigned int)(alpha * 0xffffffff);
|
opacity = (unsigned int)(alpha * 0xffffffff);
|
||||||
XChangeProperty(window->display, window->ident, opacity_atom,
|
XChangeProperty(window->display, window->ident, opacity_atom,
|
||||||
|
|
Loading…
Reference in a new issue