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
diff --git a/Nux/TextEntry.cpp b/Nux/TextEntry.cpp
index 26086fb..2554647 100644
--- a/Nux/TextEntry.cpp
+++ b/Nux/TextEntry.cpp
@@ -1140,8 +1140,10 @@ namespace nux
1140 }1140 }
1141 }1141 }
11421142
1143 bool TextEntry::CursorBlinkCallback(TextEntry *self)1143 gboolean TextEntry::CursorBlinkCallback(gpointer data)
1144 {1144 {
1145 TextEntry *self = static_cast<TextEntry*>(data);
1146
1145 if (self->cursor_blink_status_)1147 if (self->cursor_blink_status_)
1146 self->ShowCursor();1148 self->ShowCursor();
1147 else1149 else
@@ -1150,7 +1152,7 @@ namespace nux
1150 if (--self->cursor_blink_status_ < 0)1152 if (--self->cursor_blink_status_ < 0)
1151 self->cursor_blink_status_ = 2;1153 self->cursor_blink_status_ = 2;
11521154
1153 return true;1155 return TRUE;
1154 }1156 }
11551157
1156 void TextEntry::QueueCursorBlink()1158 void TextEntry::QueueCursorBlink()
@@ -1160,7 +1162,7 @@ namespace nux
11601162
1161 if (!cursor_blink_timer_)1163 if (!cursor_blink_timer_)
1162 cursor_blink_timer_ = g_timeout_add(kCursorBlinkTimeout,1164 cursor_blink_timer_ = g_timeout_add(kCursorBlinkTimeout,
1163 (GSourceFunc)&CursorBlinkCallback,1165 &TextEntry::CursorBlinkCallback,
1164 this);1166 this);
1165 }1167 }
11661168
diff --git a/Nux/TextEntry.h b/Nux/TextEntry.h
index 6880e10..142d670 100644
--- a/Nux/TextEntry.h
+++ b/Nux/TextEntry.h
@@ -292,7 +292,7 @@ namespace nux
292 void ResetPreedit();292 void ResetPreedit();
293 /** Send out a request to blink the cursor if necessary */293 /** Send out a request to blink the cursor if necessary */
294 void QueueCursorBlink();294 void QueueCursorBlink();
295 static bool CursorBlinkCallback(TextEntry* data);295 static gboolean CursorBlinkCallback(gpointer data);
296296
297 void ShowCursor();297 void ShowCursor();
298 void HideCursor();298 void HideCursor();
diff --git a/Nux/WindowThread.cpp b/Nux/WindowThread.cpp
index a043142..add0a20 100644
--- a/Nux/WindowThread.cpp
+++ b/Nux/WindowThread.cpp
@@ -1343,7 +1343,6 @@ DECLARE_LOGGER(logger, "nux.windows.thread");
1343 }1343 }
13441344
1345 Event nux_event;1345 Event nux_event;
1346 memset(&nux_event, 0, sizeof(Event));
1347#if defined(NUX_OS_WINDOWS)1346#if defined(NUX_OS_WINDOWS)
1348 graphics_display_->ProcessForeignWin32Event(hWnd, msg, wParam, lParam, &nux_event);1347 graphics_display_->ProcessForeignWin32Event(hWnd, msg, wParam, lParam, &nux_event);
1349#elif defined(USE_X11)1348#elif defined(USE_X11)
diff --git a/Nux/XICClient.cpp b/Nux/XICClient.cpp
index a010504..e2d5a10 100644
--- a/Nux/XICClient.cpp
+++ b/Nux/XICClient.cpp
@@ -44,18 +44,16 @@ void XICClient::SetCurrentTextEntry(TextEntry* text_entry)
44 text_entry_ = text_entry;44 text_entry_ = text_entry;
45}45}
4646
47static int preedit_caret_callback(XIC xic,47static void preedit_caret_callback(XIC xic,
48 XPointer clientdata,48 XPointer clientdata,
49 XIMPreeditCaretCallbackStruct* call_data)49 XIMPreeditCaretCallbackStruct* call_data)
50{50{
51 return 0;
52}51}
5352
54static int status_start_callback(XIC xic,53static void status_start_callback(XIC xic,
55 XPointer clientdata,54 XPointer clientdata,
56 XIMPreeditDrawCallbackStruct* call_data)55 XIMPreeditDrawCallbackStruct* call_data)
57{56{
58 return 0;
59}57}
6058
61static void status_draw_callback(XIC xic,59static void status_draw_callback(XIC xic,
diff --git a/Nux/XICClient.h b/Nux/XICClient.h
index c64e69b..f1b92c8 100644
--- a/Nux/XICClient.h
+++ b/Nux/XICClient.h
@@ -55,11 +55,11 @@ private:
55 XVaNestedList GetStatusCallbacks();55 XVaNestedList GetStatusCallbacks();
56 XIMStyle FilterXIMStyle();56 XIMStyle FilterXIMStyle();
5757
58 static int PreeditStartCallback(XIC xic, XPointer clientdata, XPointer data);58 static void PreeditStartCallback(XIC xic, XPointer clientdata, XPointer data);
59 static int PreeditDoneCallback(XIC xic, XPointer clientdata, XPointer data);59 static void PreeditDoneCallback(XIC xic, XPointer clientdata, XPointer data);
6060
61 static int PreeditDrawCallback(XIC xic, XPointer clientdata,61 static void PreeditDrawCallback(XIC xic, XPointer clientdata,
62 XIMPreeditDrawCallbackStruct* call_data);62 XIMPreeditDrawCallbackStruct* call_data);
6363
64 TextEntry* text_entry_;64 TextEntry* text_entry_;
65 XIC xic_;65 XIC xic_;
diff --git a/Nux/XIMCallbacks.cpp b/Nux/XIMCallbacks.cpp
index aa54103..afd6cc2 100644
--- a/Nux/XIMCallbacks.cpp
+++ b/Nux/XIMCallbacks.cpp
@@ -38,30 +38,26 @@ namespace nux
3838
39int const FEEDBACK_MASK = (XIMUnderline | XIMReverse);39int const FEEDBACK_MASK = (XIMUnderline | XIMReverse);
4040
41int XICClient::PreeditStartCallback(XIC xic,41void XICClient::PreeditStartCallback(XIC xic,
42 XPointer clientdata,42 XPointer clientdata,
43 XPointer call_data)43 XPointer call_data)
44{44{
45 TextEntry* text_entry = (TextEntry*)clientdata;45 TextEntry* text_entry = (TextEntry*)clientdata;
46 if (text_entry)46 if (text_entry)
47 {47 {
48 text_entry->PreeditStarted();48 text_entry->PreeditStarted();
49 }49 }
50
51 return 0;
52}50}
5351
54int XICClient::PreeditDoneCallback(XIC xic,52void XICClient::PreeditDoneCallback(XIC xic,
55 XPointer clientdata,53 XPointer clientdata,
56 XPointer call_data)54 XPointer call_data)
57{55{
58 TextEntry* text_entry = (TextEntry*)clientdata;56 TextEntry* text_entry = (TextEntry*)clientdata;
59 if (text_entry)57 if (text_entry)
60 {58 {
61 text_entry->ClearPreedit();59 text_entry->ClearPreedit();
62 }60 }
63
64 return 0;
65}61}
6662
67void add_feedback_attr(PangoAttrList* attrs,63void add_feedback_attr(PangoAttrList* attrs,
@@ -154,9 +150,9 @@ void feedback_to_pango_list(PangoAttrList** attrs,
154 }150 }
155}151}
156152
157int XICClient::PreeditDrawCallback(XIC xic,153void XICClient::PreeditDrawCallback(XIC xic,
158 XPointer clientdata,154 XPointer clientdata,
159 XIMPreeditDrawCallbackStruct* call_data)155 XIMPreeditDrawCallbackStruct* call_data)
160{156{
161 TextEntry* text_entry = (TextEntry*)clientdata;157 TextEntry* text_entry = (TextEntry*)clientdata;
162158
@@ -182,8 +178,6 @@ int XICClient::PreeditDrawCallback(XIC xic,
182 text_entry->UpdatePreeditAttribs(preedit_attr);178 text_entry->UpdatePreeditAttribs(preedit_attr);
183 text_entry->UpdatePreedit(preedit, call_data->caret);179 text_entry->UpdatePreedit(preedit, call_data->caret);
184 }180 }
185
186 return 0;
187}181}
188182
189}183}
diff --git a/NuxGraphics/Events.cpp b/NuxGraphics/Events.cpp
index a9a5c09..ebef5f8 100644
--- a/NuxGraphics/Events.cpp
+++ b/NuxGraphics/Events.cpp
@@ -58,47 +58,6 @@ namespace nux
58 return((key_modifiers_states & key_modifier) != 0);58 return((key_modifiers_states & key_modifier) != 0);
59 }59 }
6060
61 Event::Event()
62 {
63 Memset(text, 0, sizeof(text));
64 dtext = nullptr;
65
66 for (int i = 0; i < NUX_MAX_VK; i++)
67 {
68 VirtualKeycodeState[i] = 0;
69 }
70
71 ascii_code = 0;
72 virtual_code = 0;
73 key_modifiers = 0;
74 key_repeat_count = 0;
75 mouse_state = 0;
76 x = -1;
77 y = -1;
78 x_root = 0;
79 y_root = 0;
80 dx = 0;
81 dy = 0;
82 clicks = 0;
83 is_click = 0;
84 wheel_delta = 0;
85
86#if defined(NUX_OS_WINDOWS)
87 win32_keycode = 0;
88 win32_keysym = 0;
89#endif
90
91#if defined(USE_X11)
92 x11_keycode = 0;
93 x11_keysym = 0;
94 x11_timestamp = 0;
95 x11_window = 0;
96 x11_key_state = 0;
97#endif
98
99 //Application = 0;
100 }
101
102 void Event::Reset()61 void Event::Reset()
103 {62 {
104 type = NUX_NO_EVENT;63 type = NUX_NO_EVENT;
diff --git a/NuxGraphics/Events.h b/NuxGraphics/Events.h
index b9e4edc..b383f14 100644
--- a/NuxGraphics/Events.h
+++ b/NuxGraphics/Events.h
@@ -313,8 +313,6 @@ namespace nux
313 class Event313 class Event
314 {314 {
315 public:315 public:
316 Event();
317
318 // Because an event is save in event_type instead of calling immediately the handling function,316 // Because an event is save in event_type instead of calling immediately the handling function,
319 // we must clear the previous event each time before we test for new event in Gfx_OpenGLImpl::get_event.317 // we must clear the previous event each time before we test for new event in Gfx_OpenGLImpl::get_event.
320 /*virtual*/ void Reset();318 /*virtual*/ void Reset();
@@ -383,39 +381,39 @@ namespace nux
383 */381 */
384 unsigned long GetVirtualKeyState(unsigned long VirtualKey) const;382 unsigned long GetVirtualKeyState(unsigned long VirtualKey) const;
385383
386 unsigned long VirtualKeycodeState[NUX_MAX_VK];384 unsigned long VirtualKeycodeState[NUX_MAX_VK] = {};
387 int width, height;385 int width = 0, height = 0;
388 unsigned int ascii_code;386 unsigned int ascii_code = 0;
389 int virtual_code;387 int virtual_code = 0;
390388
391 int x;389 int x = -1;
392 int y;390 int y = -1;
393 int x_root;391 int x_root = 0;
394 int y_root;392 int y_root = 0;
395 int dx;393 int dx = 0;
396 int dy;394 int dy = 0;
397 int clicks;395 int clicks = 0;
398 int is_click;396 int is_click = 0;
399397
400#if defined(NUX_OS_WINDOWS)398#if defined(NUX_OS_WINDOWS)
401 int win32_keycode; // Not used. Just a place holder.399 int win32_keycode = 0; // Not used. Just a place holder.
402 int win32_keysym;400 int win32_keysym = 0;
403#elif defined(USE_X11)401#elif defined(USE_X11)
404 Time x11_timestamp; //!< X11 timestamp.402 Time x11_timestamp = 0; //!< X11 timestamp.
405 Window x11_window; //!< X11 window.403 Window x11_window = 0; //!< X11 window.
406 unsigned int x11_key_state; //!< X11 key state (xevent.xkey.state).404 unsigned int x11_key_state = 0; //!< X11 key state (xevent.xkey.state).
407 unsigned int x11_keycode; //!< X11 raw keycode.405 unsigned int x11_keycode = 0; //!< X11 raw keycode.
408 KeySym x11_keysym; //!< X11 keysym.406 KeySym x11_keysym = 0; //!< X11 keysym.
409#endif407#endif
410408
411 int wheel_delta; //!< Wheel delta.409 int wheel_delta = 0; //!< Wheel delta.
412410
413 char text[NUX_EVENT_TEXT_BUFFER_SIZE];411 char text[NUX_EVENT_TEXT_BUFFER_SIZE] = {};
414 char* dtext; //!< Dynamically allocated412 char* dtext = nullptr; //!< Dynamically allocated
415 unsigned long key_modifiers; //!< Key modifiers. A bitwise inclusive OR of values in KeyModifier.413 unsigned long key_modifiers = 0; //!< Key modifiers. A bitwise inclusive OR of values in KeyModifier.
416 unsigned long mouse_state;414 unsigned long mouse_state = 0;
417 unsigned short key_repeat_count; //!< Number of time a key is repeated;415 unsigned short key_repeat_count = 0; //!< Number of time a key is repeated;
418 EventType type;416 EventType type = EVENT_NONE;
419 };417 };
420};418};
421419
diff --git a/gputests/framebufferobject.cpp b/gputests/framebufferobject.cpp
index 9bbca5d..9b64a7f 100644
--- a/gputests/framebufferobject.cpp
+++ b/gputests/framebufferobject.cpp
@@ -58,7 +58,6 @@ void RenderToFrameBufferObject ()
58 graphics_engine->Push2DWindow(w, h);58 graphics_engine->Push2DWindow(w, h);
5959
60 nux::Event event;60 nux::Event event;
61 memset(&event, 0, sizeof(nux::Event));
6261
63 bool first_time = true;62 bool first_time = true;
64 do63 do
diff --git a/gputests/quad_2texmod.cpp b/gputests/quad_2texmod.cpp
index 6170015..638b3f9 100755
--- a/gputests/quad_2texmod.cpp
+++ b/gputests/quad_2texmod.cpp
@@ -87,7 +87,6 @@ void QuadRendering_2TexMod ()
8787
88 int w, h;88 int w, h;
89 nux::Event event;89 nux::Event event;
90 memset(&event, 0, sizeof(nux::Event));
91 graphics_engine->GetWindowSize(w, h);90 graphics_engine->GetWindowSize(w, h);
92 graphics_engine->SetViewport(0, 0, w, h);91 graphics_engine->SetViewport(0, 0, w, h);
93 graphics_engine->SetScissor(0, 0, w, h);92 graphics_engine->SetScissor(0, 0, w, h);
diff --git a/gputests/texture_blur.cpp b/gputests/texture_blur.cpp
index de15aae..355050e 100644
--- a/gputests/texture_blur.cpp
+++ b/gputests/texture_blur.cpp
@@ -60,7 +60,6 @@ void RenderBlurredTexture ()
60 graphics_engine->Push2DWindow(w, h);60 graphics_engine->Push2DWindow(w, h);
6161
62 nux::Event event;62 nux::Event event;
63 memset(&event, 0, sizeof(nux::Event));
64 63
65 /*char fps [25];64 /*char fps [25];
66 int frame_counter = 0;65 int frame_counter = 0;
diff --git a/gputests/texture_copy_blur.cpp b/gputests/texture_copy_blur.cpp
index 54f1cf7..8e79e36 100644
--- a/gputests/texture_copy_blur.cpp
+++ b/gputests/texture_copy_blur.cpp
@@ -60,7 +60,6 @@ void RenderBlurredCopyOfRenderTarget ()
60 graphics_engine->Push2DWindow(w, h);60 graphics_engine->Push2DWindow(w, h);
6161
62 nux::Event event;62 nux::Event event;
63 memset(&event, 0, sizeof(nux::Event));
6463
65 /*char fps [25];64 /*char fps [25];
66 int frame_counter = 0;65 int frame_counter = 0;
diff --git a/gputests/texture_data.cpp b/gputests/texture_data.cpp
index f8248d2..6bd22f3 100644
--- a/gputests/texture_data.cpp
+++ b/gputests/texture_data.cpp
@@ -95,9 +95,7 @@ void RenderTexturePowerOfTwo ()
95 m_GraphicsContext->Push2DWindow(w, h);95 m_GraphicsContext->Push2DWindow(w, h);
9696
97 nux::Event event;97 nux::Event event;
98 memset(&event, 0, sizeof(nux::Event));
9998
100
101 {99 {
102 CHECKGL( glClearColor(0, 0, 0, 1) );100 CHECKGL( glClearColor(0, 0, 0, 1) );
103 CHECKGL( glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT) );101 CHECKGL( glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT) );
diff --git a/gputests/texture_power_of_2.cpp b/gputests/texture_power_of_2.cpp
index 98eb833..392ee97 100644
--- a/gputests/texture_power_of_2.cpp
+++ b/gputests/texture_power_of_2.cpp
@@ -93,7 +93,6 @@ void RenderTexturePowerOfTwo ()
93 m_GraphicsContext->Push2DWindow(w, h);93 m_GraphicsContext->Push2DWindow(w, h);
9494
95 nux::Event event;95 nux::Event event;
96 memset(&event, 0, sizeof(nux::Event));
9796
98 do97 do
99 {98 {

Subscribers

People subscribed via source and target branches

to all changes: