Catching keyboard and mouse events in second window

Using the code below I create a second window. I can bind the second window’s update and draw functions (called updateTv and drawTv) to the same function on the first so they will run in sync.
But I can’t seem to find a way to do the same thing with the keyboard events. When the main window is selected my app has no problem catching keyboard events, but with the second window selected, nothing happens.

I tried all kinds of combinations of ofAddListener(tvWindow->events().keyReleased(int key),mainApp.get(),&ofApp::keyReleasedTv(int key)); and similar, based on the working update and draw binding, but so far no luck as I’m not sure how to call the function properly.

Does anybody have some hints?

Update: looking further, the multiWindowExample seemed useful as you can easily add a keyRelease function to the second window, but the example doesn’t allow communication from the second window to the first it seems, so there is no way to notify the main window. I guess I’m a bit lost in the way different classes can interact.

int main( ){

    // Projector window
    ofGLFWWindowSettings settings;
    settings.resizable = false;
    settings.width = 800;
    settings.height = 600;
    shared_ptr<ofAppBaseWindow> projectorWindow = ofCreateWindow(settings);

    settings.width = 800;
    settings.height = 600;

    shared_ptr<ofAppBaseWindow> tvWindow = ofCreateWindow(settings);
    tvWindow->setVerticalSync(true);

    shared_ptr<ofApp> mainApp(new ofApp);
    ofAddListener(tvWindow->events().draw, mainApp.get(), &ofApp::drawTv);
    ofAddListener(tvWindow->events().update,mainApp.get(),&ofApp::updateTv);

    ofRunApp(projectorWindow, mainApp);
    ofRunMainLoop();

}

hey, i came across the same problem how did you managed to fix it if you did?

Sorry, I’m not sure what I was working on at the time and how/if I fixed it.
I might have gone with one big window in the end. In OSX you might want to check the display settings as you’ll have to untick a box saying something like “windows have their own screen”. This will allow them to span multiple monitors.
This way you only need to catch events on one window.