summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Allum <breakfast@10.am>2004-09-01 11:13:36 +0000
committerMatthew Allum <breakfast@10.am>2004-09-01 11:13:36 +0000
commit7c0aaa53bf8dcf3d0a8c9e78d31cf62b1766fb35 (patch)
tree90a32e297854aea2af5e7113f66a7f3fa9b19aaa
parent16ff3a872731633b6f1f4920f793153722026189 (diff)
'-dpi' fixes for Xephyr
-rw-r--r--hw/kdrive/ephyr/ephyr.c20
-rw-r--r--hw/kdrive/ephyr/hostx.c33
-rw-r--r--hw/kdrive/ephyr/hostx.h6
3 files changed, 22 insertions, 37 deletions
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index ffee350c3..a105b284d 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -83,9 +83,10 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
screen->height = height;
}
- screen->width_mm = screen->width * hostx_mm_per_pixel_horizontal();
- screen->height_mm = screen->height * hostx_mm_per_pixel_vertical();
-
+
+ if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
+ ErrorF("\nXephyr screen depth must match hosts, ignoring.\n");
+
screen->fb[0].depth = hostx_get_depth();
screen->rate = 72;
@@ -345,16 +346,17 @@ ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
RRRegisterSize (pScreen,
sizes[n].width,
- sizes[n].height,
- sizes[n].width * hostx_mm_per_pixel_horizontal(),
- sizes[n].height * hostx_mm_per_pixel_vertical());
+ sizes[n].height,
+ (sizes[n].width * screen->width_mm)/screen->width,
+ (sizes[n].height *screen->height_mm)/screen->height
+ );
n++;
}
}
pSize = RRRegisterSize (pScreen,
screen->width,
- screen->height,
+ screen->height,
screen->width_mm,
screen->height_mm);
@@ -372,8 +374,8 @@ ephyrRandRSetConfig (ScreenPtr pScreen,
RRScreenSizePtr pSize)
{
KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
- EphyrScrPriv *scrpriv = screen->driver;
+ KdScreenInfo *screen = pScreenPriv->screen;
+ EphyrScrPriv *scrpriv = screen->driver;
Bool wasEnabled = pScreenPriv->enabled;
EphyrScrPriv oldscr;
int oldwidth;
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index f02978727..3274e166c 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -57,8 +57,6 @@ struct EphyrHostXVars
int depth;
XImage *ximg;
int win_width, win_height;
- double mm_per_pixel_vertical, mm_per_pixel_horizontal;
-
Bool use_host_cursor;
Bool have_shm;
long damage_debug_nsec;
@@ -78,6 +76,7 @@ extern int kdMaxScanCode;
extern int kdMinKeyCode;
extern int kdMaxKeyCode;
extern int kdKeymapWidth;
+extern int monitorResolution;
/* X Error traps */
@@ -189,11 +188,13 @@ hostx_init(void)
HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
+ /* old way of getting dpi
HostX.mm_per_pixel_vertical = (double)DisplayHeightMM(HostX.dpy, HostX.screen)
/ DisplayHeight(HostX.dpy, HostX.screen);
HostX.mm_per_pixel_horizontal = (double)DisplayWidthMM(HostX.dpy, HostX.screen)
/ DisplayWidth(HostX.dpy, HostX.screen);
+ */
if (HostX.win_pre_existing != None)
{
@@ -222,14 +223,14 @@ hostx_init(void)
else
{
HostX.win = XCreateWindow(HostX.dpy,
- HostX.winroot,
- 0,0,100,100, /* will resize */
- 0,
- CopyFromParent,
- CopyFromParent,
- CopyFromParent,
- CWEventMask,
- &attr);
+ HostX.winroot,
+ 0,0,100,100, /* will resize */
+ 0,
+ CopyFromParent,
+ CopyFromParent,
+ CopyFromParent,
+ CWEventMask,
+ &attr);
XStoreName(HostX.dpy, HostX.win, "Xephyr");
}
@@ -321,18 +322,6 @@ hostx_get_visual_masks (unsigned long *rmsk,
*bmsk = HostX.visual->blue_mask;
}
-double
-hostx_mm_per_pixel_vertical(void)
-{
- return HostX.mm_per_pixel_vertical;
-}
-
-double
-hostx_mm_per_pixel_horizontal(void)
-{
- return HostX.mm_per_pixel_horizontal;
-}
-
void*
hostx_screen_init (int width, int height)
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index 69607e73d..44d2d74b4 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -111,12 +111,6 @@ hostx_get_visual_masks (unsigned long *rmsk,
unsigned long *gmsk,
unsigned long *bmsk);
-double
-hostx_mm_per_pixel_vertical(void);
-
-double
-hostx_mm_per_pixel_horizontal(void);
-
void*
hostx_screen_init (int width, int height);