Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse cursor disappears when keyboard is used #995

Closed
marekhrabe opened this issue Jan 10, 2015 · 4 comments · Fixed by #1520
Closed

Mouse cursor disappears when keyboard is used #995

marekhrabe opened this issue Jan 10, 2015 · 4 comments · Fixed by #1520

Comments

@marekhrabe
Copy link

When I press any key on my keyboard while in atom-shell app, mouse cursor hides until mouse moves again. This might be just the right option for some of the apps, but we are really struggling with this behavior in our atom-shell app Avocode.

Our interface is similar to graphic editors - you have big canvas with opened document and set of tools you can use. All tools have keyboard shortcuts for activation and when you press for example shortcut for color picker, then instead of changing cursor to eyedropper (which we do in css), the cursor hides and won't show up again until you move your mouse. The experience seems broken

I went a little further while writing this issue and discovered that this is probably issue just on Mac (although not confirmed) which is caused by this snipped of code from chromium (I searched in latest stable release source)

// from chromium-39.0.2171.95/content/browser/renderer_host/render_widget_host_view_mac.mm// Determine whether we should autohide the cursor (i.e., hide it until mouse
// move) for the given event. Customize here to be more selective about which
// key presses to autohide on.
+ (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event {
  return ([event type] == NSKeyDown &&
             !([event modifierFlags] & NSCommandKeyMask)) ? YES : NO;
}

Is is possible that this could be overridden by atom-shell app via any kind of setting/flag? Thanks for any help

@whistlegraph
Copy link
Contributor

I've run into this multiple times. The way I work around it is to create an element containing the cursor image positioned where the cursor would be after the key is pressed and then on the mouse move event when the cursor reappears I hide the element.

The downsides to this approach are that the cursor gets cut off on the edge of the window and if you are trying to do anything where you need to hold a key down while moving the cursor... well, hardware cursors feel much more responsive than html elements so it's kind of a drag.

@zcbenz
Copy link
Contributor

zcbenz commented Jan 12, 2015

I'll add an option for this in BrowserWindow, thanks for finding out the troubling line.

@MaxGraey
Copy link
Contributor

Hi, is there some progress in this matter?

@mark-hahn
Copy link

This is somewhat off-topic but I'm having the same problem but with the text cursor, not the mouse cursor. I assume it has something to do with losing focus. Can someone point me to any issue about that? If not I'll create one.

zcbenz added a commit to electron/libchromiumcontent that referenced this issue Apr 27, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Apr 27, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 5, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 5, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 10, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 12, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 12, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 12, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 12, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 22, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 26, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 26, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 26, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 29, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 29, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 29, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 29, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 29, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue May 29, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Jun 1, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Jun 4, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
hokein pushed a commit to hokein/libchromiumcontent that referenced this issue Jul 23, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
hokein pushed a commit to hokein/libchromiumcontent that referenced this issue Jul 24, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
hokein pushed a commit to hokein/libchromiumcontent that referenced this issue Jul 24, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
hokein pushed a commit to hokein/libchromiumcontent that referenced this issue Aug 5, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Aug 6, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Aug 11, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Aug 11, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Aug 11, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Aug 11, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Aug 21, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Sep 2, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Sep 2, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Sep 2, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Sep 2, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Sep 2, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Sep 7, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Sep 26, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Sep 30, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995

5. Disable beeps when pressing certain keys.
electron/electron#2617
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Oct 14, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Oct 27, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
clebeaupin pushed a commit to clebeaupin/libchromiumcontent that referenced this issue Nov 14, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Dec 7, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Dec 7, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Dec 7, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Dec 8, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Dec 8, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Dec 8, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
zcbenz added a commit to electron/libchromiumcontent that referenced this issue Dec 8, 2015
1. Avoid capturing key event to menu.
electron/electron#170

2. Enable accepting first mouse event.
electron/electron#212

3. Enable using transparent window.
electron/electron#949

4. Enable turning off auto hide cursor.
electron/electron#995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants