535N/A--- src/Makefile.am 2008-08-26 09:58:57.225299000 -0700
535N/A+++ src/Makefile.am.new 2008-08-26 10:08:24.257125000 -0700
535N/A@@ -17,6 +17,7 @@ libXp_la_SOURCES = \
535N/A XpPrinter.c \
535N/A XpPutData.c \
535N/A XpScreens.c \
535N/A+ XpDpi.c \
535N/A \
535N/A XpExtUtil.h
535N/A
535N/A--- src/XpDpi.c 1969-12-31 16:00:00.000000000 -0800
535N/A+++ src/XpDpi.c.new 2008-08-26 13:44:31.473701000 -0700
1370N/A@@ -0,0 +1,101 @@
535N/A+/* $XConsortium: XpDpi.c /main/4 1996/12/04 10:24:31 lehors $ */
535N/A+/******************************************************************************
535N/A+ ******************************************************************************
535N/A+ **
535N/A+ ** (c) Copyright 1996 Hewlett-Packard Company
535N/A+ ** (c) Copyright 1996 International Business Machines Corp.
943N/A+ ** (c) Copyright 1996, Oracle and/or its affiliates. All rights reserved.
535N/A+ ** (c) Copyright 1996 Novell, Inc.
535N/A+ ** (c) Copyright 1996 Digital Equipment Corp.
535N/A+ ** (c) Copyright 1996 Fujitsu Limited
535N/A+ ** (c) Copyright 1996 Hitachi, Ltd.
535N/A+ **
535N/A+ ** Permission is hereby granted, free of charge, to any person obtaining a copy
535N/A+ ** of this software and associated documentation files (the "Software"), to deal
535N/A+ ** in the Software without restriction, including without limitation the rights
535N/A+ ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
535N/A+ ** copies of the Software, and to permit persons to whom the Software is
535N/A+ ** furnished to do so, subject to the following conditions:
535N/A+ **
535N/A+ ** The above copyright notice and this permission notice shall be included in
535N/A+ ** all copies or substantial portions of the Software.
535N/A+ **
535N/A+ ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
535N/A+ ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
535N/A+ ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
535N/A+ ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
535N/A+ ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
535N/A+ ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
535N/A+ **
535N/A+ ** Except as contained in this notice, the names of the copyright holders shall
535N/A+ ** not be used in advertising or otherwise to promote the sale, use or other
535N/A+ ** dealings in this Software without prior written authorization from said
535N/A+ ** copyright holders.
535N/A+ **
535N/A+ ******************************************************************************
535N/A+ *****************************************************************************/
1370N/A+#ifdef HAVE_CONFIG_H
1370N/A+#include <config.h>
1370N/A+#endif
535N/A+#include <X11/extensions/Printstr.h>
1233N/A+#include "XpExtUtil.h"
535N/A+#include <X11/Xlibint.h>
1233N/A+#include <X11/Xos.h>
535N/A+#include <limits.h>
535N/A+#ifndef WIN32
535N/A+#define X_INCLUDE_PWD_H
535N/A+#define XOS_USE_XLIB_LOCKING
535N/A+#include <X11/Xos_r.h>
535N/A+#endif
535N/A+#include <limits.h>
535N/A+
535N/A+
535N/A+Bool
535N/A+XpClientDPI (
535N/A+ Display *dpy,
535N/A+ int client_dpi
535N/A+)
535N/A+{
535N/A+ xPrintClientDpiReq *req;
535N/A+ xPrintClientDpiReply rep;
535N/A+ XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
535N/A+ short dpi = (short)client_dpi;
535N/A+
535N/A+ XPContext context;
535N/A+
535N/A+ if (XpCheckExtInit(dpy, XP_SECOND_RELEASE) == -1)
535N/A+ return (False); /* NoSuchExtension */
535N/A+
535N/A+ LockDisplay (dpy);
535N/A+
535N/A+ GetReq(PrintClientDpi,req);
535N/A+ req->reqType = info->codes->major_opcode;
535N/A+ req->printReqType = X_PrintClientDpi;
535N/A+ req->clientDPI = (CARD16) dpi;
535N/A+
535N/A+ if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) {
535N/A+ UnlockDisplay (dpy);
535N/A+ SyncHandle ();
535N/A+ return (False);
535N/A+ }
535N/A+
535N/A+ UnlockDisplay(dpy);
535N/A+ SyncHandle ();
535N/A+
535N/A+ return ( rep.status );
535N/A+}
535N/A+
535N/A+/*
535N/A+ * Bug 4402782: Add Sun specific propietary call until X.Org takes the
535N/A+ * change.
535N/A+ */
535N/A+#ifdef SUNSOFT
535N/A+Bool
535N/A+XpClientDPI_SUNW (
535N/A+ Display *dpy,
535N/A+ int client_dpi
535N/A+)
535N/A+{
535N/A+ return XpClientDPI(dpy, client_dpi);
535N/A+}
535N/A+#endif