Nux

Merge ~azzar1/nux:fix-ftbs into nux:master

Proposed by Andrea Azzarone
Status: Work in progress
Proposed branch: ~azzar1/nux:fix-ftbs
Merge into: nux:master
Diff against target: 376 lines (+51/-108)
14 files modified
Nux/TextEntry.cpp (+5/-3)
Nux/TextEntry.h (+1/-1)
Nux/WindowThread.cpp (+0/-1)
Nux/XICClient.cpp (+6/-8)
Nux/XICClient.h (+4/-4)
Nux/XIMCallbacks.cpp (+9/-15)
NuxGraphics/Events.cpp (+0/-41)
NuxGraphics/Events.h (+26/-28)
gputests/framebufferobject.cpp (+0/-1)
gputests/quad_2texmod.cpp (+0/-1)
gputests/texture_blur.cpp (+0/-1)
gputests/texture_copy_blur.cpp (+0/-1)
gputests/texture_data.cpp (+0/-2)
gputests/texture_power_of_2.cpp (+0/-1)
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+363369@code.launchpad.net
To post a comment you must log in.

Unmerged commits

3e1285e... by Andrea Azzarone

XICClient: Update signature of preedit callbacks

539c191... by Andrea Azzarone

events: Use value-initialization instead of memset

a52383c... by Andrea Azzarone

textEntry: fix FTBS

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Nux/TextEntry.cpp b/Nux/TextEntry.cpp
2index 26086fb..2554647 100644
3--- a/Nux/TextEntry.cpp
4+++ b/Nux/TextEntry.cpp
5@@ -1140,8 +1140,10 @@ namespace nux
6 }
7 }
8
9- bool TextEntry::CursorBlinkCallback(TextEntry *self)
10+ gboolean TextEntry::CursorBlinkCallback(gpointer data)
11 {
12+ TextEntry *self = static_cast<TextEntry*>(data);
13+
14 if (self->cursor_blink_status_)
15 self->ShowCursor();
16 else
17@@ -1150,7 +1152,7 @@ namespace nux
18 if (--self->cursor_blink_status_ < 0)
19 self->cursor_blink_status_ = 2;
20
21- return true;
22+ return TRUE;
23 }
24
25 void TextEntry::QueueCursorBlink()
26@@ -1160,7 +1162,7 @@ namespace nux
27
28 if (!cursor_blink_timer_)
29 cursor_blink_timer_ = g_timeout_add(kCursorBlinkTimeout,
30- (GSourceFunc)&CursorBlinkCallback,
31+ &TextEntry::CursorBlinkCallback,
32 this);
33 }
34
35diff --git a/Nux/TextEntry.h b/Nux/TextEntry.h
36index 6880e10..142d670 100644
37--- a/Nux/TextEntry.h
38+++ b/Nux/TextEntry.h
39@@ -292,7 +292,7 @@ namespace nux
40 void ResetPreedit();
41 /** Send out a request to blink the cursor if necessary */
42 void QueueCursorBlink();
43- static bool CursorBlinkCallback(TextEntry* data);
44+ static gboolean CursorBlinkCallback(gpointer data);
45
46 void ShowCursor();
47 void HideCursor();
48diff --git a/Nux/WindowThread.cpp b/Nux/WindowThread.cpp
49index a043142..add0a20 100644
50--- a/Nux/WindowThread.cpp
51+++ b/Nux/WindowThread.cpp
52@@ -1343,7 +1343,6 @@ DECLARE_LOGGER(logger, "nux.windows.thread");
53 }
54
55 Event nux_event;
56- memset(&nux_event, 0, sizeof(Event));
57 #if defined(NUX_OS_WINDOWS)
58 graphics_display_->ProcessForeignWin32Event(hWnd, msg, wParam, lParam, &nux_event);
59 #elif defined(USE_X11)
60diff --git a/Nux/XICClient.cpp b/Nux/XICClient.cpp
61index a010504..e2d5a10 100644
62--- a/Nux/XICClient.cpp
63+++ b/Nux/XICClient.cpp
64@@ -44,18 +44,16 @@ void XICClient::SetCurrentTextEntry(TextEntry* text_entry)
65 text_entry_ = text_entry;
66 }
67
68-static int preedit_caret_callback(XIC xic,
69- XPointer clientdata,
70- XIMPreeditCaretCallbackStruct* call_data)
71+static void preedit_caret_callback(XIC xic,
72+ XPointer clientdata,
73+ XIMPreeditCaretCallbackStruct* call_data)
74 {
75- return 0;
76 }
77
78-static int status_start_callback(XIC xic,
79- XPointer clientdata,
80- XIMPreeditDrawCallbackStruct* call_data)
81+static void status_start_callback(XIC xic,
82+ XPointer clientdata,
83+ XIMPreeditDrawCallbackStruct* call_data)
84 {
85- return 0;
86 }
87
88 static void status_draw_callback(XIC xic,
89diff --git a/Nux/XICClient.h b/Nux/XICClient.h
90index c64e69b..f1b92c8 100644
91--- a/Nux/XICClient.h
92+++ b/Nux/XICClient.h
93@@ -55,11 +55,11 @@ private:
94 XVaNestedList GetStatusCallbacks();
95 XIMStyle FilterXIMStyle();
96
97- static int PreeditStartCallback(XIC xic, XPointer clientdata, XPointer data);
98- static int PreeditDoneCallback(XIC xic, XPointer clientdata, XPointer data);
99+ static void PreeditStartCallback(XIC xic, XPointer clientdata, XPointer data);
100+ static void PreeditDoneCallback(XIC xic, XPointer clientdata, XPointer data);
101
102- static int PreeditDrawCallback(XIC xic, XPointer clientdata,
103- XIMPreeditDrawCallbackStruct* call_data);
104+ static void PreeditDrawCallback(XIC xic, XPointer clientdata,
105+ XIMPreeditDrawCallbackStruct* call_data);
106
107 TextEntry* text_entry_;
108 XIC xic_;
109diff --git a/Nux/XIMCallbacks.cpp b/Nux/XIMCallbacks.cpp
110index aa54103..afd6cc2 100644
111--- a/Nux/XIMCallbacks.cpp
112+++ b/Nux/XIMCallbacks.cpp
113@@ -38,30 +38,26 @@ namespace nux
114
115 int const FEEDBACK_MASK = (XIMUnderline | XIMReverse);
116
117-int XICClient::PreeditStartCallback(XIC xic,
118- XPointer clientdata,
119- XPointer call_data)
120+void XICClient::PreeditStartCallback(XIC xic,
121+ XPointer clientdata,
122+ XPointer call_data)
123 {
124 TextEntry* text_entry = (TextEntry*)clientdata;
125 if (text_entry)
126 {
127 text_entry->PreeditStarted();
128 }
129-
130- return 0;
131 }
132
133-int XICClient::PreeditDoneCallback(XIC xic,
134- XPointer clientdata,
135- XPointer call_data)
136+void XICClient::PreeditDoneCallback(XIC xic,
137+ XPointer clientdata,
138+ XPointer call_data)
139 {
140 TextEntry* text_entry = (TextEntry*)clientdata;
141 if (text_entry)
142 {
143 text_entry->ClearPreedit();
144 }
145-
146- return 0;
147 }
148
149 void add_feedback_attr(PangoAttrList* attrs,
150@@ -154,9 +150,9 @@ void feedback_to_pango_list(PangoAttrList** attrs,
151 }
152 }
153
154-int XICClient::PreeditDrawCallback(XIC xic,
155- XPointer clientdata,
156- XIMPreeditDrawCallbackStruct* call_data)
157+void XICClient::PreeditDrawCallback(XIC xic,
158+ XPointer clientdata,
159+ XIMPreeditDrawCallbackStruct* call_data)
160 {
161 TextEntry* text_entry = (TextEntry*)clientdata;
162
163@@ -182,8 +178,6 @@ int XICClient::PreeditDrawCallback(XIC xic,
164 text_entry->UpdatePreeditAttribs(preedit_attr);
165 text_entry->UpdatePreedit(preedit, call_data->caret);
166 }
167-
168- return 0;
169 }
170
171 }
172diff --git a/NuxGraphics/Events.cpp b/NuxGraphics/Events.cpp
173index a9a5c09..ebef5f8 100644
174--- a/NuxGraphics/Events.cpp
175+++ b/NuxGraphics/Events.cpp
176@@ -58,47 +58,6 @@ namespace nux
177 return((key_modifiers_states & key_modifier) != 0);
178 }
179
180- Event::Event()
181- {
182- Memset(text, 0, sizeof(text));
183- dtext = nullptr;
184-
185- for (int i = 0; i < NUX_MAX_VK; i++)
186- {
187- VirtualKeycodeState[i] = 0;
188- }
189-
190- ascii_code = 0;
191- virtual_code = 0;
192- key_modifiers = 0;
193- key_repeat_count = 0;
194- mouse_state = 0;
195- x = -1;
196- y = -1;
197- x_root = 0;
198- y_root = 0;
199- dx = 0;
200- dy = 0;
201- clicks = 0;
202- is_click = 0;
203- wheel_delta = 0;
204-
205-#if defined(NUX_OS_WINDOWS)
206- win32_keycode = 0;
207- win32_keysym = 0;
208-#endif
209-
210-#if defined(USE_X11)
211- x11_keycode = 0;
212- x11_keysym = 0;
213- x11_timestamp = 0;
214- x11_window = 0;
215- x11_key_state = 0;
216-#endif
217-
218- //Application = 0;
219- }
220-
221 void Event::Reset()
222 {
223 type = NUX_NO_EVENT;
224diff --git a/NuxGraphics/Events.h b/NuxGraphics/Events.h
225index b9e4edc..b383f14 100644
226--- a/NuxGraphics/Events.h
227+++ b/NuxGraphics/Events.h
228@@ -313,8 +313,6 @@ namespace nux
229 class Event
230 {
231 public:
232- Event();
233-
234 // Because an event is save in event_type instead of calling immediately the handling function,
235 // we must clear the previous event each time before we test for new event in Gfx_OpenGLImpl::get_event.
236 /*virtual*/ void Reset();
237@@ -383,39 +381,39 @@ namespace nux
238 */
239 unsigned long GetVirtualKeyState(unsigned long VirtualKey) const;
240
241- unsigned long VirtualKeycodeState[NUX_MAX_VK];
242- int width, height;
243- unsigned int ascii_code;
244- int virtual_code;
245+ unsigned long VirtualKeycodeState[NUX_MAX_VK] = {};
246+ int width = 0, height = 0;
247+ unsigned int ascii_code = 0;
248+ int virtual_code = 0;
249
250- int x;
251- int y;
252- int x_root;
253- int y_root;
254- int dx;
255- int dy;
256- int clicks;
257- int is_click;
258+ int x = -1;
259+ int y = -1;
260+ int x_root = 0;
261+ int y_root = 0;
262+ int dx = 0;
263+ int dy = 0;
264+ int clicks = 0;
265+ int is_click = 0;
266
267 #if defined(NUX_OS_WINDOWS)
268- int win32_keycode; // Not used. Just a place holder.
269- int win32_keysym;
270+ int win32_keycode = 0; // Not used. Just a place holder.
271+ int win32_keysym = 0;
272 #elif defined(USE_X11)
273- Time x11_timestamp; //!< X11 timestamp.
274- Window x11_window; //!< X11 window.
275- unsigned int x11_key_state; //!< X11 key state (xevent.xkey.state).
276- unsigned int x11_keycode; //!< X11 raw keycode.
277- KeySym x11_keysym; //!< X11 keysym.
278+ Time x11_timestamp = 0; //!< X11 timestamp.
279+ Window x11_window = 0; //!< X11 window.
280+ unsigned int x11_key_state = 0; //!< X11 key state (xevent.xkey.state).
281+ unsigned int x11_keycode = 0; //!< X11 raw keycode.
282+ KeySym x11_keysym = 0; //!< X11 keysym.
283 #endif
284
285- int wheel_delta; //!< Wheel delta.
286+ int wheel_delta = 0; //!< Wheel delta.
287
288- char text[NUX_EVENT_TEXT_BUFFER_SIZE];
289- char* dtext; //!< Dynamically allocated
290- unsigned long key_modifiers; //!< Key modifiers. A bitwise inclusive OR of values in KeyModifier.
291- unsigned long mouse_state;
292- unsigned short key_repeat_count; //!< Number of time a key is repeated;
293- EventType type;
294+ char text[NUX_EVENT_TEXT_BUFFER_SIZE] = {};
295+ char* dtext = nullptr; //!< Dynamically allocated
296+ unsigned long key_modifiers = 0; //!< Key modifiers. A bitwise inclusive OR of values in KeyModifier.
297+ unsigned long mouse_state = 0;
298+ unsigned short key_repeat_count = 0; //!< Number of time a key is repeated;
299+ EventType type = EVENT_NONE;
300 };
301 };
302
303diff --git a/gputests/framebufferobject.cpp b/gputests/framebufferobject.cpp
304index 9bbca5d..9b64a7f 100644
305--- a/gputests/framebufferobject.cpp
306+++ b/gputests/framebufferobject.cpp
307@@ -58,7 +58,6 @@ void RenderToFrameBufferObject ()
308 graphics_engine->Push2DWindow(w, h);
309
310 nux::Event event;
311- memset(&event, 0, sizeof(nux::Event));
312
313 bool first_time = true;
314 do
315diff --git a/gputests/quad_2texmod.cpp b/gputests/quad_2texmod.cpp
316index 6170015..638b3f9 100755
317--- a/gputests/quad_2texmod.cpp
318+++ b/gputests/quad_2texmod.cpp
319@@ -87,7 +87,6 @@ void QuadRendering_2TexMod ()
320
321 int w, h;
322 nux::Event event;
323- memset(&event, 0, sizeof(nux::Event));
324 graphics_engine->GetWindowSize(w, h);
325 graphics_engine->SetViewport(0, 0, w, h);
326 graphics_engine->SetScissor(0, 0, w, h);
327diff --git a/gputests/texture_blur.cpp b/gputests/texture_blur.cpp
328index de15aae..355050e 100644
329--- a/gputests/texture_blur.cpp
330+++ b/gputests/texture_blur.cpp
331@@ -60,7 +60,6 @@ void RenderBlurredTexture ()
332 graphics_engine->Push2DWindow(w, h);
333
334 nux::Event event;
335- memset(&event, 0, sizeof(nux::Event));
336
337 /*char fps [25];
338 int frame_counter = 0;
339diff --git a/gputests/texture_copy_blur.cpp b/gputests/texture_copy_blur.cpp
340index 54f1cf7..8e79e36 100644
341--- a/gputests/texture_copy_blur.cpp
342+++ b/gputests/texture_copy_blur.cpp
343@@ -60,7 +60,6 @@ void RenderBlurredCopyOfRenderTarget ()
344 graphics_engine->Push2DWindow(w, h);
345
346 nux::Event event;
347- memset(&event, 0, sizeof(nux::Event));
348
349 /*char fps [25];
350 int frame_counter = 0;
351diff --git a/gputests/texture_data.cpp b/gputests/texture_data.cpp
352index f8248d2..6bd22f3 100644
353--- a/gputests/texture_data.cpp
354+++ b/gputests/texture_data.cpp
355@@ -95,9 +95,7 @@ void RenderTexturePowerOfTwo ()
356 m_GraphicsContext->Push2DWindow(w, h);
357
358 nux::Event event;
359- memset(&event, 0, sizeof(nux::Event));
360
361-
362 {
363 CHECKGL( glClearColor(0, 0, 0, 1) );
364 CHECKGL( glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT) );
365diff --git a/gputests/texture_power_of_2.cpp b/gputests/texture_power_of_2.cpp
366index 98eb833..392ee97 100644
367--- a/gputests/texture_power_of_2.cpp
368+++ b/gputests/texture_power_of_2.cpp
369@@ -93,7 +93,6 @@ void RenderTexturePowerOfTwo ()
370 m_GraphicsContext->Push2DWindow(w, h);
371
372 nux::Event event;
373- memset(&event, 0, sizeof(nux::Event));
374
375 do
376 {

Subscribers

People subscribed via source and target branches

to all changes: