Hi and best wishes for 2010,
When running on a mutliheaded display, either with Xinerama or with
XRandr, there's no warranty that the Xinerama pseudo screen 0 will be
in (0,0). It can be at any offset. Currently ssh-askpass assumes that
screen 0 is always at (0,0).
If all your monitors have the same pixel size, the only effect of this
is that ssh-askpass will always appear on the leftmost one. I have a
smaller monitor on the left, and whithout the attached patch,
ssh-askpass appears at a strange position on it.
This patch makes ssh-askpass appear at the expected position on the
pseudo screen 0.
There's still a problem with the resolution computation in the case of
XRandR. it will have to be fixed by making ssh-askpass XRandR aware.
ok?
Index: x11-ssh-askpass.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/ssh-askpass/x11-ssh-askpass.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 x11-ssh-askpass.c
--- x11-ssh-askpass.c 14 Jun 2008 01:05:04 -0000 1.4
+++ x11-ssh-askpass.c 1 Jan 2010 13:11:39 -0000
@@ -698,8 +698,8 @@ void createDialog(AppInfo *app)
calcButtonLabelPosition(&(d->okButton));
calcButtonLabelPosition(&(d->cancelButton));
- d->w3.w.x = (app->screen_width - d->w3.w.width) / 2;
- d->w3.w.y = (app->screen_height - d->w3.w.height) / 3;
+ d->w3.w.x = app->screen_xoffset + (app->screen_width - d->w3.w.width) / 2;
+ d->w3.w.y = app->screen_yoffset + (app->screen_height - d->w3.w.height) / 3;
app->dialog = d;
}
@@ -1504,11 +1504,15 @@ int main(int argc, char **argv)
app.screen_width = WidthOfScreen(app.screen);
app.screen_height = HeightOfScreen(app.screen);
+ app.screen_xoffset = 0;
+ app.screen_yoffset = 0;
if (XineramaIsActive(app.dpy) &&
(screens = XineramaQueryScreens(app.dpy, &nscreens)) != NULL &&
nscreens) {
app.screen_width = screens[0].width;
app.screen_height = screens[0].height;
+ app.screen_xoffset = screens[0].x_org;
+ app.screen_yoffset = screens[0].y_org;
XFree(screens);
}
Index: x11-ssh-askpass.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/ssh-askpass/x11-ssh-askpass.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 x11-ssh-askpass.h
--- x11-ssh-askpass.h 14 Jun 2008 01:05:04 -0000 1.3
+++ x11-ssh-askpass.h 1 Jan 2010 13:11:39 -0000
@@ -160,6 +160,8 @@ typedef struct
Screen *screen;
long screen_width;
long screen_height;
+ long screen_xoffset;
+ long screen_yoffset;
Window rootWindow;
Pixel black;
Pixel white;
--
Matthieu Herrb