Ejemplo n.º 1
0
static double pixelWidth(void)
{
    double width, widthMM;
    width = gdk_screen_width();
    widthMM = gdk_screen_width_mm();
    return ((double)widthMM / (double)width) / MM_PER_INCH;
}
Ejemplo n.º 2
0
/**
 *  This function gets the dpi in the same way that mozilla gets the dpi, 
 *  this allows us to convert from pixels to points easily
 */
static gint
mozilla_get_dpi (void)
{
	GtkSettings* settings = gtk_settings_get_default ();
	gint dpi = 0;
	char *val;
	float screenWidthIn;

	/* Use the gtk-xft-dpi setting if it is set */
	if (g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (settings)),
					  "gtk-xft-dpi"))
	{
		g_object_get (G_OBJECT (settings), "gtk-xft-dpi", &dpi, NULL);
		if (dpi) return INT_ROUND (dpi / PANGO_SCALE);
	}

	/* Fall back to what xft thinks it is */
	val = XGetDefault (GDK_DISPLAY (), "Xft", "dpi");
	if (val)
	{
		char *e;
		double d = strtod(val, &e);
		if (e != val) return INT_ROUND (d);
	}
	
	/* Fall back to calculating manually from the gdk screen settings */
	screenWidthIn = ((float)gdk_screen_width_mm()) / 25.4f;
	return INT_ROUND (gdk_screen_width() / screenWidthIn);
}
Ejemplo n.º 3
0
void LayerDevice::CreateDevice(gdouble wInInches, gdouble hInInches)
{
    // Compute resolution
    gdouble resolutionX = mmPerInch * gdk_screen_width() / gdk_screen_width_mm();
    gdouble resolutionY = mmPerInch * gdk_screen_height() / gdk_screen_height_mm();
    gdouble wInPoints = wInInches * pointsPerInch;
    gdouble hInPoints = hInInches * pointsPerInch;
    gint wInPixels = (gint)(wInInches * resolutionX);
    gint hInPixels = (gint)(hInInches * resolutionY);
    lDesc = new LayerDesc(wInPoints, hInPoints, wInPixels, hInPixels, dd);
}
JNIEXPORT jint JNICALL 
Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenResolution (JNIEnv *env, 
							   jobject obj)
{
  jint res;

  gdk_threads_enter ();

  res = gdk_screen_width () / (gdk_screen_width_mm () / 25.4);

  gdk_threads_leave ();
  return res;
}
Ejemplo n.º 5
0
void wxDisplaySizeMM( int *width, int *height )
{
#ifdef __WXGTK4__
    GdkMonitor* monitor = gdk_display_get_primary_monitor(gdk_display_get_default());
    if (width) *width = gdk_monitor_get_width_mm(monitor);
    if (height) *height = gdk_monitor_get_height_mm(monitor);
#else
    wxGCC_WARNING_SUPPRESS(deprecated-declarations)
    if (width) *width = gdk_screen_width_mm();
    if (height) *height = gdk_screen_height_mm();
    wxGCC_WARNING_RESTORE()
#endif
}
Ejemplo n.º 6
0
void wxDisplaySizeMM( int *width, int *height )
{
    if (width) *width = gdk_screen_width_mm();
    if (height) *height = gdk_screen_height_mm();
}
Ejemplo n.º 7
0
static VALUE
gdk_s_screen_width_mm(VALUE self)
{
    return INT2NUM(gdk_screen_width_mm());
}
Ejemplo n.º 8
0
// Returns the width of the screen in millimeters.
// Note that on many X servers this value will not be correct.
int
clip_GDK_SCREENWIDTHMM(ClipMachine * ClipMachineMemory)
{
   _clip_retni(ClipMachineMemory, gdk_screen_width_mm());
   return 0;
}
Ejemplo n.º 9
0
static VALUE
rg_m_screen_width_mm(G_GNUC_UNUSED VALUE self)
{
    return INT2NUM(gdk_screen_width_mm());
}