From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Re: Calculating screen relative X when horizontal scrolling. Date: Wed, 17 Oct 2018 10:54:01 -0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1539798794 10999 195.159.176.226 (17 Oct 2018 17:53:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 17 Oct 2018 17:53:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 17 19:53:10 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gCq0K-0002ia-Lb for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2018 19:53:09 +0200 Original-Received: from localhost ([::1]:38447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCq2Q-0003xD-TU for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2018 13:55:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCq1m-0003x5-PA for emacs-devel@gnu.org; Wed, 17 Oct 2018 13:54:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCq1i-0001oN-2o for emacs-devel@gnu.org; Wed, 17 Oct 2018 13:54:38 -0400 Original-Received: from gateway36.websitewelcome.com ([192.185.185.36]:33098) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gCq1f-0001fY-Vh for emacs-devel@gnu.org; Wed, 17 Oct 2018 13:54:32 -0400 Original-Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway36.websitewelcome.com (Postfix) with ESMTP id B65AF40201C3C for ; Wed, 17 Oct 2018 12:01:19 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id Cq1DgMWPMaSeyCq1Kgh6fO; Wed, 17 Oct 2018 12:54:14 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=v/ntWKGqRh21uVTyxqtZ+BU9ynsTfeLy2S6CPFWnAoA=; b=KfLeKlh5Gcwtp4UncHkqYzdaps z23YZjSBmKPfem2ZyxpslW+MHJxs6nrDUGPC9kM1XoaWVQjy0XOu0BmK4bIhKp4L+wP3hAhrV+8G8 Zo8E4JN54qnY5uGv6IX40BYbUEEF2kKOIuRxqAKEW/3Z2Pa5ZYKMRBvlZco3mg7tRrglR5K6lvexS 7AqnqylhZ4cr7WgxsJgNlD2azKZj2ZHfQVtR2sL+Aj7v+iY73/egccsrnz91GW3jkt7lCa+OiiyMC A+pZUs3mDVfnesNDhO3FZx79uf6+zGLTJIJqoiP/t9Sb2NNLPGYhcohR75k52+iCQzpCpgvUDtmlh nMy8xT8w==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:49566 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.91) (envelope-from ) id 1gCq1B-002P3t-LQ; Wed, 17 Oct 2018 12:54:01 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1gCq1B-002P3t-LQ X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:49566 X-Source-Auth: lawlist X-Email-Count: 4 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.185.36 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:230460 Archived-At: I apologize for having misspoken about using the 3rd argument of draw_window_cursor to control the relative x coordinate of the fake cursor. I had forgotten that I actually temporarily hijack w->phys_cursor.x and assign my own relative x just prior to calling draw_window_cursor. Here is a snippet from the relevant section of feature requests 17684 (crosshairs) and 22873 (multiple fake cursors): /* Record some of the current values for the cursor and glyph_row. */ bool phys_cursor_on_p = w->phys_cursor_on_p; struct glyph_row *glyph_row = MATRIX_ROW (w->current_matrix, vpos); bool cursor_in_fringe_p = glyph_row->cursor_in_fringe_p; bool reversed_p = glyph_row->reversed_p; ptrdiff_t phys_cursor_x = w->phys_cursor.x; ptrdiff_t phys_cursor_y = w->phys_cursor.y; ptrdiff_t phys_cursor_hpos = w->phys_cursor.hpos; ptrdiff_t phys_cursor_vpos = w->phys_cursor.vpos; ptrdiff_t phys_cursor_ascent = w->phys_cursor_ascent; ptrdiff_t phys_cursor_height = w->phys_cursor_height; ptrdiff_t phys_cursor_width = w->phys_cursor_width; enum text_cursor_kinds phys_cursor_type = w->phys_cursor_type; /* Hijack w->phys_cursor. */ w->phys_cursor.x = x; w->phys_cursor.y = glyph_row->y; w->phys_cursor.hpos = hpos; w->phys_cursor.vpos = vpos; w->phys_cursor_type = cursor_type; w->phys_cursor_ascent = glyph_row->ascent; w->phys_cursor_height = glyph_row->height; w->phys_cursor_width = cursor_width; FRAME_RIF (f)->draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, true, active_cursor_p); /* Restore the previous values for w->phys_cursor and glyph_row. */ w->phys_cursor_on_p = phys_cursor_on_p; w->phys_cursor.x = phys_cursor_x; w->phys_cursor.y = phys_cursor_y; w->phys_cursor.hpos = phys_cursor_hpos; w->phys_cursor.vpos = phys_cursor_vpos; w->phys_cursor_type = phys_cursor_type; glyph_row->cursor_in_fringe_p = cursor_in_fringe_p; glyph_row->reversed_p = reversed_p; w->phys_cursor_ascent = phys_cursor_ascent; w->phys_cursor_height = phys_cursor_height; w->phys_cursor_width = phys_cursor_width; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > Date: [10-17-2018 09:25:41] <17 Oct 2018 19:25:41 +0300> > From: Eli Zaretskii > To: Keith David Bershatsky > CC: emacs-devel@gnu.org > Subject: Re: Calculating screen relative X when horizontal scrolling. > > > Date: Tue, 16 Oct 2018 08:41:00 -0700 > > From: Keith David Bershatsky > > Cc: emacs-devel@gnu.org > > > > The x coordinate sought will be used as the 3rd argument to draw_window_cursor in conjunction with feature requests 17684 (crosshairs) and 22873 (multiple fake cursors). > > > > The method of calculation used in the initial post is off by a few pixels when dealing with each of the fact patterns described. Here is a sample _current_ line (miscellaneous characters of varying pixel widths) where my calculations go awry: > > I'm sorry, I still don't have a clear understanding of the issue. In > particular, the implementations of draw_window_cursor method don't use > the 3rd argument for positioning the cursor. So I still don't > understand what you mean by "relative x".