diff --git a/x11-misc/wmres/Manifest b/x11-misc/wmres/Manifest new file mode 100644 index 0000000..242d9fb --- /dev/null +++ b/x11-misc/wmres/Manifest @@ -0,0 +1,3 @@ +AUX Makefile 93 RMD160 af42229f5f958a772f2918a895f2777469535224 SHA1 891848d68ba454cb4bb4f55d83b7348485121c50 SHA256 afef91df0fbc76d714ea55b110b0a3c0a36f6dab6c2ad658e6cfec2e90d8cf64 +AUX wmres.c 2193 RMD160 1c546a5cab6ec3ecacb9c90227ead43a56d76413 SHA1 45a0836f9b4af1222601087ddd5f61f270922868 SHA256 38c7a478a7d6c76188656ce567601094b279658c0e17742475703e9655633f4f +EBUILD wmres-1.ebuild 679 RMD160 89634291e21a46a018cd0953f8c5761af3a3c225 SHA1 d35143b6314e93e8ed81d5650d3ed21c9a109ec7 SHA256 45c5bf2c5d34890f1994361a691aac0412b36b1391ba052883cbc4c7ccc8a701 diff --git a/x11-misc/wmres/files/Makefile b/x11-misc/wmres/files/Makefile new file mode 100644 index 0000000..7d746ef --- /dev/null +++ b/x11-misc/wmres/files/Makefile @@ -0,0 +1,5 @@ +all: + gcc -o wmres wmres.c -L/usr/lib -lXxf86vm -lXmu -lX11 + strip -g wmres +clean: + rm wmres diff --git a/x11-misc/wmres/files/wmres.c b/x11-misc/wmres/files/wmres.c new file mode 100644 index 0000000..800121b --- /dev/null +++ b/x11-misc/wmres/files/wmres.c @@ -0,0 +1,65 @@ +/* + * WMRES -- A display resolution changer for the Window Maker menu + * Thrown together by Sam Brauer (sam@webslingerZ.com) 01-APR-1999 + * Set this up as an external menu whose definition is read from a pipe. + * I ripped the vidmode code from Ian Moore's gtkuickres program. + * He in turn ripped it from Adam Kopacz's xvidmode. + * Thanks guys!!! + * + * Modified by Laurent Julliard - - + * - 2002-09-12 Also display the vertical Frequency next to the Video + * mode. This is very useful when one have the same resolution with + * different refresh rate to drive either a monitor or an external + * video projector (useful for laptop users like me :-) + * + * Compilation instructions: + * gcc -o wmres wmres.c -L/usr/X11R6/lib -lXxf86vm -lXmu -lX11 + * or maybe + * gcc -o wmres wmres.c -L/usr/X11/lib -lXxf86vm -lXmu -lX11 + * It depends on your system/distribution where the X libraries are located. + */ +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + Display *dpy; + XF86VidModeModeInfo **vm_modelines; + int vm_count; + + int i; + unsigned int width, height, dotclock; + + dpy=XOpenDisplay(""); + XF86VidModeGetAllModeLines(dpy,XDefaultScreen(dpy),&vm_count,&vm_modelines); + if(!(vm_count)) { + fprintf(stderr,"error: no video modes found\n"); + exit(1); + } + + if(argc > 3) { + width = atoi(argv[1]); + height = atoi(argv[2]); + dotclock = atoi(argv[3]); + + for(i=0; i < vm_count; i++) { + if(vm_modelines[i]->hdisplay==width && vm_modelines[i]->vdisplay==height && vm_modelines[i]->dotclock==dotclock) { + XF86VidModeSwitchToMode(dpy,XDefaultScreen(dpy),vm_modelines[i]); + XFlush(dpy); + return 0; + } + } + } + + printf("\"Resolutions\" MENU\n"); + for(i=0; i < vm_count; i++) { + unsigned int vfreq = (vm_modelines[i]->dotclock*1000)/(vm_modelines[i]->htotal*vm_modelines[i]->vtotal); + printf("\"%dx%d %dHz\" EXEC %s %d %d %d\n",vm_modelines[i]->hdisplay,vm_modelines[i]->vdisplay, vfreq, argv[0], vm_modelines[i]->hdisplay, vm_modelines[i]->vdisplay, vm_modelines[i]->dotclock); + } + printf("\"Resolutions\" END\n"); + return 0; +} + + diff --git a/x11-misc/wmres/wmres-1.ebuild b/x11-misc/wmres/wmres-1.ebuild new file mode 100644 index 0000000..679ad71 --- /dev/null +++ b/x11-misc/wmres/wmres-1.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-util/lockrun/lockrun-2.ebuild,v 1.7 2010/08/11 01:00:23 jer Exp $ + +inherit toolchain-funcs + +DESCRIPTION="A display resolution changer for the Window Maker menu" +HOMEPAGE="?" + +LICENSE="public-domain" +SLOT="0" +KEYWORDS="amd64 hppa x86" +IUSE="" + +RESTRICT="test" + +DEPEND="" +RDEPEND="${DEPEND}" + +S="${WORKDIR}" + +src_unpack() { + cp "${FILESDIR}"/wmres.c "${S}"/wmres.c + cp -f "${FILESDIR}"/Makefile "${S}" || die + + sed -i '/#include /a\ +#include ' "${S}"/wmres.c + + tc-export CC +} + +src_install () { + dobin ${PN} || die +}