ssh-askpass(1): fix indicator size with multiple screens

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ssh-askpass(1): fix indicator size with multiple screens

Matthieu Herrb-3
Hi,

ssh-askpass(1) is trying to be clever and computes the size of its
indicator relatively to the screen resolution.

Unfortunatly, when multiple screens are present, this gets ugly. The
support for Xinerama correctly computes the dimensions of the window
to be created, relatively to the screen on which it will appear, but
the computation of the indicator size is based on the size of the
whole display, resulting in too small indicators (and too many of them
if the screens hare layed out horizontally).

The patch below fixes that by computing the resolution of the whole
display before taking xinerama into account.

A better fix would be to make this application really aware of XRandR
and use the actual screen resolution from XRandR; this is an
interesting project, if anyone wants to give it a try.

ok?

Index: x11-ssh-askpass.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/ssh-askpass/x11-ssh-askpass.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 x11-ssh-askpass.c
--- x11-ssh-askpass.c 24 Apr 2015 02:19:41 -0000 1.6
+++ x11-ssh-askpass.c 9 Jun 2019 14:32:59 -0000
@@ -1507,6 +1507,12 @@ int main(int argc, char **argv)
    app.screen_height = HeightOfScreen(app.screen);
    app.screen_xoffset = 0;
    app.screen_yoffset = 0;
+
+   app.xResolution =
+      app.screen_width * 1000 / WidthMMOfScreen(app.screen);
+   app.yResolution =
+      app.screen_height * 1000 / HeightMMOfScreen(app.screen);
+
    if (XineramaIsActive(app.dpy) &&
       (screens = XineramaQueryScreens(app.dpy, &nscreens)) != NULL &&
       nscreens) {
@@ -1516,11 +1522,6 @@ int main(int argc, char **argv)
       app.screen_yoffset = screens[0].y_org;
       XFree(screens);
    }
-
-   app.xResolution =
-      app.screen_width * 1000 / WidthMMOfScreen(app.screen);
-   app.yResolution =
-      app.screen_height * 1000 / HeightMMOfScreen(app.screen);
 
    createDialog(&app);
    createGCs(&app);

--
Matthieu Herrb

Reply | Threaded
Open this post in threaded view
|

Re: ssh-askpass(1): fix indicator size with multiple screens

Matthieu Herrb-3
On Sun, Jun 09, 2019 at 04:47:53PM +0200, Matthieu Herrb wrote:

> Hi,
>
> ssh-askpass(1) is trying to be clever and computes the size of its
> indicator relatively to the screen resolution.
>
> Unfortunatly, when multiple screens are present, this gets ugly. The
> support for Xinerama correctly computes the dimensions of the window
> to be created, relatively to the screen on which it will appear, but
> the computation of the indicator size is based on the size of the
> whole display, resulting in too small indicators (and too many of them
> if the screens hare layed out horizontally).
>
> The patch below fixes that by computing the resolution of the whole
> display before taking xinerama into account.
>
> A better fix would be to make this application really aware of XRandR
> and use the actual screen resolution from XRandR; this is an
> interesting project, if anyone wants to give it a try.
>
> ok?

ping

>
> Index: x11-ssh-askpass.c
> ===================================================================
> RCS file: /cvs/OpenBSD/xenocara/app/ssh-askpass/x11-ssh-askpass.c,v
> retrieving revision 1.6
> diff -u -p -u -r1.6 x11-ssh-askpass.c
> --- x11-ssh-askpass.c 24 Apr 2015 02:19:41 -0000 1.6
> +++ x11-ssh-askpass.c 9 Jun 2019 14:32:59 -0000
> @@ -1507,6 +1507,12 @@ int main(int argc, char **argv)
>     app.screen_height = HeightOfScreen(app.screen);
>     app.screen_xoffset = 0;
>     app.screen_yoffset = 0;
> +
> +   app.xResolution =
> +      app.screen_width * 1000 / WidthMMOfScreen(app.screen);
> +   app.yResolution =
> +      app.screen_height * 1000 / HeightMMOfScreen(app.screen);
> +
>     if (XineramaIsActive(app.dpy) &&
>        (screens = XineramaQueryScreens(app.dpy, &nscreens)) != NULL &&
>        nscreens) {
> @@ -1516,11 +1522,6 @@ int main(int argc, char **argv)
>        app.screen_yoffset = screens[0].y_org;
>        XFree(screens);
>     }
> -
> -   app.xResolution =
> -      app.screen_width * 1000 / WidthMMOfScreen(app.screen);
> -   app.yResolution =
> -      app.screen_height * 1000 / HeightMMOfScreen(app.screen);
>  
>     createDialog(&app);
>     createGCs(&app);
>
> --
> Matthieu Herrb

--
Matthieu Herrb

Reply | Threaded
Open this post in threaded view
|

Re: ssh-askpass(1): fix indicator size with multiple screens

Damien Miller


On Sun, 16 Jun 2019, Matthieu Herrb wrote:

> On Sun, Jun 09, 2019 at 04:47:53PM +0200, Matthieu Herrb wrote:
> > Hi,
> >
> > ssh-askpass(1) is trying to be clever and computes the size of its
> > indicator relatively to the screen resolution.
> >
> > Unfortunatly, when multiple screens are present, this gets ugly. The
> > support for Xinerama correctly computes the dimensions of the window
> > to be created, relatively to the screen on which it will appear, but
> > the computation of the indicator size is based on the size of the
> > whole display, resulting in too small indicators (and too many of them
> > if the screens hare layed out horizontally).
> >
> > The patch below fixes that by computing the resolution of the whole
> > display before taking xinerama into account.
> >
> > A better fix would be to make this application really aware of XRandR
> > and use the actual screen resolution from XRandR; this is an
> > interesting project, if anyone wants to give it a try.
> >
> > ok?
>
> ping

ok djm. Is there an upstream for ssh-askpass? The old one I have
http://www.jmknoble.net/software/x11-ssh-askpass/ doesn't resolve any more.

-d

Reply | Threaded
Open this post in threaded view
|

Re: ssh-askpass(1): fix indicator size with multiple screens

Matthieu Herrb-3
On Sun, Jun 16, 2019 at 09:55:24PM +1000, Damien Miller wrote:

>
>
> On Sun, 16 Jun 2019, Matthieu Herrb wrote:
>
> > On Sun, Jun 09, 2019 at 04:47:53PM +0200, Matthieu Herrb wrote:
> > > Hi,
> > >
> > > ssh-askpass(1) is trying to be clever and computes the size of its
> > > indicator relatively to the screen resolution.
> > >
> > > Unfortunatly, when multiple screens are present, this gets ugly. The
> > > support for Xinerama correctly computes the dimensions of the window
> > > to be created, relatively to the screen on which it will appear, but
> > > the computation of the indicator size is based on the size of the
> > > whole display, resulting in too small indicators (and too many of them
> > > if the screens hare layed out horizontally).
> > >
> > > The patch below fixes that by computing the resolution of the whole
> > > display before taking xinerama into account.
> > >
> > > A better fix would be to make this application really aware of XRandR
> > > and use the actual screen resolution from XRandR; this is an
> > > interesting project, if anyone wants to give it a try.
> > >
> > > ok?
> >
> > ping
>
> ok djm.

Thanks,

> Is there an upstream for ssh-askpass? The old one I have
> http://www.jmknoble.net/software/x11-ssh-askpass/ doesn't resolve any more.

I have the same (dead) reference in /usr/xenocara/3RDPARTY and google
can't find any newer home, except
https://github.com/sigmavirus24/x11-ssh-askpass but it's just a mirror
of the original code, without anything new.

--
Matthieu Herrb