Author: fabien
Date: 2007-04-08 15:18:40 -0400 (Sun, 08 Apr 2007)
New Revision: 5767
Log:
Mores fixes to the mac platform
+ Fixed Rez not invoked anymore correctly since recent changes
+ Fixed compiled Mac app (with Rez) would not launch from the Desktop
because would not skip the -psn parameter (process serial number)
+ more code rewrite for offscreen osx
Modified:
branches/fctrunk/configure.in
branches/fctrunk/fltk/Offscreen.h
branches/fctrunk/fluid/WindowType.cxx
branches/fctrunk/fluid/fluid.cxx
branches/fctrunk/src/Offscreen.cxx
branches/fctrunk/src/args.cxx
Modified: branches/fctrunk/configure.in
===================================================================
--- branches/fctrunk/configure.in 2007-04-07 22:14:29 UTC (rev 5766)
+++ branches/fctrunk/configure.in 2007-04-08 19:18:40 UTC (rev 5767)
@@ -575,7 +575,7 @@
HLINKS="#"
# Add a postbuild step after linking applications
- dnl POSTBUILD="/Developer/Tools/Rez -t APPL -o"
+ POSTBUILD="/Developer/Tools/Rez -t APPL -o"
dnl Check for Cairo library unless disabled...
AC_ARG_ENABLE(cairo,[ --enable-cairo use Cairo graphics
(default=no)])
if test x$enable_cairo = xyes; then
Modified: branches/fctrunk/fltk/Offscreen.h
===================================================================
--- branches/fctrunk/fltk/Offscreen.h 2007-04-07 22:14:29 UTC (rev 5766)
+++ branches/fctrunk/fltk/Offscreen.h 2007-04-08 19:18:40 UTC (rev 5767)
@@ -44,9 +44,10 @@
private:
int num_saved_dc_; // for cleaning up our offscreen created dc
-#elif defined(__APPLE_QUARTZ__) || defined(__APPLE_QD__)
+#elif defined(__APPLE__) && USE_QUARTZ
+ typedef CGContextRef GraphicData;
+#elif defined(__APPLE__) && !USE_QUARTZ
typedef GWorldPtr GraphicData;
-
#else
typedef void * GraphicData;
#endif
Modified: branches/fctrunk/fluid/WindowType.cxx
===================================================================
--- branches/fctrunk/fluid/WindowType.cxx 2007-04-07 22:14:29 UTC (rev
5766)
+++ branches/fctrunk/fluid/WindowType.cxx 2007-04-08 19:18:40 UTC (rev
5767)
@@ -828,7 +828,9 @@
ow->image(new Image(ww,hh)); // Fl::scheme_bg_);
ow->redraw();
- fltk::flush();
+#if defined (WIN32)
+ fltk::flush(); // seems a bit harsh, should be a smoother way to force an
immediate draw
+#endif
// Read the screen image...
uchar * pixels = fltk::readimage(0, RGB, fltk::Rectangle(ww, hh));
Modified: branches/fctrunk/fluid/fluid.cxx
===================================================================
--- branches/fctrunk/fluid/fluid.cxx 2007-04-07 22:14:29 UTC (rev 5766)
+++ branches/fctrunk/fluid/fluid.cxx 2007-04-08 19:18:40 UTC (rev 5767)
@@ -1342,17 +1342,23 @@
}
}
#endif
+static int usage(int argc, char **argv) {
+ fprintf(stderr,"usage: %s <switches> name.fl\n"
+ " -c : write .cxx and .h and exit\n"
+ " -o <name> : .cxx output filename, or extension if <name> starts
with '.'\n"
+ " -h <name> : .h output filename, or extension if <name> starts with
'.'\n"
+ "%s\n", argv[0], help);
+ // indicate the arguments to the user (i.e launched from a GUI or Desktop
with args)
+ fprintf(stderr, "Bad invocation : %s ",argv[0]);
+ while (--argc>0) fprintf(stderr,"%s ",argv[argc]);
+ fprintf(stderr, ".\n");
+ return 1;
+}
int main(int argc,char **argv) {
int i = 1;
- if (!args(argc,argv,i,::arg) || i < argc-1) {
- fprintf(stderr,"usage: %s <switches> name.fl\n"
- " -c : write .cxx and .h and exit\n"
- " -o <name> : .cxx output filename, or extension if
<name> starts with '.'\n"
- " -h <name> : .h output filename, or extension if
<name> starts with '.'\n"
- "%s\n", argv[0], help);
- return 1;
- }
+ if (!args(argc,argv,i,::arg) || i < argc-1) return usage(argc, argv);
+
const char *c = argv[i];
register_images();
Modified: branches/fctrunk/src/Offscreen.cxx
===================================================================
--- branches/fctrunk/src/Offscreen.cxx 2007-04-07 22:14:29 UTC (rev 5766)
+++ branches/fctrunk/src/Offscreen.cxx 2007-04-08 19:18:40 UTC (rev 5767)
@@ -194,20 +194,18 @@
#endif
Offscreen::~Offscreen () {
- CGContextRef ctx = (CGContextRef) graphic_data_;
- if (!ctx) return;
- void *data = CGBitmapContextGetData((CGContextRef)ctx);
- CGContextRelease((CGContextRef)ctx);
+ if (!graphic_data_) return;
+ void *data = CGBitmapContextGetData(graphic_data_);
+ CGContextRelease(graphic_data_);
if (data) free(data);
}
bool Offscreen::begin() {
if (!graphic_data_) return false;
- CGContextRef src = (CGContextRef) graphic_data_;
context_save_ = new GSave(); // push matrix, clip, save context handles
- int w = CGBitmapContextGetWidth(src);
- int h = CGBitmapContextGetHeight(src);
- draw_into(src, w, h);
+ int w = CGBitmapContextGetWidth(graphic_data_);
+ int h = CGBitmapContextGetHeight(graphic_data_);
+ draw_into(graphic_data_, w, h);
return true;
}
Modified: branches/fctrunk/src/args.cxx
===================================================================
--- branches/fctrunk/src/args.cxx 2007-04-07 22:14:29 UTC (rev 5766)
+++ branches/fctrunk/src/args.cxx 2007-04-08 19:18:40 UTC (rev 5767)
@@ -129,8 +129,13 @@
fl_bg_switch = color(v);
if (!fl_bg_switch) error("Unknown color \"%s\"", v);
- } else return 0; // unrecognized
-
+ } else if (strncmp(s, "psn",3)==0) {
+ // skipthe process serial number passed from Mac Os XDesktop
+ } else {
+ fprintf(stderr, "Unrecognized parameter <%s> \n",s);
+ return 0; // unrecognized
+
+ }
i += 2;
return 2;
}
@@ -181,6 +186,10 @@
arg_called = true;
i = 1; // skip argv[0]
while (i < argc) {
+ if (strncmp(argv[i], "-psn",4)==0) {
+ // skip the process serial number passed from Mac Os XDesktop
+ i++; continue;
+ }
if (cb && cb(argc,argv,i)) continue;
if (!arg(argc,argv,i)) {if (!return_i) i = 0; break;}
}
@@ -274,7 +283,9 @@
and if any are not recognized it calls fltk::fatal(fltk::help).
*/
void fltk::args(int argc, char **argv) {
- int i; if (args(argc,argv,i) < argc) error(helpmsg);
+ int i;
+ if (args(argc,argv,i) < argc)
+ error(helpmsg);
}
#if !USE_X11
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit