From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: Blink cursor changes, possible W32 breakage. Date: Tue, 16 Jul 2013 19:00:30 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1373994089 3271 80.91.229.3 (16 Jul 2013 17:01:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Jul 2013 17:01:29 +0000 (UTC) Cc: Emacs developers To: =?UTF-8?Q?Jan_Dj=C3=A4rv?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 16 19:01:31 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 1Uz8d0-0001XU-18 for ged-emacs-devel@m.gmane.org; Tue, 16 Jul 2013 19:01:30 +0200 Original-Received: from localhost ([::1]:50040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz8cz-0000eQ-NU for ged-emacs-devel@m.gmane.org; Tue, 16 Jul 2013 13:01:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz8cm-0000cN-V7 for emacs-devel@gnu.org; Tue, 16 Jul 2013 13:01:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uz8ci-0000a6-6f for emacs-devel@gnu.org; Tue, 16 Jul 2013 13:01:16 -0400 Original-Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]:52124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uz8ch-0000Zm-SZ for emacs-devel@gnu.org; Tue, 16 Jul 2013 13:01:12 -0400 Original-Received: by mail-ea0-f176.google.com with SMTP id z15so505686ead.21 for ; Tue, 16 Jul 2013 10:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=m0M5PSHPJg610Rb02VMWpZGpddwxmR4HAXAdy6MpN4I=; b=FPdB4B9Z6x2u4tLFtD4x36fzxJn9pUSB0S2lgAWuUaKqugWkhV88XvVXsH5CGXemvO Vf9sEAYvLMh27UBLd4/NSQm0Adr2bqh1xQd4cFPyaXSJsXrMXxe5rgNAY3dcgK9xm9GM 3qOHXveb+/Kegd/G5gp0rYaG59As8LB6C692frmxpkqvXHl3ocfPm+5VehBH9N/794SV G2DsMamo7OOGfh5oNVXdVeKftyaPOChXXEBox2P11W0SwaXPaaIGHD5stF8FBGb5B/Vh PZ3AwPc1+M4B9EP0aKALqX284roWM4neqefdmIb5Miiu6s4ox/pygQ0c4YBUaZ+311Rb GaNA== X-Received: by 10.15.25.2 with SMTP id k2mr2379384eeu.99.1373994071086; Tue, 16 Jul 2013 10:01:11 -0700 (PDT) Original-Received: by 10.14.142.4 with HTTP; Tue, 16 Jul 2013 10:00:30 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::230 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:161936 Archived-At: The following patch works. I'm not sure about the keyboard.c part. I suppose it is OK to use FRAME_X_DISPLAY_INFO in the X and NS code? === modified file 'lisp/frame.el' --- lisp/frame.el 2013-07-16 11:41:06 +0000 +++ lisp/frame.el 2013-07-16 16:44:14 +0000 @@ -1709,7 +1709,7 @@ "Timer function of timer `blink-cursor-timer'." (internal-show-cursor nil (not (internal-show-cursor-p))) ;; Each blink is two calls to this function. - (when (memq window-system '(x ns)) + (when (memq window-system '(x ns w32)) (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done)) (when (and (> blink-cursor-blinks 0) (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done)) @@ -1729,11 +1729,11 @@ (setq blink-cursor-timer nil))) (defun blink-cursor-suspend () - "Suspend cursor blinking on NS and X. + "Suspend cursor blinking on NS, X and W32. This is called when no frame has focus and timers can be suspended. Timers are restarted by `blink-cursor-check', which is called when a frame receives focus." - (when (memq window-system '(x ns)) + (when (memq window-system '(x ns w32)) (blink-cursor-end) (when blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer) === modified file 'src/keyboard.c' --- src/keyboard.c 2013-07-16 11:41:06 +0000 +++ src/keyboard.c 2013-07-16 16:57:20 +0000 @@ -4085,7 +4085,7 @@ } else if (event->kind == FOCUS_OUT_EVENT) { -#if defined(HAVE_NS) || defined (HAVE_X11) +#if defined (HAVE_NS) || defined (HAVE_X11) || defined (WINDOWSNT) #ifdef HAVE_NS struct ns_display_info *di; @@ -4095,11 +4095,11 @@ Lisp_Object rest, frame = event->frame_or_window; bool focused = false; - for (di = x_display_list; di && ! focused; di = di->next) - focused = di->x_highlight_frame != 0; + for (di = x_display_list; di && ! focused; di = FRAME_X_DISPLAY_INFO (di)->next) + focused = FRAME_X_DISPLAY_INFO (di)->x_highlight_frame = 0; if (! focused) obj = make_lispy_focus_out (frame); -#endif /* HAVE_NS || HAVE_X11 */ +#endif /* HAVE_NS || HAVE_X11 || WINDOWSNT */ kbd_fetch_ptr = event + 1; } === modified file 'src/w32term.c' --- src/w32term.c 2013-07-13 14:21:01 +0000 +++ src/w32term.c 2013-07-16 16:38:18 +0000 @@ -2912,9 +2912,15 @@ && CONSP (Vframe_list) && !NILP (XCDR (Vframe_list))) { - bufp->kind = FOCUS_IN_EVENT; - XSETFRAME (bufp->frame_or_window, frame); - } + bufp->arg = Qt; + } + else + { + bufp->arg = Qnil; + } + + bufp->kind = FOCUS_IN_EVENT; + XSETFRAME (bufp->frame_or_window, frame); } frame->output_data.x->focus_state |= state; @@ -2929,7 +2935,10 @@ { dpyinfo->w32_focus_event_frame = 0; x_new_focus_frame (dpyinfo, 0); - } + + bufp->kind = FOCUS_OUT_EVENT; + XSETFRAME (bufp->frame_or_window, frame); + } /* TODO: IME focus? */ }