Skip to content

Commit

Permalink
bugfix fixes fullscreen issues on RPI. closes #6445 (#6456)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofTheo authored and arturoc committed Nov 17, 2019
1 parent 2e573e1 commit 637dbe8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions libs/openFrameworks/app/ofAppGLFWWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ void ofAppGLFWWindow::setup(const ofGLFWWindowSettings & _settings){

windowW = settings.getWidth();
windowH = settings.getHeight();

#ifdef TARGET_RASPBERRY_PI
windowRect.width = windowW;
windowRect.height = windowH;
#endif

glfwMakeContextCurrent(windowP);

Expand Down Expand Up @@ -441,6 +446,21 @@ void ofAppGLFWWindow::update(){
setFullscreen(true);
}
}

#ifdef TARGET_RASPBERRY_PI
//needed for rpi. as good values don't come into resize_cb when coming out of fullscreen
if( needsResizeCheck && windowP ){
int winW, winH;
glfwGetWindowSize(windowP, &winW, &winH);

//wait until the window size is the size it was before going fullscreen
//then stop the resize check
if( winW == windowRect.getWidth() && winH == windowRect.getHeight() ){
resize_cb(windowP, currentW, currentH);
needsResizeCheck = false;
}
}
#endif
}

//--------------------------------------------
Expand Down Expand Up @@ -700,6 +720,16 @@ void ofAppGLFWWindow::setFullscreen(bool fullscreen){
Window nativeWin = glfwGetX11Window(windowP);
Display* display = glfwGetX11Display();
if(targetWindowMode==OF_FULLSCREEN){

#ifdef TARGET_RASPBERRY_PI
// save window shape before going fullscreen
if( windowP ){
int tmpW, tmpH;
glfwGetWindowSize(windowP, &tmpW, &tmpH);
windowRect.setSize(tmpW, tmpH);
}
#endif

int monitorCount;
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
if( settings.multiMonitorFullScreen && monitorCount > 1 ){
Expand Down Expand Up @@ -798,6 +828,13 @@ void ofAppGLFWWindow::setFullscreen(bool fullscreen){
XChangeProperty(display, nativeWin, m_bypass_compositor, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&value, 1);

XFlush(display);

#ifdef TARGET_RASPBERRY_PI
if( !fullscreen ){
needsResizeCheck = true;
}
#endif

// setWindowShape(windowW, windowH);

#elif defined(TARGET_OSX)
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/app/ofAppGLFWWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ class ofAppGLFWWindow : public ofAppBaseGLWindow {

int nFramesSinceWindowResized;
bool bWindowNeedsShowing;
bool needsResizeCheck = false; /// Just for RPI at this point

GLFWwindow* windowP;

Expand Down

0 comments on commit 637dbe8

Please sign in to comment.