unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Power: blink-cursor-mode is a pig
@ 2011-12-29 23:54 Daniel Colascione
  2011-12-30  3:55 ` Lennart Borgman
                   ` (3 more replies)
  0 siblings, 4 replies; 26+ messages in thread
From: Daniel Colascione @ 2011-12-29 23:54 UTC (permalink / raw)
  To: Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]

blink-cursor-mode uses an idle timer to activate a regular timer that
blinks the cursor every 500ms.  While an Emacs frame has focus, we want
this timer to run so that we can make the cursor blink.  The problem is
that although the cursor stops blinking when Emacs loses focus, the
timer keeps running because Emacs has no idea it lost focus and doesn't
know it can turn off the timer.  The unnecessary Emacs wakeups caused by
this timer waste power.

We should turn off blink-cursor's timer when Emacs loses focus.  But as
far as I see, we don't send a focus-lost event to lisp.  The manual
specifically says that this switch-frame behavior is a feature, not a bug:

"Some X window managers are set up so that just moving the mouse into
a window is enough to set the focus there.  Usually, there is no need
for a Lisp program to know about the focus change until some other kind
of input arrives.  Emacs generates a focus event only when the user
actually types a keyboard key or presses a mouse button in the new
frame; just moving the mouse between frames does not generate a focus
event."

I think the reasoning behind this behavior has gone stale: blink-cursor
is on by default; most people use click-to-focus windowing systems; and
Emacs often runs on devices with batteries.  We should send focus and
blur events eagerly so blink-cursor can turn itself off.  (Ideally, we'd
also stop blinking the cursor when Emacs is invisible, but I imagine
it's rare for a window to be both focused and invisible.)

Is there an easier way of stopping the blink-cursor timer than plumbing
new events through the Emacs core, or turning blink-cursor off?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 235 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: Power: blink-cursor-mode is a pig
@ 2011-12-31 12:00 grischka
  2011-12-31 14:40 ` Eli Zaretskii
  0 siblings, 1 reply; 26+ messages in thread
From: grischka @ 2011-12-31 12:00 UTC (permalink / raw)
  To: eliz; +Cc: emacs-devel

Eli Zaretskii wrote:
>> Date: Fri, 30 Dec 2011 23:21:59 -0800
>> From: Daniel Colascione <address@hidden>
>> Cc: YAMAMOTO Mitsuharu <address@hidden>, address@hidden
>> 
>> Windows takes pains to not send out useless message broadcasts.  Other
>> than these broadcasts, a program is only woken to receive a message
>> when something specifically sends it a message.  If there's no system
>> activity, or the only activity is unrelated to Emacs, Emacs won't
>> receive any messages and won't wake up.
> 
> As long as no messages arrive, the w32 message-reading thread is blocked
> inside the call to WaitForSingleObject (see w32xfns.c:get_next_message).
> This call has no timeout, so it will block indefinitely.

(A) w32xfns.c:get_next_message doesn't run in the "w32 message-reading thread"
and (B) never calls WaitForSingleObject.

--- grischka



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2011-12-31 18:11 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 23:54 Power: blink-cursor-mode is a pig Daniel Colascione
2011-12-30  3:55 ` Lennart Borgman
2011-12-30 16:54   ` Richard Stallman
2011-12-30  9:10 ` Eli Zaretskii
2011-12-30  9:19   ` Lennart Borgman
2011-12-30  9:20   ` Daniel Colascione
2011-12-30 11:42     ` Eli Zaretskii
2011-12-30 11:58       ` Daniel Colascione
2011-12-30 12:39         ` Daniel Colascione
2011-12-30 15:32         ` Eli Zaretskii
2011-12-30 12:49       ` 山本 光晴
2011-12-30 15:35         ` Eli Zaretskii
2011-12-31  3:47           ` YAMAMOTO Mitsuharu
2011-12-31  7:10             ` Eli Zaretskii
2011-12-31  7:21               ` Daniel Colascione
2011-12-31  7:42                 ` YAMAMOTO Mitsuharu
2011-12-31 10:59                   ` Jan Djärv
2011-12-31  7:42                 ` Eli Zaretskii
2011-12-30 14:37   ` David De La Harpe Golden
2011-12-30 15:37     ` Eli Zaretskii
2011-12-30 13:57 ` Thien-Thi Nguyen
2011-12-30 14:46   ` Óscar Fuentes
2011-12-31 18:04 ` Chong Yidong
2011-12-31 18:11   ` Lennart Borgman
  -- strict thread matches above, loose matches on Subject: below --
2011-12-31 12:00 grischka
2011-12-31 14:40 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).