Skip to content

Commit

Permalink
sdl: tweak full/auto-size behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
hodefoting committed Aug 10, 2016
1 parent 7c66f63 commit 8d49589
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bin/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ int host_idle_check (void *data)
MmmRectangle rect = {mmm_get_x (client->mmm), mmm_get_y (client->mmm),
mmm_get_width (client->mmm), mmm_get_height (client->mmm)};
host_queue_draw (host, &rect);
fprintf (stderr, "probably dead code\n");
fprintf (stderr, "client might be dead.. \n");
}
}
}
Expand Down
29 changes: 14 additions & 15 deletions bin/sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,27 +210,23 @@ Host *host_sdl_new (const char *path, int width, int height)
return NULL;
}

if (width < 0)
{
width = 1024;
height = 768;
host->fullscreen = 1;
}


if (width < 0)
{
SDL_Rect **modes;
modes = SDL_ListModes(NULL, SDL_HWSURFACE|SDL_FULLSCREEN);
host->fullscreen = 1;
if (modes == (SDL_Rect**)0) {
width=host_width = 400;
height=host_height = 300;
}
else
{
host_width = modes[0]->w - 128;
host_height = modes[0]->h - 128;

width=host_width = modes[0]->w - 128;
height=host_height = modes[0]->h - 128;
}
}

}

host->width = width;
host->bpp = 4;
Expand Down Expand Up @@ -410,15 +406,18 @@ static int sdl_check_events (Host *host)
break;
case SDL_VIDEORESIZE:
host_sdl->screen = SDL_SetVideoMode (event.resize.w,
event.resize.h,32,
baseflags | SDL_RESIZABLE);
event.resize.h,32,
baseflags | SDL_RESIZABLE);
host->width = event.resize.w;
host->height = event.resize.h;
host->stride = host->width * host->bpp;

if (host->single_app && host->focused)
fprintf (stderr, "%ix%i\n", event.resize.w, event.resize.h);
#if 1
// if (host->single_app && host->focused)
mmm_host_set_size (host->focused->mmm,
host->width, host->height);
host->width, host->height);
#endif
break;
}
got_event = 1;
Expand Down

0 comments on commit 8d49589

Please sign in to comment.