Scroll bar in text-editor shows the wrong mouse cursor #37867

Closed
opened 2013-12-19 11:08:56 +01:00 by Alexander N. · 26 comments
Member

in text-editor when you got with the mouse cursor to the scroll-bar on the right side, the mouse-cursor does not change to the arrow-cursor as expected form normal behavior of scroll-bars outside of blender application.

  1. open blender
  2. change view to text-editor
  3. create a new text
  4. hover with the mouse-cursor above the scroll-bar on the right-side
  • the mouse-cursor stays with the cursor for text input, but usually is should be an arrow cursor

issue_-scroll_bar-_current.PNG issue_-scroll_bar-_wanted.PNG

issue_-_scroll_bar.blend

in text-editor when you got with the mouse cursor to the scroll-bar on the right side, the mouse-cursor does not change to the arrow-cursor as expected form normal behavior of scroll-bars outside of blender application. 1. open blender 2. change view to text-editor 3. create a new text 4. hover with the mouse-cursor above the scroll-bar on the right-side - >> the mouse-cursor stays with the cursor for text input, but usually is should be an arrow cursor ![issue_-_scroll_bar_-_current.PNG](https://archive.blender.org/developer/F46505/issue_-_scroll_bar_-_current.PNG) ![issue_-_scroll_bar_-_wanted.PNG](https://archive.blender.org/developer/F46508/issue_-_scroll_bar_-_wanted.PNG) [issue_-_scroll_bar.blend](https://archive.blender.org/developer/F46510/issue_-_scroll_bar.blend)
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @beta-tester

Added subscriber: @beta-tester
Brecht Van Lommel changed title from scroll bar in text-editor shows the wrong mouse cursor to Scroll bar in text-editor shows the wrong mouse cursor 2013-12-19 16:56:12 +01:00

Added subscriber: @brecht

Added subscriber: @brecht

I'm making this a To Do task, would be nice if it worked better but would not consider it a bug.

I'm making this a To Do task, would be nice if it worked better but would not consider it a bug.
NikoLeopold self-assigned this 2014-02-08 16:50:57 +01:00

i would like to claim this as a very first task to dip into the blender code and get a bit of an idea of the patching process. if you are in need for this to be assigned to someone more competent, please take it! :)

i would like to claim this as a very first task to dip into the blender code and get a bit of an idea of the patching process. if you are in need for this to be assigned to someone more competent, please take it! :)

Added subscriber: @Harshit-3

Added subscriber: @Harshit-3

got back to try my luck on this task today.
so far found out how to change mouse cursor icon. the following function calls seem of relevance:

WM_cursor_set(CTX_wm_window(C), SYSCURSOR);
WM_cursor_set(CTX_wm_window(C), BC_TEXTEDITCURSOR);

(where C is a pointer to bContext struct)
unfortunately since this is my first venture into the huge code base i am quite lost about where to put those calls...
in text_ops.c i found text_scroll_bar_invoke() and putting it there makes it possible to change the cursor when the scrollbar is clicked, but nothing about when the mouse is hovering over it.

got back to try my luck on this task today. so far found out how to change mouse cursor icon. the following function calls seem of relevance: ``` WM_cursor_set(CTX_wm_window(C), SYSCURSOR); WM_cursor_set(CTX_wm_window(C), BC_TEXTEDITCURSOR); ``` (where C is a pointer to bContext struct) unfortunately since this is my first venture into the huge code base i am quite lost about where to put those calls... in `text_ops.c` i found `text_scroll_bar_invoke()` and putting it there makes it possible to change the cursor when the scrollbar is clicked, but nothing about when the mouse is hovering over it.
NikoLeopold removed their assignment 2014-02-21 19:54:04 +01:00

Added subscriber: @NikoLeopold

Added subscriber: @NikoLeopold

i guess this would be easy for someone more experienced and since i don't want to destroy the code factorization through my limited knowledge i place this up for grabs again...
i would really love to know how this would be done however :)

i guess this would be easy for someone more experienced and since i don't want to destroy the code factorization through my limited knowledge i place this up for grabs again... i would really love to know how this would be done however :)

I am also new to blender source code. I have spent some time working on this problem i.e studying various data structures used and event handles. I would like to grab it.

I am also new to blender source code. I have spent some time working on this problem i.e studying various data structures used and event handles. I would like to grab it.

sure that would be great :)
id love to see how this should be done...

sure that would be great :) id love to see how this should be done...
chipgw commented 2014-03-03 05:06:54 +01:00 (Migrated from localhost:3001)

Added subscriber: @chipgw

Added subscriber: @chipgw
chipgw commented 2014-03-03 05:06:54 +01:00 (Migrated from localhost:3001)

this seems to work, but now the normal text input cursor flickers a little bit when moving the cursor around...

text_editor_scroll_cursor.patch

(BTW I'm new here, so this could very well NOT be the way it should be done.)

this seems to work, but now the normal text input cursor flickers a little bit when moving the cursor around... [text_editor_scroll_cursor.patch](https://archive.blender.org/developer/F79755/text_editor_scroll_cursor.patch) (BTW I'm new here, so this could very well NOT be the way it should be done.)

The method seems ok, two comments:

  • The check for sa->spacetype == SPACE_TEXT is not needed, this callback will only be called for the text space.
  • Why not use win->eventstate->y - ar->winrct.ymin for the Y coordinates? Not strictly needed but might as well not make any assumptions about the positioning of the scrollbar.

For the flickering, I didn't see that here on OS X, I'm not sure how that would happen. You could check if it is actually it is actually setting a different value in text_cursor when it flickers, or if it's some other place calling WM_cursor_set that causes it, or if somehow calling WM_cursor_set with the same value multiple times causes the flicker.

The method seems ok, two comments: * The check for `sa->spacetype == SPACE_TEXT` is not needed, this callback will only be called for the text space. * Why not use `win->eventstate->y - ar->winrct.ymin` for the Y coordinates? Not strictly needed but might as well not make any assumptions about the positioning of the scrollbar. For the flickering, I didn't see that here on OS X, I'm not sure how that would happen. You could check if it is actually it is actually setting a different value in text_cursor when it flickers, or if it's some other place calling WM_cursor_set that causes it, or if somehow calling WM_cursor_set with the same value multiple times causes the flicker.

the patch works nice for me! no flickering here either (also OS X).
interestingly enough, the second thing brecht suggested doesn't seem to work for me, don't really see why...

the patch works nice for me! no flickering here either (also OS X). interestingly enough, the second thing brecht suggested doesn't seem to work for me, don't really see why...
chipgw commented 2014-03-03 22:44:25 +01:00 (Migrated from localhost:3001)

apparently the y part of st->txtscroll is something else, st->txtbar is the actual scrollbar rectangle.

text_editor_scrollbar_cursor.patch

this still has the slight flickering on ArchLinux KDE. it isn't a steady flicker, just every second or so it blips to the standard cursor and back, probably just for one frame.

EDIT: wait, now it bugs when there is no file open and therefore the scrollbar isn't visible.

EDIT2: checking st->text fixes that. (st->txtbar isn't set if st->text is null)

text_editor_scrollbar_cursor.patch

apparently the y part of st->txtscroll is something else, st->txtbar is the actual scrollbar rectangle. [text_editor_scrollbar_cursor.patch](https://archive.blender.org/developer/F79838/text_editor_scrollbar_cursor.patch) this still has the slight flickering on ArchLinux KDE. it isn't a steady flicker, just every second or so it blips to the standard cursor and back, probably just for one frame. EDIT: wait, now it bugs when there is no file open and therefore the scrollbar isn't visible. EDIT2: checking st->text fixes that. (st->txtbar isn't set if st->text is null) [text_editor_scrollbar_cursor.patch](https://archive.blender.org/developer/F79842/text_editor_scrollbar_cursor.patch)
chipgw commented 2014-03-04 01:07:17 +01:00 (Migrated from localhost:3001)

as far as I can tell the flicker problem is from

GHOST_WindowX11::setWindowCustomCursorShape()

redefining the cursor every time it's called.
so sometimes the time between XFreeCursor and XDefineCursor/XFlush is long enough that the standard cursor is briefly visible. does this sound right?

as far as I can tell the flicker problem is from ``` GHOST_WindowX11::setWindowCustomCursorShape() ``` redefining the cursor every time it's called. so sometimes the time between XFreeCursor and XDefineCursor/XFlush is long enough that the standard cursor is briefly visible. does this sound right?

That seems like a good hypothesis, perhaps the flicker can be avoided by delaying the XFreeCursor call like this: x11_custom_cursor_flicker.diff

We can also detect if the cursor shape actually changes before changing it in GHOST, but it really shouldn't be flickering to begin with.

That seems like a good hypothesis, perhaps the flicker can be avoided by delaying the `XFreeCursor` call like this: [x11_custom_cursor_flicker.diff](https://archive.blender.org/developer/F79862/x11_custom_cursor_flicker.diff) We can also detect if the cursor shape actually changes before changing it in GHOST, but it really shouldn't be flickering to begin with.
chipgw commented 2014-03-04 03:56:06 +01:00 (Migrated from localhost:3001)

Hm, I thought that would do it but apparently not. it even still happens if I comment out XFreeCursor completely. but it is only for custom cursors. with a different system one it's fine. (also if I set any of the node editor resize cursors to a custom cursor it flickers there as well)

EDIT: it happens if I build with WITH_GHOST_SDL as well.

Hm, I thought that would do it but apparently not. it even still happens if I comment out `XFreeCursor` completely. but it *is* only for custom cursors. with a different system one it's fine. (also if I set any of the node editor resize cursors to a custom cursor it flickers there as well) EDIT: it happens if I build with WITH_GHOST_SDL as well.
chipgw commented 2014-03-04 05:13:04 +01:00 (Migrated from localhost:3001)

this almost works, but it doesn't change when switching screen layouts. text_editor_scrollbar_cursor.patch

this almost works, but it doesn't change when switching screen layouts. [text_editor_scrollbar_cursor.patch](https://archive.blender.org/developer/F79866/text_editor_scrollbar_cursor.patch)
chipgw commented 2014-03-06 03:23:33 +01:00 (Migrated from localhost:3001)

so is passing swin_changed from region_cursor_set a problem at all? this works without any issues as far as I can tell. text_editor_scrollbar_cursor.patch (I don't think the X11 flicker bug itself will be fixed short of only defining the cursor once at startup and reusing it)

so is passing `swin_changed` from `region_cursor_set` a problem at all? this works without any issues as far as I can tell. [text_editor_scrollbar_cursor.patch](https://archive.blender.org/developer/F80065/text_editor_scrollbar_cursor.patch) (I don't think the X11 flicker bug itself will be fixed short of only defining the cursor once at startup and reusing it)

This issue was referenced by blender/blender-addons-contrib@19e74f1d4f

This issue was referenced by blender/blender-addons-contrib@19e74f1d4f9bc955c6c7616cadcde65e6f6d2d3d

This issue was referenced by 19e74f1d4f

This issue was referenced by 19e74f1d4f9bc955c6c7616cadcde65e6f6d2d3d

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 19e74f1d4f.

Closed by commit 19e74f1d4f.

I committed a fix for the X11 mouse cursor problem, the problem was in the function that sets the cursor visibility (see f04fd50073).

Committed the earlier patch now, thanks!

I committed a fix for the X11 mouse cursor problem, the problem was in the function that sets the cursor visibility (see f04fd500731). Committed the earlier patch now, thanks!
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#37867
No description provided.