Merge lp:~tiagosh/unity-2d/fix-dash-cursor into lp:unity-2d

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 920
Merged at revision: 966
Proposed branch: lp:~tiagosh/unity-2d/fix-dash-cursor
Merge into: lp:unity-2d
Diff against target: 42 lines (+12/-19)
1 file modified
shell/common/SearchEntry.qml (+12/-19)
To merge this branch: bzr merge lp:~tiagosh/unity-2d/fix-dash-cursor
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Paul Sladen (community) functionality Needs Fixing
Gerry Boland (community) design (rosie) Needs Fixing
Xi Zhu design Pending
Review via email: mp+93416@code.launchpad.net

Description of the change

[dash] make the dash cursor blink

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

You've changed the appearance of the cursor with this. Cursor should be 2 pixels wide.

review: Needs Fixing
Revision history for this message
Gerry Boland (gerboland) wrote :

Please also supply screenshot of the change, so Design can sign this change off

Revision history for this message
Gerry Boland (gerboland) wrote :

My apologies, I did not notice that you inserted videos into the attached bug. They're great, thanks.

We just need to get get Design confirmation that 1pixel cursor width is correct, and this is good to go!
Thanks
-G

Revision history for this message
Gerry Boland (gerboland) wrote :

<greyback> JohnLea: quickest of questions! Width of flashing cursor in Dash search box is 1 pixel wide?
<JohnLea> greyback; I think so

Over IRC, you also confirmed with me that Unity uses 1 pixel wide cursor, so please withdraw my objections there.

I dug into Nux to see their cursor flash time is 400ms. Be nice to match that.

Revision history for this message
Gerry Boland (gerboland) wrote :

Chatting with Rosie, she pointed out that we should use the HUD mockups which have a cursor visible.

Cursor there is 1x30pixels, with 5 pixels margin above & below. Yours is 34pixels high.

review: Needs Fixing (design (rosie))
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :
Revision history for this message
Gerry Boland (gerboland) wrote :

Can you not make a simple cursor component?

Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

As discussed on IRC, unfortunately we can't change the height even for custom cursors, and the default one is already 1 px wide. In case we don't really need the fading animation, I think this patch matches the spec.

Revision history for this message
Gerry Boland (gerboland) wrote :

Playing with this, the following cursor component works for me:

Rectangle {
    color: "white"
    anchors.top: parent.top
    anchors.bottom: parent.bottom
    anchors.topMargin: 4
    anchors.bottomMargin: 8
    width: 1
....
}

and the above/below margins are adjustable.

Revision history for this message
Paul Sladen (sladen) wrote :

The tree here still leaves the text too large. I did manage to get it to the correct size with 'height: height-2'; see:

  lp:~sladen/unity-2d/unity-2d-dash-cursor-size-lp942122

although clearly, getting ride of the margins/padding, then forcing the height upwards would be preferable.

review: Needs Fixing (functionality)
lp:~tiagosh/unity-2d/fix-dash-cursor updated
918. By Tiago Salem Herrmann

use margins in order to fix the cursor size.
use timer to make it blink

919. By Tiago Salem Herrmann

add one more pixel in order to have a cursor 30px high and 5px top and bottom margin.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Having a look at the Nux::TextEntry code we can find
  static const int kCursorBlinkTimeout = 400;
and
  bool TextEntry::CursorBlinkCallback(TextEntry *self)
  {
    if (self->cursor_blink_status_)
      self->ShowCursor();
    else
      self->HideCursor();

    if (--self->cursor_blink_status_ < 0)
      self->cursor_blink_status_ = 2;

    return true;
  }
and
  void TextEntry::ProcessKeyEvent(
    unsigned long event_type , /*event type*/
    unsigned long keysym , /*event keysym*/
    unsigned long state , /*event state*/
    const char* character , /*character*/
    unsigned short keyCount /*key repeat count*/)
  {
    cursor_blink_status_ = 4;

Meaning that the regular cadence of blinking is 800msec vs 400msec and when a key is typed it takes 1600msec for it to blink again

I'm not sure if we really want the 1600msec after typing stuff, but at least you should adapt the 900-300 to 800-400

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

Gerry says we should not trouble ourselves for the 1600msec stuff on typing, so just go for the 800-400 msec change :)

lp:~tiagosh/unity-2d/fix-dash-cursor updated
920. By Tiago Salem Herrmann

change blinking interval to 800-400

Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

changed to 800-400 as requested.

Revision history for this message
Albert Astals Cid (aacid) wrote :

With this code here my cursor is 31px height instead of 30, can you recheck you get 30?

Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :
Revision history for this message
Albert Astals Cid (aacid) wrote :

This is what i get https://imgur.com/zST1U :-/

Revision history for this message
Albert Astals Cid (aacid) wrote :

Actually might be related to the fact that we are not setting the font to id: searchInput just the pixelsize and we use different fonts?

Revision history for this message
Albert Astals Cid (aacid) wrote :

Bad me for using a non default font!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shell/common/SearchEntry.qml'
2--- shell/common/SearchEntry.qml 2012-02-28 12:30:17 +0000
3+++ shell/common/SearchEntry.qml 2012-03-06 16:37:20 +0000
4@@ -120,27 +120,20 @@
5 id: cursor
6
7 Rectangle {
8+ id: customCursor
9 color: "white"
10- width: 2
11- height: 16
12-
13- /* WARNING: that animation uses resources */
14- /* The following animation would behave exactly like
15- Unity if only 'search_input' could be referenced from
16- within the cursor Component.
17- /*
18- SequentialAnimation on opacity {
19- id: cursor_pulse
20- loops: 30
21- running: false
22- PropertyAnimation { duration: 1000; to: 0; easing.type: Easing.InOutQuad }
23- PropertyAnimation { duration: 1000; to: 1; easing.type: Easing.InOutQuad }
24+ anchors.top: parent.top
25+ anchors.bottom: parent.bottom
26+ anchors.topMargin: 2
27+ anchors.bottomMargin: 2
28+ width: 1
29+ Timer {
30+ interval: 800; running: true; repeat: true
31+ onTriggered: {
32+ interval = interval == 800 ? 400 : 800
33+ customCursor.visible = !customCursor.visible
34+ }
35 }
36- Connections {
37- target: search_input
38- onTextChanged: cursor_pulse.running = true
39- onActiveFocusChanged: cursor_pulse.running = search_input.activeFocus
40- }*/
41 }
42 }
43

Subscribers

People subscribed via source and target branches