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-v2.patch

File dummy-constant-dpi-v2.patch, 2.2 KB (added by Antoine Martin, 8 years ago)

updated patch: use the system dpi (comes from DisplaySize? in dummy driver section of xorg.conf and falls back to Xorg -dpi value)

  • 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..d1e00ca 100644
    a b  
    1717/* All drivers using the mi colormap manipulation need this */
    1818#include "micmap.h"
    1919
     20#ifdef RANDR
     21//#include <X11/Xlib.h>
     22#include "randrstr.h"
     23#endif
     24
    2025/* identifying atom needed by magnifiers */
    2126#include <X11/Xatom.h>
    2227#include "property.h"
    static SymTabRec DUMMYChipsets[] = { 
    118123};
    119124
    120125typedef enum {
    121     OPTION_SW_CURSOR
     126    OPTION_SW_CURSOR,
     127    OPTION_CONSTANT_DPI
    122128} DUMMYOpts;
    123129
    124130static const OptionInfoRec DUMMYOptions[] = {
    125131    { OPTION_SW_CURSOR, "SWcursor",     OPTV_BOOLEAN,   {0}, FALSE },
     132#ifdef RANDR
     133    { OPTION_CONSTANT_DPI,      "ConstantDPI",  OPTV_BOOLEAN,   {0}, FALSE },
     134#endif
    126135    { -1,                  NULL,           OPTV_NONE,   {0}, FALSE }
    127136};
    128137
    DUMMYPreInit(ScrnInfoPtr pScrn, int flags) 
    362371    xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, dPtr->Options);
    363372
    364373    xf86GetOptValBool(dPtr->Options, OPTION_SW_CURSOR,&dPtr->swCursor);
     374    xf86GetOptValBool(dPtr->Options, OPTION_CONSTANT_DPI, &dPtr->constantDPI);
    365375
    366376    if (device->videoRam != 0) {
    367377        pScrn->videoRam = device->videoRam;
    Bool 
    666676DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL)
    667677{
    668678    SCRN_INFO_PTR(arg);
    669     return dummyModeInit(pScrn, mode);
     679    if (!dummyModeInit(pScrn, mode))
     680        return FALSE;
     681#ifdef RANDR
     682    DUMMYPtr dPtr = DUMMYPTR(pScrn);
     683    if (dPtr->constantDPI) {
     684        //25.4 mm per inch: (254/10)
     685        pScrn->pScreen->mmWidth = mode->HDisplay * 254 / pScrn->xDpi / 10;
     686        pScrn->pScreen->mmHeight = mode->VDisplay * 254 / pScrn->yDpi / 10;
     687        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "mm(dpi %ix%i)=%ix%i", pScrn->xDpi, pScrn->yDpi, pScrn->pScreen->mmWidth, pScrn->pScreen->mmHeight);
     688        RRScreenSizeNotify(pScrn->pScreen);
     689        RRTellChanged(pScrn->pScreen);
     690    }
     691#endif
     692    return TRUE;
    670693}
    671694
    672695/* Mandatory */