From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: x-display-pixel-width/height inconsistency Date: Wed, 1 May 2013 11:58:15 +0200 Message-ID: <02B98FCD-71DB-47EC-B58B-41A2539FF61A@swipnet.se> References: <514A5DE1.10009@gmx.de> <831ub767wf.fsf@gnu.org> <83mwtu4p7c.fsf@gnu.org> <83vc8h313t.fsf@gnu.org> <5073D6B8-95E4-4012-AA74-106F428379DC@swipnet.se> <8BD4B041-5A3F-4D7C-AFD3-E997E194AA9D@swipnet.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_5FF547F5-3255-4237-A81C-B9754DAE3D78" X-Trace: ger.gmane.org 1367402316 14621 80.91.229.3 (1 May 2013 09:58:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 May 2013 09:58:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 01 11:58:34 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UXTo1-0000mV-Gz for ged-emacs-devel@m.gmane.org; Wed, 01 May 2013 11:58:33 +0200 Original-Received: from localhost ([::1]:55392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXTo1-0003IF-7v for ged-emacs-devel@m.gmane.org; Wed, 01 May 2013 05:58:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXTnq-000371-No for emacs-devel@gnu.org; Wed, 01 May 2013 05:58:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXTno-0004Z1-V7 for emacs-devel@gnu.org; Wed, 01 May 2013 05:58:22 -0400 Original-Received: from mailout.melmac.se ([62.20.26.67]:65083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXTno-0004XO-GD for emacs-devel@gnu.org; Wed, 01 May 2013 05:58:20 -0400 Original-Received: from mail01.melmac.se (mail01.melmac.se [62.20.26.80]) by mailout.melmac.se (Postfix) with ESMTP id 858E4925B for ; Wed, 1 May 2013 11:58:15 +0200 (CEST) Original-Received: (qmail 22445 invoked by uid 89); 1 May 2013 09:57:07 -0000 Original-Received: from unknown (HELO coolsville.localdomain) (boel.djarv@bdtv.se@176.10.223.235) by mail01.melmac.se with ESMTPA; 1 May 2013 09:57:07 -0000 Original-Received: from [172.20.199.13] (unknown [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 08D5C1A1CB6; Wed, 1 May 2013 09:58:18 +0000 (UTC) In-Reply-To: X-Mailer: Apple Mail (2.1503) X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 62.20.26.67 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159234 Archived-At: --Apple-Mail=_5FF547F5-3255-4237-A81C-B9754DAE3D78 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-7 Hello. 29 apr 2013 kl. 04:27 skrev YAMAMOTO Mitsuharu = : > I found a couple of trivial mistakes in the patch: >=20 > * In x_get_monitor_attributes: > `XRenderQueryExtension' should be `XRRQueryExtension'. >=20 > * In x_make_monitor_attribute_list: > `return attributes_list' is missing at the end. >=20 Good, I've fixed those in the new patch (attached). > This guess was not right. GDK rejects XRandR in Xquartz and uses > Xinerama instead. The distinction is made by comparing the output > name with "default". >=20 > in init_randr13 (gdkscreen-x11.c): >=20 > XRROutputInfo *output =3D > XRRGetOutputInfo (dpy, resources, resources->outputs[i]); >=20 > /* Non RandR1.2 X driver have output name "default" */ > randr12_compat |=3D !g_strcmp0 (output->name, "default"); I did not know that. I've made adjustments for this in the patch, = tested on XQuartz which indeed does not seem to have a 1.2-compatible = driver. Strange that. I also added name and source (the latter mostly for debugging) to the = Lisp structure returned. I also check for XRRGetScreenResourcesCurrent in configure as that is a = 1.3 version function. Jan D. --Apple-Mail=_5FF547F5-3255-4237-A81C-B9754DAE3D78 Content-Disposition: attachment; filename=randr.diff Content-Type: application/octet-stream; name="randr.diff" Content-Transfer-Encoding: quoted-printable =3D=3D=3D=20modified=20file=20'configure.ac'=0A---=20configure.ac=09= 2013-04-26=2019:31:09=20+0000=0A+++=20configure.ac=092013-05-01=20= 09:53:07=20+0000=0A@@=20-2814,6=20+2814,57=20@@=0A=20fi=0A=20= AC_SUBST(LIBXSM)=0A=20=0A+###=20Use=20XRandr=20(-lXrandr)=20if=20= available=0A+HAVE_XRANDR=3Dno=0A+if=20test=20"${HAVE_X11}"=20=3D=20= "yes";=20then=0A+=20=20XRANDR_REQUIRED=3D1.2.2=0A+=20=20= XRANDR_MODULES=3D"xrandr=20>=3D=20$XRANDR_REQUIRED"=0A+=20=20= PKG_CHECK_MODULES(XRANDR,=20$XRANDR_MODULES,=20HAVE_XRANDR=3Dyes,=20= HAVE_XRANDR=3Dno)=0A+=20=20if=20test=20$HAVE_XRANDR=20=3D=20no;=20then=0A= +=20=20=20=20#=20Test=20old=20way=20in=20case=20pkg-config=20doesn't=20= have=20it=20(older=20machines).=0A+=20=20=20=20= AC_CHECK_HEADER(X11/extensions/Xrandr.h,=0A+=20=20=20=20=20=20= [AC_CHECK_LIB(XRANDR,=20XRRQueryExtension,=20HAVE_XRANDR=3Dyes,=20,=20= -lXrandr)])=0A+=20=20=20=20if=20test=20$HAVE_XRANDR=20=3D=20yes;=20then=0A= +=20=20=20=20=20=20XRANDR_LIBS=3D-lXrandr=0A+=20=20=20=20=20=20= AC_SUBST(XRANDR_LIBS)=0A+=20=20=20=20fi=0A+=20=20fi=0A+=20=20if=20test=20= $HAVE_XRANDR=20=3D=20yes;=20then=0A+=20=20=20=20SAVE_CFLAGS=3D"$CFLAGS"=0A= +=20=20=20=20SAVE_LIBS=3D"$LIBS"=0A+=20=20=20=20CFLAGS=3D"$XRANDR_CFLAGS=20= $CFLAGS"=0A+=20=20=20=20LIBS=3D"$XRANDR_LIBS=20$LIBS"=0A+=20=20=20=20= AC_CHECK_FUNCS(XRRGetOutputPrimary=20XRRGetScreenResourcesCurrent)=0A+=20= =20=20=20CFLAGS=3D"$SAVE_CFLAGS"=0A+=20=20=20=20LIBS=3D"$SAVE_LIBS"=0A+=0A= +=20=20=20=20AC_DEFINE(HAVE_XRANDR,=201,=20[Define=20to=201=20if=20you=20= have=20the=20XRandr=20extension.])=0A+=20=20fi=0A+fi=0A+=0A+###=20Use=20= Xinerama=20(-lXinerama)=20if=20available=0A+HAVE_XINERAMA=3Dno=0A+if=20= test=20"${HAVE_X11}"=20=3D=20"yes";=20then=0A+=20=20= XINERAMA_REQUIRED=3D1.0.2=0A+=20=20XINERAMA_MODULES=3D"xinerama=20>=3D=20= $XINERAMA_REQUIRED"=0A+=20=20PKG_CHECK_MODULES(XINERAMA,=20= $XINERAMA_MODULES,=20HAVE_XINERAMA=3Dyes,=20=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20HAVE_XINERAMA=3Dno)=0A+=20=20if=20test=20= $HAVE_XINERAMA=20=3D=20no;=20then=0A+=20=20=20=20#=20Test=20old=20way=20= in=20case=20pkg-config=20doesn't=20have=20it=20(older=20machines).=0A+=20= =20=20=20AC_CHECK_HEADER(X11/extensions/Xrandr.h,=0A+=20=20=20=20=20=20= [AC_CHECK_LIB(XINERAMA,=20XineramaQueryExtension,=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20HAVE_XINERAMA=3Dyes,=20,=20= -lXinerama)])=0A+=20=20=20=20if=20test=20$HAVE_XINERAMA=20=3D=20yes;=20= then=0A+=20=20=20=20=20=20XINERAMA_LIBS=3D-lXinerama=0A+=20=20=20=20=20=20= AC_SUBST(XINERAMA_LIBS)=0A+=20=20=20=20fi=0A+=20=20fi=0A+=20=20if=20test=20= $HAVE_XINERAMA=20=3D=20yes;=20then=0A+=20=20=20=20= AC_DEFINE(HAVE_XINERAMA,=201,=20[Define=20to=201=20if=20you=20have=20the=20= Xinerama=20extension.])=0A+=20=20fi=0A+fi=0A+=0A+=0A=20###=20Use=20= libxml=20(-lxml2)=20if=20available=0A=20HAVE_LIBXML2=3Dno=0A=20if=20test=20= "${with_xml2}"=20!=3D=20"no";=20then=0A=0A=3D=3D=3D=20modified=20file=20= 'src/Makefile.in'=0A---=20src/Makefile.in=092013-04-22=2005:18:30=20= +0000=0A+++=20src/Makefile.in=092013-04-28=2017:17:40=20+0000=0A@@=20= -232,6=20+232,12=20@@=0A=20LIBXML2_LIBS=20=3D=20@LIBXML2_LIBS@=0A=20= LIBXML2_CFLAGS=20=3D=20@LIBXML2_CFLAGS@=0A=20=0A+XRANDR_LIBS=20=3D=20= @XRANDR_LIBS@=0A+XRANDR_CFLAGS=20=3D=20@XRANDR_CFLAGS@=0A+=0A= +XINERAMA_LIBS=20=3D=20@XINERAMA_LIBS@=0A+XINERAMA_CFLAGS=20=3D=20= @XINERAMA_CFLAGS@=0A+=0A=20##=20widget.o=20if=20USE_X_TOOLKIT,=20= otherwise=20empty.=0A=20WIDGET_OBJ=3D@WIDGET_OBJ@=0A=20=0A@@=20-315,7=20= +321,7=20@@=0A=20=20=20-I$(lib)=20-I$(srcdir)/../lib=20\=0A=20=20=20= $(C_SWITCH_MACHINE)=20$(C_SWITCH_SYSTEM)=20$(C_SWITCH_X_SITE)=20\=0A=20=20= =20$(GNUSTEP_CFLAGS)=20$(CFLAGS_SOUND)=20$(RSVG_CFLAGS)=20= $(IMAGEMAGICK_CFLAGS)=20\=0A-=20=20$(LIBXML2_CFLAGS)=20$(DBUS_CFLAGS)=20= \=0A+=20=20$(LIBXML2_CFLAGS)=20$(DBUS_CFLAGS)=20$(XRANDR_CFLAGS)=20= $(XINERAMA_CFLAGS)=20\=0A=20=20=20$(SETTINGS_CFLAGS)=20= $(FREETYPE_CFLAGS)=20$(FONTCONFIG_CFLAGS)=20\=0A=20=20=20= $(LIBOTF_CFLAGS)=20$(M17N_FLT_CFLAGS)=20$(DEPFLAGS)=20\=0A=20=20=20= $(LIBGNUTLS_CFLAGS)=20\=0A@@=20-393,7=20+399,7=20@@=0A=20=20=20=20= $(LIBX_OTHER)=20$(LIBSOUND)=20\=0A=20=20=20=20$(RSVG_LIBS)=20= $(IMAGEMAGICK_LIBS)=20$(LIB_CLOCK_GETTIME)=20\=0A=20=20=20=20= $(LIB_EACCESS)=20$(LIB_FDATASYNC)=20$(LIB_TIMER_TIME)=20$(DBUS_LIBS)=20\=0A= -=20=20=20$(LIB_EXECINFO)=20\=0A+=20=20=20$(LIB_EXECINFO)=20= $(XRANDR_LIBS)=20$(XINERAMA_LIBS)=20\=0A=20=20=20=20$(LIBXML2_LIBS)=20= $(LIBGPM)=20$(LIBRESOLV)=20$(LIBS_SYSTEM)=20\=0A=20=20=20=20= $(LIBS_TERMCAP)=20$(GETLOADAVG_LIBS)=20$(SETTINGS_LIBS)=20= $(LIBSELINUX_LIBS)=20\=0A=20=20=20=20$(FREETYPE_LIBS)=20= $(FONTCONFIG_LIBS)=20$(LIBOTF_LIBS)=20$(M17N_FLT_LIBS)=20\=0A=0A=3D=3D=3D=20= modified=20file=20'src/xfns.c'=0A---=20src/xfns.c=092013-04-07=20= 04:41:19=20+0000=0A+++=20src/xfns.c=092013-05-01=2009:53:07=20+0000=0A@@=20= -59,6=20+59,13=20@@=0A=20=0A=20#include=20"xsettings.h"=0A=20=0A+#ifdef=20= HAVE_XRANDR=0A+#include=20=0A+#endif=0A+#ifdef=20= HAVE_XINERAMA=0A+#include=20=0A+#endif=0A+=0A=20= #ifdef=20USE_GTK=0A=20#include=20"gtkutil.h"=0A=20#endif=0A@@=20-126,6=20= +133,7=20@@=0A=20static=20Lisp_Object=20Qsuppress_icon;=0A=20static=20= Lisp_Object=20Qundefined_color;=0A=20static=20Lisp_Object=20= Qcompound_text,=20Qcancel_timer;=0A+static=20Lisp_Object=20Qgeometry,=20= Qworkarea,=20Qmm_size,=20Qframes,=20Qsource;=0A=20Lisp_Object=20= Qfont_param;=0A=20=0A=20#ifdef=20GLYPH_DEBUG=0A@@=20-3791,6=20+3799,596=20= @@=0A=20=20=20else=0A=20=20=20=20=20return=20Qnil;=0A=20}=0A+=0A+/*=20= Return=20an=20alist=20of=20the=20form=0A+=20=20=20((left=20.=20(+=20= XOFFSET))=20(top=20.=20(+=20YOFFSET))=0A+=20=20=20=20(width=20.=20WIDTH)=20= (height=20.=20HEIGHT))=0A+=20=20=20with=20converting=20XOFFSET,=20= YOFFSET,=20WIDTH=20and=20HEIGHT=20to=20Lisp=0A+=20=20=20integers.=20=20= */=0A+=0A+static=20Lisp_Object=0A+x_create_geometry_alist=20(EMACS_INT=20= xoffset,=20EMACS_INT=20yoffset,=0A+=09=09=09=20EMACS_INT=20width,=20= EMACS_INT=20height)=0A+{=0A+=20=20return=20list4=20(Fcons=20(Qleft,=20= list2=20(Qplus,=20make_number=20(xoffset))),=0A+=09=09Fcons=20(Qtop,=20= list2=20(Qplus,=20make_number=20(yoffset))),=0A+=09=09Fcons=20(Qwidth,=20= make_number=20(width)),=0A+=09=09Fcons=20(Qheight,=20make_number=20= (height)));=0A+}=0A+=0A+/*=20Return=20an=20alist=20of=20the=20form=20= ((width=20.=20WIDTH)=20(height=20.=20HEIGHT)).=0A+=20=20=20with=20= converting=20WIDTH=20and=20HEIGHT=20to=20Lisp=20integers.=20=20*/=0A+=0A= +static=20Lisp_Object=0A+x_create_size_alist=20(EMACS_INT=20width,=20= EMACS_INT=20height)=0A+{=0A+=20=20return=20list2=20(Fcons=20(Qwidth,=20= make_number=20(width)),=0A+=09=09Fcons=20(Qheight,=20make_number=20= (height)));=0A+}=0A+=0A+/*=20Store=20the=20geometry=20of=20the=20= workarea=20on=20display=20DPYINFO=20into=20*RECT.=0A+=20=20=20Return=20= false=20if=20and=20only=20if=20the=20workarea=20information=20cannot=20= be=0A+=20=20=20obtained=20via=20the=20_NET_WORKAREA=20root=20window=20= property.=20=20*/=0A+=0A+static=20bool=0A+x_get_net_workarea=20(struct=20= x_display_info=20*dpyinfo,=20XRectangle=20*rect)=0A+{=0A+=20=20Display=20= *dpy=20=3D=20dpyinfo->display;=0A+=20=20long=20offset,=20max_len;=0A+=20=20= Atom=20target_type,=20actual_type;=0A+=20=20unsigned=20long=20= actual_size,=20bytes_remaining;=0A+=20=20int=20rc,=20actual_format;=0A+=20= =20unsigned=20char=20*tmp_data=20=3D=20NULL;=0A+=20=20bool=20result=20=3D=20= false;=0A+=0A+=20=20x_catch_errors=20(dpy);=0A+=20=20offset=20=3D=200;=0A= +=20=20max_len=20=3D=201;=0A+=20=20target_type=20=3D=20XA_CARDINAL;=0A+=20= =20rc=20=3D=20XGetWindowProperty=20(dpy,=20dpyinfo->root_window,=0A+=09=09= =09=20=20=20dpyinfo->Xatom_net_current_desktop,=0A+=09=09=09=20=20=20= offset,=20max_len,=20False,=20target_type,=0A+=09=09=09=20=20=20= &actual_type,=20&actual_format,=20&actual_size,=0A+=09=09=09=20=20=20= &bytes_remaining,=20&tmp_data);=0A+=20=20if=20(rc=20=3D=3D=20Success=20= &&=20actual_type=20=3D=3D=20target_type=20&&=20!x_had_errors_p=20(dpy)=0A= +=20=20=20=20=20=20&&=20actual_format=20=3D=3D=2032=20&&=20actual_size=20= =3D=3D=20max_len)=0A+=20=20=20=20{=0A+=20=20=20=20=20=20long=20= current_desktop=20=3D=20((long=20*)=20tmp_data)[0];=0A+=0A+=20=20=20=20=20= =20XFree=20(tmp_data);=0A+=20=20=20=20=20=20tmp_data=20=3D=20NULL;=0A+=0A= +=20=20=20=20=20=20offset=20=3D=204=20*=20current_desktop;=0A+=20=20=20=20= =20=20max_len=20=3D=204;=0A+=20=20=20=20=20=20rc=20=3D=20= XGetWindowProperty=20(dpy,=20dpyinfo->root_window,=0A+=09=09=09=20=20=20=20= =20=20=20dpyinfo->Xatom_net_workarea,=0A+=09=09=09=20=20=20=20=20=20=20= offset,=20max_len,=20False,=20target_type,=0A+=09=09=09=20=20=20=20=20=20= =20&actual_type,=20&actual_format,=20&actual_size,=0A+=09=09=09=20=20=20=20= =20=20=20&bytes_remaining,=20&tmp_data);=0A+=20=20=20=20=20=20if=20(rc=20= =3D=3D=20Success=20&&=20actual_type=20=3D=3D=20target_type=20&&=20= !x_had_errors_p=20(dpy)=0A+=09=20=20&&=20actual_format=20=3D=3D=2032=20= &&=20actual_size=20=3D=3D=20max_len)=0A+=09{=0A+=09=20=20long=20= *workareas=20=3D=20(long=20*)=20tmp_data;=0A+=0A+=09=20=20rect->x=20=3D=20= workareas[0];=0A+=09=20=20rect->y=20=3D=20workareas[1];=0A+=09=20=20= rect->width=20=3D=20workareas[2];=0A+=09=20=20rect->height=20=3D=20= workareas[3];=0A+=0A+=09=20=20XFree=20(tmp_data);=0A+=09=20=20tmp_data=20= =3D=20NULL;=0A+=0A+=09=20=20result=20=3D=20true;=0A+=09}=0A+=20=20=20=20= }=0A+=20=20if=20(tmp_data)=0A+=20=20=20=20XFree=20(tmp_data);=0A+=20=20= x_uncatch_errors=20();=0A+=0A+=20=20return=20result;=0A+}=0A+=0A+struct=20= MonitorInfo=20{=0A+=20=20XRectangle=20geom,=20work;=0A+=20=20int=20= mm_width,=20mm_height;=0A+=20=20char=20*name;=0A+};=0A+=0A+static=20void=0A= +free_monitors=20(struct=20MonitorInfo=20*monitors,=20int=20n_monitors)=0A= +{=0A+=20=20int=20i;=0A+=20=20for=20(i=20=3D=200;=20i=20<=20n_monitors;=20= ++i)=0A+=20=20=20=20xfree=20(monitors[i].name);=0A+=20=20xfree=20= (monitors);=0A+}=0A+=0A+=0A+/*=20Return=20monitor=20number=20where=20F=20= is=20"most"=20or=20closest=20to.=20=20*/=0A+static=20int=0A= +x_get_monitor_for_frame=20(struct=20frame=20*f,=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20struct=20= MonitorInfo=20*monitors,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20int=20n_monitors)=0A+{=0A+=20=20XRectangle=20= frect;=0A+=20=20int=20area=20=3D=200,=20dist=20=3D=20-1;=0A+=20=20int=20= best_area=20=3D=20-1,=20best_dist=20=3D=20-1;=0A+=20=20int=20i;=0A+=0A+=20= =20if=20(n_monitors=20=3D=3D=201)=20return=200;=0A+=20=20frect.x=20=3D=20= f->left_pos;=0A+=20=20frect.y=20=3D=20f->top_pos;=0A+=20=20frect.width=20= =3D=20FRAME_PIXEL_WIDTH=20(f);=0A+=20=20frect.height=20=3D=20= FRAME_PIXEL_HEIGHT=20(f);=0A+=0A+=20=20for=20(i=20=3D=200;=20i=20<=20= n_monitors;=20++i)=0A+=20=20=20=20{=0A+=20=20=20=20=20=20struct=20= MonitorInfo=20*mi=20=3D=20&monitors[i];=0A+=20=20=20=20=20=20XRectangle=20= res;=0A+=20=20=20=20=20=20int=20a=20=3D=200;=0A+=0A+=20=20=20=20=20=20if=20= (mi->geom.width=20=3D=3D=200)=20continue;=0A+=0A+=20=20=20=20=20=20if=20= (x_intersect_rectangles=20(&mi->geom,=20&frect,=20&res))=0A+=20=20=20=20=20= =20=20=20{=0A+=20=20=20=20=20=20=20=20=20=20a=20=3D=20res.width=20*=20= res.height;=0A+=20=20=20=20=20=20=20=20=20=20if=20(a=20>=20area)=20{=0A+=20= =20=20=20=20=20=20=20=20=20=20=20area=20=3D=20a;=0A+=20=20=20=20=20=20=20= =20=20=20=20=20best_area=20=3D=20i;=0A+=20=20=20=20=20=20=20=20=20=20}=0A= +=20=20=20=20=20=20=20=20}=0A+=0A+=20=20=20=20=20=20if=20(a=20=3D=3D=200=20= &&=20area=20=3D=3D=200)=0A+=20=20=20=20=20=20=20=20{=0A+=20=20=20=20=20=20= =20=20=20=20int=20dx,=20dy,=20d;=0A+=20=20=20=20=20=20=20=20=20=20if=20= (frect.x=20+=20frect.width=20<=20mi->geom.x)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20dx=20=3D=20mi->geom.x=20-=20frect.x=20+=20frect.width;=0A+=20=20= =20=20=20=20=20=20=20=20else=20if=20(frect.x=20>=20mi->geom.x=20+=20= mi->geom.width)=0A+=20=20=20=20=20=20=20=20=20=20=20=20dx=20=3D=20= frect.x=20-=20mi->geom.x=20+=20mi->geom.width;=0A+=20=20=20=20=20=20=20=20= =20=20else=0A+=20=20=20=20=20=20=20=20=20=20=20=20dx=20=3D=200;=0A+=20=20= =20=20=20=20=20=20=20=20if=20(frect.y=20+=20frect.height=20<=20= mi->geom.y)=0A+=20=20=20=20=20=20=20=20=20=20=20=20dy=20=3D=20mi->geom.y=20= -=20frect.y=20+=20frect.height;=0A+=20=20=20=20=20=20=20=20=20=20else=20= if=20(frect.y=20>=20mi->geom.y=20+=20mi->geom.height)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20dy=20=3D=20frect.y=20-=20mi->geom.y=20+=20= mi->geom.height;=0A+=20=20=20=20=20=20=20=20=20=20else=0A+=20=20=20=20=20= =20=20=20=20=20=20=20dy=20=3D=200;=0A+=0A+=20=20=20=20=20=20=20=20=20=20= d=20=3D=20dx*dx=20+=20dy*dy;=0A+=20=20=20=20=20=20=20=20=20=20if=20(dist=20= =3D=3D=20-1=20||=20dist=20>=20d)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= {=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20dist=20=3D=20d;=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20best_dist=20=3D=20i;=0A+=20=20=20=20=20=20= =20=20=20=20=20=20}=0A+=20=20=20=20=20=20=20=20}=0A+=20=20=20=20}=0A+=0A= +=20=20return=20best_area=20!=3D=20-1=20?=20best_area=20:=20(best_dist=20= !=3D=20-1=20?=20best_dist=20:=200);=0A+}=0A+=0A+static=20Lisp_Object=0A= +x_make_monitor_attribute_list=20(struct=20MonitorInfo=20*monitors,=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20int=20n_monitors,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20int=20= primary_monitor,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20struct=20x_display_info=20= *dpyinfo,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20const=20char=20*source)=0A+{=0A+=20=20= Lisp_Object=20monitor_frames=20=3D=20Fmake_vector=20(make_number=20= (n_monitors),=20Qnil);=0A+=20=20Lisp_Object=20frame,=20rest,=20= attributes_list=20=3D=20Qnil;=0A+=20=20Lisp_Object=20= primary_monitor_attributes=20=3D=20Qnil;=0A+=20=20int=20i;=0A+=0A+=20=20= FOR_EACH_FRAME=20(rest,=20frame)=0A+=20=20=20=20{=0A+=20=20=20=20=20=20= struct=20frame=20*f=20=3D=20XFRAME=20(frame);=0A+=0A+=20=20=20=20=20=20= if=20(FRAME_X_P=20(f)=20&&=20FRAME_X_DISPLAY_INFO=20(f)=20=3D=3D=20= dpyinfo=0A+=09=20=20&&=20!EQ=20(frame,=20tip_frame))=0A+=09{=0A+=09=20=20= i=20=3D=20x_get_monitor_for_frame=20(f,=20monitors,=20n_monitors);=0A+=09= =20=20ASET=20(monitor_frames,=20i,=20Fcons=20(frame,=20AREF=20= (monitor_frames,=20i)));=0A+=09}=0A+=20=20=20=20}=0A+=20=20=0A+=20=20for=20= (i=20=3D=200;=20i=20<=20n_monitors;=20++i)=20=0A+=20=20=20=20{=0A+=20=20=20= =20=20=20Lisp_Object=20geometry,=20workarea,=20attributes=20=3D=20Qnil;=0A= +=20=20=20=20=20=20struct=20MonitorInfo=20*mi=20=3D=20&monitors[i];=0A+=0A= +=20=20=20=20=20=20if=20(mi->geom.width=20=3D=3D=200)=20continue;=0A+=0A= +=20=20=20=20=20=20workarea=20=3D=20x_create_geometry_alist=20= (mi->work.x,=20mi->work.y,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20mi->work.width,=20mi->work.height);=0A+=20=20=20=20=20=20geometry=20= =3D=20x_create_geometry_alist=20(mi->geom.x,=20mi->geom.y,=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20mi->geom.width,=20= mi->geom.height);=0A+=20=20=20=20=20=20attributes=20=3D=20Fcons=20(Fcons=20= (Qsource,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20make_string=20(source,=20strlen=20= (source))),=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20attributes);=0A+=20=20=20=20=20=20attributes=20=3D=20= Fcons=20(Fcons=20(Qframes,=20AREF=20(monitor_frames,=20i)),=0A+=09=09=09=20= =20attributes);=0A+=20=20=20=20=20=20attributes=20=3D=20Fcons=20(Fcons=20= (Qmm_size,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20x_create_size_alist=20= (mi->mm_width,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20mi->mm_height)),=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20attributes);=0A+=20= =20=20=20=20=20attributes=20=3D=20Fcons=20(Fcons=20(Qworkarea,=20= workarea),=20attributes);=0A+=20=20=20=20=20=20attributes=20=3D=20Fcons=20= (Fcons=20(Qgeometry,=20geometry),=20attributes);=0A+=20=20=20=20=20=20if=20= (mi->name)=0A+=20=20=20=20=20=20=20=20attributes=20=3D=20Fcons=20(Fcons=20= (Qname,=20make_string=20(mi->name,=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20strlen=20= (mi->name))),=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20attributes);=0A+=0A+=20=20=20=20=20=20if=20(i=20= =3D=3D=20primary_monitor)=0A+=20=20=20=20=20=20=20=20= primary_monitor_attributes=20=3D=20attributes;=0A+=20=20=20=20=20=20else=0A= +=20=20=20=20=20=20=20=20attributes_list=20=3D=20Fcons=20(attributes,=20= attributes_list);=0A+=20=20=20=20}=0A+=0A+=20=20if=20(!NILP=20= (primary_monitor_attributes))=0A+=20=20=20=20attributes_list=20=3D=20= Fcons=20(primary_monitor_attributes,=20attributes_list);=0A+=20=20return=20= attributes_list;=0A+}=0A+=0A+static=20Lisp_Object=0A= +x_get_monitor_attributes_fallback=20(struct=20x_display_info=20= *dpyinfo)=0A+{=0A+=20=20struct=20MonitorInfo=20monitor;=0A+=20=20int=20= width_mm,=20height_mm;=0A+=20=20XRectangle=20workarea_r;=0A+=0A+=20=20/*=20= Fallback:=20treat=20(possibly)=20multiple=20physical=20monitors=20as=20= if=20they=0A+=20=20=20=20=20formed=20a=20single=20monitor=20as=20a=20= whole.=20=20This=20should=20provide=20a=0A+=20=20=20=20=20consistent=20= result=20at=20least=20on=20single=20monitor=20environments.=20=20*/=0A+=20= =20monitor.geom.x=20=3D=20monitor.geom.y=20=3D=200;=0A+=20=20= monitor.geom.width=20=3D=20x_display_pixel_width=20(dpyinfo);=0A+=20=20= monitor.geom.height=20=3D=20x_display_pixel_height=20(dpyinfo);=0A+=20=20= monitor.mm_width=20=3D=20WidthMMOfScreen=20(dpyinfo->screen);=0A+=20=20= monitor.mm_height=20=3D=20HeightMMOfScreen=20(dpyinfo->screen);=0A+=20=20= monitor.name=20=3D=20xstrdup=20("combined=20screen");=0A+=0A+=20=20if=20= (x_get_net_workarea=20(dpyinfo,=20&workarea_r))=0A+=20=20=20=20= monitor.work=20=3D=20workarea_r;=0A+=20=20else=0A+=20=20=20=20= monitor.work=20=3D=20monitor.geom;=0A+=20=20return=20= x_make_monitor_attribute_list=20(&monitor,=201,=200,=20dpyinfo,=20= "fallback");=0A+}=0A+=0A+=0A+#ifdef=20HAVE_XINERAMA=0A+static=20= Lisp_Object=0A+x_get_monitor_attributes_xinerama=20(struct=20= x_display_info=20*dpyinfo)=0A+{=0A+=20=20int=20n_monitors,=20i;=0A+=20=20= Lisp_Object=20attributes_list=20=3D=20Qnil;=0A+=20=20Display=20*dpy=20=3D=20= dpyinfo->display;=0A+=20=20XineramaScreenInfo=20*info=20=3D=20= XineramaQueryScreens=20(dpy,=20&n_monitors);=0A+=20=20struct=20= MonitorInfo=20*monitors;=0A+=20=20float=20mm_width_per_pixel,=20= mm_height_per_pixel;=0A+=0A+=20=20if=20(!=20info)=20return=20= attributes_list;=0A+=0A+=20=20mm_width_per_pixel=20=3D=20((float)=20= WidthMMOfScreen=20(dpyinfo->screen)=0A+=09=09=09/=20= x_display_pixel_width=20(dpyinfo));=0A+=20=20mm_height_per_pixel=20=3D=20= ((float)=20HeightMMOfScreen=20(dpyinfo->screen)=0A+=09=09=09=20/=20= x_display_pixel_height=20(dpyinfo));=0A+=20=20monitors=20=3D=20(struct=20= MonitorInfo=20*)=20xzalloc=20(n_monitors=20*=20sizeof=20(*monitors));=0A= +=20=20for=20(i=20=3D=200;=20i=20<=20n_monitors;=20++i)=20=0A+=20=20=20=20= {=0A+=20=20=20=20=20=20struct=20MonitorInfo=20*mi=20=3D=20&monitors[i];=0A= +=20=20=20=20=20=20XRectangle=20workarea_r;=0A+=0A+=20=20=20=20=20=20= mi->geom.x=20=3D=20info[i].x_org;=0A+=20=20=20=20=20=20mi->geom.y=20=3D=20= info[i].y_org;=0A+=20=20=20=20=20=20mi->geom.width=20=3D=20= info[i].width;=0A+=20=20=20=20=20=20mi->geom.height=20=3D=20= info[i].height;=0A+=20=20=20=20=20=20mi->mm_width=20=3D=20mi->geom.width=20= *=20mm_width_per_pixel=20+=200.5;=0A+=20=20=20=20=20=20mi->mm_height=20=3D= =20mi->geom.height=20*=20mm_height_per_pixel=20+=200.5;=0A+=20=20=20=20=20= =20mi->name=20=3D=200;=0A+=0A+=20=20=20=20=20=20/*=20Xinerama=20usually=20= have=20primary=20monitor=20first,=20just=20use=20that.=20=20*/=0A+=20=20=20= =20=20=20if=20(i=20=3D=3D=200=20&&=20x_get_net_workarea=20(dpyinfo,=20= &workarea_r))=0A+=20=20=20=20=20=20=20=20=20=20=20=20{=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20mi->work=20=3D=20workarea_r;=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20if=20(!=20x_intersect_rectangles=20= (&mi->geom,=20&mi->work,=20&mi->work))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20mi->work=20=3D=20mi->geom;=0A+=20=20=20=20=20=20=20=20=20=20= =20=20}=0A+=20=20=20=20=20=20=20=20=20=20else=0A+=20=20=20=20=20=20=20=20= =20=20=20=20mi->work=20=3D=20mi->geom;=0A+=20=20=20=20}=0A+=20=20XFree=20= (info);=0A+=0A+=20=20attributes_list=20=3D=20= x_make_monitor_attribute_list=20(monitors,=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20n_monitors,=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=200,=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20dpyinfo,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20"Xinerama");=0A+=20=20free_monitors=20(monitors,=20= n_monitors);=0A+=20=20return=20attributes_list;=0A+=20=20=0A+}=0A+#endif=20= /*=20HAVE_XINERAMA=20*/=0A+=0A+=0A+#ifdef=20HAVE_XRANDR=0A+static=20= Lisp_Object=0A+x_get_monitor_attributes_xrandr=20(struct=20= x_display_info=20*dpyinfo)=0A+{=0A+=20=20Lisp_Object=20attributes_list=20= =3D=20Qnil;=0A+=20=20XRRScreenResources=20*resources;=0A+=20=20Display=20= *dpy=20=3D=20dpyinfo->display;=0A+=20=20int=20i,=20n_monitors,=20primary=20= =3D=20-1;=0A+=20=20RROutput=20pxid=20=3D=20None;=0A+=20=20struct=20= MonitorInfo=20*monitors;=0A+=0A+#ifdef=20= HAVE_XRRGETSCREENRESOURCESCURRENT=0A+=20=20resources=20=3D=20= XRRGetScreenResourcesCurrent=20(dpy,=20dpyinfo->root_window);=0A+#else=0A= +=20=20resources=20=3D=20XRRGetScreenResources=20(dpy,=20= dpyinfo->root_window);=0A+#endif=0A+=20=20if=20(!=20resources)=20return=20= Qnil;=0A+=20=20n_monitors=20=3D=20resources->noutput;=0A+=20=20monitors=20= =3D=20(struct=20MonitorInfo=20*)=20xzalloc=20(n_monitors=20*=20sizeof=20= (*monitors));=0A+=0A+#ifdef=20HAVE_XRRGETOUTPUTPRIMARY=0A+=20=20pxid=20=3D= =20XRRGetOutputPrimary=20(dpy,=20dpyinfo->root_window);=0A+#endif=0A+=0A= +=20=20for=20(i=20=3D=200;=20i=20<=20n_monitors;=20++i)=20=0A+=20=20=20=20= {=0A+=20=20=20=20=20=20XRROutputInfo=20*info=20=3D=20XRRGetOutputInfo=20= (dpy,=20resources,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20resources->outputs[i]);=0A+=20=20=20=20=20=20Connection=20= conn=20=3D=20info=20?=20info->connection=20:=20RR_Disconnected;=0A+=20=20= =20=20=20=20RRCrtc=20id=20=3D=20info=20?=20info->crtc=20:=20None;=0A+=20=20= =20=20=20=20=0A+=20=20=20=20=20=20if=20(strcmp=20(info->name,=20= "default")=20=3D=3D=200)=0A+=20=20=20=20=20=20=20=20{=0A+=20=20=20=20=20=20= =20=20=20=20/*=20Non=20XRandr=201.2=20driver,=20does=20not=20give=20= useful=20data.=20=20*/=0A+=20=20=20=20=20=20=20=20=20=20free_monitors=20= (monitors,=20n_monitors);=0A+=20=20=20=20=20=20=20=20=20=20return=20= Qnil;=0A+=20=20=20=20=20=20=20=20}=0A+=0A+=20=20=20=20=20=20if=20(conn=20= !=3D=20RR_Disconnected=20&&=20id=20!=3D=20None)=0A+=20=20=20=20=20=20=20=20= {=0A+=20=20=20=20=20=20=20=20=20=20XRRCrtcInfo=20*crtc=20=3D=20= XRRGetCrtcInfo=20(dpy,=20resources,=20id);=0A+=20=20=20=20=20=20=20=20=20= =20struct=20MonitorInfo=20*mi=20=3D=20&monitors[i];=0A+=20=20=20=20=20=20= =20=20=20=20XRectangle=20workarea_r;=0A+=0A+=20=20=20=20=20=20=20=20=20=20= if=20(!=20crtc)=20continue;=0A+=0A+=20=20=20=20=20=20=20=20=20=20= mi->geom.x=20=3D=20crtc->x;=0A+=20=20=20=20=20=20=20=20=20=20mi->geom.y=20= =3D=20crtc->y;=0A+=20=20=20=20=20=20=20=20=20=20mi->geom.width=20=3D=20= crtc->width;=0A+=20=20=20=20=20=20=20=20=20=20mi->geom.height=20=3D=20= crtc->height;=0A+=20=20=20=20=20=20=20=20=20=20mi->mm_width=20=3D=20= info->mm_width;=0A+=20=20=20=20=20=20=20=20=20=20mi->mm_height=20=3D=20= info->mm_height;=0A+=20=20=20=20=20=20=20=20=20=20mi->name=20=3D=20= xstrdup=20(info->name);=0A+=0A+=20=20=20=20=20=20=20=20=20=20if=20(pxid=20= !=3D=20None=20&&=20pxid=20=3D=3D=20resources->outputs[i])=0A+=20=20=20=20= =20=20=20=20=20=20=20=20primary=20=3D=20i;=0A+=20=20=20=20=20=20=20=20=20= =20else=20if=20(primary=20=3D=3D=20-1=20&&=20strcmp=20(info->name,=20= "LVDS")=20=3D=3D=200)=0A+=20=20=20=20=20=20=20=20=20=20=20=20primary=20=3D= =20i;=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=0A+=20=20=20=20= =20=20=20=20=20=20if=20(i=20=3D=3D=20primary=20&&=20x_get_net_workarea=20= (dpyinfo,=20&workarea_r))=0A+=20=20=20=20=20=20=20=20=20=20=20=20{=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20mi->work=3D=20workarea_r;=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20if=20(!=20x_intersect_rectangles=20= (&mi->geom,=20&mi->work,=20&mi->work))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20mi->work=20=3D=20mi->geom;=0A+=20=20=20=20=20=20=20=20=20=20= =20=20}=0A+=20=20=20=20=20=20=20=20=20=20else=0A+=20=20=20=20=20=20=20=20= =20=20=20=20mi->work=20=3D=20mi->geom;=0A+=0A+=20=20=20=20=20=20=20=20=20= =20XRRFreeCrtcInfo=20(crtc);=0A+=20=20=20=20=20=20=20=20}=0A+=20=20=20=20= =20=20XRRFreeOutputInfo=20(info);=0A+=20=20=20=20}=0A+=20=20= XRRFreeScreenResources=20(resources);=0A+=0A+=20=20attributes_list=20=3D=20= x_make_monitor_attribute_list=20(monitors,=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20n_monitors,=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= primary,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20dpyinfo,=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20"XRandr");=0A+=20=20free_monitors=20= (monitors,=20n_monitors);=0A+=20=20return=20attributes_list;=0A+}=0A= +#endif=20/*=20HAVE_XRANDR=20*/=0A+=0A+static=20Lisp_Object=0A= +x_get_monitor_attributes=20(struct=20x_display_info=20*dpyinfo)=0A+{=0A= +=20=20Lisp_Object=20attributes_list=20=3D=20Qnil;=0A+=20=20Display=20= *dpy=20=3D=20dpyinfo->display;=0A+=0A+#ifdef=20HAVE_XRANDR=0A+=20=20int=20= xrr_event_base,=20xrr_error_base;=0A+=20=20bool=20xrr_ok=20=3D=20false;=0A= +=20=20xrr_ok=20=3D=20XRRQueryExtension=20(dpy,=20&xrr_event_base,=20= &xrr_error_base);=0A+=20=20if=20(xrr_ok)=0A+=20=20=20=20{=0A+=20=20=20=20= =20=20int=20xrr_major,=20xrr_minor;=0A+=20=20=20=20=20=20XRRQueryVersion=20= (dpy,=20&xrr_major,=20&xrr_minor);=0A+=20=20=20=20=20=20xrr_ok=20=3D=20= (xrr_major=20=3D=3D=201=20&&=20xrr_minor=20>=3D=202)=20||=20xrr_major=20= >=201;=0A+=20=20=20=20}=0A+=0A+=20=20if=20(xrr_ok)=0A+=20=20=20=20= attributes_list=20=3D=20x_get_monitor_attributes_xrandr=20(dpyinfo);=0A= +#endif=20/*=20HAVE_XRANDR=20*/=0A+=0A+#ifdef=20HAVE_XINERAMA=0A+=20=20= if=20(NILP=20(attributes_list))=0A+=20=20=20=20{=0A+=20=20=20=20=20=20= int=20xin_event_base,=20xin_error_base;=0A+=20=20=20=20=20=20bool=20= xin_ok=20=3D=20false;=0A+=20=20=20=20=20=20xin_ok=20=3D=20= XineramaQueryExtension=20(dpy,=20&xin_event_base,=20&xin_error_base);=0A= +=20=20=20=20=20=20if=20(xin_ok=20&&=20XineramaIsActive=20(dpy))=0A+=20=20= =20=20=20=20=20=20attributes_list=20=3D=20= x_get_monitor_attributes_xinerama=20(dpyinfo);=0A+=20=20=20=20}=0A= +#endif=20/*=20HAVE_XINERAMA=20*/=0A+=0A+=20=20if=20(NILP=20= (attributes_list))=0A+=20=20=20=20attributes_list=20=3D=20= x_get_monitor_attributes_fallback=20(dpyinfo);=0A+=0A+=20=20return=20= attributes_list;=0A+}=0A+=0A+DEFUN=20= ("x-display-monitor-attributes-list",=20= Fx_display_monitor_attributes_list,=0A+=20=20=20=20=20=20=20= Sx_display_monitor_attributes_list,=0A+=20=20=20=20=20=20=200,=201,=200,=0A= +=20=20=20=20=20=20=20doc:=20/*=20Return=20a=20list=20of=20physical=20= monitor=20attributes=20on=20X=20display.=0A+Each=20element=20of=20the=20= list=20represents=20the=20attributes=20of=20each=20physical=0A+monitor.=20= =20The=20first=20element=20corresponds=20to=20the=20primary=20monitor.=0A= +=0A+Attributes=20for=20a=20physical=20monitor=20is=20represented=20as=20= an=20alist=20of=0A+attribute=20names=20and=20values=20as=20follows:=0A+=0A= +=20=20=20=20Name=20=20=20=20=20|=20Value=0A+=20=20=20=20= ---------+--------------------------------------------------=0A+=20=20=20= =20geometry=20|=20Position=20and=20size=20in=20the=20form=20of=0A+=09=20=20= =20=20=20|=20((left=20.=20(+=20XOFFSET))=20(top=20.=20(+=20YOFFSET))=0A+=09= =20=20=20=20=20|=20=20(width=20.=20WIDTH)=20(height=20.=20HEIGHT)).=0A+=09= =20=20=20=20=20|=0A+=20=20=20=20workarea=20|=20Position=20and=20size=20= of=20the=20workarea=20in=20the=20form=20of=0A+=09=20=20=20=20=20|=20= ((left=20.=20(+=20XOFFSET))=20(top=20.=20(+=20YOFFSET))=0A+=09=20=20=20=20= =20|=20=20(width=20.=20WIDTH)=20(height=20.=20HEIGHT)).=0A+=09=20=20=20=20= =20|=0A+=20=20=20=20mm-size=20=20|=20Width=20and=20height=20in=20= millimeters=20in=20the=20form=20of=0A+=09=20=20=20=20=20|=20((width=20.=20= WIDTH)=20(height=20.=20HEIGHT)).=0A+=09=20=20=20=20=20|=0A+=20=20=20=20= frames=20=20=20|=20List=20of=20frames=20belonging=20to=20the=20physical=20= monitor.=0A+=0A+where=20XOFFSET,=20YOFFSET,=20WIDTH,=20and=20HEIGHT=20= are=20integers.=20=20A=20frame=0A+belongs=20to=20a=20monitor=20when=20= either=20the=20largest=20area=20of=20the=20frame=20resides=0A+in=20the=20= monitor,=20or=20the=20monitor=20is=20the=20closest=20to=20the=20frame=20= if=20the=0A+frame=20does=20not=20intersect=20any=20monitors.=20=20Every=20= non-tip=20frame=20(including=0A+invisible=20one)=20in=20a=20graphical=20= display=20belongs=20to=20exactly=20one=20monitor.=0A+=0A+The=20optional=20= argument=20TERMINAL=20specifies=20which=20display=20to=20ask=20about.=0A= +TERMINAL=20should=20be=20a=20terminal=20object,=20a=20frame=20or=20a=20= display=20name=20(a=20string).=0A+If=20omitted=20or=20nil,=20that=20= stands=20for=20the=20selected=20frame's=20display.=20=20*/)=0A+=20=20= (Lisp_Object=20terminal)=0A+{=0A+=20=20struct=20x_display_info=20= *dpyinfo=20=3D=20check_x_display_info=20(terminal);=0A+=20=20Lisp_Object=20= attributes_list=20=3D=20Qnil;=0A+=0A+#ifdef=20USE_GTK=0A+=20=20float=20= mm_width_per_pixel,=20mm_height_per_pixel;=0A+=20=20GdkDisplay=20*gdpy;=0A= +=20=20GdkScreen=20*gscreen;=0A+=20=20gint=20primary_monitor=20=3D=200,=20= n_monitors,=20i;=0A+=20=20Lisp_Object=20primary_monitor_attributes=20=3D=20= Qnil;=0A+=20=20Lisp_Object=20monitor_frames,=20rest,=20frame;=0A+=20=20= static=20const=20char=20*source=20=3D=20"Gdk";=0A+=0A+=20=20block_input=20= ();=0A+=20=20mm_width_per_pixel=20=3D=20((float)=20WidthMMOfScreen=20= (dpyinfo->screen)=0A+=09=09=09/=20x_display_pixel_width=20(dpyinfo));=0A= +=20=20mm_height_per_pixel=20=3D=20((float)=20HeightMMOfScreen=20= (dpyinfo->screen)=0A+=09=09=09=20/=20x_display_pixel_height=20= (dpyinfo));=0A+=20=20gdpy=20=3D=20gdk_x11_lookup_xdisplay=20= (dpyinfo->display);=0A+=20=20gscreen=20=3D=20= gdk_display_get_default_screen=20(gdpy);=0A+#if=20GTK_MAJOR_VERSION=20>=20= 2=20||=20GTK_MINOR_VERSION=20>=3D=2020=0A+=20=20primary_monitor=20=3D=20= gdk_screen_get_primary_monitor=20(gscreen);=0A+#endif=0A+=20=20= n_monitors=20=3D=20gdk_screen_get_n_monitors=20(gscreen);=0A+=20=20= monitor_frames=20=3D=20Fmake_vector=20(make_number=20(n_monitors),=20= Qnil);=0A+=20=20FOR_EACH_FRAME=20(rest,=20frame)=0A+=20=20=20=20{=0A+=20=20= =20=20=20=20struct=20frame=20*f=20=3D=20XFRAME=20(frame);=0A+=0A+=20=20=20= =20=20=20if=20(FRAME_X_P=20(f)=20&&=20FRAME_X_DISPLAY_INFO=20(f)=20=3D=3D=20= dpyinfo=0A+=09=20=20&&=20!EQ=20(frame,=20tip_frame))=0A+=09{=0A+=09=20=20= GdkWindow=20*gwin=20=3D=20gtk_widget_get_window=20(FRAME_GTK_WIDGET=20= (f));=0A+=0A+=09=20=20i=20=3D=20gdk_screen_get_monitor_at_window=20= (gscreen,=20gwin);=0A+=09=20=20ASET=20(monitor_frames,=20i,=20Fcons=20= (frame,=20AREF=20(monitor_frames,=20i)));=0A+=09}=0A+=20=20=20=20}=0A+=0A= +=20=20i=20=3D=20n_monitors;=0A+=20=20while=20(i--=20>=200)=0A+=20=20=20=20= {=0A+=20=20=20=20=20=20Lisp_Object=20geometry,=20workarea,=20attributes=20= =3D=20Qnil;=0A+=20=20=20=20=20=20gint=20width_mm=20=3D=20-1,=20height_mm=20= =3D=20-1;=0A+=20=20=20=20=20=20GdkRectangle=20rec;=0A+=0A+=20=20=20=20=20= =20attributes=20=3D=20Fcons=20(Fcons=20(Qsource,=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20make_string=20(source,=20strlen=20(source))),=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20attributes);=0A= +=20=20=20=20=20=20attributes=20=3D=20Fcons=20(Fcons=20(Qframes,=20AREF=20= (monitor_frames,=20i)),=0A+=09=09=09=20=20attributes);=0A+=0A+=20=20=20=20= =20=20gdk_screen_get_monitor_geometry=20(gscreen,=20i,=20&rec);=0A+=20=20= =20=20=20=20geometry=20=3D=20x_create_geometry_alist=20(rec.x,=20rec.y,=20= rec.width,=20rec.height);=0A+=0A+#if=20GTK_MAJOR_VERSION=20>=202=20||=20= GTK_MINOR_VERSION=20>=3D=2014=0A+=20=20=20=20=20=20width_mm=20=3D=20= gdk_screen_get_monitor_width_mm=20(gscreen,=20i);=0A+=20=20=20=20=20=20= height_mm=20=3D=20gdk_screen_get_monitor_height_mm=20(gscreen,=20i);=0A= +#endif=0A+=20=20=20=20=20=20if=20(width_mm=20<=200)=0A+=09width_mm=20=3D=20= rec.width=20*=20mm_width_per_pixel=20+=200.5;=0A+=20=20=20=20=20=20if=20= (height_mm=20<=200)=0A+=09height_mm=20=3D=20rec.height=20*=20= mm_height_per_pixel=20+=200.5;=0A+=20=20=20=20=20=20attributes=20=3D=20= Fcons=20(Fcons=20(Qmm_size,=0A+=09=09=09=09=20x_create_size_alist=20= (width_mm,=20height_mm)),=0A+=09=09=09=20=20attributes);=0A+=0A+#if=20= GTK_MAJOR_VERSION=20>=203=20||=20(GTK_MAJOR_VERSION=20=3D=3D=203=20&&=20= GTK_MINOR_VERSION=20>=3D=204)=0A+=20=20=20=20=20=20= gdk_screen_get_monitor_workarea=20(gscreen,=20i,=20&rec);=0A+=20=20=20=20= =20=20workarea=20=3D=20x_create_geometry_alist=20(rec.x,=20rec.y,=20= rec.width,=20rec.height);=0A+#else=0A+=20=20=20=20=20=20/*=20Emulate=20= the=20behavior=20of=20GTK+=203.4.=20=20*/=0A+=20=20=20=20=20=20{=0A+=09= XRectangle=20workarea_r;=0A+=0A+=09workarea=20=3D=20Qnil;=0A+=09if=20(i=20= =3D=3D=20primary_monitor=20&&=20x_get_net_workarea=20(dpyinfo,=20= &workarea_r))=0A+=09=20=20{=0A+=09=20=20=20=20GdkRectangle=20work;=0A+=0A= +=09=20=20=20=20work.x=20=3D=20workarea_r.x;=0A+=09=20=20=20=20work.y=20= =3D=20workarea_r.y;=0A+=09=20=20=20=20work.width=20=3D=20= workarea_r.width;=0A+=09=20=20=20=20work.height=20=3D=20= workarea_r.height;=0A+=09=20=20=20=20if=20(gdk_rectangle_intersect=20= (&rec,=20&work,=20&work))=0A+=09=20=20=20=20=20=20workarea=20=3D=20= x_create_geometry_alist=20(work.x,=20work.y,=0A+=09=09=09=09=09=09=20=20= work.width,=20work.height);=0A+=09=20=20}=0A+=09if=20(NILP=20(workarea))=0A= +=09=20=20workarea=20=3D=20geometry;=0A+=20=20=20=20=20=20}=0A+#endif=0A= +=20=20=20=20=20=20attributes=20=3D=20Fcons=20(Fcons=20(Qworkarea,=20= workarea),=20attributes);=0A+=0A+=20=20=20=20=20=20attributes=20=3D=20= Fcons=20(Fcons=20(Qgeometry,=20geometry),=20attributes);=0A+#if=20= GTK_MAJOR_VERSION=20>=202=20||=20(GTK_MAJOR_VERSION=20=3D=3D=202=20&&=20= GTK_MINOR_VERSION=20>=3D=2014)=0A+=20=20=20=20=20=20{=0A+=20=20=20=20=20=20= =20=20char=20*name=20=3D=20gdk_screen_get_monitor_plug_name=20(gscreen,=20= i);=0A+=20=20=20=20=20=20=20=20if=20(name)=0A+=20=20=20=20=20=20=20=20=20= =20attributes=20=3D=20Fcons=20(Fcons=20(Qname,=20make_string=20(name,=20= strlen=20(name))),=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20attributes);=0A+=20=20=20=20=20=20= }=0A+#endif=0A+=0A+=20=20=20=20=20=20if=20(i=20=3D=3D=20primary_monitor)=0A= +=09primary_monitor_attributes=20=3D=20attributes;=0A+=20=20=20=20=20=20= else=0A+=09attributes_list=20=3D=20Fcons=20(attributes,=20= attributes_list);=0A+=20=20=20=20}=0A+=0A+=20=20if=20(!NILP=20= (primary_monitor_attributes))=0A+=20=20=20=20attributes_list=20=3D=20= Fcons=20(primary_monitor_attributes,=20attributes_list);=0A+=20=20= unblock_input=20();=0A+#else=20=20/*=20not=20USE_GTK=20*/=0A+=0A+=20=20= block_input=20();=0A+=20=20attributes_list=20=3D=20= x_get_monitor_attributes=20(dpyinfo);=0A+=20=20unblock_input=20();=0A+=0A= +#endif=09/*=20not=20USE_GTK=20*/=0A+=0A+=20=20return=20attributes_list;=0A= +}=0A+=0A=20=0C=0A=20int=0A=20x_pixel_width=20(register=20struct=20frame=20= *f)=0A@@=20-5701,6=20+6299,11=20@@=0A=20=20=20DEFSYM=20= (Qundefined_color,=20"undefined-color");=0A=20=20=20DEFSYM=20= (Qcompound_text,=20"compound-text");=0A=20=20=20DEFSYM=20(Qcancel_timer,=20= "cancel-timer");=0A+=20=20DEFSYM=20(Qgeometry,=20"geometry");=0A+=20=20= DEFSYM=20(Qworkarea,=20"workarea");=0A+=20=20DEFSYM=20(Qmm_size,=20= "mm-size");=0A+=20=20DEFSYM=20(Qframes,=20"frames");=0A+=20=20DEFSYM=20= (Qsource,=20"source");=0A=20=20=20DEFSYM=20(Qfont_param,=20= "font-parameter");=0A=20=20=20/*=20This=20is=20the=20end=20of=20symbol=20= initialization.=20=20*/=0A=20=0A@@=20-5864,6=20+6467,7=20@@=0A=20=20=20= defsubr=20(&Sx_display_visual_class);=0A=20=20=20defsubr=20= (&Sx_display_backing_store);=0A=20=20=20defsubr=20= (&Sx_display_save_under);=0A+=20=20defsubr=20= (&Sx_display_monitor_attributes_list);=0A=20=20=20defsubr=20= (&Sx_wm_set_size_hint);=0A=20=20=20defsubr=20(&Sx_create_frame);=0A=20=20= =20defsubr=20(&Sx_open_connection);=0A=0A=3D=3D=3D=20modified=20file=20= 'src/xterm.c'=0A---=20src/xterm.c=092013-03-25=2017:58:35=20+0000=0A+++=20= src/xterm.c=092013-04-28=2017:17:40=20+0000=0A@@=20-10251,6=20+10251,8=20= @@=0A=20=20=20=20=20=20=20{=20"_NET_WM_WINDOW_OPACITY",=20= &dpyinfo->Xatom_net_wm_window_opacity=20},=0A=20=20=20=20=20=20=20{=20= "_NET_ACTIVE_WINDOW",=20&dpyinfo->Xatom_net_active_window=20},=0A=20=20=20= =20=20=20=20{=20"_NET_FRAME_EXTENTS",=20= &dpyinfo->Xatom_net_frame_extents=20},=0A+=20=20=20=20=20=20{=20= "_NET_CURRENT_DESKTOP",=20&dpyinfo->Xatom_net_current_desktop=20},=0A+=20= =20=20=20=20=20{=20"_NET_WORKAREA",=20&dpyinfo->Xatom_net_workarea=20},=0A= =20=20=20=20=20=20=20/*=20Session=20management=20*/=0A=20=20=20=20=20=20=20= {=20"SM_CLIENT_ID",=20&dpyinfo->Xatom_SM_CLIENT_ID=20},=0A=20=20=20=20=20= =20=20{=20"_XSETTINGS_SETTINGS",=20&dpyinfo->Xatom_xsettings_prop=20},=0A= =0A=3D=3D=3D=20modified=20file=20'src/xterm.h'=0A---=20src/xterm.h=09= 2013-04-07=2004:41:19=20+0000=0A+++=20src/xterm.h=092013-04-28=20= 17:17:40=20+0000=0A@@=20-346,7=20+346,8=20@@=0A=20=20=20Atom=20= Xatom_net_wm_state,=20Xatom_net_wm_state_fullscreen,=0A=20=20=20=20=20= Xatom_net_wm_state_maximized_horz,=20Xatom_net_wm_state_maximized_vert,=0A= =20=20=20=20=20Xatom_net_wm_state_sticky,=20Xatom_net_wm_state_hidden,=0A= -=20=20=20=20Xatom_net_frame_extents;=0A+=20=20=20=20= Xatom_net_frame_extents,=0A+=20=20=20=20Xatom_net_current_desktop,=20= Xatom_net_workarea;=0A=20=0A=20=20=20/*=20XSettings=20atoms=20and=20= windows.=20=20*/=0A=20=20=20Atom=20Xatom_xsettings_sel,=20= Xatom_xsettings_prop,=20Xatom_xsettings_mgr;=0A=0A= --Apple-Mail=_5FF547F5-3255-4237-A81C-B9754DAE3D78 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=iso-8859-7 --Apple-Mail=_5FF547F5-3255-4237-A81C-B9754DAE3D78--