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: 0002-Constant-DPI.patch

File 0002-Constant-DPI.patch, 2.2 KB (added by Antoine Martin, 8 years ago)

patch as used by the spec files

  • 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..8b85fb1 100644
    a b  
    1717/* All drivers using the mi colormap manipulation need this */
    1818#include "micmap.h"
    1919
     20#ifdef RANDR
     21#include "randrstr.h"
     22#endif
     23
    2024/* identifying atom needed by magnifiers */
    2125#include <X11/Xatom.h>
    2226#include "property.h"
    static SymTabRec DUMMYChipsets[] = { 
    118122};
    119123
    120124typedef enum {
    121     OPTION_SW_CURSOR
     125    OPTION_SW_CURSOR,
     126    OPTION_CONSTANT_DPI
    122127} DUMMYOpts;
    123128
    124129static const OptionInfoRec DUMMYOptions[] = {
    125130    { OPTION_SW_CURSOR, "SWcursor",     OPTV_BOOLEAN,   {0}, FALSE },
     131#ifdef RANDR
     132    { OPTION_CONSTANT_DPI,      "ConstantDPI",  OPTV_BOOLEAN,   {0}, FALSE },
     133#endif
    126134    { -1,                  NULL,           OPTV_NONE,   {0}, FALSE }
    127135};
    128136
    DUMMYPreInit(ScrnInfoPtr pScrn, int flags) 
    362370    xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, dPtr->Options);
    363371
    364372    xf86GetOptValBool(dPtr->Options, OPTION_SW_CURSOR,&dPtr->swCursor);
     373    xf86GetOptValBool(dPtr->Options, OPTION_CONSTANT_DPI, &dPtr->constantDPI);
    365374
    366375    if (device->videoRam != 0) {
    367376        pScrn->videoRam = device->videoRam;
    Bool 
    666675DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL)
    667676{
    668677    SCRN_INFO_PTR(arg);
    669     return dummyModeInit(pScrn, mode);
     678    if (!dummyModeInit(pScrn, mode))
     679        return FALSE;
     680#ifdef RANDR
     681    DUMMYPtr dPtr = DUMMYPTR(pScrn);
     682    if (dPtr->constantDPI) {
     683        //25.4 mm per inch: (254/10)
     684        pScrn->pScreen->mmWidth = mode->HDisplay * 254 / pScrn->xDpi / 10;
     685        pScrn->pScreen->mmHeight = mode->VDisplay * 254 / pScrn->yDpi / 10;
     686        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "mm(dpi %ix%i)=%ix%i", pScrn->xDpi, pScrn->yDpi, pScrn->pScreen->mmWidth, pScrn->pScreen->mmHeight);
     687        RRScreenSizeNotify(pScrn->pScreen);
     688        RRTellChanged(pScrn->pScreen);
     689    }
     690#endif
     691    return TRUE;
    670692}
    671693
    672694/* Mandatory */