Skip to content

Commit

Permalink
Screen capture should be HiDPI aware.
Browse files Browse the repository at this point in the history
An attempt to tackle #4.

I believe that it won't work if one uses a per display HiDPI
setting. Google seemed to suggest that this an experimental
feature anyway (is that still true?).
  • Loading branch information
fzwoch committed Feb 4, 2019
1 parent f1e1956 commit 3e9810b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gnome-screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static void start(data_t* data)
{
GError* err = NULL;
gboolean capture_desktop = FALSE;
GdkRectangle rect = {};
GdkRectangle rect = {0};

gint screen = obs_data_get_int(data->settings, "screen");
if (screen >= gdk_display_get_n_monitors(gdk_display_get_default()))
Expand All @@ -105,7 +105,15 @@ static void start(data_t* data)
}
else
{
gdk_monitor_get_geometry(gdk_display_get_monitor(gdk_display_get_default(), screen), &rect);
GdkMonitor* monitor = gdk_display_get_monitor(gdk_display_get_default(), screen);

int scale_factor = gdk_monitor_get_scale_factor(monitor);
gdk_monitor_get_geometry(monitor, &rect);

rect.x *= scale_factor;
rect.y *= scale_factor;
rect.width *= scale_factor;
rect.height *= scale_factor;
}

if (g_file_test(obs_data_get_string(data->settings, "shm_socket"), G_FILE_TEST_EXISTS) == TRUE)
Expand Down

0 comments on commit 3e9810b

Please sign in to comment.