xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #163: dummy-constant-dpi-option.diff

File dummy-constant-dpi-option.diff, 1.9 KB (added by Antoine Martin, 8 years ago)

same change with an xorg.conf option instead

  • src/dummy.h

    diff --git a/src/dummy.h b/src/dummy.h
    index c3fdd6e..7e7e0aa 100644
    a b typedef struct dummyRec 
    5151    /* options */
    5252    OptionInfoPtr Options;
    5353    Bool swCursor;
     54    Bool constantDPI;
    5455    /* proc pointer */
    5556    CloseScreenProcPtr CloseScreen;
    5657    xf86CursorInfoPtr CursorInfo;
  • src/dummy_driver.c

    diff --git a/src/dummy_driver.c b/src/dummy_driver.c
    index 6062c39..926bf5a 100644
    a b  
    3434#include <X11/extensions/Xv.h>
    3535#endif
    3636
     37#include "randrstr.h"
     38
    3739/*
    3840 * Driver data structures.
    3941 */
    static SymTabRec DUMMYChipsets[] = { 
    118120};
    119121
    120122typedef enum {
    121     OPTION_SW_CURSOR
     123    OPTION_SW_CURSOR,
     124    OPTION_CONSTANT_DPI
    122125} DUMMYOpts;
    123126
    124127static const OptionInfoRec DUMMYOptions[] = {
    125128    { OPTION_SW_CURSOR, "SWcursor",     OPTV_BOOLEAN,   {0}, FALSE },
     129    { OPTION_CONSTANT_DPI,      "ConstantDPI",  OPTV_BOOLEAN,   {0}, FALSE },
    126130    { -1,                  NULL,           OPTV_NONE,   {0}, FALSE }
    127131};
    128132
    DUMMYPreInit(ScrnInfoPtr pScrn, int flags) 
    362366    xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, dPtr->Options);
    363367
    364368    xf86GetOptValBool(dPtr->Options, OPTION_SW_CURSOR,&dPtr->swCursor);
     369    xf86GetOptValBool(dPtr->Options, OPTION_CONSTANT_DPI, &dPtr->constantDPI);
    365370
    366371    if (device->videoRam != 0) {
    367372        pScrn->videoRam = device->videoRam;
    Bool 
    666671DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL)
    667672{
    668673    SCRN_INFO_PTR(arg);
    669     return dummyModeInit(pScrn, mode);
     674    if (!dummyModeInit(pScrn, mode))
     675        return FALSE;
     676    DUMMYPtr dPtr = DUMMYPTR(pScrn);
     677    if (dPtr->constantDPI) {
     678        pScrn->pScreen->mmWidth = mode->HDisplay * 254 / 960;
     679        pScrn->pScreen->mmHeight = mode->VDisplay * 254 / 960;
     680        RRScreenSizeNotify(pScrn->pScreen);
     681        RRTellChanged(pScrn->pScreen);
     682    }
     683    return TRUE;
    670684}
    671685
    672686/* Mandatory */