openframeworks / openframeworks/openFrameworks
Proposal : ofAppGLFWWindow, set position and shape at the same time
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
reading the code I've noticed some hacks to make things work like this:
setWindowPosition(pos.x, pos.y);
setWindowShape(screenSize.x, screenSize.y);
setWindowPosition(pos.x, pos.y);
and inside function setWindowShape we have another setWindowPosition going.
I'm proposing the creation of a function who does the two things at the same time, only to be used when position and shape (dimensions) are set at once.
//------------------------------------------------------------
void ofAppGLFWWindow::setWindowRectangle(ofRectangle rect) {
if(settings.windowMode == OF_WINDOW){
windowW = rect.width;
windowH = rect.height;
}
currentW = rect.width/pixelScreenCoordScale;
currentH = rect.height/pixelScreenCoordScale;
// cout << "glfwSetWindowSize " << ofGetFrameNum() << endl;
glfwSetWindowSize(windowP,currentW,currentH);
glfwSetWindowPos(windowP,rect.x/pixelScreenCoordScale,rect.y/pixelScreenCoordScale);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ofAppGLFWWindow::setWindowPosition and setWindowShape, including the existing callers that set both values. Compare them with the proposed setWindowRectangle behavior; done means position and dimensions can be applied together without the duplicate positioning calls while preserving window-mode and scaled-coordinate handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100