You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

798 lines
24KB

  1. /**
  2. \page osissues Operating System Issues
  3. This appendix describes the operating system specific interfaces in FLTK:
  4. \li \ref osissues_accessing
  5. \li \ref osissues_unix
  6. \li \ref osissues_win32
  7. \li \ref osissues_macos
  8. \section osissues_accessing Accessing the OS Interfaces
  9. All programs that need to access the operating system
  10. specific interfaces must include the following header file:
  11. \code
  12. #include <FL/x.H>
  13. \endcode
  14. Despite the name, this header file will define the
  15. appropriate interface for your environment. The pages that
  16. follow describe the functionality that is provided for each
  17. operating system.
  18. <CENTER>
  19. <TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0" BGCOLOR="#cccccc">
  20. <TR>
  21. <TD><B>WARNING:</B>
  22. The interfaces provided by this header file may
  23. change radically in new FLTK releases. Use them only
  24. when an existing generic FLTK interface is not
  25. sufficient.
  26. </TD>
  27. </TR>
  28. </TABLE>
  29. </CENTER>
  30. \section osissues_unix The UNIX (X11) Interface
  31. The UNIX interface provides access to the X Window System
  32. state information and data structures.
  33. \subsection osissues_x_events Handling Other X Events
  34. void Fl::add_handler(int (*f)(int))
  35. \par
  36. Installs a function to parse unrecognized events. If FLTK
  37. cannot figure out what to do with an event, it calls each of
  38. these functions (most recent first) until one of them returns
  39. non-zero. If none of them returns non-zero then the event is
  40. ignored.
  41. \par
  42. FLTK calls this for any X events it does not recognize, or X
  43. events with a window ID that FLTK does not recognize. You can
  44. look at the X event in the \c fl_xevent variable.
  45. \par
  46. The argument is the FLTK event type that was not handled, or
  47. zero for unrecognized X events. These handlers are also called
  48. for global shortcuts and some other events that the widget they
  49. were passed to did not handle, for example
  50. \c FL_SHORTCUT.
  51. extern XEvent *fl_xevent
  52. \par
  53. This variable contains the most recent X event.
  54. extern ulong fl_event_time
  55. \par
  56. This variable contains the time stamp from the most recent X
  57. event that reported it; not all events do. Many X calls like cut
  58. and paste need this value.
  59. Window fl_xid(const Fl_Window *)
  60. \par
  61. Returns the XID for a window, or zero if not \c shown().
  62. Fl_Window *fl_find(ulong xid)
  63. \par
  64. Returns the Fl_Window that corresponds to the given
  65. XID, or \c NULL if not found. This function uses a cache
  66. so it is slightly faster than iterating through the windows
  67. yourself.
  68. int fl_handle(const XEvent &)
  69. \par
  70. This call allows you to supply the X events to FLTK, which
  71. may allow FLTK to cooperate with another toolkit or library. The
  72. return value is non-zero if FLTK understood the event. If the
  73. window does not belong to FLTK and the \c add_handler()
  74. functions all return 0, this function will return false.
  75. \par
  76. Besides feeding events your code should call Fl::flush()
  77. periodically so that FLTK redraws its windows.
  78. \par
  79. This function will call the callback functions. It will not
  80. return until they complete. In particular, if a callback pops up
  81. a modal window by calling
  82. fl_ask(),
  83. for instance, it will not return until the modal function
  84. returns.
  85. \subsection osissues_drawing_xlib Drawing using Xlib
  86. The following global variables are set before
  87. Fl_Widget::draw() is called, or by Fl_Window::make_current():
  88. \code
  89. extern Display *fl_display;
  90. extern Window fl_window;
  91. extern GC fl_gc;
  92. extern int fl_screen;
  93. extern XVisualInfo *fl_visual;
  94. extern Colormap fl_colormap;
  95. \endcode
  96. You must use them to produce Xlib calls. Don't attempt to change
  97. them. A typical X drawing call is written like this:
  98. \code
  99. XDrawSomething(fl_display, fl_window, fl_gc, ...);
  100. \endcode
  101. Other information such as the position or size of the X
  102. window can be found by looking at Fl_Window::current(),
  103. which returns a pointer to the Fl_Window being drawn.
  104. unsigned long fl_xpixel(Fl_Color i) <br>
  105. unsigned long fl_xpixel(uchar r, uchar g, uchar b)
  106. \par
  107. Returns the X pixel number used to draw the given FLTK color
  108. index or RGB color. This is the X pixel that
  109. \ref drawing_colors "fl_color()"
  110. would use.
  111. int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
  112. \par
  113. Convert a name into the red, green, and blue values of a color
  114. by parsing the X11 color names. On other systems, \c fl_parse_color()
  115. can only convert names in hexadecimal encoding, for example <tt>\#ff8083</tt>.
  116. extern XFontStruct *fl_xfont
  117. \par
  118. Points to the font selected by the most recent
  119. \ref ssect_Fonts "fl_font()".
  120. This is not necessarily the current font of \c fl_gc,
  121. which is not set until
  122. \ref ssect_Text "fl_draw()"
  123. is called. If FLTK was compiled with Xft support, \c fl_xfont
  124. will usually be 0 and \c fl_xftfont will contain a pointer
  125. to the \c XftFont structure instead.
  126. extern void *fl_xftfont
  127. \par
  128. If FLTK was compiled with Xft support enabled, \c fl_xftfont
  129. points to the xft font selected by the most recent
  130. \ref ssect_Fonts "fl_font()".
  131. Otherwise it will be 0. \c fl_xftfont should be cast to
  132. <tt>XftFont*</tt>.
  133. \subsection osissues_xvisual Changing the Display, Screen, or X Visual
  134. FLTK uses only a single display, screen, X visual, and X
  135. colormap. This greatly simplifies its internal structure and
  136. makes it much smaller and faster. You can change which it uses
  137. by setting global variables
  138. <I>
  139. before the first Fl_Window::show() is called.
  140. </I>
  141. You may also want to call Fl::visual(), which is a portable interface
  142. to get a full color and/or double buffered visual.
  143. int Fl::display(const char *)
  144. \par
  145. Set which X display to use. This actually does
  146. <tt>putenv("DISPLAY=...")</tt> so that child programs
  147. will display on the same screen if called with \c exec().
  148. This must be done before the display is opened. This call is
  149. provided under MacOS and WIN32 but it has no effect.
  150. extern Display *fl_display
  151. \par
  152. The open X display. This is needed as an argument to most
  153. Xlib calls. Don't attempt to change it! This is \c NULL
  154. before the display is opened.
  155. void fl_open_display()
  156. \par
  157. Opens the display. Does nothing if it is already open. This
  158. will make sure \c fl_display is non-zero. You should call
  159. this if you wish to do X calls and there is a chance that your
  160. code will be called before the first \c show() of a window.
  161. \par
  162. This may call Fl::abort() if there is an error opening the display.
  163. void fl_close_display()
  164. \par
  165. This closes the X connection. You do \e not need to call
  166. this to exit, and in fact it is faster to not do so! It may be
  167. useful to call this if you want your program to continue without
  168. the X connection. You cannot open the display again, and
  169. probably cannot call any FLTK functions.
  170. extern int fl_screen
  171. \par
  172. Which screen number to use. This is set by
  173. \c fl_open_display() to the default screen. You can change
  174. it by setting this to a different value immediately afterwards.
  175. It can also be set by changing the last number in the
  176. Fl::display() string to "host:0.#".
  177. extern XVisualInfo *fl_visual <br>
  178. extern Colormap fl_colormap
  179. \par
  180. The visual and colormap that FLTK will use for all windows.
  181. These are set by \c fl_open_display() to the default
  182. visual and colormap. You can change them before calling
  183. \c show() on the first window. Typical code for changing
  184. the default visual is:
  185. \code
  186. Fl::args(argc, argv); // do this first so $DISPLAY is set
  187. fl_open_display();
  188. fl_visual = find_a_good_visual(fl_display, fl_screen);
  189. if (!fl_visual) Fl::abort("No good visual");
  190. fl_colormap = make_a_colormap(fl_display, fl_visual->visual, fl_visual->depth);
  191. // it is now ok to show() windows:
  192. window->show(argc, argv);
  193. \endcode
  194. \subsection osissues_specialx Using a Subclass of Fl_Window for Special X Stuff
  195. FLTK can manage an X window on a different screen, visual
  196. and/or colormap, you just can't use FLTK's drawing routines to
  197. draw into it. But you can write your own \c draw() method
  198. that uses Xlib (and/or OpenGL) calls only.
  199. FLTK can also manage XID's provided by other libraries or
  200. programs, and call those libraries when the window needs to be
  201. redrawn.
  202. To do this, you need to make a subclass of
  203. Fl_Window
  204. and override some of these virtual functions:
  205. virtual void Fl_Window::show()
  206. \par
  207. If the window is already \c shown() this must cause it
  208. to be raised, this can usually be done by calling Fl_Window::show().
  209. If not \c shown() your implementation must call either
  210. Fl_X::set_xid() or Fl_X::make_xid().
  211. \par
  212. An example:
  213. \code
  214. void MyWindow::show() {
  215. if (shown()) {Fl_Window::show(); return;} // you must do this!
  216. fl_open_display(); // necessary if this is first window
  217. // we only calculate the necessary visual colormap once:
  218. static XVisualInfo *visual;
  219. static Colormap colormap;
  220. if (!visual) {
  221. visual = figure_out_visual();
  222. colormap = XCreateColormap(fl_display, RootWindow(fl_display,fl_screen),
  223. vis->visual, AllocNone);
  224. }
  225. Fl_X::make_xid(this, visual, colormap);
  226. }
  227. \endcode
  228. \verbatim
  229. Fl_X *Fl_X::set_xid(Fl_Window*, Window xid)
  230. \endverbatim
  231. \par
  232. Allocate a hidden class called an Fl_X, put the
  233. XID into it, and set a pointer to it from the Fl_Window.
  234. This causes Fl_Window::shown() to return true.
  235. void Fl_X::make_xid(Fl_Window*, XVisualInfo* = fl_visual, Colormap = fl_colormap)
  236. \par
  237. This static method does the most onerous parts of creating an
  238. X window, including setting the label, resize limitations, etc.
  239. It then does Fl_X::set_xid() with this new window and maps the window.
  240. virtual void Fl_Window::flush()
  241. \par
  242. This virtual function is called by Fl::flush() to
  243. update the window. For FLTK's own windows it does this by
  244. setting the global variables \c fl_window and \c fl_gc
  245. and then calling the \c draw() method. For
  246. your own windows you might just want to put all the drawing code
  247. in here.
  248. \par
  249. The X region that is a combination of all \c damage()
  250. calls done so far is in <tt>Fl_X::i(this)->region</tt>. If
  251. \c NULL then you should redraw the entire window. The
  252. undocumented function \c fl_clip_region(XRegion) will
  253. initialize the FLTK clip stack with a region or \c NULL
  254. for no clipping. You must set region to \c NULL afterwards
  255. as \c fl_clip_region() will own and delete it when
  256. done.
  257. \par
  258. If <tt>damage() & FL_DAMAGE_EXPOSE</tt> then only X
  259. expose events have happened. This may be useful if you have an
  260. undamaged image (such as a backing buffer) around.
  261. \par
  262. Here is a sample where an undamaged image is kept somewhere:
  263. \code
  264. void MyWindow::flush() {
  265. fl_clip_region(Fl_X::i(this)->region);
  266. Fl_X::i(this)->region = 0;
  267. if (damage() != 2) {... draw things into backing store ...}
  268. ... copy backing store to window ...
  269. }
  270. \endcode
  271. virtual void Fl_Window::hide()
  272. \par
  273. Destroy the window server copy of the window. Usually you
  274. will destroy contexts, pixmaps, or other resources used by the
  275. window, and then call Fl_Window::hide() to get rid of
  276. the main window identified by \c xid(). If you override
  277. this, you must also override the destructor as shown:
  278. \code
  279. void MyWindow::hide() {
  280. if (mypixmap) {
  281. XFreePixmap(fl_display,mypixmap);
  282. mypixmap = 0;
  283. }
  284. Fl_Window::hide(); // you must call this
  285. }
  286. \endcode
  287. virtual void Fl_Window::~Fl_Window()
  288. \par
  289. Because of the way C++ works, if you override \c hide()
  290. you \e must override the destructor as well (otherwise only
  291. the base class \c hide() is called):
  292. \code
  293. MyWindow::~MyWindow() {
  294. hide();
  295. }
  296. \endcode
  297. \note Access to the Fl_X hidden class requires to \#define FL_INTERNALS
  298. before compilation.
  299. \subsection osissues_x_icon Setting the Icon of a Window
  300. FLTK currently supports setting a window's icon \b before it
  301. is shown using the Fl_Window::icon() method.
  302. void Fl_Window::icon(const void *)
  303. \par
  304. Sets the icon for the window to the passed pointer. You will
  305. need to cast the icon \c Pixmap to a \c char* when
  306. calling this method. To set a monochrome icon using a bitmap compiled
  307. with your application use:
  308. \code
  309. #include "icon.xbm"
  310. fl_open_display(); // needed if display has not been previously opened
  311. Pixmap p = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
  312. icon_bits, icon_width, icon_height);
  313. window->icon((const void*)p);
  314. \endcode
  315. \par
  316. To use a multi-colored icon, the XPM format and library
  317. should be used as follows:
  318. \code
  319. #include <X11/xpm.h>
  320. #include "icon.xpm"
  321. fl_open_display(); // needed if display has not been previously opened
  322. Pixmap p, mask;
  323. XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display),
  324. icon_xpm, &p, &mask, NULL);
  325. window->icon((const void *)p);
  326. \endcode
  327. \par
  328. When using the Xpm library, be sure to include it in the list
  329. of libraries that are used to link the application (usually "-lXpm").
  330. <CENTER>
  331. <TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0" BGCOLOR="#cccccc">
  332. <TR>
  333. <TD><B>NOTE:</B>
  334. You must call Fl_Window::show(int argc, char** argv)
  335. for the icon to be used. The Fl_Window::show() method
  336. does not bind the icon to the window.
  337. </TD>
  338. </TR>
  339. </TABLE>
  340. </CENTER>
  341. \subsection osissues_xresources X Resources
  342. When the
  343. Fl_Window::show(int argc, char** argv)
  344. method is called, FLTK looks for the following X resources:
  345. \li \c background - The default background color
  346. for widgets (color).
  347. \li \c dndTextOps - The default setting for
  348. drag and drop text operations (boolean).
  349. \li \c foreground - The default foreground (label)
  350. color for widgets (color).
  351. \li \c scheme - The default scheme to use (string).
  352. \li \c selectBackground - The default selection
  353. color for menus, etc. (color).
  354. \li <tt>Text.background</tt> - The default background
  355. color for text fields (color).
  356. \li \c tooltips - The default setting for
  357. tooltips (boolean).
  358. \li \c visibleFocus - The default setting for
  359. visible keyboard focus on non-text widgets (boolean).
  360. Resources associated with the first window's Fl_Window::xclass()
  361. string are queried first, or if no class has been specified then
  362. the class "fltk" is used (e.g. <tt>fltk.background</tt>). If no
  363. match is found, a global search is done (e.g.
  364. <tt>*background</tt>).
  365. \section osissues_win32 The Windows (WIN32) Interface
  366. The Windows interface provides access to the WIN32 GDI
  367. state information and data structures.
  368. \subsection osissues_win32_messages Handling Other WIN32 Messages
  369. By default a single WNDCLASSEX called "FLTK" is
  370. created. All Fl_Window 's are of this class unless you
  371. use Fl_Window::xclass(). The window class is created
  372. the first time Fl_Window::show() is called.
  373. You can probably combine FLTK with other libraries that make
  374. their own WIN32 window classes. The easiest way is to call
  375. Fl::wait(), as it will call \c DispatchMessage()
  376. for all messages to the other windows. If necessary you can let
  377. the other library take over as long as it calls
  378. \c DispatchMessage(), but you will have to arrange for the
  379. function Fl::flush() to be called regularly so that
  380. widgets are updated, timeouts are handled, and the idle
  381. functions are called.
  382. extern MSG fl_msg
  383. \par
  384. This variable contains the most recent message read by
  385. \c GetMessage(), which is called by Fl::wait().
  386. This may not be the
  387. most recent message sent to an FLTK window, because silly WIN32
  388. calls the handle procedures directly for some events (sigh).
  389. void Fl::add_handler(int (*f)(int))
  390. \par
  391. Installs a function to parse unrecognized messages sent to
  392. FLTK windows. If FLTK cannot figure out what to do with a
  393. message, it calls each of these functions (most recent first)
  394. until one of them returns non-zero. The argument passed to the
  395. functions is the FLTK event that was not handled or zero for
  396. unknown messages. If all the handlers return zero then FLTK
  397. calls \c DefWindowProc().
  398. HWND fl_xid(const Fl_Window *)
  399. \par
  400. Returns the window handle for a Fl_Window, or zero
  401. if not \c shown().
  402. Fl_Window *fl_find(HWND xid)
  403. \par
  404. Returns the Fl_Window that corresponds to the given
  405. window handle, or \c NULL if not found. This function uses
  406. a cache so it is slightly faster than iterating through the
  407. windows yourself.
  408. \subsection osissues_win32_gdi Drawing Things Using the WIN32 GDI
  409. When the virtual function Fl_Widget::draw() is
  410. called, FLTK stores all the extra arguments you need to
  411. make a proper GDI call in some global variables:
  412. \code
  413. extern HINSTANCE fl_display;
  414. extern HWND fl_window;
  415. extern HDC fl_gc;
  416. COLORREF fl_RGB();
  417. HPEN fl_pen();
  418. HBRUSH fl_brush();
  419. \endcode
  420. These global variables are set before Fl_Widget::draw() is called, or by
  421. Fl_Window::make_current().
  422. You can refer to them when needed to produce GDI calls, but don't
  423. attempt to change them. The functions return GDI objects for
  424. the current color set by
  425. \ref drawing_colors "fl_color()"
  426. and are created as
  427. needed and cached. A typical GDI drawing call is written like
  428. this:
  429. \code
  430. DrawSomething(fl_gc, ..., fl_brush());
  431. \endcode
  432. It may also be useful to refer to Fl_Window::current()
  433. to get the window's size or position.
  434. \subsection osissues_icon_windows Setting the Icon of a Window
  435. FLTK currently supports setting a window's icon *before* it
  436. is shown using the Fl_Window::icon() method.
  437. void Fl_Window::icon(const void *)
  438. \par
  439. Sets the icon for the window to the passed pointer. You will
  440. need to cast the \c HICON handle to a \c char* when
  441. calling this method. To set the icon using an icon resource
  442. compiled with your application use:
  443. \code
  444. window->icon((const void *)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON)));
  445. \endcode
  446. \par
  447. You can also use the \c LoadImage() and related
  448. functions to load specific resolutions or create the icon from
  449. bitmap data.
  450. <CENTER>
  451. <TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0" BGCOLOR="#cccccc">
  452. <TR>
  453. <TD><B>NOTE:</B>
  454. You must call Fl_Window::show(int argc, char** argv)
  455. for the icon to be used. The Fl_Window::show() method
  456. does not bind the icon to the window.
  457. </TD>
  458. </TR>
  459. </TABLE>
  460. </CENTER>
  461. \subsection osissues_msdos_console How to Not Get a MSDOS Console Window
  462. WIN32 has a really stupid mode switch stored in the
  463. executables that controls whether or not to make a console
  464. window.
  465. To always get a console window you simply create a console
  466. application (the "/SUBSYSTEM:CONSOLE" option for the
  467. linker). For a GUI-only application create a WIN32 application
  468. (the "/SUBSYSTEM:WINDOWS" option for the linker).
  469. FLTK includes a \c WinMain() function that calls the
  470. ANSI standard \c main() entry point for you.
  471. <I>
  472. This function creates a console window when you use the debug
  473. version of the library.
  474. </I>
  475. WIN32 applications without a console cannot write to
  476. \c stdout or \c stderr, even if they are run from a
  477. console window. Any output is silently thrown away.
  478. Additionally, WIN32 applications are run in the background by
  479. the console, although you can use "start /wait program" to run
  480. them in the foreground.
  481. \subsection osissues_win32_problems Known WIN32 Bugs and Problems
  482. The following is a list of known bugs and problems in the WIN32
  483. version of FLTK:
  484. \li If a program is deactivated, <tt>Fl::wait()</tt>
  485. does not return until it is activated again, even though
  486. many events are delivered to the program. This can cause
  487. idle background processes to stop unexpectedly. This
  488. also happens while the user is dragging or resizing
  489. windows or otherwise holding the mouse down. We were
  490. forced to remove most of the efficiency FLTK uses for
  491. redrawing in order to get windows to update while being
  492. moved. This is a design error in WIN32 and probably
  493. impossible to get around.
  494. \li <tt>Fl_Gl_Window::can_do_overlay()</tt> returns true
  495. until the first time it attempts to draw an overlay, and
  496. then correctly returns whether or not there is overlay
  497. hardware.
  498. \li <tt>SetCapture</tt> (used by <tt>Fl::grab()</tt>)
  499. doesn't work, and the main window title bar turns gray
  500. while menus are popped up.
  501. \li Compilation with <tt>gcc 3.4.4</tt> and <tt>-Os</tt> exposes an
  502. optimisation bug in gcc. The symptom is that when drawing
  503. filled circles only the perimeter is drawn. This can for instance
  504. be seen in the symbols demo. Other optimisation options such
  505. as -O2 and -O3 seem to work OK. More details can be found
  506. in STR#1656
  507. \section osissues_macos The Apple OS X Interface
  508. FLTK supports Apple OS X using the Apple Cocoa library. Older
  509. versions of MacOS are no longer supported.
  510. Control, Option, and Command Modifier Keys
  511. \par
  512. FLTK maps the Mac 'control' key to \c FL_CTRL, the
  513. 'option' key to \c FL_ALT and the 'Apple' key to
  514. \c FL_META. Furthermore, \c FL_COMMAND designates the 'Apple' key on Mac OS X
  515. and the 'control' key on other platforms.
  516. Keyboard events return the key name in
  517. Fl::event_key() and the keystroke translation in
  518. Fl::event_text(). For example, typing Option-Y on a Mac
  519. US keyboard will set \c FL_ALT in Fl::event_state(),
  520. set Fl::event_key() to 'y' and return the Yen symbol in
  521. Fl::event_text().
  522. Apple "Quit" Event
  523. \par
  524. When the user presses Cmd-Q or requests a termination of the
  525. application, OS X will send a "Quit" Apple Event. FLTK handles
  526. this event by sending an \c FL_CLOSE event to all open
  527. windows. If all windows close, the application will terminate.
  528. Apple "Open" Event
  529. \par
  530. Whenever the user drops a file onto an application icon, OS X
  531. generates an Apple Event of the type "Open". You can have FLTK
  532. notify you of an Open event by calling the \ref fl_open_callback
  533. function.
  534. void fl_open_display()
  535. \par
  536. Opens the display. Does nothing if it is already open. You should call
  537. this if you wish to do Cocoa or Quartz calls and there is a chance that your
  538. code will be called before the first \c show() of a window.
  539. Window fl_xid(const Fl_Window *)
  540. \par
  541. Returns the window reference for an Fl_Window, or
  542. \c NULL if the window has not been shown. This reference is a pointer
  543. to an instance of the subclass FLWindow of Cocoa's NSWindow class.
  544. Fl_Window *fl_find(Window xid)
  545. \par
  546. Returns the Fl_Window that corresponds to the given window reference,
  547. or \c NULL if not found. FLTK windows that are children of top-level
  548. windows share the \c Window of the top-level window.
  549. void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut)
  550. \par
  551. Attaches the callback \c cb to the "About myprog" item of the system application menu.
  552. \c cb will be called with NULL first argument and \c user_data second argument.
  553. Fl_Mac_App_Menu class
  554. \par
  555. The Fl_Mac_App_Menu class allows to localize the application menu.
  556. Fl_Sys_Menu_Bar class
  557. \par
  558. The Fl_Sys_Menu_Bar class allows to build menu bars that, on Mac OS X, are
  559. placed in the system menu bar (at top-left of display), and, on other platforms,
  560. at a user-chosen location of a user-chosen window.
  561. \subsection osissues_quartz Drawing Things Using Quartz
  562. All code inside Fl_Widget::draw()
  563. is expected to call Quartz drawing functions. The Quartz coordinate system
  564. is flipped to match
  565. FLTK's coordinate system. The origin for all drawing is in the top
  566. left corner of the enclosing Fl_Window. The global variable
  567. \c fl_gc is the appropriate Quartz 2D drawing environment.
  568. Include FL/x.H to declare the \c fl_gc variable.
  569. Fl_Double_Window
  570. OS X double-buffers all windows automatically. On OS X,
  571. Fl_Window and Fl_Double_Window are handled
  572. internally in the same way.
  573. \subsection osissues_mac_files Mac File System Specifics
  574. \par Resource Forks
  575. FLTK does not access the resource fork of an application.
  576. However, a minimal resource fork must be created for OS X
  577. applications. Starting with OS X 10.6, resource forks are
  578. no longer needed.
  579. <CENTER>
  580. <TABLE WIDTH="80%" BORDER="1" BGCOLOR="#cccccc" CELLPADDING="5">
  581. <TR><TD><B>Caution (OS X 10.2 and older):</B>
  582. When using UNIX commands to copy or move executables, OS X
  583. will NOT copy any resource forks! For copying and moving use
  584. CpMac and MvMac respectively. For creating a tar archive, all
  585. executables need to be stripped from their Resource Fork before
  586. packing, e.g. "DeRez fluid > fluid.r". After unpacking the
  587. Resource Fork needs to be reattached, e.g. "Rez fluid.r -o
  588. fluid".
  589. </TD></TR></TABLE>
  590. </CENTER>
  591. It is advisable to use the Finder for moving and copying and
  592. Mac archiving tools like Sit for distribution as they will
  593. handle the Resource Fork correctly.
  594. \par Mac File Paths
  595. FLTK uses UTF-8-encoded UNIX-style filenames and paths.
  596. \sa group_macosx
  597. \htmlonly
  598. <hr>
  599. <table summary="navigation bar" width="100%" border="0">
  600. <tr>
  601. <td width="45%" align="LEFT">
  602. <a class="el" href="forms.html">
  603. [Prev]
  604. Forms Compatibility
  605. </a>
  606. </td>
  607. <td width="10%" align="CENTER">
  608. <a class="el" href="index.html">[Index]</a>
  609. </td>
  610. <td width="45%" align="RIGHT">
  611. <a class="el" href="migration_1_1.html">
  612. Migrating Code from FLTK 1.0 to 1.1
  613. [Next]
  614. </a>
  615. </td>
  616. </tr>
  617. </table>
  618. \endhtmlonly
  619. */