Nux

Merge lp:~gordallott/nux/nux-fixes-07-04 into lp:nux

Proposed by Gord Allott
Status: Merged
Merge reported by: Gord Allott
Merged at revision: not available
Proposed branch: lp:~gordallott/nux/nux-fixes-07-04
Merge into: lp:nux
Diff against target: 186 lines (+48/-38)
4 files modified
Nux/Focusable.cpp (+1/-0)
Nux/GridHLayout.cpp (+42/-35)
Nux/GridHLayout.h (+4/-2)
Nux/TextEntry.cpp (+1/-1)
To merge this branch: bzr merge lp:~gordallott/nux/nux-fixes-07-04
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+56771@code.launchpad.net

Description of the change

fixes some bugs, attached

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) wrote :

Shouldn't the same thing be done for GridVLayout?

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/Focusable.cpp'
2--- Nux/Focusable.cpp 2011-03-23 06:46:46 +0000
3+++ Nux/Focusable.cpp 2011-04-07 13:47:29 +0000
4@@ -53,6 +53,7 @@
5 switch (keysym)
6 {
7 case NUX_VK_ENTER:
8+ case NUX_KP_ENTER:
9 type = FOCUS_EVENT_ACTIVATE;
10 //g_debug ("focus key activated");
11 break;
12
13=== modified file 'Nux/GridHLayout.cpp'
14--- Nux/GridHLayout.cpp 2011-04-06 21:54:09 +0000
15+++ Nux/GridHLayout.cpp 2011-04-07 13:47:29 +0000
16@@ -97,6 +97,33 @@
17 return NULL;
18 }
19
20+ long GridHLayout::DoFocusNext (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
21+ {
22+ Area *parent = GetParentObject ();
23+ if (parent != NULL)
24+ {
25+ return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
26+ }
27+ else
28+ {
29+ Layout::DoFocusNext (ievent, TraverseInfo, ProcessEventInfo);
30+ }
31+
32+ return ProcessEventInfo;
33+ }
34+
35+ long GridHLayout::DoFocusPrev (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
36+ {
37+ Area *parent = GetParentObject ();
38+ if (parent != NULL)
39+ return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
40+ else
41+ Layout::DoFocusPrev (ievent, TraverseInfo, ProcessEventInfo);
42+
43+ return ProcessEventInfo;
44+ }
45+
46+
47 long GridHLayout::DoFocusLeft (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
48 {
49 // if we are left on an edge, then send up
50@@ -106,13 +133,12 @@
51
52 if (parent == NULL || position % GetNumColumn ())
53 {
54- return Layout::DoFocusLeft (ievent, TraverseInfo, ProcessEventInfo);
55- }
56- else
57- {
58- // left edge
59- return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
60- }
61+ //inside container
62+ return Layout::DoFocusPrev (ievent, TraverseInfo, ProcessEventInfo);
63+ }
64+
65+
66+ return TraverseInfo;
67 }
68
69 long GridHLayout::DoFocusRight (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
70@@ -124,13 +150,11 @@
71
72 if (parent == NULL || (position + 1) % GetNumColumn ())
73 {
74- return Layout::DoFocusRight (ievent, TraverseInfo, ProcessEventInfo);
75- }
76- else
77- {
78- // Right Edge
79- return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
80- }
81+ // inside container
82+ return Layout::DoFocusNext (ievent, TraverseInfo, ProcessEventInfo);
83+ }
84+
85+ return TraverseInfo;
86 }
87
88 //up and down should pass event to parent
89@@ -139,34 +163,25 @@
90 Area* focused_child = GetFocusedChild ();
91 int position = GetChildPos (focused_child);
92 Area *parent = GetParentObject ();
93-
94- if (focused_child == NULL || position < GetNumColumn ())
95+ if (focused_child == NULL)
96 {
97-
98 if (parent != NULL)
99+ {
100 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
101+ }
102 else
103 FocusFirstChild ();
104-
105 }
106 else
107 {
108 // so hacky, but its cheap!
109 // just focus the child position - numcolumns
110- //focused_child->SetFocused (false);
111 focused_child = GetChildAtPosition (position - GetNumColumn ());
112 if (focused_child)
113 {
114 focused_child->SetFocused (true);
115 ChildFocusChanged.emit (this, focused_child);
116 }
117- else
118- {
119- if (parent != NULL)
120- return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
121- else
122- FocusFirstChild ();
123- }
124 }
125
126 return TraverseInfo;
127@@ -177,7 +192,7 @@
128 int position = GetChildPos (focused_child);
129 Area *parent = GetParentObject ();
130
131- if (focused_child == NULL || position > GetNumColumn () * (GetNumRow () - 1))
132+ if (focused_child == NULL)
133 {
134 if (parent != NULL)
135 return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
136@@ -188,20 +203,12 @@
137 {
138 // so hacky, but its cheap!
139 // just focus the child position - numcolumns
140- //focused_child->SetFocused (false);
141 focused_child = GetChildAtPosition (position + GetNumColumn ());
142 if (focused_child)
143 {
144 focused_child->SetFocused (true);
145 ChildFocusChanged.emit (this, focused_child);
146 }
147- else
148- {
149- if (parent != NULL)
150- return SendEventToArea (parent, ievent, TraverseInfo, ProcessEventInfo);
151- else
152- FocusLastChild ();
153- }
154 }
155
156 return TraverseInfo;
157
158=== modified file 'Nux/GridHLayout.h'
159--- Nux/GridHLayout.h 2011-04-06 21:54:09 +0000
160+++ Nux/GridHLayout.h 2011-04-07 13:47:29 +0000
161@@ -107,8 +107,10 @@
162 protected:
163 int GetChildPos (Area *child);
164 Area* GetChildAtPosition (int pos);
165- virtual long DoFocusUp (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
166- virtual long DoFocusDown (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
167+ virtual long DoFocusNext (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
168+ virtual long DoFocusPrev (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
169+ virtual long DoFocusUp (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
170+ virtual long DoFocusDown (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
171 virtual long DoFocusLeft (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
172 virtual long DoFocusRight (IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
173
174
175=== modified file 'Nux/TextEntry.cpp'
176--- Nux/TextEntry.cpp 2011-04-07 11:01:32 +0000
177+++ Nux/TextEntry.cpp 2011-04-07 13:47:29 +0000
178@@ -374,7 +374,7 @@
179 if (keysym == NUX_VK_TAB)
180 return;
181
182- if (keysym == NUX_VK_ENTER)
183+ if (keysym == NUX_VK_ENTER || NUX_KP_ENTER)
184 {
185 activated.emit ();
186 return;

Subscribers

People subscribed via source and target branches