From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: GTK pixmap background support? Date: 13 Aug 2003 20:04:36 +0900 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: Reply-To: Miles Bader NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1060773481 15603 80.91.224.253 (13 Aug 2003 11:18:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2003 11:18:01 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Aug 13 13:18:00 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19mtdg-0002z8-00 for ; Wed, 13 Aug 2003 13:18:00 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19mtdk-0007lN-00 for ; Wed, 13 Aug 2003 13:18:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19mtdJ-0004XB-Hf for emacs-devel@quimby.gnus.org; Wed, 13 Aug 2003 07:17:37 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19mtXS-0000Rr-0q for emacs-devel@gnu.org; Wed, 13 Aug 2003 07:11:34 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19mtRN-0007Bs-Js for emacs-devel@gnu.org; Wed, 13 Aug 2003 07:05:48 -0400 Original-Received: from [202.32.8.214] (helo=TYO201.gate.nec.co.jp) by monty-python.gnu.org with esmtp (Exim 4.20) id 19mtQn-0006z3-AT; Wed, 13 Aug 2003 07:04:41 -0400 Original-Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.194]) by TYO201.gate.nec.co.jp (8.11.6/3.7W01080315) with ESMTP id h7DB4d120245; Wed, 13 Aug 2003 20:04:39 +0900 (JST) Original-Received: from mailsv.nec.co.jp (mailgate51.nec.co.jp [10.7.69.190]) by mailgate3.nec.co.jp (8.11.6/3.7W-MAILGATE-NEC) with ESMTP id h7DB4cm05872; Wed, 13 Aug 2003 20:04:38 +0900 (JST) Original-Received: from edtmg01.lsi.nec.co.jp ([10.26.16.201]) by mailsv.nec.co.jp (8.11.6/3.7W-MAILSV-NEC) with ESMTP id h7DB4cS12596; Wed, 13 Aug 2003 20:04:38 +0900 (JST) Original-Received: from mcsss2.ucom.lsi.nec.co.jp (localhost [127.0.0.1]) by edtmg01.lsi.nec.co.jp (8.9.3p2+3.2W/3.7W_EDC_Ver.1.0) with ESMTP id UAA25284; Wed, 13 Aug 2003 20:04:38 +0900 (JST) Original-Received: from mcspd15.ucom.lsi.nec.co.jp (mcspd15 [10.30.114.174]) by mcsss2.ucom.lsi.nec.co.jp (8.12.8/8.12.8/EDcg v2.01-mc/1046780839) with ESMTP id h7DB4aNH014219; Wed, 13 Aug 2003 20:04:36 +0900 (JST) Original-Received: by mcspd15.ucom.lsi.nec.co.jp (Postfix, from userid 31295) id C316C3723; Wed, 13 Aug 2003 20:04:36 +0900 (JST) Original-To: "Jan D." System-Type: i686-pc-linux-gnu Blat: Foop Original-Lines: 60 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15925 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15925 Hi, I've been working on my pixmap background patch for emacs, and have run into a slight bad interaction with the GTK toolkit support; I think it can be worked around, but would like to see if it's possible to solve it more cleanly. Basically, when emacs sets the default background color, it this (in src/xfns.c): void x_set_background_color (f, arg, oldval) { ... XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg); ... #ifdef USE_GTK xg_set_background_color (f, bg); #endif ... } `xg_set_background_color' looks like this: xg_set_background_color (f, bg) { ... gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &gdk_bg); ... } This means that calls to XClear*, and exposures, will start out with the correct background color, and emacs need only worry about changing other things. When using the GTK toolkit, GTK itself apparently uses XSetWindowBackground for its own purposes, but the xg_set_background gives GTK enough info to keep things basically how emacs likes. However, with pixmap backgrounds, I want to use `XSetWindowBackgroundPixmap' instead -- but there doesn't appear to be any equivalent call to `gtk_widget_modify_bg' that takes a pixmap instead of a color! So you can see the problem: even though I've done a XSetWindowBackgroundPixmap, GTK will at some point set the window background to a color, and there doesn't seem to be any way to tell it not to, so clears/exposures come out incorrectly. As it happens, I think I have to support more complete redrawing modes in emacs anyway (for more complicated background tiling than just simple frame-relative pixmaps), but it would be nice to be able to use the native X calls when possible, as it's more efficient, and probably going to be less buggy for a while... :-) So can you see any possible GTK solution to this qunadary? I thought maybe it would possible to do something tricky by consing up a theme or something, but that seems rather hairy and certainly beyond my limited experience. Thanks, -Miles -- .Numeric stability is probably not all that important when you're guessing.