Fix sizing when using GDK hidpi scaling with OpenGL or Xv.

This commit is contained in:
Brandon Wright 2016-10-02 19:41:42 -05:00
parent fe55308901
commit 17f83a0806
2 changed files with 23 additions and 12 deletions

View File

@ -116,15 +116,17 @@ S9xOpenGLDisplayDriver::update (int width, int height)
void *pboMemory = NULL;
int x, y, w, h;
if (width <= 0)
{
gdk_window_hide (gdk_window);
return;
}
GtkAllocation allocation;
gtk_widget_get_allocation (drawing_area, &allocation);
#if GTK_CHECK_VERSION(3,10,0)
int gdk_scale_factor = gdk_window_get_scale_factor (gdk_window);
allocation.width *= gdk_scale_factor;
allocation.height *= gdk_scale_factor;
#endif
if (output_window_width != allocation.width ||
output_window_height != allocation.height)
{

View File

@ -95,15 +95,17 @@ S9xXVDisplayDriver::update (int width, int height)
GtkAllocation allocation;
gtk_widget_get_allocation (drawing_area, &allocation);
#if GTK_CHECK_VERSION(3,10,0)
int gdk_scale_factor = gdk_window_get_scale_factor (gdk_window);
allocation.width *= gdk_scale_factor;
allocation.height *= gdk_scale_factor;
#endif
current_width = allocation.width;
current_height = allocation.height;
if (width <= 0)
{
gdk_window_hide (gdk_window);
return;
}
if (output_window_width != current_width ||
output_window_height != current_height)
{
@ -514,6 +516,13 @@ S9xXVDisplayDriver::clear (void)
GC xgc = XDefaultGC (display, XDefaultScreen (display));
gtk_widget_get_allocation (drawing_area, &allocation);
#if GTK_CHECK_VERSION(3,10,0)
int gdk_scale_factor = gdk_window_get_scale_factor (gdk_window);
allocation.width *= gdk_scale_factor;
allocation.height *= gdk_scale_factor;
#endif
width = allocation.width;
height = allocation.height;