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-ifdefed-constified.diff

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

same but constified (cleaner)

  • 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..fef0c57 100644
    a b  
    3434#include <X11/extensions/Xv.h>
    3535#endif
    3636
     37#ifdef RANDR
     38#include "randrstr.h"
     39#define CONSTANT_DPI 96
     40#endif
     41
    3742/*
    3843 * Driver data structures.
    3944 */
    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        pScrn->pScreen->mmWidth = mode->HDisplay * 254 / CONSTANT_DPI /10;
     685        pScrn->pScreen->mmHeight = mode->VDisplay * 254 / CONSTANT_DPI /10;
     686        RRScreenSizeNotify(pScrn->pScreen);
     687        RRTellChanged(pScrn->pScreen);
     688    }
     689#endif
     690    return TRUE;
    670691}
    671692
    672693/* Mandatory */