From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Gramiak Newsgroups: gmane.emacs.devel Subject: Removing the usage of X structures (or their names) in independent code Date: Wed, 08 May 2019 22:28:23 -0600 Message-ID: <875zqkdzfc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="246794"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 09 06:28:31 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOafW-00126C-Uv for ged-emacs-devel@m.gmane.org; Thu, 09 May 2019 06:28:31 +0200 Original-Received: from localhost ([127.0.0.1]:47730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOafV-0000fN-Qu for ged-emacs-devel@m.gmane.org; Thu, 09 May 2019 00:28:29 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOafP-0000fE-Js for emacs-devel@gnu.org; Thu, 09 May 2019 00:28:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOafN-0001Tk-L6 for emacs-devel@gnu.org; Thu, 09 May 2019 00:28:23 -0400 Original-Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:41196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOafK-0001R4-0q for emacs-devel@gnu.org; Thu, 09 May 2019 00:28:19 -0400 Original-Received: by mail-pg1-x532.google.com with SMTP id z3so506627pgp.8 for ; Wed, 08 May 2019 21:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=LTJYzwskFxI2oc8pXBR7lLyRf0e9JXr51S981ZUkU5Q=; b=FliFP6zySraV509jBEM44IOVn5ddU1WEI6fMg8ycZWVHM/AWxZS5QcF5Xj+hCxiNtn Box2ERAruKqhF4FC7iwd5K6+tbM5MLEPtv4vwVeIFz3zsiUpif+PKbHpyRPFcZQqLD/k Nwl4ylscZfeqp+33NgiVMJ2lB88f0kk/5Z748KZ5jEFosd83G7qUkMMknm/QpT5XQ1Q4 NEQPE8WKgxAsdDTHiOb8qL2FQEH4/L+lZ14z7DsprJFDDTL6BQ7GAHCx+aZ+6unS6Uu0 +GQDKGp8Pq/xuRZQf98nsVCRP3kc0V4hJWQ4hQxz0XGmPvpQ50Q7+3eUZ0PlurY5vXEk Is0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=LTJYzwskFxI2oc8pXBR7lLyRf0e9JXr51S981ZUkU5Q=; b=XZMq2bpaccnY1/LW0o+TRSJIx9JumcZ77i0n01vpjJEWgwi2eAQV8EOULqGqXiWtsf Kkj21OPZhkq0i99QLL2lixlq+Ujf+qR9SfbnTnftgj3B0qjIwRalK1NL460KeSw+ZzaL 1K1WFURECsgs5UOmKnmb6Q+hprinnCdOJpIn4a1fQyjp1HwcyruiHHB4/t607HC0/XIY I4RPTELJnkV5dqiR7J5jr24PnZz0+FPL8RxBuKP/g9Vcau8NSlJQCk3yC9frlwsbK189 OgZ7eQ1ld2v+2sWTcflQZenh0+xfF7oZ1SB1PpLaU2cht8sMw0E+zHgu33aEeERYGFdy 3iYA== X-Gm-Message-State: APjAAAXDvXvsOvWufS5gNrC8zQPsZ0spB8/YleiK5noE3gvuuQNyymF3 NBVm9ZjUnytXByj5RTlnYUiN8bxP X-Google-Smtp-Source: APXvYqw95RMEko/7YtShy/ba5/rekK6vTD+rOaXyEPleVMxtKqE5ov+HLE3G+QHpqBW81WhV1AHsvg== X-Received: by 2002:a65:448b:: with SMTP id l11mr2745905pgq.185.1557376096218; Wed, 08 May 2019 21:28:16 -0700 (PDT) Original-Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id a26sm1230115pfl.177.2019.05.08.21.28.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 May 2019 21:28:15 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::532 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:236321 Archived-At: Numerous internal procedures in Emacs that aren't tied to X expect and use structures with the same name as X structures: e.g., XColor, XGCValues, GC, XRectangle, XChar2b, Display, Pixmap, Cursor. This poses an issue when attempting to use a non-X backend to Emacs that conditionally uses X itself: name clashes occur between the structures intended for use in the independent Emacs code and the internal X structures. Workarounds using the preprocessor exist but are ugly and fragile. What would be the preferred way to fix this situation? Two options are to use typedefs for these structures like XImagePtr_or_DC, or to use unions. Everything else being equal, I would prefer the union approach. Alternatively, for structures like XColor, there could be new generic structures that all the backends share, but that would involve some overhead on the X side for conversion.