Re: [fltk.bugs] [HIGH] STR #2944: Mac OS X Fl_Gl_Window bugs - all FLTK versions
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Active] Link: http://www.fltk.org/str.php?L2944 Version: 1.3.2 To fix #2, I'm thinking the attached patch, rasterpos_bugfix.patch, might be a good way to implement the fix with code reuse in mind. This adds a find_offset() method to Fl_Widget.. essentially the same code you provided from Fl_mac.cxx, but made into a method so that both Fl_mac.cxx + Fl_Gl_Window.cxx can use it. Funny thing though, I *think* Fl_mac.cxx is completely unused code, a left over from the de-carbonization of FLTK. (verifying this with the other devs) In which case the code reuse issue might be moot. Still, it's probably useful to have this as a method; awaiting info from the other devs. Anyway, leaving this alternate patch suggestion to fix just #2 here, in case I get pulled off on other stuff and forget where I left off. Link: http://www.fltk.org/str.php?L2944 Version: 1.3.2Index: src/Fl_Gl_Window.cxx === --- src/Fl_Gl_Window.cxx(revision 9861) +++ src/Fl_Gl_Window.cxx(working copy) @@ -183,8 +183,10 @@ GLint xywh[4]; if (window()) { -xywh[0] = x(); -xywh[1] = window()-h() - y() - h(); +int xoff,yoff; +const Fl_Window *win = find_offset(xoff, yoff);// STR #2944 +xywh[0] = xoff; +xywh[1] = win-h() - yoff - h(); } else { xywh[0] = 0; xywh[1] = 0; Index: src/Fl_Window.cxx === --- src/Fl_Window.cxx (revision 9861) +++ src/Fl_Window.cxx (working copy) @@ -278,6 +278,21 @@ icon_ = ic; } +/** + Finds the x/y offset of the current window relative to the top-level window. + \param[out] xoff,yoff Returns the x/y offset + \returns the top-level window +*/ +Fl_Window* Fl_Window::find_offset(int xoff, int yoff) const { + xoff = yoff = 0; + const Fl_Window *win = (const Fl_Window*)this; + while (win win-window()) { +xoff += win-x(); // accumulate offsets +yoff += win-y(); +win = win-window(); // walk up window hierarchy + } + return (Fl_Window*)win; +} // // End of $Id$. Index: FL/Fl_Window.H === --- FL/Fl_Window.H (revision 9861) +++ FL/Fl_Window.H (working copy) @@ -120,6 +120,7 @@ \see force_position(int) */ int force_position() const { return ((flags() FORCE_POSITION)?1:0); } + Fl_Window* find_offset(int xoff, int yoff) const; public: ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2939: Fl_Tabs not honoring when(FL_WHEN_NOT_CHANGED)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Active] Link: http://www.fltk.org/str.php?L2939 Version: 1.3.2 Suggesting the attached Fl_Tabs-add-when-v6.patch which modifies Fl_Tabs to handle when(). Includes doxygen docs that describe the various combos of when() flags supported. Putting this here so I can remember where I left off if I get pulled into other activities for a time. Want to do a little more testing of this before commit. Link: http://www.fltk.org/str.php?L2939 Version: 1.3.2Index: FL/Fl_Tabs.H === --- FL/Fl_Tabs.H(revision 9857) +++ FL/Fl_Tabs.H(working copy) @@ -49,6 +49,41 @@ gap is larger. It is easiest to lay this out in fluid, using the fluid browser to select each child group and resize them until the tabs look the way you want them to. + + As of FLTK 1.3.3, Fl_Tabs() honors the value of when() based on the following + table. The default value for when() is FL_WHEN_RELEASE (inherited from Fl_Widget): + + \code +when() Flags | Mouse Behavior | Keyboard Behavior +--|-|-- +NEVER | change: no callback | change: no callback + | no change: no callback | no change: no callback +--|-|-- + CHANGED| change: callback on PUSH, changed()=true| change: callback on PUSH, changed()=true + | no change: no callback | no change: no callback +--|-|-- + NOT_CHANGED | change: no callback | change: no callback + | no change: callback on PUSH, changed()=false| no change: callback on PUSH, changed()=false +--|-|-- + CHANGED + | change: callback on PUSH, changed()=true| change: callback on PUSH, changed()=true + NOT_CHANGED | no change: callback on PUSH, changed()=false| no change: callback on PUSH, changed()=false +--|-|-- + RELEASE| change: callback on RELEASE, changed()=true | change: callback on RELEASE, changed()=true + | no change: no callback | no change: no callback +--|-|-- + RELEASE + | change: callback on RELEASE, changed()=true | change: callback on RELEASE, changed()=true + CHANGED| no change: no callback | no change: no callback +--|-|-- + RELEASE + | change: no callback | change: no callback + NOT_CHANGED | no change: callback on RELEASE, changed()=false | no change: callback on RELEASE, changed()=false +--|-|-- + RELEASE + | change: callback on RELEASE, changed()=true | change: callback on RELEASE, changed()=true + CHANGED + | no change: callback on RELEASE, changed()=false | no change: callback on RELEASE, changed()=false + NOT_CHANGED | | ++-- + + \endcode + */ class FL_EXPORT Fl_Tabs : public Fl_Group { Fl_Widget *value_; Index: src/Fl_Tabs.cxx === --- src/Fl_Tabs.cxx (revision 9857) +++ src/Fl_Tabs.cxx (working copy) @@ -170,25 +170,62 @@ }} /* FALLTHROUGH */ case FL_DRAG: - case FL_RELEASE: -o = which(Fl::event_x(), Fl::event_y()); + case FL_RELEASE: { +// PUSH, DRAG, RELEASE.. +int do_cb=0; +if ((o = which(Fl::event_x(), Fl::event_y( { // get tab group for tab user is over + if (o != value()) set_changed(); // if over tab, handle change + else clear_changed(); +} if (event == FL_RELEASE) { - push(0); - if (o Fl::visible_focus() Fl::focus()!=this) { -Fl::focus(this); -redraw_tabs(); + push(0); // no longer 'pushed' + // Over a tab? + if (o) { + // Handle taking keyboard focus w/visible focus indication + if (Fl::visible_focus() Fl::focus()!=this) { + Fl::focus(this); + redraw_tabs(); + } + if (value(o)) {
Re: [fltk.bugs] [HIGH] STR #2944: Mac OS X Fl_Gl_Window bugs - allFLTK versions
Yes, I agree that find_offset would be a useful method. Regarding bug #1, the swap_buffers problem with glRasterPos being modified by gl_draw on Mac OS X: Looking at the non-APPLE implementation(s) of gl_draw, they appear to leave that state of glRasterPos alone, which is probably why this bug has not been previously reported. However, it is probably desirable that swap_buffers not depend on the state of glRasterPos, or the OpenGL transform matrices. --PART-BOUNDARY Content-Type: text/plain DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Active] Link: http://www.fltk.org/str.php?L2944 Version: 1.3.2 To fix #2, I'm thinking the attached patch, rasterpos_bugfix.patch, might be a good way to implement the fix with code reuse in mind. This adds a find_offset() method to Fl_Widget.. essentially the same code you provided from Fl_mac.cxx, but made into a method so that both Fl_mac.cxx + Fl_Gl_Window.cxx can use it. Funny thing though, I *think* Fl_mac.cxx is completely unused code, a left over from the de-carbonization of FLTK. (verifying this with the other devs) In which case the code reuse issue might be moot. Still, it's probably useful to have this as a method; awaiting info from the other devs. Anyway, leaving this alternate patch suggestion to fix just #2 here, in case I get pulled off on other stuff and forget where I left off. Link: http://www.fltk.org/str.php?L2944 Version: 1.3.2 --PART-BOUNDARY Content-Type: text/plain Content-Disposition: attachment; filename=rasterpos_bugfix.patch Index: src/Fl_Gl_Window.cxx === --- src/Fl_Gl_Window.cxx (revision 9861) +++ src/Fl_Gl_Window.cxx (working copy) @@ -183,8 +183,10 @@ GLint xywh[4]; if (window()) { -xywh[0] = x(); -xywh[1] = window()-h() - y() - h(); +int xoff,yoff; +const Fl_Window *win = find_offset(xoff, yoff); // STR #2944 +xywh[0] = xoff; +xywh[1] = win-h() - yoff - h(); } else { xywh[0] = 0; xywh[1] = 0; Index: src/Fl_Window.cxx === --- src/Fl_Window.cxx (revision 9861) +++ src/Fl_Window.cxx (working copy) @@ -278,6 +278,21 @@ icon_ = ic; } +/** + Finds the x/y offset of the current window relative to the top-level window. + \param[out] xoff,yoff Returns the x/y offset + \returns the top-level window +*/ +Fl_Window* Fl_Window::find_offset(int xoff, int yoff) const { + xoff = yoff = 0; + const Fl_Window *win = (const Fl_Window*)this; + while (win win-window()) { +xoff += win-x();// accumulate offsets +yoff += win-y(); +win = win-window(); // walk up window hierarchy + } + return (Fl_Window*)win; +} // // End of $Id$. Index: FL/Fl_Window.H === --- FL/Fl_Window.H(revision 9861) +++ FL/Fl_Window.H(working copy) @@ -120,6 +120,7 @@ \see force_position(int) */ int force_position() const { return ((flags() FORCE_POSITION)?1:0); } + Fl_Window* find_offset(int xoff, int yoff) const; public: --PART-BOUNDARY-- ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs