graphics API: Write changed window size only after it has stopped changing.

svn path=/trunk/boinc/; revision=13713
This commit is contained in:
Charlie Fenton 2007-09-29 01:20:42 +00:00
parent a1590ff580
commit 71255d3194
2 changed files with 32 additions and 17 deletions

View File

@ -81,30 +81,39 @@ void mouse_click_move(int x, int y){
static void maybe_render() {
int new_xpos, new_ypos, new_width, new_height;
static int size_changed = 0;
new_xpos = glutGet(GLUT_WINDOW_X);
new_ypos = glutGet(GLUT_WINDOW_Y);
new_width = glutGet(GLUT_WINDOW_WIDTH);
new_height = glutGet(GLUT_WINDOW_HEIGHT);
if ((! fullscreen) &&
((new_xpos != xpos) || (new_ypos != ypos) ||
(new_width != width) || (new_height != height))
) {
xpos = new_xpos;
ypos = new_ypos;
width = new_width;
height = new_height;
FILE *f = boinc_fopen("gfx_info", "w");
if (f) {
// ToDo: change this to XML
fprintf(f, "%d %d %d %d\n", xpos, ypos, width, height);
fclose(f);
}
}
if (throttled_app_render(width, height, dtime())) {
if (throttled_app_render(new_width, new_height, dtime())) {
glutSwapBuffers();
if (! fullscreen) {
// If user has changed window size, wait until it stops
// changing and then write the new dimensions to file
if ((new_xpos != xpos) || (new_ypos != ypos) ||
(new_width != width) || (new_height != height)
) {
size_changed = 1;
xpos = new_xpos;
ypos = new_ypos;
width = new_width;
height = new_height;
} else {
if (++size_changed > 10) {
size_changed = 0;
FILE *f = boinc_fopen("gfx_info", "w");
if (f) {
// ToDo: change this to XML
fprintf(f, "%d %d %d %d\n", xpos, ypos, width, height);
fclose(f);
}
}
} // End if (new size != previous size) else
} // End if (! fullscreen)
#ifdef __APPLE__
MacGLUTFix(fullscreen);
if (need_show) {

View File

@ -8929,7 +8929,7 @@ Charlie 28 Sep 2007
api/
graphics2_unix.C
David 28 Sept 2007
- scheduler: <max_wus_in_progress> option wasn't working,
because the reply.req structure was getting zeroed
@ -8938,3 +8938,9 @@ David 28 Sept 2007
sched/
handle_request.C
sched_send.C
Charlie 28 Sep 2007
- graphics API: Write changed window size only after it has stopped changing.
api/
graphics2_unix.C