From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: x-display-pixel-width/height inconsistency Date: Sun, 28 Apr 2013 19:16:25 +0200 Message-ID: <8BD4B041-5A3F-4D7C-AFD3-E997E194AA9D@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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_616DF557-0E23-4ADE-B616-20BC70E2F9DA" X-Trace: ger.gmane.org 1367169400 16390 80.91.229.3 (28 Apr 2013 17:16:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Apr 2013 17:16:40 +0000 (UTC) Cc: emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 28 19:16:45 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 1UWVDN-0005AJ-Rg for ged-emacs-devel@m.gmane.org; Sun, 28 Apr 2013 19:16:42 +0200 Original-Received: from localhost ([::1]:51053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWVDN-0005Qu-Bn for ged-emacs-devel@m.gmane.org; Sun, 28 Apr 2013 13:16:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWVDJ-0005Qp-Ix for emacs-devel@gnu.org; Sun, 28 Apr 2013 13:16:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWVDH-0004hK-Lb for emacs-devel@gnu.org; Sun, 28 Apr 2013 13:16:37 -0400 Original-Received: from mailfe09.swip.net ([212.247.155.1]:35504 helo=swip.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWVDH-0004fk-3l for emacs-devel@gnu.org; Sun, 28 Apr 2013 13:16:35 -0400 X-T2-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50, MIME_QP_LONG_LINE Original-Received: from [176.10.223.182] (account mj138573@tele2.se HELO [10.0.1.4]) by mailfe09.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPSA id 227415367; Sun, 28 Apr 2013 19:16:27 +0200 In-Reply-To: X-Mailer: Apple Mail (2.1503) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 212.247.155.1 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:159197 Archived-At: --Apple-Mail=_616DF557-0E23-4ADE-B616-20BC70E2F9DA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Hello. 28 apr 2013 kl. 03:40 skrev YAMAMOTO Mitsuharu = : >>>>>> On Sat, 27 Apr 2013 10:04:46 +0200, Jan Dj=E4rv = said: >=20 >> A general objection is that XRandr/Xinerama is not used, so >> the non-Gtk+ code relies on a freedesktop compliant window manager, >> rather than taking the general approach. If XRandr/Xinerama is >> used, no split between Gtk+ and non-Gtk+ code is needed. >> Xrandr/Xinerama is what Gtk+ use anyway so we are not adding any new >> dependencies. >=20 > Of course, patches welcome. (And also for implementations for other > platforms.) I guess XRandR 1.2 covers most of the current uses. Patch attached. The patch includes your code. Actually 1.3 is better, it has XRRGetOutputPrimary. Without it we have = to guess. >=20 > Because XRandR or Xinerama doesn't help us get information about the > workarea (that's the task of window managers), we need some function > like x_get_net_workarea regardless of the use of XRandR or Xinerama. Right. >=20 > Even with XRandR or Xinerama code, leaving the GDK code would be > meaningful because we may have yet another framework for multiple > monitor support (GDK already covers 3 of them on X11) in future. Gdk covers the "Xinerama on Solaris" case which is a bit different. I = don't have any Solaris available, so I can't do that. Another comment: Your defun is x-display-monitor-attributes-list. Aren't we supposed to = try to avoid the use of x-prefixed functions? = display-monitor-attributes-list sounds fine to me. Jan D. --Apple-Mail=_616DF557-0E23-4ADE-B616-20BC70E2F9DA 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-04-28=20= 17:03:38=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)=0A+=20=20=20=20CFLAGS=3D"$SAVE_CFLAGS"= =0A+=20=20=20=20LIBS=3D"$SAVE_LIBS"=0A+=0A+=20=20=20=20= AC_DEFINE(HAVE_XRANDR,=201,=20[Define=20to=201=20if=20you=20have=20the=20= XRandr=20extension.])=0A+=20=20fi=0A+fi=0A+=0A+###=20Use=20Xinerama=20= (-lXinerama)=20if=20available=0A+HAVE_XINERAMA=3Dno=0A+if=20test=20= "${HAVE_X11}"=20=3D=20"yes";=20then=0A+=20=20XINERAMA_REQUIRED=3D1.0.2=0A= +=20=20XINERAMA_MODULES=3D"xinerama=20>=3D=20$XINERAMA_REQUIRED"=0A+=20=20= PKG_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=20= HAVE_XINERAMA=3Dno)=0A+=20=20if=20test=20$HAVE_XINERAMA=20=3D=20no;=20= then=0A+=20=20=20=20#=20Test=20old=20way=20in=20case=20pkg-config=20= doesn't=20have=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(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=2016:31:43=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-04-28=2017:04: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;=0A=20Lisp_Object=20Qfont_param;=0A=20=0A= =20#ifdef=20GLYPH_DEBUG=0A@@=20-3791,6=20+3799,548=20@@=0A=20=20=20else=0A= =20=20=20=20=20return=20Qnil;=0A=20}=0A+=0A+/*=20Return=20an=20alist=20= of=20the=20form=0A+=20=20=20((left=20.=20(+=20XOFFSET))=20(top=20.=20(+=20= YOFFSET))=0A+=20=20=20=20(width=20.=20WIDTH)=20(height=20.=20HEIGHT))=0A= +=20=20=20with=20converting=20XOFFSET,=20YOFFSET,=20WIDTH=20and=20HEIGHT=20= to=20Lisp=0A+=20=20=20integers.=20=20*/=0A+=0A+static=20Lisp_Object=0A= +x_create_geometry_alist=20(EMACS_INT=20xoffset,=20EMACS_INT=20yoffset,=0A= +=09=09=09=20EMACS_INT=20width,=20EMACS_INT=20height)=0A+{=0A+=20=20= return=20list4=20(Fcons=20(Qleft,=20list2=20(Qplus,=20make_number=20= (xoffset))),=0A+=09=09Fcons=20(Qtop,=20list2=20(Qplus,=20make_number=20= (yoffset))),=0A+=09=09Fcons=20(Qwidth,=20make_number=20(width)),=0A+=09=09= Fcons=20(Qheight,=20make_number=20(height)));=0A+}=0A+=0A+/*=20Return=20= an=20alist=20of=20the=20form=20((width=20.=20WIDTH)=20(height=20.=20= HEIGHT)).=0A+=20=20=20with=20converting=20WIDTH=20and=20HEIGHT=20to=20= Lisp=20integers.=20=20*/=0A+=0A+static=20Lisp_Object=0A= +x_create_size_alist=20(EMACS_INT=20width,=20EMACS_INT=20height)=0A+{=0A= +=20=20return=20list2=20(Fcons=20(Qwidth,=20make_number=20(width)),=0A+=09= =09Fcons=20(Qheight,=20make_number=20(height)));=0A+}=0A+=0A+/*=20Store=20= the=20geometry=20of=20the=20workarea=20on=20display=20DPYINFO=20into=20= *RECT.=0A+=20=20=20Return=20false=20if=20and=20only=20if=20the=20= workarea=20information=20cannot=20be=0A+=20=20=20obtained=20via=20the=20= _NET_WORKAREA=20root=20window=20property.=20=20*/=0A+=0A+static=20bool=0A= +x_get_net_workarea=20(struct=20x_display_info=20*dpyinfo,=20XRectangle=20= *rect)=0A+{=0A+=20=20Display=20*dpy=20=3D=20dpyinfo->display;=0A+=20=20= long=20offset,=20max_len;=0A+=20=20Atom=20target_type,=20actual_type;=0A= +=20=20unsigned=20long=20actual_size,=20bytes_remaining;=0A+=20=20int=20= rc,=20actual_format;=0A+=20=20unsigned=20char=20*tmp_data=20=3D=20NULL;=0A= +=20=20bool=20result=20=3D=20false;=0A+=0A+=20=20x_catch_errors=20(dpy);=0A= +=20=20offset=20=3D=200;=0A+=20=20max_len=20=3D=201;=0A+=20=20= target_type=20=3D=20XA_CARDINAL;=0A+=20=20rc=20=3D=20XGetWindowProperty=20= (dpy,=20dpyinfo->root_window,=0A+=09=09=09=20=20=20= dpyinfo->Xatom_net_current_desktop,=0A+=09=09=09=20=20=20offset,=20= max_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&&=20= actual_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=20current_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=20= 4=20*=20current_desktop;=0A+=20=20=20=20=20=20max_len=20=3D=204;=0A+=20=20= =20=20=20=20rc=20=3D=20XGetWindowProperty=20(dpy,=20= dpyinfo->root_window,=0A+=09=09=09=20=20=20=20=20=20=20= dpyinfo->Xatom_net_workarea,=0A+=09=09=09=20=20=20=20=20=20=20offset,=20= max_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+};=0A+=0A+/*=20Return=20monitor=20number=20= where=20F=20is=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+{=0A+=20=20Lisp_Object=20monitor_frames=20=3D=20= Fmake_vector=20(make_number=20(n_monitors),=20Qnil);=0A+=20=20= Lisp_Object=20frame,=20rest,=20attributes_list=20=3D=20Qnil;=0A+=20=20= Lisp_Object=20primary_monitor_attributes=20=3D=20Qnil;=0A+=20=20int=20i;=0A= +=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= 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= (Qframes,=20AREF=20(monitor_frames,=20i)),=0A+=09=09=09=20=20= attributes);=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+=0A+=20=20=20=20=20=20= if=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+=0A+}=0A+=0A= +static=20Lisp_Object=0A+x_get_monitor_attributes_fallback=20(struct=20= x_display_info=20*dpyinfo)=0A+{=0A+=20=20struct=20MonitorInfo=20monitor;=0A= +=20=20int=20width_mm,=20height_mm;=0A+=20=20XRectangle=20workarea_r;=0A= +=0A+=20=20/*=20Fallback:=20treat=20(possibly)=20multiple=20physical=20= monitors=20as=20if=20they=0A+=20=20=20=20=20formed=20a=20single=20= monitor=20as=20a=20whole.=20=20This=20should=20provide=20a=0A+=20=20=20=20= =20consistent=20result=20at=20least=20on=20single=20monitor=20= environments.=20=20*/=0A+=20=20monitor.geom.x=20=3D=20monitor.geom.y=20=3D= =200;=0A+=20=20monitor.geom.width=20=3D=20x_display_pixel_width=20= (dpyinfo);=0A+=20=20monitor.geom.height=20=3D=20x_display_pixel_height=20= (dpyinfo);=0A+=20=20monitor.mm_width=20=3D=20WidthMMOfScreen=20= (dpyinfo->screen);=0A+=20=20monitor.mm_height=20=3D=20HeightMMOfScreen=20= (dpyinfo->screen);=0A+=20=20if=20(x_get_net_workarea=20(dpyinfo,=20= &workarea_r))=0A+=20=20=20=20monitor.work=20=3D=20workarea_r;=0A+=20=20= else=0A+=20=20=20=20monitor.work=20=3D=20monitor.geom;=0A+=20=20return=20= x_make_monitor_attribute_list=20(&monitor,=201,=200,=20dpyinfo);=0A+}=0A= +=0A+=0A+#ifdef=20HAVE_XINERAMA=0A+static=20Lisp_Object=0A= +x_get_monitor_attributes_xinerama=20(struct=20x_display_info=20= *dpyinfo)=0A+{=0A+=20=20int=20n_monitors,=20i;=0A+=20=20Lisp_Object=20= attributes_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+=0A+=20=20=20=20= =20=20/*=20Xinerama=20usually=20have=20primary=20monitor=20first,=20just=20= use=20that.=20=20*/=0A+=20=20=20=20=20=20if=20(i=20=3D=3D=200=20&&=20= x_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=20= workarea_r;=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20if=20(!=20= x_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=20xfree=20(monitors);=0A+=20=20return=20= attributes_list;=0A+=20=20=0A+}=0A+#endif=20/*=20HAVE_XINERAMA=20*/=0A+=0A= +=0A+#ifdef=20HAVE_XRANDR=0A+static=20Lisp_Object=0A= +x_get_monitor_attributes_xrandr=20(struct=20x_display_info=20*dpyinfo)=0A= +{=0A+=20=20Lisp_Object=20attributes_list=20=3D=20Qnil;=0A+=20=20= XRRScreenResources=20*resources;=0A+=20=20Display=20*dpy=20=3D=20= dpyinfo->display;=0A+=20=20int=20i,=20n_monitors,=20primary=20=3D=20-1;=0A= +=20=20RROutput=20pxid=20=3D=20None;=0A+=20=20struct=20MonitorInfo=20= *monitors;=0A+=0A+=20=20resources=20=3D=20XRRGetScreenResourcesCurrent=20= (dpy,=20dpyinfo->root_window);=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(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=20XRRGetCrtcInfo=20(dpy,=20= resources,=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=20= workarea_r;=0A+=0A+=20=20=20=20=20=20=20=20=20=20if=20(!=20crtc)=20= continue;=0A+=0A+=20=20=20=20=20=20=20=20=20=20mi->geom.x=20=3D=20= crtc->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=20crtc->width;=0A+=20= =20=20=20=20=20=20=20=20=20mi->geom.height=20=3D=20crtc->height;=0A+=20=20= =20=20=20=20=20=20=20=20mi->mm_width=20=3D=20info->mm_width;=0A+=20=20=20= =20=20=20=20=20=20=20mi->mm_height=20=3D=20info->mm_height;=0A+=0A+=20=20= =20=20=20=20=20=20=20=20if=20(pxid=20!=3D=20None=20&&=20pxid=20=3D=3D=20= resources->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=20= primary=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=20= mi->work=3D=20workarea_r;=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= if=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=20= mi->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=20XRRFreeScreenResources=20(resources);=0A= +=0A+=20=20attributes_list=20=3D=20x_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=20primary,=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= xfree=20(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=20XRenderQueryExtension=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+=0A+=20=20= block_input=20();=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=20gdpy=20=3D=20= gdk_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(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+=0A+=20=20=20= =20=20=20if=20(i=20=3D=3D=20primary_monitor)=0A+=09= primary_monitor_attributes=20=3D=20attributes;=0A+=20=20=20=20=20=20else=0A= +=09attributes_list=20=3D=20Fcons=20(attributes,=20attributes_list);=0A+=20= =20=20=20}=0A+=0A+=20=20if=20(!NILP=20(primary_monitor_attributes))=0A+=20= =20=20=20attributes_list=20=3D=20Fcons=20(primary_monitor_attributes,=20= attributes_list);=0A+=20=20unblock_input=20();=0A+#else=20=20/*=20not=20= USE_GTK=20*/=0A+=0A+=20=20block_input=20();=0A+=20=20attributes_list=20=3D= =20x_get_monitor_attributes=20(dpyinfo);=0A+=20=20unblock_input=20();=0A= +=0A+#endif=09/*=20not=20USE_GTK=20*/=0A+=0A+=20=20return=20= attributes_list;=0A+}=0A+=0A=20=0C=0A=20int=0A=20x_pixel_width=20= (register=20struct=20frame=20*f)=0A@@=20-5701,6=20+6251,10=20@@=0A=20=20=20= DEFSYM=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=20=20DEFSYM=20= (Qfont_param,=20"font-parameter");=0A=20=20=20/*=20This=20is=20the=20end=20= of=20symbol=20initialization.=20=20*/=0A=20=0A@@=20-5864,6=20+6418,7=20= @@=0A=20=20=20defsubr=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=2012:00:47=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= 12:00:47=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=_616DF557-0E23-4ADE-B616-20BC70E2F9DA Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=iso-8859-1 --Apple-Mail=_616DF557-0E23-4ADE-B616-20BC70E2F9DA--