From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: check_window_system Date: Fri, 05 Apr 2013 17:33:31 +0300 Message-ID: <83zjxddp38.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1365278634 29599 80.91.229.3 (6 Apr 2013 20:03:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Apr 2013 20:03:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 06 22:03:54 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 1UOZJi-00023j-EW for ged-emacs-devel@m.gmane.org; Sat, 06 Apr 2013 22:02:26 +0200 Original-Received: from localhost ([::1]:45524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO7hy-0007SZ-HF for ged-emacs-devel@m.gmane.org; Fri, 05 Apr 2013 10:33:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO7ht-0007Oi-1j for emacs-devel@gnu.org; Fri, 05 Apr 2013 10:33:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UO7hr-0001Uo-VD for emacs-devel@gnu.org; Fri, 05 Apr 2013 10:33:32 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:54023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO7hr-0001Ua-Nh for emacs-devel@gnu.org; Fri, 05 Apr 2013 10:33:31 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MKS00800DN6CM00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Fri, 05 Apr 2013 17:33:29 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MKS007DADRTYOA0@a-mtaout21.012.net.il>; Fri, 05 Apr 2013 17:33:29 +0300 (IDT) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.169 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:158718 Archived-At: I think these changes ------------------------------------------------------------ revno: 112228 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-04-05 14:07:02 +0000 message: Consistently use platform-specific function to detect window system. * lisp.h (check_window_system): New prototype. This function is going to replace check_x, check_w32 and check_ns. (have_menus_p): Mention msdos.c in comment. * fontset.c (check_window_system_func): Remove. Adjust all users. * fontset.h (check_window_system_func): Remove prototype. * nsterm.h (check_ns): * xterm.h (check_x): * w32term.h (check_w32): Likewise. * menu.c (Fx_popup_menu): Use check_window_system. * msdos.c (check_window_system): Define for MS-DOS. * nsfns.m (check_window_system): Define for NS. Adjust all users. * w32fns.c (check_window_system): Likewise for MS-Windows. * xfns.c (check_window_system): Likewise for X. * font.c, frame.c, nsmenu.m, nsselect.m, nsterm.m, w32menu.c: * xfaces.c, xmenu.c: Use check_window_system where appropriate. go against our tendency to replace window-system tests at compile time with run-time tests for frame type (FRAME_X_P, FRAME_NS_P, etc.). Thus, after the changes above, we have 4 different implementations of the same function check_window_system, which means it would be impossible to have, say, X and NS frames in the same binary/session. Instead, check_window_system should have been implemented only once, in some common source file, and it should have been doing something like this: #ifdef HAVE_X_WINDOWS if (FRAME_X_P (f)) check_x (); #endif #ifdef HAVE_NS if (FRAME_NS_P (f)) check_ns (); #endif etc., you get the idea. IOW, there should be no assumption that X, NS, and w32 are mutually exclusive.