From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Will Roberts Newsgroups: gmane.emacs.devel Subject: patch: bug #4831 part 2 Date: Fri, 23 Jul 2010 20:45:54 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/mixed; boundary=Apple-Mail-5-955843581 X-Trace: dough.gmane.org 1279911625 5927 80.91.229.12 (23 Jul 2010 19:00:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 23 Jul 2010 19:00:25 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 23 21:00:24 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OcNTq-0005o8-U8 for ged-emacs-devel@m.gmane.org; Fri, 23 Jul 2010 21:00:23 +0200 Original-Received: from localhost ([127.0.0.1]:58915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcNTq-0006Ph-8l for ged-emacs-devel@m.gmane.org; Fri, 23 Jul 2010 15:00:22 -0400 Original-Received: from [140.186.70.92] (port=52766 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcNG3-0002B7-6B for emacs-devel@gnu.org; Fri, 23 Jul 2010 14:46:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OcNG1-0000gG-OR for emacs-devel@gnu.org; Fri, 23 Jul 2010 14:46:07 -0400 Original-Received: from mail-fx0-f41.google.com ([209.85.161.41]:47632) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OcNG1-0000fx-G9 for emacs-devel@gnu.org; Fri, 23 Jul 2010 14:46:05 -0400 Original-Received: by fxm20 with SMTP id 20so5775831fxm.0 for ; Fri, 23 Jul 2010 11:46:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type:subject :date:message-id:to:mime-version:x-mailer; bh=Nc4rOgyc7N6RfEeE0kLad3NI2i7Is3yt35dIjEpe3w8=; b=WOEVFMH3fUXOXGpIZGuiiYhYCTWIS+zPORUm/RG9qzVLwz3jhYGOI1wzfbqBsKNeCk b/sO25jFSSCrF2EetSIMT9i4CASsaFJIx6dNO8NeiGGTZCBCle2rmUwRQf2lBuAtFc9Q nASXe8EYGCQUv0y9p5GSoewPYeIwAtPEhqmDg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:subject:date:message-id:to:mime-version:x-mailer; b=pn72jnngaB616UvT/0hh9tOtYpDC5oM49q7hhseE9xmErrgaB1CVSUQwjYKj/mnQvy 33Ql1p2D8dLckQqnwVFR9li8xbt7RILUohy0Le2Daxy6RvmpT74OB+ebtqOQyfR/HEM1 d2adYIaXkCp7VJQs7Hxp/4yVq4RGnDfomuR7M= Original-Received: by 10.223.119.204 with SMTP id a12mr3623257far.67.1279910763753; Fri, 23 Jul 2010 11:46:03 -0700 (PDT) Original-Received: from [192.168.1.107] (p5DC5AB10.dip.t-dialin.net [93.197.171.16]) by mx.google.com with ESMTPS id r27sm189015faa.0.2010.07.23.11.46.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 23 Jul 2010 11:46:02 -0700 (PDT) X-Mailer: Apple Mail (2.1081) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Fri, 23 Jul 2010 15:00:15 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:127721 Archived-At: --Apple-Mail-5-955843581 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hello: This is my first patch submission to Emacs. I'd be happy to learn how = to do it better in the future, if you have any comments or criticism. = The patch was made against the bazaar repository. Thanks, Will =3D=3D Description: =3D=3D A first draft at patching bug #4831 (23.1.50; cursor problems on Mac OS = X), specifically part 2, where characters under the cursor are not seen. Modified the drawing routines:=20 * the cursor will be drawn with the frame foreground color if the cursor = color is the same as the current face background color or the frame = background color. * the text over the cursor will be drawn with the frame background color = if the cursor is a filled box, and the cursor color is the same as the = text color =3D=3D Copyright =3D=3D I happily assign copyright for this code to the FSF. Please do with it = what you like. =3D=3D src/ChangeLog: =3D=3D 2010-07-23 Will Roberts * nsfont.m (nsfont_draw): Change the text color if needed to be distinct from the cursor color * nsterm.m (ns_draw_window_cursor): Change the cursor color to = be distinct from the text color --Apple-Mail-5-955843581 Content-Disposition: attachment; filename=ns-cursor.patch Content-Type: application/octet-stream; name="ns-cursor.patch" Content-Transfer-Encoding: 7bit === modified file 'src/nsfont.m' *** src/nsfont.m 2010-07-07 22:18:28 +0000 --- src/nsfont.m 2010-07-23 18:20:12 +0000 *************** nsfont_draw (struct glyph_string *s, int *** 1168,1173 **** --- 1168,1205 ---- ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) : FRAME_BACKGROUND_COLOR (s->f))); + // change character color if we're drawing the cursor, the cursor + // covers the text, and the cursor is the same color as the text + if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR) + { + // maybe the cursor itself is modified because of the face + // background? + if (ns_index_color (FRAME_CURSOR_COLOR (s->f), s->f) == + ns_index_color (FRAME_BACKGROUND_COLOR (s->f), s->f) || + ns_index_color (FRAME_CURSOR_COLOR (s->f), s->f) == + NS_FACE_BACKGROUND (face)) + { + // cursor is set to frame foreground color, set the text to + // frame background + col = FRAME_BACKGROUND_COLOR(s->f); + } + else + { + // otherwise, if the text foreground color is the same as + // the cursor color, + unsigned faceFgId = (NS_FACE_FOREGROUND (face) != 0 ? + NS_FACE_FOREGROUND (face) : + ns_index_color (FRAME_FOREGROUND_COLOR (s->f), + s->f)); + if (ns_index_color (FRAME_CURSOR_COLOR (s->f), s->f) == faceFgId) + { + // cursor is the same as the face foreground, set the + // text to frame background + col = FRAME_BACKGROUND_COLOR(s->f); + } + } + } + /* render under GNUstep using DPS */ #ifdef NS_IMPL_GNUSTEP { === modified file 'src/nsterm.m' *** src/nsterm.m 2010-07-10 18:52:53 +0000 --- src/nsterm.m 2010-07-23 18:21:20 +0000 *************** ns_draw_window_cursor (struct window *w, *** 2288,2295 **** /* TODO: only needed in rare cases with last-resort font in HELLO.. should we do this more efficiently? */ ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */ ! [FRAME_CURSOR_COLOR (f) set]; ! #ifdef NS_IMPL_COCOA /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph atomic. Cleaner ways of doing this should be investigated. --- 2288,2315 ---- /* TODO: only needed in rare cases with last-resort font in HELLO.. should we do this more efficiently? */ ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */ ! ! /* make sure the cursor is distinct from the text background */ ! struct face *textFace; ! textFace = FACE_FROM_ID (f, phys_cursor_glyph->face_id); ! if (ns_index_color (FRAME_CURSOR_COLOR (f), f) == ! ns_index_color (FRAME_BACKGROUND_COLOR (f), f) || ! (textFace != NULL && ns_index_color (FRAME_CURSOR_COLOR (f), f) == ! NS_FACE_BACKGROUND (textFace))) ! { ! NSColor *alternateCursorColor; ! { ! alternateCursorColor = FRAME_FOREGROUND_COLOR(f); ! } ! if (!alternateCursorColor) ! alternateCursorColor = FRAME_CURSOR_COLOR (f); ! [alternateCursorColor set]; ! } ! else ! { ! [FRAME_CURSOR_COLOR (f) set]; ! } ! #ifdef NS_IMPL_COCOA /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph atomic. Cleaner ways of doing this should be investigated. --Apple-Mail-5-955843581--