summaryrefslogtreecommitdiff
path: root/plugins/gtkui/retina.m
blob: b76c2321acb564740e86b56789edcea5deb18b5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <Cocoa/Cocoa.h>
#include <gtk/gtk.h>
#include <gdk/gdkquartz.h>
#include "retina.h"

int
is_retina (GtkWidget *w) {
    NSWindow *window = gdk_quartz_window_get_nswindow (gtk_widget_get_window (w));
    if ([window respondsToSelector:@selector(backingScaleFactor)]) {
        float s = [window backingScaleFactor];
        return s > 1.0f;
    }
    return 0; 
}