STR #1747

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.3 ]

STR #1747

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:4 - High, e.g. key functionality not working
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:Fl::grab() behavior changed on newer platforms
Created By:StanS
Assigned To:matt
Fix Version:1.3.0 (SVN: v6037)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files

Trouble Report Comments:

Name/Time/Date Text top right image
#1 StanS
08:23 Jul 23, 2007
Below, when the typedef of Window is Fl_Window, the second
window receives events from all over the screen, as expected.
When the typedef is changed to Fl_Double_Window, the second
window only sees events within itself or within the first window.

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

//typedef Fl_Window Window;
typedef Fl_Double_Window Window;

class Win : public Window {
  Win(int w, int h, char const* label = 0)
    : Window(w, h, label) {;}

  int handle(int event)
    int r = Window::handle(event);
      switch(event) {
        case FL_PUSH: std::cout << "PUSH\n"; break;
        case FL_RELEASE: std::cout << "RELEASE\n"; break;
        case FL_KEYDOWN:
          if(Fl::event_key() == FL_Escape) {
            Fl::release(); hide();
    return r;

int main()
  Fl_Double_Window first(300, 300, "First Window");
  Win second(200, 200, "Second Window");
  return Fl::run();
#2 matt
09:40 Oct 06, 2007
Which OS and compiler please?  
#3 StanS
05:30 Oct 09, 2007
Not exactly state of the art:

uname -sr
SunOS 5.8

CC: Sun C++ 5.5 2003/03/12
#5 matt
13:37 Jan 09, 2008
No issues on OS X. All is as expected.  
#6 wavexx
09:24 Feb 14, 2008
Trying to debug this issue...

Can you describe how the test is supposed to work?

When run under OSX 10.4, two windows appear. Clicking on either produces PUSH/RELEASE events, but clicking outside (on the desktop, for example) does not. The same happens if I change Fl_Window to Fl_Double_Window.

This is identical to the behavior I get on linux (fedora with blackbox).

Nothing changes if I remove "first window" entirely.

Is this expected or grab isn't working at all here?
#7 matt
10:44 Feb 20, 2008
It seem that the behavior of exclusively grabbing the mouse was disabled on all supported platfroms by the platform developers. This is useful to avoid individual programs locking up a whole desktop. Grabbing seems to be limited to the time during which a mouse button is held down.

We should note these issues in the documentation.
#8 matt
10:58 Feb 20, 2008
Updated the docs.

This issue needs furter investigation. I suggest for 1.2 that we will introduce a fully functional popup window that handles grabbing correctly for every platform. We may have to limit the use of Fl::grab() to mouse-clicks-and-drags only.
#9 fabien
05:58 Jan 12, 2009
matt can we close that one now ?  
#10 matt
06:58 Jan 12, 2009
Yes, I think we can close this.  
#11 matt
12:48 Feb 19, 2010
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 ''.