Use overscan height of 239 pixels.

Resize window on status bar visibility.
This commit is contained in:
Brandon Wright 2014-03-29 22:15:04 -05:00
parent ea09396218
commit 427ef85bd3
3 changed files with 33 additions and 6 deletions

View File

@ -63,7 +63,7 @@ S9xSetEndianess (int type)
double double
S9xGetAspect (void) S9xGetAspect (void)
{ {
double native_aspect = 256.0 / (gui_config->overscan ? 240.0 : 224.0); double native_aspect = 256.0 / (gui_config->overscan ? 239.0 : 224.0);
double aspect; double aspect;
switch (gui_config->aspect_ratio) switch (gui_config->aspect_ratio)

View File

@ -100,10 +100,7 @@ event_toggle_interface (GtkWidget *widget, gpointer data)
static gboolean static gboolean
event_show_statusbar (GtkWidget *widget, gpointer data) event_show_statusbar (GtkWidget *widget, gpointer data)
{ {
Snes9xWindow *window = (Snes9xWindow *) data; ((Snes9xWindow *) data)->toggle_statusbar ();
window->config->statusbar_visible = !window->config->statusbar_visible;
window->configure_widgets ();
return TRUE; return TRUE;
} }
@ -1731,6 +1728,35 @@ Snes9xWindow::draw_background (int x, int y, int w, int h)
return; return;
} }
void
Snes9xWindow::toggle_statusbar (void)
{
GtkWidget *item;
GtkAllocation allocation;
int width = 0;
int height = 0;
item = get_widget ("menubar");
gtk_widget_get_allocation (item, &allocation);
height += gtk_widget_get_visible (item) ? allocation.height : 0;
item = get_widget ("drawingarea");
gtk_widget_get_allocation (item, &allocation);
height += allocation.height;
width = allocation.width;
config->statusbar_visible = !config->statusbar_visible;
configure_widgets ();
item = get_widget ("statusbar");
gtk_widget_get_allocation (item, &allocation);
height += gtk_widget_get_visible (item) ? allocation.height : 0;
resize (width, height);
return;
}
void void
Snes9xWindow::resize_viewport (int width, int height) Snes9xWindow::resize_viewport (int width, int height)
{ {
@ -2003,7 +2029,7 @@ Snes9xWindow::update_accels (void)
void void
Snes9xWindow::resize_to_multiple (int factor) Snes9xWindow::resize_to_multiple (int factor)
{ {
int h = (config->overscan ? 240 : 224) * factor; int h = (config->overscan ? 239 : 224) * factor;
int w = h * S9xGetAspect (); int w = h * S9xGetAspect ();
resize_viewport (w, h); resize_viewport (w, h);

View File

@ -53,6 +53,7 @@ class Snes9xWindow : public GtkBuilderWindow
void show (void); void show (void);
void show_status_message (const char *message); void show_status_message (const char *message);
void update_statusbar (void); void update_statusbar (void);
void toggle_statusbar (void);
void draw_background (int x = -1, int y = -1, int w = -1, int h = -1); void draw_background (int x = -1, int y = -1, int w = -1, int h = -1);
void draw_background (cairo_t *cr); void draw_background (cairo_t *cr);
void set_menu_item_selected (const char *name); void set_menu_item_selected (const char *name);