コード例 #1
0
RRMode
xfce_randr_preferred_mode (XfceRandr *randr,
                           guint      output)
{
    RRMode best_mode;
    gint   best_dist, dist, n;

    g_return_val_if_fail (randr != NULL, None);
    g_return_val_if_fail (output < randr->noutput, None);

    /* mimic xrandr's preferred_mode () */

    best_mode = None;
    best_dist = 0;
    for (n = 0; n < randr->priv->output_info[output]->nmode; ++n)
    {
        if (n < randr->priv->output_info[output]->npreferred)
            dist = 0;
        else if (randr->priv->output_info[output]->mm_height != 0)
            dist = (1000 * gdk_screen_height () / gdk_screen_height_mm () -
                1000 * randr->priv->modes[output][n].height /
                    randr->priv->output_info[output]->mm_height);
        else
            dist = gdk_screen_height () - randr->priv->modes[output][n].height;

        dist = ABS (dist);

        if (best_mode == None || dist < best_dist)
        {
            best_mode = randr->priv->modes[output][n].id;
            best_dist = dist;
        }
    }
    return best_mode;
}
コード例 #2
0
ファイル: devGTK.c プロジェクト: cran/gtkDevice
static double pixelHeight(void)
{
    double height, heightMM;
    height = gdk_screen_height();
    heightMM = gdk_screen_height_mm();
    return ((double)heightMM / (double)height) / MM_PER_INCH;
}
コード例 #3
0
ファイル: LayerDevice.cpp プロジェクト: yixuan/Layer
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);
}
コード例 #4
0
ファイル: utilsgtk.cpp プロジェクト: slunski/wxWidgets
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
}
コード例 #5
0
void wxDisplaySizeMM( int *width, int *height )
{
    if (width) *width = gdk_screen_width_mm();
    if (height) *height = gdk_screen_height_mm();
}
コード例 #6
0
ファイル: rbgdk.c プロジェクト: geoffyoungs/ruby-gnome2
static VALUE
gdk_s_screen_height_mm(VALUE self)
{
    return INT2NUM(gdk_screen_height_mm());
}
コード例 #7
0
ファイル: gdk.c プロジェクト: amery/clip-angelo
// Returns the height of the screen in millimeters.
// Note that on many X servers this value will not be correct.
int
clip_GDK_SCREENHEIGHTMM(ClipMachine * ClipMachineMemory)
{
   _clip_retni(ClipMachineMemory, gdk_screen_height_mm());
   return 0;
}
コード例 #8
0
ファイル: rbgdk.c プロジェクト: tanahiro/ruby-gnome2
static VALUE
rg_m_screen_height_mm(G_GNUC_UNUSED VALUE self)
{
    return INT2NUM(gdk_screen_height_mm());
}