STR #1849

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features | Roadmap 1.1 ]

STR #1849

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:hidden subwindows receive events
Created By:StanS
Assigned To:matt
Fix Version:1.1-current (SVN: v6030)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Name/Time/Date Filename/Size top right image
#1 wavexx
09:19 Feb 15, 2008
bottom left image   bottom right image

Trouble Report Comments:

Name/Time/Date Text top right image
#1 StanS
10:06 Dec 24, 2007
Per the documentation of Fl_Widget::hide(),
 ".. An invisible widget never gets redrawn and does not get events. [..]"

However, that does not seem to be the case for sub-windows.  On
my system, the following demonstrates FL_LEAVE, FL_KEYUP, and
FL_NO_EVENT being handled.

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/names.h>
#include <iostream>

class SubWindow : public Fl_Double_Window {
    SubWindow(int x, int y, int w, int h, char const* label = 0)
        : Fl_Double_Window(x, y, w, h, label)
    { end(); hide(); }

    int handle(int event)
        std::cout << fl_eventnames[event] << " in hidden subwindow\n";
        return Fl_Double_Window::handle(event);

int main()
    Fl_Double_Window win(300, 300, "Main");
    SubWindow sub(50, 50, 100, 100, "Sub");
    return Fl::run();
#2 matt
15:07 Dec 28, 2007
In Fl_Group.cxx in line 263 it says:

if (a[j]->takesevents() || event != FL_MOUSEWHEEL)...

I do not understand this line. Why would I test if a child handles events (it doesn't if it is hidden), but only for MOUSEWHEEL. I believe the line shoudl be something like:

if (a[j]->takesevents() || event == FL_MOUSEWHEEL)...

but I still cannot follow the logic. Does anybody know why MOUSEWHEEL events would be sent (or excluded for that matter)? Heck, it may even have been me who wrote this line ;-) ...
#3 wavexx
09:18 Feb 15, 2008
Yes, this line is buggy. It's probably a cut&paste bug, or the like (change 2205 mentions some cosmetic changes only).

Anyway, the line should read:

        if (a[j]->takesevents()) if (send(a[j], event)) return 1;

(testing "event" here is just a bug: FL_MOUSEWHEEL is already handled in the outer switch).

Attaching the diff against trunk.
#4 matt
09:43 Feb 20, 2008
Fixed in Subversion repository.

Thanks once again, wavexx.
bottom left image   bottom right image

Return to Bugs & Features ]


Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.