Home » Developing U++ » Mac OS » MacOS X woes
|
|
|
|
|
|
Re: MacOS X woes [message #7375 is a reply to message #7368] |
Sun, 24 December 2006 01:58 |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
Great. Do I need to send you that file?
Also, possible bug, on my colleague's machine, which don't have much of the X11 stuff, he dies in XftCharExists(), from DrawTextXftp.cpp:86.
XftFont *xftfont = XftFontOpen(Xdisplay, Xscreenno,
XFT_FAMILY, XftTypeString, (char *)face,
XFT_PIXEL_SIZE, XftTypeInteger, 20,
(void *)0);
int n = 0;
for(int c = 0; c < 128; c++)
if(!XftCharExists(Xdisplay, xftfont, c + 256))
n++;
So I added:
XftFont *xftfont = XftFontOpen(Xdisplay, Xscreenno,
XFT_FAMILY, XftTypeString, (char *)face,
XFT_PIXEL_SIZE, XftTypeInteger, 20,
(void *)0);
if (!xftfont) return 0;
int n = 0;
Which stops it from coring and gets further in.
Lund
|
|
|
|
Re: MacOS X woes [message #7382 is a reply to message #7381] |
Tue, 26 December 2006 08:58 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
lundman wrote on Tue, 26 December 2006 01:20 |
After fixing that Xft issue, it actually starts the application, but dies in Acquire() later on, so I guess his Xft is returning many non-standard things (he seems to have no X11 fonts).
f->xftfont = CreateXftFont(font, angle);
f->filename = NULL;
f->ascent = (int16)f->xftfont->ascent;
f->descent = (int16)f->xftfont->descent;
Which happens because CreateXftFont() returns NULL. But I am unsure how to fix this, or if we would just consider it "too broken" not to have fonts?
|
Yes, too broken. I would not waste the time with this; the final Mac solution should use Carbon anyway, I consider this effort as an intermediate step (but very important, because we have actually fixed all CPU incompatibility bugs in this productive session).
Mirek
|
|
|
|
|
|
|
Re: MacOS X woes [message #7427 is a reply to message #7406] |
Fri, 29 December 2006 05:41 |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
While looking into your "No 1" task, I discovered PackageOrganiser/Add/Remove-Flags.. siigghh.. all my complaining about no link-options Anyway, it would be nice if the "WHEN" could also sense the BuildEnvironment-name used. "GCC32" and "GCC32CARBON" or what not.
Anyway, very simple carbon app compiled in U++ as "Core console project", straight out of developer.apple.com, so no credits to me:
UPPCarbon.cpp:
#include <Carbon/Carbon.h>
#include "UPPCarbon.h"
#define kWindowTop 100
#define kWindowLeft 50
#define kWindowRight 250
#define kWindowBottom 250
const EventTypeSpec eventList[] =
{
{ kEventClassWindow, kEventWindowClose },
{ kEventClassWindow, kEventWindowActivated },
{ kEventClassWindow, kEventWindowDeactivated },
};
static pascal OSStatus MyWindowEventHandler(EventHandlerCallRef nextHandler,
EventRef theEvent,
void *userData)
{
OSStatus result = eventNotHandledErr;
WindowRef theWindow = (WindowRef) userData;
UInt32 whatHappened;
whatHappened = GetEventKind(theEvent);
switch(whatHappened) {
case kEventWindowClose:
DisposeWindow(theWindow);
QuitApplicationEventLoop();
result = noErr;
break;
case kEventWindowActivated:
::CallNextEventHandler(nextHandler, theEvent);
result = noErr;
break;
case kEventWindowDeactivated:
::CallNextEventHandler(nextHandler, theEvent);
result = noErr;
break;
}
return result;
}
void Initialize(void)
{
// Do one-time-only initialization
WindowRef theWindow;
WindowAttributes windowAttrs;
Rect contentRect;
EventHandlerUPP handlerUPP;
windowAttrs = kWindowStandardDocumentAttributes |
kWindowStandardHandlerAttribute;
SetRect(&contentRect, kWindowLeft, kWindowTop,
kWindowRight, kWindowBottom);
CreateNewWindow(kDocumentWindowClass, windowAttrs,
&contentRect, &theWindow);
SetWindowTitleWithCFString(theWindow, CFSTR("U++ Carbon Example"));
handlerUPP = NewEventHandlerUPP(MyWindowEventHandler);
InstallWindowEventHandler(theWindow, handlerUPP,
GetEventTypeCount(eventList), eventList,
theWindow, NULL);
ShowWindow(theWindow);
InitCursor();
}
void Finalize(void)
{
}
using namespace UPP;
CONSOLE_APP_MAIN
{
Initialize(); // Do one-time-only initialization
RunApplicationEventLoop(); //Process events until time to quit
Finalize(); // Do one-time-only finalization
}
Extra link flags, and post-link step added:
UPPCarbon.upp:
flags(OSX11) "-framework carbon";
uses
Core;
link(OSX11) " -framework carbon";
file
UPPCarbon.h,
UPPCarbon.cpp;
mainconfig
"" = "";
custom(OSX11) "post-link",
"mkdir -p $(OUTTITLE).App/Contents/MacOS\ncp $(OUTPATH) $(OUTTITLE).App"
"/Contents/MacOS",
"";
And yes, creating the UPPCarbon.App/Contents/MacOs/ is required for it to fully function.
Looks like:
http://netbsd.interq.or.jp/~lundman/carbon.jpg
-
Attachment: carbon.jpg
(Size: 31.89KB, Downloaded 945 times)
|
|
|
|
Re: MacOS X woes [message #7449 is a reply to message #7430] |
Sat, 30 December 2006 09:16 |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
Thanks, that was quite fun, and the apple docs are pretty good.
But yes, we need someway to be able to specify linker flags, I think you should just add link options, next to compile options in the build environment, but I guess I can also get around that with -Wl,flags but that is very noisy.
Also, the ide leaves a lot of zombies around when compiling, are you calling wait(3) properly on the children?
Lund
|
|
|
|
|
Re: MacOS X woes [message #9098 is a reply to message #7375] |
Tue, 17 April 2007 10:11 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
lundman wrote on Sat, 23 December 2006 19:58 | Great. Do I need to send you that file?
Also, possible bug, on my colleague's machine, which don't have much of the X11 stuff, he dies in XftCharExists(), from DrawTextXftp.cpp:86.
|
BTW, as I was stucked a day or two at the same trouble, the one thing that heals this issue is:
sudo fc-cache
After that, TheIDE finally starts again...
Mirek
|
|
|
Goto Forum:
Current Time: Fri Apr 26 11:03:15 CEST 2024
Total time taken to generate the page: 0.05808 seconds
|