From 6e9a1630357a21c6ef6357cdde324ae89a565826 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 8 Feb 2007 23:04:20 +0000 Subject: Add handler for thread messages (STR #1536) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5683 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/Fl.html | 17 ++++++++--------- documentation/advanced.html | 38 ++++++++++++-------------------------- documentation/common.html | 4 ++-- documentation/drawing.html | 2 +- documentation/examples.html | 2 +- documentation/fltk.book | 6 ++++-- documentation/intro.html | 4 ++-- documentation/osissues.html | 2 +- 8 files changed, 31 insertions(+), 44 deletions(-) (limited to 'documentation') diff --git a/documentation/Fl.html b/documentation/Fl.html index 281ef7b8a..24d5be118 100644 --- a/documentation/Fl.html +++ b/documentation/Fl.html @@ -126,6 +126,7 @@ state information and global methods for the current application.

  • selection_owner
  • set_abort
  • set_atclose
  • +
  • set_awake_cb
  • set_boxtype
  • set_color
  • set_font
  • @@ -390,17 +391,11 @@ argument on the command-line. You can change the message by setting the

    void awake(void *p);

    -

    The awake() method sends a message pointer to the -main thread, causing any pending wait() call to -terminate so that the main thread can retrieve the message and -any pending redraws can be processed. +

    The awake() method sends a message pointer to the main thread, causing any pending Fl::wait() call to terminate so that the main thread can retrieve the message and any pending redraws can be processed. -

    Multiple calls to awake() will overwrite the same -message pointer. -thread_message() only returns -the last message stored by the last awake() call. +

    Multiple calls to Fl::awake() will queue multiple pointers for the main thread to process, up to a system-defined (typically several thousand) depth. The default message handler saves the last message which can be accessed using the Fl::thread_message() function. Use the Fl::set_awake_cb() function to register your own thread message handler that is called for every message received by the main thread. -

    See also: multithreading +

    See also: multithreading.

    void background2(uchar, uchar, uchar);

    @@ -1174,6 +1169,10 @@ of this.

    void set_atclose(void (*f)(Fl_Window*,void*));

    +

    void set_awake_cb(void (*cb)(void*));

    + +

    Sets a function to handle thread messages sent via the Fl::awake() function.

    +

    void set_boxtype(Fl_Boxtype, Fl_Box_Draw_F*,uchar,uchar,uchar,uchar);
    void set_boxtype(Fl_Boxtype, Fl_Boxtype from);

    diff --git a/documentation/advanced.html b/documentation/advanced.html index 52c3009b6..51ea1895b 100644 --- a/documentation/advanced.html +++ b/documentation/advanced.html @@ -9,24 +9,13 @@

    This chapter explains advanced programming and design topics that will help you to get the most out of FLTK.

    -

    10.1 Multithreading

    +

    Multithreading

    -

    FLTK supports multithreaded application using a locking mechanism -based on "pthreads". We do not provide a threading interface -as part of the library. However a simple example how threads can -be implemented for all supported platforms can be found in -test/threads.h and test/threads.cxx. +

    FLTK supports multithreaded application using a locking mechanism based on "pthreads". We do not provide a threading interface as part of the library. However a simple example how threads can be implemented for all supported platforms can be found in test/threads.h and test/threads.cxx. -

    To use the locking mechanism, the command line version of FLTK -must be compiled with --enable-threads set during the -configure process. IDE-based versions of FLTK are -automatically compiled with locking enabled if possible. +

    To use the locking mechanism, FLTK must be compiled with --enable-threads set during the configure process. IDE-based versions of FLTK are automatically compiled with locking enabled if possible. -

    In main(), before calling Fl::run(), call -Fl::lock(). This will startup the runtime multithreading -support for your program. All callbacks and derived functions -like handle() and draw() will now be properly -locked. +

    In main(), call Fl::lock() before Fl::run() to start the runtime multithreading support for your program. All callbacks and derived functions like handle() and draw() will now be properly locked.

       main() {
    @@ -56,34 +45,31 @@ in the following code:
     

    FLTK supports multiple platforms, some of them which do not allow any other but the main thread to handle system events and open or close windows. The safe thing to do is to adhere to the -following rulesi for threads on all operating systems. +following rules for threads on all operating systems:

      -
    • don't show() or hide()anything that contains +
    • Don't show() or hide()anything that contains widgets derived from Fl_Window, including dialogs, file choosers, subwindows or Fl_GL_Windows
    • -
    • don't call Fl::wait(), Fl::flush() or any +
    • Don't call Fl::wait(), Fl::flush() or any related methods that will handle system messages
    • -
    • don't start or cancel timers
    • +
    • Don't start or cancel timers
    • -
    • don't change window decorations or titles
    • +
    • Don't change window decorations or titles
    • -
    • make_current() may or may not work well for regular -windows, but should always work for Fl_GL_Windows to -allow for high speed rendering on graphics cards with multiple -pipelines
    • +
    • The make_current() method may or may not work well for regular windows, but should always work for Fl_GL_Windows to allow for high speed rendering on graphics cards with multiple pipelines

    See also: +void awake(void *message), void lock(), void unlock(), -void awake(void *message), +void set_awake_cb(void (*cb)(void *), void *thread_message(). - diff --git a/documentation/common.html b/documentation/common.html index a759bd5ff..75a95092b 100644 --- a/documentation/common.html +++ b/documentation/common.html @@ -533,7 +533,7 @@ around the origin. This function is then linked into the symbols table using fl_add_symbol:

    name is the name of the symbol without the "@"; scalable @@ -541,7 +541,7 @@ must be set to 1 if the symbol is generated using scalable vector drawing functions.

    This function draw a named symbol fitting the given rectangle. diff --git a/documentation/drawing.html b/documentation/drawing.html index de68225e5..f734ce34a 100644 --- a/documentation/drawing.html +++ b/documentation/drawing.html @@ -229,7 +229,7 @@ widths. Full functionality is not available under Windows 95, 98, and Me due to the reduced drawing functionality these operating systems provide. -

    void fl_line_style(int style, int width=0, char* dashes=0)

    +

    void fl_line_style(int style, int width=0, char* dashes=0)

    Set how to draw lines (the "pen"). If you change this it is your responsibility to set it back to the default with diff --git a/documentation/examples.html b/documentation/examples.html index bed27925d..53101d396 100644 --- a/documentation/examples.html +++ b/documentation/examples.html @@ -4,7 +4,7 @@ -

    I - Tests and Demo Source Code

    +

    I - Tests and Demo Source Code

    March 19, 2005

    diff --git a/documentation/fltk.book b/documentation/fltk.book index 68c5a0226..acd4fcc0c 100644 --- a/documentation/fltk.book +++ b/documentation/fltk.book @@ -1,5 +1,5 @@ -#HTMLDOC 1.8.20 --t pdf13 -f fltk.pdf --book --toclevels 2 --no-numbered --toctitle "Table of Contents" --title --titleimage FL.gif --linkstyle underline --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --footer h.1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=50 --no-embedfonts --fontsize 11.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 11.0 --headfootfont Helvetica --charset 8859-1 --links --no-truetype --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 +#HTMLDOC 1.8.27.1 +-t pdf13 -f "fltk.pdf" --book --toclevels 2 --no-numbered --toctitle "Table of Contents" --title --titleimage "FL.gif" --linkstyle underline --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --header1 ... --footer h.1 --nup 1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=50 --fontsize 11.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 11.0 --headfootfont Helvetica --charset iso-8859-1 --links --no-embedfonts --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 --strict --no-overflow preface.html intro.html basics.html @@ -11,6 +11,7 @@ subclassing.html opengl.html fluid.html widgets.html +advanced.html Fl.html Fl_Adjuster.html Fl_Bitmap.html @@ -75,6 +76,7 @@ Fl_Scroll.html Fl_Scrollbar.html Fl_Secret_Input.html Fl_Select_Browser.html +Fl_Shared_Image.html Fl_Single_Window.html Fl_Slider.html Fl_Spinner.html diff --git a/documentation/intro.html b/documentation/intro.html index a3b464e6a..dac5355d3 100644 --- a/documentation/intro.html +++ b/documentation/intro.html @@ -335,8 +335,8 @@ make
    fltk-bugs@fltk.org [for reporting bugs] -
    News
    -
    news.easysw.com
    +
    NNTP Newsgroups
    +
    news.easysw.com
    diff --git a/documentation/osissues.html b/documentation/osissues.html index ef3eb324c..a838b7a87 100644 --- a/documentation/osissues.html +++ b/documentation/osissues.html @@ -136,7 +136,7 @@ unsigned long fl_xpixel(uchar r, uchar g, uchar b) index or RGB color. This is the X pixel that fl_color() would use. -

    int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)

    +

    int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)

    Convert a name into the red, green, and blue values of a color by parsing the X11 color names. On other systems, fl_parse_color -- cgit v1.2.3