Nux

Merge lp:~brandontschaefer/nux/xim-tests into lp:nux

Proposed by Brandon Schaefer on 2012-08-22
Status: Superseded
Proposed branch: lp:~brandontschaefer/nux/xim-tests
Merge into: lp:nux
Diff against target: 4879 lines (+1842/-633)
66 files modified
INSTALL (+7/-2)
Nux/Area.cpp (+29/-16)
Nux/Area.h (+3/-2)
Nux/BaseWindow.cpp (+29/-6)
Nux/BaseWindow.h (+4/-6)
Nux/FloatingWindow.cpp (+3/-4)
Nux/GesturesSubscription.cpp (+4/-0)
Nux/InputArea.cpp (+30/-17)
Nux/InputMethodIBus.cpp (+0/-4)
Nux/MainLoopGLib.cpp (+26/-17)
Nux/Makefile.am (+100/-84)
Nux/MenuPage.h (+0/-1)
Nux/Nux.cpp (+1/-0)
Nux/Nux.h (+4/-1)
Nux/TextEntry.cpp (+20/-15)
Nux/TextEntry.h (+2/-2)
Nux/WindowCompositor.cpp (+34/-16)
Nux/WindowCompositor.h (+7/-0)
Nux/WindowThread.cpp (+16/-7)
Nux/WindowThread.h (+18/-6)
NuxCore/Logger.cpp (+6/-1)
NuxCore/System.h (+27/-4)
NuxGraphics/CairoGraphics.h (+4/-0)
NuxGraphics/Events.cpp (+6/-7)
NuxGraphics/Events.h (+4/-4)
NuxGraphics/FontRenderer.cpp (+6/-0)
NuxGraphics/FontRenderer.h (+2/-3)
NuxGraphics/GLDeviceObjects.h (+2/-0)
NuxGraphics/GLRenderStates.cpp (+8/-17)
NuxGraphics/GLRenderStates.h (+27/-157)
NuxGraphics/GLResource.h (+7/-5)
NuxGraphics/GLSh_ColorPicker.cpp (+12/-1)
NuxGraphics/GLSh_ColorPicker.h (+2/-0)
NuxGraphics/GLSh_DrawFunction.cpp (+2/-0)
NuxGraphics/GLSh_DrawFunction.h (+2/-0)
NuxGraphics/GLWindowManager.cpp (+5/-5)
NuxGraphics/GLWindowManager.h (+6/-4)
NuxGraphics/GpuDevice.cpp (+36/-7)
NuxGraphics/GpuDevice.h (+12/-1)
NuxGraphics/GpuDeviceShader.cpp (+2/-0)
NuxGraphics/GraphicsDisplay.h (+1/-1)
NuxGraphics/GraphicsDisplayX11.cpp (+45/-2)
NuxGraphics/GraphicsDisplayX11.h (+9/-1)
NuxGraphics/GraphicsEngine.cpp (+13/-11)
NuxGraphics/GraphicsEngine.h (+2/-1)
NuxGraphics/IOpenGLSurface.cpp (+5/-4)
NuxGraphics/Makefile.am (+32/-11)
NuxGraphics/RenderingPipeGLSL.cpp (+133/-137)
NuxGraphics/VirtualKeyCodes.h (+5/-0)
NuxGraphics/XICClient.cpp (+115/-0)
NuxGraphics/XICClient.h (+56/-0)
NuxGraphics/XIMController.cpp (+140/-0)
NuxGraphics/XIMController.h (+57/-0)
NuxGraphics/XInputWindow.cpp (+4/-1)
NuxGraphics/XInputWindow.h (+1/-0)
configure.ac (+37/-7)
examples/Makefile.am (+2/-2)
gputests/framebufferobject.cpp (+19/-9)
gputests/quad_2texmod.cpp (+1/-0)
gputests/texture_blur.cpp (+42/-19)
gputests/texture_copy_blur.cpp (+4/-2)
tests/Makefile.am (+11/-2)
tests/nux_automated_test_framework.cpp (+89/-1)
tests/nux_automated_test_framework.h (+2/-0)
tests/xim-test-commands.txt (+52/-0)
tests/xtest-text-entry-xim.cpp (+450/-0)
To merge this branch: bzr merge lp:~brandontschaefer/nux/xim-tests
Reviewer Review Type Date Requested Status
Łukasz Zemczak Disapprove on 2012-09-07
Andrea Azzarone Approve on 2012-08-31
Jay Taoko 2012-08-22 Pending
Review via email: mp+120726@code.launchpad.net

This proposal supersedes a proposal from 2012-07-18.

This proposal has been superseded by a proposal from 2012-11-05.

Commit Message

XIM Support and Tests.

Description of the Change

Fixed this branch to work with Unity: https://code.launchpad.net/~paulliu/nux/nux
To add XIM Support, as well as get some test for it.

This lets users add test for each IM easily in the text file xim-test-commands.txt. Ill probably have to write documentation but there are examples for 3 IMs.

The bases is:
0 = like an init function. It starts the IM with the name you give it.
1 = Key sequences to get the IM in the correct state. ie. ctrl+space
2 = Input you would type into your IM, ie. ninhao
3 = Checks the current text with what it should be.
4 = halt. So we know when to end the current IM test.

To test the three I have in there you'll need: fcitx, hime, and gcin
(sudo apt-get install gcin-chewing fcitx-googlepinyin hime-anthy)

The XIMController is in control of the current XICClient which gets switched based on the current XInputWindow(Dash/Hud. Each window has it's own XICClient).

XIMController gets allocated in GraphicsDisaplyX11 which you can get the XIMController anywhere else through GetGraphicsDisplay()->GetXIMController(). This is how XInputWindow gets a hold of the current XIMController.

***Note*** I still need to figure a good way out to only make XICClients for those windows that accept text....but as of right now any BaseWindow that ->EnableInputWindow() will create an XICClient for that window. (Im thinking I could hijack the bool take_focus which is only true for the Dash/Hud)

To post a comment you must log in.
Jay Taoko (jaytaoko) wrote : Posted in a previous version of this proposal

The test is failing on my system. When the program runs, some of the xim test passes while other fails. Anything I am missing on my system? In running on precise.

review: Needs Fixing
Brandon Schaefer (brandontschaefer) wrote :

Resubmitted as a lot has changed now....

Andrea Azzarone (azzar1) wrote :

76 + if (m_xim_controller)
77 + {
78 + delete m_xim_controller;
79 + }

What about using a smart ptr?

95 + void GraphicsDisplay::XICFocus()
96 + {
97 + m_xim_controller->FocusInXIC();
98 + }
99 +
100 + void GraphicsDisplay::XICUnFocus()
101 + {
102 + m_xim_controller->FocusOutXIC();
103 + }

I see that m_xim_controller is not initialized in the ctor. So I think that we should add a null check. Or am I missing something?

+* Copyright 2010-2012 Inalogic® Inc.

I think you don't need 2010 :)

I'll continue the review tomorrow (it's late now...).

Brandon Schaefer (brandontschaefer) wrote :

Well we want to avoid using the new C++ standard for now in Nux. Pointers aren't that bad ;).

The reason I didn't do a NULL check is the m_xim_controller gets initialized when the OpenGL window is created.

In GLWindowManager.cpp

112 GraphicsDisplay *glwindow = new GraphicsDisplay();
113 glwindow->CreateOpenGLWindow(WindowTitle, WindowWidth, WindowHeight, Style, GLWindow, FullscreenFlag, create_rendering_data);

or this function:

128 GraphicsDisplay *glwindow = new GraphicsDisplay();
129 glwindow->CreateFromOpenGLWindow(WindowHandle, WindowDCHandle, OpenGLRenderingContext);

Right after the GrapichsDisplay is created the window is made which allocates the controller.

For sanity reason I can check for NULL...but it doesn't seem necessary, because if the m_xim_controller is NULL then so is the m_X11Display and m_X11Window which I don't see those checked for NULL else where in there...let me know what you think.

And yes...it is no longer 2010 haha :)

Brandon Schaefer (brandontschaefer) wrote :

Or are you talking about nux::ObjectPtr?

Andrea Azzarone (azzar1) wrote :

> Well we want to avoid using the new C++ standard for now in Nux. Pointers
> aren't that bad ;).

I think that the 'old" C++ standard has smart ptrs too :) Boost can help here too.

>
> The reason I didn't do a NULL check is the m_xim_controller gets initialized
> when the OpenGL window is created.
>
> In GLWindowManager.cpp
>
> 112 GraphicsDisplay *glwindow = new GraphicsDisplay();
> 113 glwindow->CreateOpenGLWindow(WindowTitle, WindowWidth, WindowHeight,
> Style, GLWindow, FullscreenFlag, create_rendering_data);
>
> or this function:
>
> 128 GraphicsDisplay *glwindow = new GraphicsDisplay();
> 129 glwindow->CreateFromOpenGLWindow(WindowHandle, WindowDCHandle,
> OpenGLRenderingContext);
>
> Right after the GrapichsDisplay is created the window is made which allocates
> the controller.
>
> For sanity reason I can check for NULL...but it doesn't seem necessary,
> because if the m_xim_controller is NULL then so is the m_X11Display and
> m_X11Window which I don't see those checked for NULL else where in there...let
> me know what you think.

Perfect. Yeah it's not necessary. Never mind my comment ;)

>
> And yes...it is no longer 2010 haha :)

Andrea Azzarone (azzar1) wrote :

> Or are you talking about nux::ObjectPtr?

No, don't use nux::ObjectPtr. boost::shared_ptr should be good.

Andrea Azzarone (azzar1) :
review: Approve
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-nux/184/console reported an error when processing this lp:~brandontschaefer/nux/xim-tests branch.
Not merging it.

Łukasz Zemczak (sil2100) wrote :

Ok, first of all - I approve of this code and think it's very useful to have, but.

After consulting with the release team, we have decided to postpone this feature to 13.04. So sadly, here I need to disapprove of it so that it does not accidentally land in 12.10 lp:nux trunk.

But what I would like to do is (what Iain proposed) creating a PPA with unity and nux versions including this feature, making it public for people to test and comment (through the 2 bugs that are mentioned). So that we have it fully tested for 13.04.

review: Disapprove
lp:~brandontschaefer/nux/xim-tests updated on 2012-12-02
664. By Brandon Schaefer on 2012-09-11

* merged trunk

665. By Brandon Schaefer on 2012-10-19

* Merged trunk

666. By Brandon Schaefer on 2012-11-05

* Merge with thumpers nux.armel-fixes

667. By Brandon Schaefer on 2012-11-23

* Merged trunk

668. By Brandon Schaefer on 2012-11-24

* Moved to std::shared_ptr
* Fixed headers
* Moved to new logger

669. By Brandon Schaefer on 2012-11-27

* Following up on review

670. By Brandon Schaefer on 2012-11-27

* Fixed conflict, merged trunk

671. By Brandon Schaefer on 2012-12-02

* Merged trunk

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'INSTALL'
2--- INSTALL 2010-09-01 19:25:37 +0000
3+++ INSTALL 2012-11-05 17:50:27 +0000
4@@ -1,8 +1,8 @@
5 Installation Instructions
6 *************************
7
8-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
9-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
10+Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
11+Inc.
12
13 Copying and distribution of this file, with or without modification,
14 are permitted in any medium without royalty provided the copyright
15@@ -226,6 +226,11 @@
16
17 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
18
19+ HP-UX `make' updates targets which have the same time stamps as
20+their prerequisites, which makes it generally unusable when shipped
21+generated files such as `configure' are involved. Use GNU `make'
22+instead.
23+
24 On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
25 parse its `<wchar.h>' header file. The option `-nodtk' can be used as
26 a workaround. If GNU CC is not installed, it is therefore recommended
27
28=== modified file 'Nux/Area.cpp'
29--- Nux/Area.cpp 2012-09-30 23:28:23 +0000
30+++ Nux/Area.cpp 2012-11-05 17:50:27 +0000
31@@ -24,10 +24,12 @@
32 #include "Area.h"
33 #include "NuxGraphics/GraphicsEngine.h"
34 #include "Layout.h"
35-#include "VSplitter.h"
36-#include "HSplitter.h"
37 #include "BaseWindow.h"
38-#include "MenuPage.h"
39+#if !defined(NUX_MINIMAL)
40+# include "VSplitter.h"
41+# include "HSplitter.h"
42+# include "MenuPage.h"
43+#endif
44
45 #ifdef NUX_GESTURES_SUPPORT
46 #include "NuxGraphics/GestureEvent.h"
47@@ -512,21 +514,23 @@
48
49 if (ic->CanBreakLayout())
50 {
51-
52- if ((child != 0) &&
53- (ic->Type().IsObjectType(VSplitter::StaticObjectType) || ic->Type().IsObjectType(HSplitter::StaticObjectType)))
54+#if !defined(NUX_MINIMAL)
55+ if ((child != 0) && (ic->Type().IsObjectType(VSplitter::StaticObjectType) || ic->Type().IsObjectType(HSplitter::StaticObjectType)))
56 {
57 // If this element is a Splitter, then we submit its child to the refresh list. We don't want to submit the
58 // splitter because this will cause a redraw of all parts of the splitter(costly and unnecessary).
59 window_thread_->QueueObjectLayout(child);
60 }
61 else
62+#endif
63 {
64 window_thread_->QueueObjectLayout(ic);
65 }
66 }
67 else if (ic->parent_area_)
68+ {
69 ic->parent_area_->ReconfigureParentLayout(this);
70+ }
71 else
72 {
73 window_thread_->QueueObjectLayout(ic);
74@@ -551,14 +555,19 @@
75
76 if (ic->CanBreakLayout())
77 {
78+#if !defined(NUX_MINIMAL)
79 if ((child != 0) &&
80- (ic->Type().IsObjectType(VSplitter::StaticObjectType) || ic->Type().IsObjectType(HSplitter::StaticObjectType)))
81+ (ic->Type().IsObjectType(VSplitter::StaticObjectType) ||
82+ ic->Type().IsObjectType(HSplitter::StaticObjectType)))
83 {
84- // If the parent of this element is a splitter, then we submit its child to the refresh list. We don't want to submit the
85- // splitter because this will cause a redraw of all parts of the splitter(costly and unnecessary).
86+ // If the parent of this element is a splitter, then we submit
87+ // its child to the refresh list. We don't want to submit the
88+ // splitter because this will cause a redraw of all parts of the
89+ // splitter(costly and unnecessary).
90 window_thread_->QueueObjectLayout(this);
91 }
92 else
93+#endif
94 {
95 window_thread_->QueueObjectLayout(ic);
96 }
97@@ -774,7 +783,9 @@
98 Geometry Area::GetAbsoluteGeometry() const
99 {
100 if (Type().IsDerivedFromType(BaseWindow::StaticObjectType) ||
101+#if !defined(NUX_MINIMAL)
102 Type().IsDerivedFromType(MenuPage::StaticObjectType) ||
103+#endif
104 (this == window_thread_->GetLayout()))
105 {
106 // Do not apply the _2D_xform matrix to a BaseWindow or the main layout
107@@ -952,19 +963,20 @@
108 // then return false.
109 return false;
110 }
111-
112+
113 bool mouse_pointer_inside_area = false;
114-
115+#if !defined(NUX_MINIMAL)
116 if (Type().IsDerivedFromType(MenuPage::StaticObjectType))
117 {
118 // A MenuPage geometry is already in absolute coordinates.
119 mouse_pointer_inside_area = geometry_.IsInside(mouse_position);
120 }
121 else
122+#endif
123 {
124 mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position);
125 }
126-
127+
128 if ((event_type == NUX_MOUSE_WHEEL) && mouse_pointer_inside_area)
129 {
130 if (accept_mouse_wheel_event_ == false)
131@@ -985,22 +997,23 @@
132 // - it is not enabled
133 // - it is not visible
134 // then return false.
135-
136+
137 return false;
138 }
139-
140+
141 bool mouse_pointer_inside_area = false;
142-
143+#if !defined(NUX_MINIMAL)
144 if (Type().IsDerivedFromType(MenuPage::StaticObjectType))
145 {
146 // A MenuPage geometry is already in absolute coordinates.
147 mouse_pointer_inside_area = geometry_.IsInside(mouse_position);
148 }
149 else
150+#endif
151 {
152 mouse_pointer_inside_area = GetAbsoluteGeometry().IsInside(mouse_position);
153 }
154-
155+
156 return mouse_pointer_inside_area;
157 }
158
159
160=== modified file 'Nux/Area.h'
161--- Nux/Area.h 2012-09-26 06:44:12 +0000
162+++ Nux/Area.h 2012-11-05 17:50:27 +0000
163@@ -795,12 +795,13 @@
164
165 friend class Layout;
166 friend class View;
167+ friend class WindowCompositor;
168 friend class WindowThread;
169+#if !defined(NUX_MINIMAL)
170 friend class HSplitter;
171 friend class VSplitter;
172- friend class WindowCompositor;
173+#endif
174 };
175-
176 }
177 #endif // BASEOBJECT_H
178
179
180=== modified file 'Nux/BaseWindow.cpp'
181--- Nux/BaseWindow.cpp 2012-10-02 07:32:55 +0000
182+++ Nux/BaseWindow.cpp 2012-11-05 17:50:27 +0000
183@@ -27,7 +27,6 @@
184 #include "HLayout.h"
185 #include "WindowCompositor.h"
186 #include "BaseWindow.h"
187-#include "TextEntry.h"
188
189 namespace nux
190 {
191@@ -57,7 +56,7 @@
192 _size_match_layout = false;
193 _is_visible = false;
194 _is_modal = false;
195-#if defined(NUX_OS_LINUX)
196+#if defined(USE_X11)
197 m_input_window_enabled = false;
198 m_input_window = 0;
199 #endif
200@@ -85,7 +84,7 @@
201 _enter_focus_input_area->UnReference();
202 }
203
204-#if defined(NUX_OS_LINUX)
205+#if defined(USE_X11)
206 if (m_input_window)
207 delete m_input_window;
208 #endif
209@@ -239,12 +238,13 @@
210
211 }
212
213- #if defined(NUX_OS_LINUX)
214+#if defined(NUX_OS_LINUX)
215 void BaseWindow::EnableInputWindow(bool b,
216 const char* title,
217 bool take_focus,
218 bool override_redirect)
219 {
220+#if defined(USE_X11)
221 if (b)
222 {
223 if (m_input_window == 0)
224@@ -260,56 +260,79 @@
225 m_input_window->Hide();
226 m_input_window_enabled = false;
227 }
228+#endif
229 }
230
231 bool BaseWindow::InputWindowEnabled()
232 {
233+#if defined(USE_X11)
234 return m_input_window_enabled;
235+#else
236+ return false;
237+#endif
238 }
239
240 void BaseWindow::InputWindowEnableStruts(bool enable)
241 {
242+#if defined(USE_X11)
243 if (m_input_window)
244 m_input_window->EnableStruts(enable);
245+#endif
246 }
247
248 bool BaseWindow::InputWindowStrutsEnabled()
249 {
250+#if defined(USE_X11)
251 return m_input_window_enabled && m_input_window->StrutsEnabled();
252+#else
253+ return false;
254+#endif
255 }
256
257 void BaseWindow::InputWindowEnableOverlayStruts(bool enable)
258 {
259+#if defined(USE_X11)
260 if (m_input_window)
261 m_input_window->EnableOverlayStruts(enable);
262+#endif
263 }
264
265 bool BaseWindow::InputWindowOverlayStrutsEnabled()
266 {
267+#if defined(USE_X11)
268 return m_input_window && m_input_window->OverlayStrutsEnabled();
269+#else
270+ return false;
271+#endif
272 }
273
274 void BaseWindow::SetInputFocus()
275 {
276+#if defined(USE_X11)
277 if (m_input_window)
278 m_input_window->SetInputFocus();
279+#endif
280 }
281
282 Window BaseWindow::GetInputWindowId()
283 {
284+#if defined(USE_X11)
285 if (m_input_window)
286 return m_input_window->GetWindow();
287 else
288 return 0;
289+#else
290+ return 0;
291+#endif
292 }
293
294- #endif
295+#endif
296
297 void BaseWindow::SetGeometry(const Geometry &geo)
298 {
299 Area::SetGeometry(geo);
300
301- #if defined(NUX_OS_LINUX)
302+ #if defined(USE_X11)
303 if (m_input_window)
304 m_input_window->SetGeometry(geo);
305 #endif
306
307=== modified file 'Nux/BaseWindow.h'
308--- Nux/BaseWindow.h 2012-10-10 22:46:50 +0000
309+++ Nux/BaseWindow.h 2012-11-05 17:50:27 +0000
310@@ -27,11 +27,9 @@
311 #include <boost/scoped_ptr.hpp>
312 #include "ScrollView.h"
313
314-#if defined(NUX_OS_WINDOWS)
315-#include "NuxGraphics/Events.h"
316-#elif defined(NUX_OS_LINUX)
317-#include "NuxGraphics/Events.h"
318-#include "NuxGraphics/XInputWindow.h"
319+#include "NuxGraphics/Events.h"
320+#if defined(USE_X11)
321+# include "NuxGraphics/XInputWindow.h"
322 #endif
323
324 #include "InputArea.h"
325@@ -242,7 +240,7 @@
326
327 bool ChildNeedsRedraw();
328
329- #if defined(NUX_OS_LINUX)
330+ #if defined(USE_X11)
331 bool m_input_window_enabled;
332 XInputWindow *m_input_window;
333 #endif
334
335=== modified file 'Nux/FloatingWindow.cpp'
336--- Nux/FloatingWindow.cpp 2012-10-10 22:46:50 +0000
337+++ Nux/FloatingWindow.cpp 2012-11-05 17:50:27 +0000
338@@ -279,7 +279,7 @@
339
340 SetGeometry(geo);
341
342-#if defined(NUX_OS_LINUX)
343+#if defined(USE_X11)
344 if (m_input_window != 0)
345 {
346 //nuxDebugMsg("Resize Input window: %d, %d, %d, %d", geo.x, geo.y, geo.width, geo.height);
347@@ -309,7 +309,7 @@
348
349 _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height));
350
351-#if defined(NUX_OS_LINUX)
352+#if defined(USE_X11)
353 if (m_input_window != 0)
354 {
355 //nuxDebugMsg("Resize Input window: %d, %d, %d, %d", geo.x, geo.y, geo.width, geo.height);
356@@ -322,11 +322,10 @@
357
358 void FloatingWindow::RecvCloseButtonClick(int /* x */, int /* y */, unsigned long /* button_flags */, unsigned long /* key_flags */)
359 {
360-#if defined(NUX_OS_LINUX)
361+#if defined(USE_X11)
362 // Disable the input window if there is one.
363 EnableInputWindow(false);
364 #endif
365-
366 StopModal();
367 }
368
369
370=== modified file 'Nux/GesturesSubscription.cpp'
371--- Nux/GesturesSubscription.cpp 2012-10-28 15:59:17 +0000
372+++ Nux/GesturesSubscription.cpp 2012-11-05 17:50:27 +0000
373@@ -31,7 +31,11 @@
374 GesturesSubscription::GesturesSubscription()
375 : gesture_classes_(DRAG_GESTURE|PINCH_GESTURE|ROTATE_GESTURE),
376 num_touches_(2),
377+#if defined(USE_X11)
378 window_id_(GetWindowThread()->GetGraphicsDisplay().GetWindowHandle()),
379+#else
380+ window_id_(0),
381+#endif
382 sub_(nullptr),
383 is_active_(false),
384 drag_threshold_(0.0026f),
385
386=== modified file 'Nux/InputArea.cpp'
387--- Nux/InputArea.cpp 2012-10-28 15:59:17 +0000
388+++ Nux/InputArea.cpp 2012-11-05 17:50:27 +0000
389@@ -125,7 +125,7 @@
390
391 void InputArea::HandleDndMove(Event &event)
392 {
393-#if defined(NUX_OS_LINUX)
394+#if defined(DRAG_AND_DROP_SUPPORTED)
395 std::list<char *> mimes;
396
397 mimes = GetWindowThread()->GetGraphicsDisplay().GetDndMimeTypes();
398@@ -139,7 +139,7 @@
399
400 void InputArea::HandleDndDrop(Event &event)
401 {
402-#if defined(NUX_OS_LINUX)
403+#if defined(DRAG_AND_DROP_SUPPORTED)
404 ProcessDndDrop(event.x, event.y);
405 #endif
406 }
407@@ -147,16 +147,21 @@
408 #if defined(NUX_OS_LINUX)
409 void InputArea::SendDndStatus(bool accept, DndAction action, Geometry region)
410 {
411+#if defined(DRAG_AND_DROP_SUPPORTED)
412 GetWindowThread()->GetGraphicsDisplay().SendDndStatus(accept, action, Rect(region.x, region.y, region.width, region.height));
413+#endif
414 }
415
416 void InputArea::SendDndFinished(bool accepted, DndAction action)
417 {
418+#if defined(DRAG_AND_DROP_SUPPORTED)
419 GetWindowThread()->GetGraphicsDisplay().SendDndFinished(accepted, action);
420+#endif
421 }
422
423 void InputArea::ProcessDndMove(int x, int y, std::list<char *> /* mimes */)
424 {
425+#if defined(DRAG_AND_DROP_SUPPORTED)
426 // must learn to deal with x/y offsets
427 Area *parent = GetToplevel();
428
429@@ -167,11 +172,14 @@
430 }
431
432 SendDndStatus(false, DNDACTION_NONE, Geometry(x, y, GetGeometry().width, GetGeometry().height));
433+#endif
434 }
435
436 void InputArea::ProcessDndDrop(int /* x */, int /* y */)
437 {
438+#if defined(DRAG_AND_DROP_SUPPORTED)
439 SendDndFinished(false, DNDACTION_NONE);
440+#endif
441 }
442
443 void InputArea::ProcessDndEnter()
444@@ -181,23 +189,25 @@
445 void InputArea::ProcessDndLeave()
446 {
447 }
448-
449+
450 void InputArea::SetDndEnabled(bool as_source, bool as_target)
451 {
452+#if defined(DRAG_AND_DROP_SUPPORTED)
453 _dnd_enabled_as_source = as_source;
454 _dnd_enabled_as_target = as_target;
455+#endif
456 }
457-
458+
459 bool InputArea::DndSourceDragBegin()
460 {
461 return false;
462 }
463-
464- NBitmapData * InputArea::DndSourceGetDragImage()
465+
466+ NBitmapData* InputArea::DndSourceGetDragImage()
467 {
468 return 0;
469 }
470-
471+
472 std::list<const char *> InputArea::DndSourceGetDragTypes()
473 {
474 std::list<const char *> types;
475@@ -205,7 +215,7 @@
476 types.push_back("UTF8_STRING");
477 return types;
478 }
479-
480+
481 const char * InputArea::DndSourceGetDataForType(const char *type, int *size, int *format)
482 {
483 *format = 8;
484@@ -215,33 +225,36 @@
485 *size = (int) strlen("this is just a test");
486 return "this is just a test";
487 }
488-
489+
490 *size = 0;
491 return 0;
492 }
493-
494- void InputArea::InnerDndSourceDragFinished(DndAction result, void *data)
495- {
496+
497+ void InputArea::InnerDndSourceDragFinished(DndAction result, void *data)
498+ {
499+#if defined(DRAG_AND_DROP_SUPPORTED)
500 InputArea *self = static_cast<InputArea *> (data);
501 self->DndSourceDragFinished(result);
502+#endif
503 }
504-
505+
506 void InputArea::DndSourceDragFinished(DndAction /* result */)
507 {
508-
509 }
510-
511+
512 void InputArea::StartDragAsSource()
513 {
514+#if defined(DRAG_AND_DROP_SUPPORTED)
515 GraphicsDisplay::DndSourceFuncs funcs;
516-
517+
518 funcs.get_drag_image = &InputArea::InnerDndSourceGetDragImage;
519 funcs.get_drag_types = &InputArea::InnerDndSourceGetDragTypes;
520 funcs.get_data_for_type = &InputArea::InnerDndSourceGetDataForType;
521 funcs.drag_finished = &InputArea::InnerDndSourceDragFinished;
522-
523+
524 if (DndSourceDragBegin())
525 GetWindowThread()->GetGraphicsDisplay().StartDndDrag(funcs, this);
526+#endif
527 }
528 #endif
529
530
531=== modified file 'Nux/InputMethodIBus.cpp'
532--- Nux/InputMethodIBus.cpp 2012-10-01 23:37:25 +0000
533+++ Nux/InputMethodIBus.cpp 2012-11-05 17:50:27 +0000
534@@ -464,16 +464,13 @@
535 // FIXME add support to Hyper and Meta keys in nux::Event
536 }
537 }
538-
539 if (!is_modifier && key)
540 ev.x11_keysym = key;
541 }
542-
543 if (ev.x11_keysym)
544 {
545 hotkeys.push_back(ev);
546 }
547-
548 g_strfreev(binding);
549 }
550 }
551@@ -504,7 +501,6 @@
552 return (ev.key_modifiers == modifiers);
553 }
554 }
555-
556 return false;
557 }
558 }
559
560=== modified file 'Nux/MainLoopGLib.cpp'
561--- Nux/MainLoopGLib.cpp 2012-10-28 15:59:17 +0000
562+++ Nux/MainLoopGLib.cpp 2012-11-05 17:50:27 +0000
563@@ -80,14 +80,18 @@
564
565 gboolean retval;
566 *timeout = -1;
567- #if defined(NUX_OS_WINDOWS)
568+#if defined(NUX_OS_WINDOWS)
569 MSG msg;
570 retval = PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE) ? TRUE : FALSE;
571- #elif defined(NUX_OS_LINUX)
572+#elif defined(NUX_OS_LINUX)
573+# if defined(USE_X11)
574 retval = GetGraphicsDisplay()->HasXPendingEvent() ? TRUE : FALSE;
575- #else
576- #error Not implemented.
577- #endif
578+# else
579+ retval = false;
580+# endif
581+#else
582+# error Not implemented.
583+#endif
584
585 nux_glib_threads_unlock();
586 return retval;
587@@ -97,23 +101,21 @@
588 {
589 nux_glib_threads_lock();
590
591- gboolean retval;
592+ gboolean retval = FALSE;
593 NuxEventSource *event_source = (NuxEventSource*) source;
594
595 if ((event_source->event_poll_fd.revents & G_IO_IN))
596 {
597- #if defined(NUX_OS_WINDOWS)
598+#if defined(NUX_OS_WINDOWS)
599 MSG msg;
600 retval = PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE) ? TRUE : FALSE;
601- #elif defined(NUX_OS_LINUX)
602+#elif defined(NUX_OS_LINUX)
603+# if defined(USE_X11)
604 retval = GetGraphicsDisplay()->HasXPendingEvent() ? TRUE : FALSE;
605- #else
606- #error Not implemented.
607- #endif
608- }
609- else
610- {
611- retval = FALSE;
612+# endif
613+#else
614+# error Not implemented.
615+#endif
616 }
617
618 nux_glib_threads_unlock();
619@@ -166,6 +168,7 @@
620
621 static gboolean nux_timeline_dispatch(GSource *source, GSourceFunc /* callback */, gpointer user_data)
622 {
623+#if !defined(NUX_MINIMAL)
624 bool has_timelines_left = false;
625 nux_glib_threads_lock();
626 gint64 micro_secs = g_source_get_time(source);
627@@ -182,6 +185,7 @@
628 }
629
630 nux_glib_threads_unlock();
631+#endif
632 return TRUE;
633 }
634
635@@ -248,9 +252,11 @@
636 #if defined(NUX_OS_WINDOWS)
637 event_source->event_poll_fd.fd = G_WIN32_MSG_HANDLE;
638 #elif defined(NUX_OS_LINUX)
639+# if defined(USE_X11)
640 event_source->event_poll_fd.fd = ConnectionNumber(GetGraphicsDisplay().GetX11Display());
641+# endif
642 #else
643-#error Not implemented.
644+# error Not implemented.
645 #endif
646
647 event_source->event_poll_fd.events = G_IO_IN;
648@@ -278,8 +284,10 @@
649 sigc::mem_fun(this, &WindowThread::ProcessGestureEvent));
650 #endif
651
652+#if !defined(NUX_MINIMAL)
653 if (_Timelines->size() > 0)
654 StartMasterClock();
655+#endif
656
657 if (!IsEmbeddedWindow())
658 {
659@@ -386,10 +394,11 @@
660 else if (main_loop_glib_context_ != 0)
661 g_source_attach(_MasterClock, main_loop_glib_context_);
662
663-
664+#if !defined(NUX_MINIMAL)
665 gint64 micro_secs = g_source_get_time(_MasterClock);
666 last_timeline_frame_time_sec_ = micro_secs / 1000000;
667 last_timeline_frame_time_usec_ = micro_secs % 1000000;
668+#endif
669 }
670 }
671
672
673=== modified file 'Nux/Makefile.am'
674--- Nux/Makefile.am 2012-10-25 10:41:45 +0000
675+++ Nux/Makefile.am 2012-11-05 17:50:27 +0000
676@@ -35,38 +35,22 @@
677 $(srcdir)/AbstractComboBox.cpp \
678 $(srcdir)/AbstractPaintLayer.cpp \
679 $(srcdir)/AbstractThread.cpp \
680- $(srcdir)/ActionItem.cpp \
681- $(srcdir)/AnimatedTextureArea.cpp \
682- $(srcdir)/PaintLayer.cpp \
683- $(srcdir)/InputArea.cpp \
684 $(srcdir)/Area.cpp \
685 $(srcdir)/BaseWindow.cpp \
686 $(srcdir)/BasicView.cpp \
687 $(srcdir)/Button.cpp \
688+ $(srcdir)/CairoWrapper.cpp \
689 $(srcdir)/Canvas.cpp \
690- $(srcdir)/CairoWrapper.cpp \
691 $(srcdir)/CheckBox.cpp \
692 $(srcdir)/ClientArea.cpp \
693- $(srcdir)/ColorEditor.cpp \
694- $(srcdir)/ColorPickerDialog.cpp \
695- $(srcdir)/ColorPreview.cpp \
696 $(srcdir)/Coverflow.cpp \
697 $(srcdir)/CoverflowItem.cpp \
698 $(srcdir)/CoverflowModel.cpp \
699- $(srcdir)/Dialog.cpp \
700- $(srcdir)/DoubleValidator.cpp \
701- $(srcdir)/EditTextBox.cpp \
702- $(srcdir)/FileSelector.cpp \
703- $(srcdir)/FloatingWindow.cpp \
704+ $(srcdir)/EMMetrics.cpp \
705 $(srcdir)/GridHLayout.cpp \
706- $(srcdir)/GroupBox.cpp \
707- $(srcdir)/GroupBox2.cpp \
708- $(srcdir)/HexRegExpValidator.cpp \
709 $(srcdir)/HLayout.cpp \
710- $(srcdir)/HScrollBar.cpp \
711 $(srcdir)/HSplitter.cpp \
712- $(srcdir)/IntegerValidator.cpp \
713- $(srcdir)/View.cpp \
714+ $(srcdir)/InputArea.cpp \
715 $(srcdir)/KeyboardHandler.cpp \
716 $(srcdir)/KineticScrolling/AxisDecelerationAnimation.cpp \
717 $(srcdir)/KineticScrolling/KineticAxisScroller.cpp \
718@@ -78,14 +62,47 @@
719 $(srcdir)/Layout.cpp \
720 $(srcdir)/LinearLayout.cpp \
721 $(srcdir)/MainLoopGLib.cpp \
722+ $(srcdir)/Nux.cpp \
723+ $(srcdir)/NuxGlobalInitializer.cpp \
724+ $(srcdir)/Painter.cpp \
725+ $(srcdir)/PaintLayer.cpp \
726+ $(srcdir)/StaticText.cpp \
727+ $(srcdir)/StaticTextBox.cpp \
728+ $(srcdir)/SystemThread.cpp \
729+ $(srcdir)/TextEntry.cpp \
730+ $(srcdir)/TextLoader.cpp \
731+ $(srcdir)/TextureArea.cpp \
732+ $(srcdir)/Theme.cpp \
733+ $(srcdir)/TimerProc.cpp \
734+ $(srcdir)/Utils.cpp \
735+ $(srcdir)/VLayout.cpp \
736+ $(srcdir)/View.cpp \
737+ $(srcdir)/VSplitter.cpp \
738+ $(srcdir)/WidgetMetrics.cpp \
739+ $(srcdir)/WindowCompositor.cpp \
740+ $(srcdir)/WindowThread.cpp
741+
742+if !NUX_MINIMAL
743+source_cpp += \
744+ $(srcdir)/ActionItem.cpp \
745+ $(srcdir)/AnimatedTextureArea.cpp \
746+ $(srcdir)/ColorEditor.cpp \
747+ $(srcdir)/ColorPickerDialog.cpp \
748+ $(srcdir)/ColorPreview.cpp \
749+ $(srcdir)/Dialog.cpp \
750+ $(srcdir)/DoubleValidator.cpp \
751+ $(srcdir)/EditTextBox.cpp \
752+ $(srcdir)/FileSelector.cpp \
753+ $(srcdir)/FloatingWindow.cpp \
754+ $(srcdir)/GroupBox.cpp \
755+ $(srcdir)/GroupBox2.cpp \
756+ $(srcdir)/HexRegExpValidator.cpp \
757+ $(srcdir)/HScrollBar.cpp \
758+ $(srcdir)/IntegerValidator.cpp \
759 $(srcdir)/MenuPage.cpp \
760 $(srcdir)/MenuBar.cpp \
761- $(srcdir)/EMMetrics.cpp \
762 $(srcdir)/MouseAreaCtrl.cpp \
763 $(srcdir)/NumericValuator.cpp \
764- $(srcdir)/Nux.cpp \
765- $(srcdir)/NuxGlobalInitializer.cpp \
766- $(srcdir)/Painter.cpp \
767 $(srcdir)/Panel.cpp \
768 $(srcdir)/PopUpWindow.cpp \
769 $(srcdir)/RadioButton.cpp \
770@@ -98,28 +115,19 @@
771 $(srcdir)/SpinBox.cpp \
772 $(srcdir)/SpinBoxDouble.cpp \
773 $(srcdir)/SpinBox_Logic.cpp \
774- $(srcdir)/StaticText.cpp \
775- $(srcdir)/StaticTextBox.cpp \
776- $(srcdir)/SystemThread.cpp \
777 $(srcdir)/TabView.cpp \
778- $(srcdir)/TextEntry.cpp \
779- $(srcdir)/InputMethodIBus.cpp \
780- $(srcdir)/TextLoader.cpp \
781- $(srcdir)/TextureArea.cpp \
782 $(srcdir)/Timeline.cpp \
783 $(srcdir)/TimelineEasings.cpp \
784- $(srcdir)/TimerProc.cpp \
785 $(srcdir)/ToggleButton.cpp \
786 $(srcdir)/ToolButton.cpp \
787- $(srcdir)/Utils.cpp \
788- $(srcdir)/Theme.cpp \
789 $(srcdir)/Validator.cpp \
790- $(srcdir)/VLayout.cpp \
791- $(srcdir)/VScrollBar.cpp \
792- $(srcdir)/VSplitter.cpp \
793- $(srcdir)/WidgetMetrics.cpp \
794- $(srcdir)/WindowCompositor.cpp \
795- $(srcdir)/WindowThread.cpp
796+ $(srcdir)/VScrollBar.cpp
797+endif
798+
799+if USE_X11
800+source_cpp += \
801+ $(srcdir)/InputMethodIBus.cpp
802+endif
803
804 if HAVE_GEIS
805 source_cpp += \
806@@ -130,65 +138,82 @@
807 endif
808
809 source_h = \
810- $(builddir)/ABI.h \
811+ $(builddir)/Features.h \
812 $(srcdir)/AbstractButton.h \
813 $(srcdir)/AbstractCheckedButton.h \
814 $(srcdir)/AbstractComboBox.h \
815 $(srcdir)/AbstractPaintLayer.h \
816 $(srcdir)/AbstractThread.h \
817- $(srcdir)/ActionItem.h \
818- $(srcdir)/AnimatedTextureArea.h \
819- $(srcdir)/PaintLayer.h \
820- $(srcdir)/InputArea.h \
821 $(srcdir)/Area.h \
822 $(srcdir)/BaseWindow.h \
823 $(srcdir)/BasicView.h \
824 $(srcdir)/Button.h \
825+ $(srcdir)/CairoWrapper.h \
826 $(srcdir)/Canvas.h \
827- $(srcdir)/CairoWrapper.h \
828 $(srcdir)/CheckBox.h \
829 $(srcdir)/ClientArea.h \
830+ $(srcdir)/Coverflow.h \
831+ $(srcdir)/CoverflowItem.h \
832+ $(srcdir)/CoverflowModel.h \
833+ $(srcdir)/EMMetrics.h \
834+ $(srcdir)/GridHLayout.h \
835+ $(srcdir)/HLayout.h \
836+ $(srcdir)/HSplitter.h \
837+ $(srcdir)/InputArea.h \
838+ $(srcdir)/KeyboardHandler.h \
839+ $(srcdir)/KineticScrolling/AxisDecelerationAnimation.h \
840+ $(srcdir)/KineticScrolling/KineticAxisScroller.h \
841+ $(srcdir)/KineticScrolling/KineticScroller.h \
842+ $(srcdir)/KineticScrolling/KineticScrollingEnums.h \
843+ $(srcdir)/KineticScrolling/KineticScrollingTickSource.h \
844+ $(srcdir)/KineticScrolling/VelocityCalculator.h \
845+ $(srcdir)/KineticScrollView.h \
846+ $(srcdir)/LayeredLayout.h \
847+ $(srcdir)/Layout.h \
848+ $(srcdir)/LinearLayout.h \
849+ $(srcdir)/Nux.h \
850+ $(srcdir)/NuxGlobalInitializer.h \
851+ $(srcdir)/Painter.h \
852+ $(srcdir)/PaintLayer.h \
853+ $(srcdir)/StaticText.h \
854+ $(srcdir)/StaticTextBox.h \
855+ $(srcdir)/SystemThread.h \
856+ $(srcdir)/TextEntry.h \
857+ $(srcdir)/TextLoader.h \
858+ $(srcdir)/TextureArea.h \
859+ $(srcdir)/Theme.h \
860+ $(srcdir)/TimerProc.h \
861+ $(srcdir)/Utils.h \
862+ $(srcdir)/VLayout.h \
863+ $(srcdir)/View.h \
864+ $(srcdir)/VSplitter.h \
865+ $(srcdir)/WidgetMetrics.h \
866+ $(srcdir)/WindowCompositor.h \
867+ $(srcdir)/WindowThread.h
868+
869+if !NUX_MINIMAL
870+source_h += \
871+ $(builddir)/ABI.h \
872+ $(srcdir)/ActionItem.h \
873+ $(srcdir)/AnimatedTextureArea.h \
874 $(srcdir)/ColorEditor.h \
875 $(srcdir)/ColorPickerDialog.h \
876 $(srcdir)/ColorPreview.h \
877- $(srcdir)/Coverflow.h \
878- $(srcdir)/CoverflowItem.h \
879- $(srcdir)/CoverflowModel.h \
880 $(srcdir)/Dialog.h \
881 $(srcdir)/DoubleValidator.h \
882 $(srcdir)/EditTextBox.h \
883- $(builddir)/Features.h \
884 $(srcdir)/FileSelector.h \
885 $(srcdir)/FloatingWindow.h \
886- $(srcdir)/GridHLayout.h \
887 $(srcdir)/GroupBox.h \
888 $(srcdir)/GroupBox2.h \
889 $(srcdir)/HexRegExpValidator.h \
890- $(srcdir)/HLayout.h \
891 $(srcdir)/HScrollBar.h \
892- $(srcdir)/HSplitter.h \
893 $(srcdir)/IntegerValidator.h \
894- $(srcdir)/View.h \
895- $(srcdir)/KeyboardHandler.h \
896- $(srcdir)/KineticScrolling/AxisDecelerationAnimation.h \
897- $(srcdir)/KineticScrolling/KineticAxisScroller.h \
898- $(srcdir)/KineticScrolling/KineticScroller.h \
899- $(srcdir)/KineticScrolling/KineticScrollingEnums.h \
900- $(srcdir)/KineticScrolling/KineticScrollingTickSource.h \
901- $(srcdir)/KineticScrolling/VelocityCalculator.h \
902- $(srcdir)/KineticScrollView.h \
903- $(srcdir)/LayeredLayout.h \
904- $(srcdir)/Layout.h \
905- $(srcdir)/LinearLayout.h \
906 $(srcdir)/MenuPage.h \
907 $(srcdir)/MenuBar.h \
908- $(srcdir)/EMMetrics.h \
909 $(srcdir)/MouseAreaCtrl.h \
910 $(srcdir)/NumericValuator.h \
911- $(srcdir)/Nux.h \
912 $(srcdir)/NuxTimerTickSource.h \
913- $(srcdir)/NuxGlobalInitializer.h \
914- $(srcdir)/Painter.h \
915 $(srcdir)/Panel.h \
916 $(srcdir)/PopUpWindow.h \
917 $(srcdir)/RadioButton.h \
918@@ -202,29 +227,20 @@
919 $(srcdir)/SpinBox.h \
920 $(srcdir)/SpinBoxDouble.h \
921 $(srcdir)/SpinBox_Logic.h \
922- $(srcdir)/StaticText.h \
923- $(srcdir)/StaticTextBox.h \
924- $(srcdir)/SystemThread.h \
925 $(srcdir)/TabView.h \
926- $(srcdir)/TextEntry.h \
927 $(srcdir)/TextEntryComposeSeqs.h \
928- $(srcdir)/InputMethodIBus.h \
929- $(srcdir)/TextLoader.h \
930- $(srcdir)/TextureArea.h \
931 $(srcdir)/Timeline.h \
932 $(srcdir)/TimelineEasings.h \
933- $(srcdir)/TimerProc.h \
934 $(srcdir)/ToolButton.h \
935 $(srcdir)/ToggleButton.h \
936- $(srcdir)/Theme.h \
937- $(srcdir)/Utils.h \
938 $(srcdir)/Validator.h \
939- $(srcdir)/VLayout.h \
940- $(srcdir)/VScrollBar.h \
941- $(srcdir)/VSplitter.h \
942- $(srcdir)/WidgetMetrics.h \
943- $(srcdir)/WindowCompositor.h \
944- $(srcdir)/WindowThread.h
945+ $(srcdir)/VScrollBar.h
946+endif
947+
948+if USE_X11
949+source_cpp += \
950+ $(srcdir)/InputMethodIBus.h
951+endif
952
953 if HAVE_GEIS
954 source_h += \
955
956=== modified file 'Nux/MenuPage.h'
957--- Nux/MenuPage.h 2012-10-10 22:46:50 +0000
958+++ Nux/MenuPage.h 2012-11-05 17:50:27 +0000
959@@ -19,7 +19,6 @@
960 *
961 */
962
963-
964 #ifndef MENUPAGE_H
965 #define MENUPAGE_H
966
967
968=== modified file 'Nux/Nux.cpp'
969--- Nux/Nux.cpp 2012-09-26 06:44:12 +0000
970+++ Nux/Nux.cpp 2012-11-05 17:50:27 +0000
971@@ -177,6 +177,7 @@
972 return w;
973 }
974
975+#elif defined(NO_X11)
976 #elif defined(NUX_OS_LINUX)
977 #ifdef NUX_OPENGLES_20
978 WindowThread *CreateFromForeignWindow (Window X11Window, EGLContext OpenGLContext,
979
980=== modified file 'Nux/Nux.h'
981--- Nux/Nux.h 2012-08-17 12:41:21 +0000
982+++ Nux/Nux.h 2012-11-05 17:50:27 +0000
983@@ -67,7 +67,9 @@
984 #include "AbstractThread.h"
985 #include "WindowThread.h"
986 #include "WindowCompositor.h"
987-#include "Timeline.h"
988+#if !defined(NUX_MINIMAL)
989+# include "Timeline.h"
990+#endif
991 #include "SystemThread.h"
992
993
994@@ -167,6 +169,7 @@
995 HGLRC OpenGLRenderingContext,
996 ThreadUserInitFunc user_init_func,
997 void *data);
998+#elif defined(NO_X11)
999 #elif defined(NUX_OS_LINUX)
1000 //! Create a main graphics thread. This thread has a window and no parent window.
1001 #ifdef NUX_OPENGLES_20
1002
1003=== modified file 'Nux/TextEntry.cpp'
1004--- Nux/TextEntry.cpp 2012-10-02 07:32:55 +0000
1005+++ Nux/TextEntry.cpp 2012-11-05 17:50:27 +0000
1006@@ -29,11 +29,14 @@
1007 #include "TextEntry.h"
1008
1009 #if defined(NUX_OS_LINUX)
1010-#include "TextEntryComposeSeqs.h"
1011-#include <X11/cursorfont.h>
1012-#include "InputMethodIBus.h"
1013+# include "TextEntryComposeSeqs.h"
1014+# if defined(USE_X11)
1015+# include <X11/cursorfont.h>
1016+# include "InputMethodIBus.h"
1017+# endif
1018 #endif
1019
1020+
1021 namespace nux
1022 {
1023 static const int kInnerBorderX = 2;
1024@@ -151,7 +154,7 @@
1025 , font_dpi_(96.0)
1026 , _text_color(color::White)
1027 , align_(CairoGraphics::ALIGN_LEFT)
1028-#if defined(NUX_OS_LINUX)
1029+#if defined(USE_X11)
1030 , caret_cursor_(None)
1031 , ime_(new IBusIMEContext(this))
1032 #endif
1033@@ -198,7 +201,7 @@
1034 if (_texture2D)
1035 _texture2D->UnReference();
1036
1037-#if defined(NUX_OS_LINUX)
1038+#if defined(USE_X11)
1039 if (ime_)
1040 delete ime_;
1041 #endif
1042@@ -301,7 +304,7 @@
1043 const char* character , /*character*/
1044 unsigned short /* keyCount */ /*key repeat count*/)
1045 {
1046-#if defined(NUX_OS_LINUX)
1047+#if defined(USE_X11)
1048 if (im_running())
1049 {
1050 // FIXME Have to get the x11_keycode for ibus-hangul/korean input
1051@@ -318,7 +321,7 @@
1052 if (event_type == NUX_KEYUP)
1053 return;
1054
1055-#if defined(NUX_OS_LINUX)
1056+#if !defined(NO_X11)
1057 if (IsInCompositionMode() || IsInitialCompositionKeySym(keysym))
1058 {
1059 if (HandleComposition(keysym))
1060@@ -525,7 +528,7 @@
1061
1062 void TextEntry::RecvMouseEnter(int /* x */, int /* y */, unsigned long /* button_flags */, unsigned long /* key_flags */)
1063 {
1064-#if defined(NUX_OS_LINUX)
1065+#if defined(USE_X11)
1066 if (caret_cursor_ == None)
1067 {
1068 Display* display = nux::GetGraphicsDisplay()->GetX11Display();
1069@@ -542,7 +545,7 @@
1070
1071 void TextEntry::RecvMouseLeave(int /* x */, int /* y */, unsigned long /* button_flags */, unsigned long /* key_flags */)
1072 {
1073-#if defined(NUX_OS_LINUX)
1074+#if defined(USE_X11)
1075 if (caret_cursor_ != None)
1076 {
1077 Display* display = nux::GetGraphicsDisplay()->GetX11Display();
1078@@ -676,7 +679,7 @@
1079
1080 bool TextEntry::IsInitialCompositionKeySym(unsigned long keysym) const
1081 {
1082-#if defined(NUX_OS_LINUX)
1083+#if defined(USE_X11)
1084 /* Checks if a keysym is a valid initial composition key */
1085 if (keysym == XK_Multi_key ||
1086 (keysym >= XK_dead_grave && keysym <= XK_dead_currency) ||
1087@@ -690,7 +693,7 @@
1088
1089 bool TextEntry::HandleComposition(unsigned long keysym)
1090 {
1091-#if defined(NUX_OS_LINUX)
1092+#if defined(USE_X11)
1093 bool composition_mode = IsInCompositionMode();
1094
1095 if (composition_mode && IsModifierKey(keysym))
1096@@ -860,8 +863,9 @@
1097 if (!readonly_ /*&& im_context_*/)
1098 {
1099 need_im_reset_ = true;
1100-#if defined(NUX_OS_LINUX)
1101+#if defined(USE_X11)
1102 ime_->Focus();
1103+ nux::GetWindowThread()->GetGraphicsDisplay().XICFocus();
1104 #endif
1105 //gtk_im_context_focus_in(im_context_);
1106 //UpdateIMCursorLocation();
1107@@ -882,8 +886,9 @@
1108 if (!readonly_ /*&& im_context_*/)
1109 {
1110 need_im_reset_ = true;
1111-#if defined(NUX_OS_LINUX)
1112+#if defined(USE_X11)
1113 ime_->Blur();
1114+ nux::GetWindowThread()->GetGraphicsDisplay().XICUnFocus();
1115 #endif
1116 //gtk_im_context_focus_out(im_context_);
1117 }
1118@@ -1730,7 +1735,7 @@
1119
1120 bool TextEntry::im_running()
1121 {
1122-#if defined(NUX_OS_LINUX)
1123+#if defined(USE_X11)
1124 return ime_->IsConnected();
1125 #else
1126 return false;
1127@@ -2334,7 +2339,7 @@
1128 unsigned int eventType = event.type;
1129 unsigned int key_sym = event.GetKeySym();
1130
1131-#if defined(NUX_OS_LINUX)
1132+#if defined(USE_X11)
1133 if (im_running())
1134 {
1135 // Always allow IBus hotkey events
1136
1137=== modified file 'Nux/TextEntry.h'
1138--- Nux/TextEntry.h 2012-10-15 12:00:02 +0000
1139+++ Nux/TextEntry.h 2012-11-05 17:50:27 +0000
1140@@ -471,7 +471,7 @@
1141
1142 CairoGraphics::Alignment align_;
1143
1144-#if defined(NUX_OS_LINUX)
1145+#if defined(USE_X11)
1146 Cursor caret_cursor_;
1147 #endif
1148
1149@@ -480,7 +480,7 @@
1150 std::list<Rect> last_cursor_region_;
1151 std::list<Rect> cursor_region_;
1152
1153-#if defined(NUX_OS_LINUX)
1154+#if defined(USE_X11)
1155 IBusIMEContext* ime_;
1156 friend class IBusIMEContext;
1157 #endif
1158
1159=== modified file 'Nux/WindowCompositor.cpp'
1160--- Nux/WindowCompositor.cpp 2012-10-28 15:59:17 +0000
1161+++ Nux/WindowCompositor.cpp 2012-11-05 17:50:27 +0000
1162@@ -27,9 +27,12 @@
1163 #include "NuxGraphics/GLError.h"
1164 #include "WindowThread.h"
1165 #include "BaseWindow.h"
1166+#if !defined(NUX_MINIMAL)
1167 #include "MenuPage.h"
1168+#endif
1169 #include "PaintLayer.h"
1170 #include "Painter.h"
1171+#include "Layout.h"
1172
1173 #include "NuxGraphics/FontTexture.h"
1174 namespace nux
1175@@ -43,7 +46,6 @@
1176 m_OverlayWindow = NULL;
1177 _tooltip_window = NULL;
1178 m_TooltipArea = NULL;
1179- _menu_chain = NULL;
1180 m_Background = NULL;
1181 _tooltip_window = NULL;
1182 OverlayDrawingCommand = NULL;
1183@@ -53,8 +55,6 @@
1184 inside_event_cycle_ = false;
1185 inside_rendering_cycle_ = false;
1186 _dnd_area = NULL;
1187- _mouse_over_menu_page = NULL;
1188- _mouse_owner_menu_page = NULL;
1189 _starting_menu_event_cycle = false;
1190 _menu_is_active = false;
1191 on_menu_closure_continue_with_event_ = false;
1192@@ -69,7 +69,13 @@
1193 m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
1194 m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
1195
1196- _menu_chain = new std::list<MenuPage*>;
1197+#if !defined(NUX_MINIMAL)
1198+ _mouse_over_menu_page = NULL;
1199+ _mouse_owner_menu_page = NULL;
1200+ _menu_chain = NULL;
1201+ _menu_chain = new std::list<MenuPage*>;
1202+#endif
1203+
1204 m_MenuRemoved = false;
1205 m_Background = new ColorLayer(Color(0xFF4D4D4D));
1206
1207@@ -89,12 +95,14 @@
1208 m_FrameBufferObject.Release();
1209 m_MainColorRT.Release();
1210 m_MainDepthRT.Release();
1211- _menu_chain->clear();
1212 _view_window_list.clear();
1213 _modal_view_window_list.clear();
1214
1215- NUX_SAFE_DELETE(_menu_chain);
1216- NUX_SAFE_DELETE(m_Background);
1217+#if !defined(NUX_MINIMAL)
1218+ _menu_chain->clear();
1219+ delete _menu_chain;
1220+#endif
1221+ delete m_Background;
1222 }
1223
1224 WindowCompositor::RenderTargetTextures& WindowCompositor::GetWindowBuffer(BaseWindow* window)
1225@@ -167,8 +175,10 @@
1226 {
1227 mouse_over_area_ = NULL;
1228 SetMouseOwnerArea(NULL);
1229+#if !defined(NUX_MINIMAL)
1230 _mouse_over_menu_page = NULL;
1231 _mouse_owner_menu_page = NULL;
1232+#endif
1233 }
1234
1235 void WindowCompositor::FindAreaUnderMouse(const Point& mouse_position,
1236@@ -342,7 +352,7 @@
1237
1238 if (abs(dnd_safety_y_) > 30 || abs(dnd_safety_x_) > 30)
1239 {
1240-#ifdef NUX_OS_LINUX
1241+#if defined(DRAG_AND_DROP_SUPPORTED)
1242 mouse_owner_area_->StartDragAsSource();
1243 #endif
1244 ResetMousePointerAreas();
1245@@ -678,6 +688,7 @@
1246 UpdateEventTrackingByMouseOwnerAncestor(event);
1247 }
1248
1249+#if !defined(NUX_MINIMAL)
1250 void WindowCompositor::MenuEventCycle(Event& event)
1251 {
1252 // _mouse_owner_menu_page: the menu page that has the mouse down
1253@@ -859,6 +870,7 @@
1254 }
1255 }
1256 }
1257+#endif
1258
1259 void WindowCompositor::FindKeyFocusArea(NuxEventType event_type,
1260 unsigned int key_symbol,
1261@@ -1018,8 +1030,10 @@
1262 event.GetKeySym(),
1263 #if defined(NUX_OS_WINDOWS)
1264 event.win32_keycode,
1265-#elif defined(NUX_OS_LINUX)
1266+#elif defined(USE_X11)
1267 event.x11_keycode,
1268+#else
1269+ 0,
1270 #endif
1271 event.GetKeyState(),
1272 event.GetText(),
1273@@ -1041,8 +1055,10 @@
1274 event.GetKeySym(),
1275 #if defined(NUX_OS_WINDOWS)
1276 event.win32_keycode,
1277-#elif defined(NUX_OS_LINUX)
1278+#elif defined(USE_X11)
1279 event.x11_keycode,
1280+#else
1281+ 0,
1282 #endif
1283 event.GetKeyState(),
1284 event.GetText(),
1285@@ -1096,6 +1112,7 @@
1286 if (((event.type >= NUX_MOUSE_PRESSED) && (event.type <= NUX_MOUSE_WHEEL)) ||
1287 (event.type == NUX_WINDOW_MOUSELEAVE))
1288 {
1289+#if !defined(NUX_MINIMAL)
1290 bool menu_active = false;
1291 if (_menu_chain->size())
1292 {
1293@@ -1105,6 +1122,7 @@
1294 }
1295
1296 if ((menu_active && on_menu_closure_continue_with_event_) || !(menu_active))
1297+#endif
1298 {
1299 MouseEventCycle(event);
1300 }
1301@@ -1345,6 +1363,7 @@
1302
1303 void WindowCompositor::DrawMenu(bool force_draw)
1304 {
1305+#if !defined(NUX_MINIMAL)
1306 ObjectWeakPtr<BaseWindow> window = m_MenuWindow;
1307
1308 if (window.IsValid())
1309@@ -1369,10 +1388,7 @@
1310 (*rev_it_menu)->ProcessDraw(window_thread_->GetGraphicsEngine(), force_draw);
1311 SetProcessingTopView(NULL);
1312 }
1313-
1314-// GetGraphicsDisplay()->GetGraphicsEngine()->SetContext(0, 0,
1315-// window_thread_->GetGraphicsEngine().GetWindowWidth(),
1316-// window_thread_->GetGraphicsEngine().GetWindowHeight());
1317+#endif
1318 }
1319
1320 void WindowCompositor::DrawOverlay(bool /* force_draw */)
1321@@ -1693,6 +1709,7 @@
1322 }
1323 }
1324
1325+#if !defined(NUX_MINIMAL)
1326 void WindowCompositor::AddMenu(MenuPage* menu, BaseWindow* window, bool OverrideCurrentMenuChain)
1327 {
1328 if (_menu_chain->size() == 0)
1329@@ -1784,6 +1801,7 @@
1330 m_MenuWindow = NULL;
1331 }
1332 }
1333+#endif
1334
1335 void WindowCompositor::SetWidgetDrawingOverlay(InputArea* ic, BaseWindow* OverlayWindow)
1336 {
1337@@ -2096,7 +2114,7 @@
1338
1339 void WindowCompositor::SetDnDArea(InputArea* area)
1340 {
1341-#if defined(NUX_OS_LINUX)
1342+#if defined(DRAG_AND_DROP_SUPPORTED)
1343 if (_dnd_area == area)
1344 return;
1345
1346@@ -2106,7 +2124,7 @@
1347 _dnd_area->UnReference();
1348 }
1349 _dnd_area = area;
1350-
1351+
1352 if (_dnd_area)
1353 {
1354 _dnd_area->Reference();
1355
1356=== modified file 'Nux/WindowCompositor.h'
1357--- Nux/WindowCompositor.h 2012-10-10 22:46:50 +0000
1358+++ Nux/WindowCompositor.h 2012-11-05 17:50:27 +0000
1359@@ -82,9 +82,12 @@
1360
1361 void KeyboardEventCycle(Event& event);
1362
1363+#if !defined(NUX_MINIMAL)
1364 void MenuEventCycle(Event& event);
1365 MenuPage* _mouse_owner_menu_page;
1366 MenuPage* _mouse_over_menu_page;
1367+#endif
1368+
1369 bool _starting_menu_event_cycle;
1370 bool _menu_is_active;
1371
1372@@ -252,9 +255,11 @@
1373 void StartModalWindow(ObjectWeakPtr<BaseWindow>);
1374 void StopModalWindow(ObjectWeakPtr<BaseWindow>);
1375
1376+#if !defined(NUX_MINIMAL)
1377 void AddMenu(MenuPage* menu, BaseWindow* window, bool OverrideCurrentMenuChain = true);
1378 void RemoveMenu(MenuPage* menu);
1379 void CleanMenu();
1380+#endif
1381
1382 void PushModalWindow(ObjectWeakPtr<BaseWindow> window);
1383
1384@@ -504,7 +509,9 @@
1385 WindowList _modal_view_window_list;
1386 WeakBaseWindowPtr _always_on_front_window; //!< Floating view that always remains on top.
1387
1388+#if !defined(NUX_MINIMAL)
1389 std::list<MenuPage* >* _menu_chain;
1390+#endif
1391
1392 std::map<BaseWindow*, struct RenderTargetTextures> _window_to_texture_map;
1393
1394
1395=== modified file 'Nux/WindowThread.cpp'
1396--- Nux/WindowThread.cpp 2012-11-04 11:02:49 +0000
1397+++ Nux/WindowThread.cpp 2012-11-05 17:50:27 +0000
1398@@ -83,10 +83,12 @@
1399 _draw_requested_to_host_wm = false;
1400 first_pass_ = true;
1401
1402+#if !defined(NUX_MINIMAL)
1403 _Timelines = new std::list<Timeline*> ();
1404 gint64 micro_secs = g_get_real_time();
1405 last_timeline_frame_time_sec_ = micro_secs / 1000000;
1406 last_timeline_frame_time_usec_ = micro_secs % 1000000;
1407+#endif
1408 _MasterClock = NULL;
1409
1410 #if (defined(NUX_OS_LINUX) || defined(NUX_USE_GLIB_LOOP_ON_WINDOWS)) && (!defined(NUX_DISABLE_GLIB_LOOP))
1411@@ -94,7 +96,7 @@
1412 main_loop_glib_context_ = 0;
1413 #endif
1414
1415-#if defined(NUX_OS_LINUX)
1416+#if defined(USE_X11)
1417 x11display_ = NULL;
1418 ownx11display_ = false;
1419 #endif
1420@@ -113,16 +115,18 @@
1421 #endif
1422
1423 ThreadDtor();
1424+#if !defined(NUX_MINIMAL)
1425 std::list<Timeline*>::iterator li;
1426 for (li=_Timelines->begin(); li!=_Timelines->end(); ++li)
1427 {
1428 (*li)->UnReference();
1429 }
1430-
1431 delete _Timelines;
1432+#endif
1433+
1434 delete async_wake_up_signal_;
1435
1436-#if defined(NUX_OS_LINUX)
1437+#if defined(USE_X11)
1438 if (x11display_ && ownx11display_)
1439 {
1440 XCloseDisplay(x11display_);
1441@@ -376,6 +380,7 @@
1442 StopLayoutCycle();
1443 }
1444
1445+#if !defined(NUX_MINIMAL)
1446 void WindowThread::AddTimeline(Timeline *timeline)
1447 {
1448 _Timelines->push_back(timeline);
1449@@ -391,6 +396,7 @@
1450 StopMasterClock();
1451 }
1452 }
1453+#endif
1454
1455 int WindowThread::Run(void * /* ptr */)
1456 {
1457@@ -936,6 +942,7 @@
1458 return state;
1459 }
1460
1461+#if !defined(NUX_MINIMAL)
1462 bool WindowThread::ProcessTimelines(gint64 micro_secs)
1463 {
1464 // go through our timelines and tick them
1465@@ -979,6 +986,7 @@
1466 // return if we have any timelines left
1467 return (_Timelines->size() != 0);
1468 }
1469+#endif
1470
1471 void WindowThread::EnableMouseKeyboardInput()
1472 {
1473@@ -1084,9 +1092,7 @@
1474 return true;
1475 }
1476
1477-#if defined(NUX_OS_WINDOWS)
1478 SetWin32ThreadName(GetThreadId(), window_title_.c_str());
1479-#endif
1480
1481 if (RegisterNuxThread(this) == FALSE)
1482 {
1483@@ -1137,6 +1143,7 @@
1484
1485 return true;
1486 }
1487+#elif defined(NO_X11)
1488 #elif defined(NUX_OS_LINUX)
1489 #ifdef NUX_OPENGLES_20
1490 bool WindowThread::ThreadCtor(Display *X11Display, Window X11Window, EGLContext OpenGLContext)
1491@@ -1323,8 +1330,10 @@
1492
1493 #if defined(NUX_OS_WINDOWS)
1494 bool WindowThread::ProcessForeignEvent(HWND hWnd, MSG msg, WPARAM wParam, LPARAM lParam, void *data)
1495-#elif defined(NUX_OS_LINUX)
1496+#elif defined(USE_X11)
1497 bool WindowThread::ProcessForeignEvent(XEvent *xevent, void * /* data */)
1498+#else
1499+ bool WindowThread::ProcessForeignEvent()
1500 #endif
1501 {
1502 if (graphics_display_->IsPauseThreadGraphicsRendering())
1503@@ -1336,7 +1345,7 @@
1504 memset(&nux_event, 0, sizeof(Event));
1505 #if defined(NUX_OS_WINDOWS)
1506 graphics_display_->ProcessForeignWin32Event(hWnd, msg, wParam, lParam, &nux_event);
1507-#elif defined(NUX_OS_LINUX)
1508+#elif defined(USE_X11)
1509 graphics_display_->ProcessForeignX11Event(xevent, &nux_event);
1510 #endif
1511
1512
1513=== modified file 'Nux/WindowThread.h'
1514--- Nux/WindowThread.h 2012-09-26 00:43:42 +0000
1515+++ Nux/WindowThread.h 2012-11-05 17:50:27 +0000
1516@@ -42,7 +42,9 @@
1517 class SystemThread;
1518 class UXTheme;
1519 class TimerHandler;
1520+#if !defined(NUX_MINIMAL)
1521 class Timeline;
1522+#endif
1523 class Event;
1524 class Area;
1525 struct ClientAreaDraw;
1526@@ -216,8 +218,10 @@
1527
1528 #if defined(NUX_OS_WINDOWS)
1529 bool ProcessForeignEvent(HWND hWnd, MSG msg, WPARAM wParam, LPARAM lParam, void *data);
1530-#elif defined(NUX_OS_LINUX)
1531+#elif defined(USE_X11)
1532 bool ProcessForeignEvent(XEvent *event, void *data);
1533+#else
1534+ bool ProcessForeignEvent();
1535 #endif
1536
1537 /*!
1538@@ -229,6 +233,7 @@
1539 */
1540 void RenderInterfaceFromForeignCmd(Geometry *clip);
1541
1542+#if !defined(NUX_MINIMAL)
1543 /*!
1544 Add a timeline to our window
1545 */
1546@@ -237,6 +242,7 @@
1547 bool ProcessTimelines(gint64 micro_secs);
1548 long last_timeline_frame_time_sec_;
1549 long last_timeline_frame_time_usec_;
1550+#endif
1551
1552 void StartMasterClock();
1553 void StopMasterClock();
1554@@ -357,7 +363,7 @@
1555 This function is called when Nux is embedded. \sa IsEmbeddedWindow.
1556 */
1557 virtual bool ThreadCtor(HWND WindowHandle, HDC WindowDCHandle, HGLRC OpenGLRenderingContext);
1558-#elif defined(NUX_OS_LINUX)
1559+#elif defined(USE_X11)
1560 #ifdef NUX_OPENGLES_20
1561 /*!
1562 Constructor-like function for the thread.
1563@@ -536,7 +542,9 @@
1564 //! Set to true to schedule a compute cycle on the main layout.
1565 bool queue_main_layout_;
1566
1567+#if !defined(NUX_MINIMAL)
1568 std::list<Timeline*> *_Timelines;
1569+#endif
1570
1571 bool first_pass_; //!< True when going through the ExecutionLoop for the first time.
1572 unsigned int window_initial_width_; //!< Window height at startup.
1573@@ -692,16 +700,20 @@
1574 friend WindowThread *CreateFromForeignWindow(HWND WindowHandle, HDC WindowDCHandle, HGLRC OpenGLRenderingContext,
1575 ThreadUserInitFunc UserInitFunc,
1576 void *InitData);
1577-#elif defined(NUX_OS_LINUX)
1578-#ifdef NUX_OPENGLES_20
1579+#elif defined(USE_X11)
1580+# ifdef NUX_OPENGLES_20
1581 friend WindowThread *CreateFromForeignWindow (Window X11Window, EGLContext OpenGLContext,
1582 ThreadUserInitFunc UserInitFunc,
1583 void *InitData);
1584-#else
1585+# else
1586 friend WindowThread *CreateFromForeignWindow (Window X11Window, GLXContext OpenGLContext,
1587 ThreadUserInitFunc UserInitFunc,
1588 void *InitData);
1589-#endif
1590+# endif
1591+#elif defined(NO_X11)
1592+ friend WindowThread *CreateFromForeignWindow (EGLDisplay disp, EGLContext OpenGLContext,
1593+ ThreadUserInitFunc UserInitFunc,
1594+ void *InitData);
1595 #endif
1596
1597 friend SystemThread *CreateSystemThread(AbstractThread *Parent, ThreadUserInitFunc UserInitFunc, void *InitData);
1598
1599=== modified file 'NuxCore/Logger.cpp'
1600--- NuxCore/Logger.cpp 2012-10-29 07:28:01 +0000
1601+++ NuxCore/Logger.cpp 2012-11-05 17:50:27 +0000
1602@@ -31,7 +31,7 @@
1603 #include "LoggingWriter.h"
1604
1605 #if defined(NUX_OS_LINUX)
1606-#include <execinfo.h>
1607+# include <execinfo.h>
1608 #endif
1609
1610 #include <sstream>
1611@@ -381,6 +381,11 @@
1612
1613 return sout.str();
1614 }
1615+#else
1616+std::string Backtrace(int /*levels*/)
1617+{
1618+ return "Backtrace not supported on this platform.\n";
1619+}
1620 #endif
1621
1622 BlockTracer::BlockTracer(Logger const& logger,
1623
1624=== modified file 'NuxCore/System.h'
1625--- NuxCore/System.h 2011-10-19 03:23:03 +0000
1626+++ NuxCore/System.h 2012-11-05 17:50:27 +0000
1627@@ -29,6 +29,8 @@
1628
1629 #ifdef _WIN32
1630 #define NUX_OS_WINDOWS
1631+#elif __arm__
1632+ #define NUX_OS_LINUX
1633 #elif __linux__
1634 #define NUX_OS_LINUX
1635 #elif __APPLE__
1636@@ -67,10 +69,31 @@
1637 #elif defined(_M_IX86) || defined(__i386__)
1638 #define NUX_ARCH_i386
1639 #elif defined(__arm__)
1640- #define NUX_ARCH_arm
1641-#endif
1642-
1643-
1644+ #define NUX_ARCH_ARM
1645+#endif
1646+
1647+// If we are compiling for linux, and neither USE_X11 or NO_X11 are set,
1648+// then assume that we are compiling for X11
1649+#if defined(NUX_OS_LINUX)
1650+# if defined(USE_X11)
1651+# if defined(NO_X11)
1652+# error Can not define both USE_X11 and NO_X11
1653+# endif
1654+# elif !defined(NO_X11)
1655+# define USE_X11
1656+# endif
1657+#elif defined(USE_X11)
1658+# error X11 not supported on non-linux systems
1659+#endif
1660+
1661+#if defined(USE_X11)
1662+# define DRAG_AND_DROP_SUPPORTED
1663+#endif
1664+
1665+// Right now, we only support minimal builds for ARM if no X.
1666+#if (defined(NUX_ARCH_ARM) && defined(NO_X11) && !defined(NUX_MINIMAL))
1667+# define NUX_MINIMAL
1668+#endif
1669
1670 // Compiler Macros:
1671 // NUX_GNUCPP_COMPILER
1672
1673=== modified file 'NuxGraphics/CairoGraphics.h'
1674--- NuxGraphics/CairoGraphics.h 2012-05-25 20:36:09 +0000
1675+++ NuxGraphics/CairoGraphics.h 2012-11-05 17:50:27 +0000
1676@@ -23,7 +23,11 @@
1677 #ifndef CAIROGRAPHICS_H
1678 #define CAIROGRAPHICS_H
1679
1680+#ifdef NUX_ARCH_ARM
1681+#include "cairo.h"
1682+#else
1683 #include "cairo/cairo.h"
1684+#endif
1685 #include "BitmapFormats.h"
1686 #include "ImageSurface.h"
1687
1688
1689=== modified file 'NuxGraphics/Events.cpp'
1690--- NuxGraphics/Events.cpp 2012-01-30 07:53:02 +0000
1691+++ NuxGraphics/Events.cpp 2012-11-05 17:50:27 +0000
1692@@ -87,7 +87,7 @@
1693 win32_keysym = 0;
1694 #endif
1695
1696-#if defined(NUX_OS_LINUX)
1697+#if defined(USE_X11)
1698 x11_keycode = 0;
1699 x11_keysym = 0;
1700 x11_timestamp = 0;
1701@@ -107,7 +107,7 @@
1702 win32_keysym = 0;
1703 #endif
1704
1705-#if defined(NUX_OS_LINUX)
1706+#if defined(USE_X11)
1707 x11_keycode = 0;
1708 x11_keysym = 0;
1709 x11_key_state = 0;
1710@@ -195,14 +195,13 @@
1711 {
1712 #if defined(NUX_OS_WINDOWS)
1713 return win32_keysym;
1714-#endif
1715-
1716-#if defined(NUX_OS_LINUX)
1717+#elif defined(USE_X11)
1718 return x11_keysym;
1719-#endif
1720-
1721+#else
1722 return 0;
1723+#endif
1724 }
1725+
1726 unsigned short Event::GetKeyRepeatCount() const
1727 {
1728 return key_repeat_count;
1729
1730=== modified file 'NuxGraphics/Events.h'
1731--- NuxGraphics/Events.h 2012-09-26 16:09:07 +0000
1732+++ NuxGraphics/Events.h 2012-11-05 17:50:27 +0000
1733@@ -27,8 +27,10 @@
1734
1735 #if defined(NUX_OS_WINDOWS)
1736 #include "VirtualKeyCodes.h"
1737-#elif defined(NUX_OS_LINUX)
1738+#elif defined(USE_X11)
1739 #include "VirtualKeyCodesX11.h"
1740+#elif defined(NO_X11)
1741+ #include "VirtualKeyCodes.h"
1742 #else
1743 #error VirtualKeyCode file not Implemented.
1744 #endif
1745@@ -396,9 +398,7 @@
1746 #if defined(NUX_OS_WINDOWS)
1747 int win32_keycode; // Not used. Just a place holder.
1748 int win32_keysym;
1749-#endif
1750-
1751-#if defined(NUX_OS_LINUX)
1752+#elif defined(USE_X11)
1753 Time x11_timestamp; //!< X11 timestamp.
1754 Window x11_window; //!< X11 window.
1755 unsigned int x11_key_state; //!< X11 key state (xevent.xkey.state).
1756
1757=== modified file 'NuxGraphics/FontRenderer.cpp'
1758--- NuxGraphics/FontRenderer.cpp 2012-09-30 14:55:52 +0000
1759+++ NuxGraphics/FontRenderer.cpp 2012-11-05 17:50:27 +0000
1760@@ -141,6 +141,7 @@
1761 //CHECKGL(glBindAttribLocation(_shader_prog->GetOpenGLID(), 0, "_Position"));
1762 _shader_prog->Link();
1763 }
1764+#ifndef NUX_OPENGLES_20
1765 else
1766 {
1767 _asm_shader_prog = GetGraphicsDisplay()->GetGpuDevice()->CreateAsmShaderProgram();
1768@@ -154,6 +155,7 @@
1769 _asm_font_texture_rect_prog->LoadPixelShader(FontAsmFrgRect.c_str());
1770 _asm_font_texture_rect_prog->Link();
1771 }
1772+#endif
1773 }
1774
1775 FontRenderer::~FontRenderer()
1776@@ -469,7 +471,9 @@
1777 int in_attrib_scale = 0;
1778 int in_attrib_offset = 0;
1779
1780+#ifndef NUX_OPENGLES_20
1781 ObjectPtr<IOpenGLAsmShaderProgram> shader_program;
1782+#endif
1783 if (_graphics_engine.UsingGLSLCodePath())
1784 {
1785 _shader_prog->Begin();
1786@@ -576,7 +580,9 @@
1787 }
1788 else
1789 {
1790+#ifndef NUX_OPENGLES_20
1791 shader_program->End();
1792+#endif
1793 }
1794
1795 _graphics_engine.GetRenderStates().SetColorMask(TRUE, TRUE, TRUE, TRUE);
1796
1797=== modified file 'NuxGraphics/FontRenderer.h'
1798--- NuxGraphics/FontRenderer.h 2012-08-27 09:09:21 +0000
1799+++ NuxGraphics/FontRenderer.h 2012-11-05 17:50:27 +0000
1800@@ -105,11 +105,10 @@
1801 ObjectPtr<IOpenGLVertexShader> _vertex_shader_prog;
1802 ObjectPtr<IOpenGLShaderProgram> _shader_prog;
1803
1804- //ObjectPtr<IOpenGLAsmPixelShader> m_AsmPixelShaderProg;
1805- //ObjectPtr<IOpenGLAsmVertexShader> m_AsmVertexShaderProg;
1806+#ifndef NUX_OPENGLES_20
1807 ObjectPtr<IOpenGLAsmShaderProgram> _asm_shader_prog;
1808-
1809 ObjectPtr<IOpenGLAsmShaderProgram> _asm_font_texture_rect_prog;
1810+#endif
1811 };
1812
1813 }
1814
1815=== modified file 'NuxGraphics/GLDeviceObjects.h'
1816--- NuxGraphics/GLDeviceObjects.h 2011-04-06 21:54:09 +0000
1817+++ NuxGraphics/GLDeviceObjects.h 2012-11-05 17:50:27 +0000
1818@@ -43,7 +43,9 @@
1819 #include "IOpenGLTexture2D.h"
1820 #include "IOpenGLAnimatedTexture.h"
1821 #include "IOpenGLGLSLShader.h"
1822+#ifndef NUX_OPENGLES_20
1823 #include "IOpenGLAsmShader.h"
1824+#endif
1825 #include "IOpenGLQuery.h"
1826 #include "IOpenGLVertexDeclaration.h"
1827 #include "IOpenGLFrameBufferObject.h"
1828
1829=== modified file 'NuxGraphics/GLRenderStates.cpp'
1830--- NuxGraphics/GLRenderStates.cpp 2012-09-30 14:55:52 +0000
1831+++ NuxGraphics/GLRenderStates.cpp 2012-11-05 17:50:27 +0000
1832@@ -49,7 +49,6 @@
1833 UL_MAP(FRONTFACE , GL_CCW , 1);
1834
1835 UL_MAP(SCISSORTESTENABLE , GL_FALSE , 1);
1836- UL_MAP(FOGENABLE , GL_FALSE , 1);
1837
1838 UL_MAP(ZTESTENABLE , GL_FALSE , 1);
1839 UL_MAP(ZWRITEENABLE , GL_TRUE , 1);
1840@@ -89,11 +88,8 @@
1841 UL_MAP(BACK_STENCILZPASS , GL_KEEP , 1);
1842
1843
1844- UL_MAP(POINTSMOOTHENABLE , GL_FALSE , 1);
1845 UL_MAP(LINESMOOTHENABLE , GL_FALSE , 1);
1846- UL_MAP(POINTSIZE , 1 , 1);
1847 UL_MAP(LINEWIDTH , 1 , 1);
1848- UL_MAP(POINTHINT , GL_FASTEST , 1);
1849 UL_MAP(LINEHINT , GL_FASTEST , 1);
1850
1851 UL_MAP(COLORWRITEENABLE_R , GL_TRUE , 1);
1852@@ -140,10 +136,10 @@
1853 s_StateLUT.default_render_state[GFXRS_SRCBLEND].iValue, s_StateLUT.default_render_state[GFXRS_DESTBLEND].iValue,
1854 s_StateLUT.default_render_state[GFXRS_SRCBLENDALPHA].iValue, s_StateLUT.default_render_state[GFXRS_DESTBLENDALPHA ].iValue );
1855
1856-
1857+#ifndef NUX_OPENGLES_20
1858 HW__EnableAlphaTest( s_StateLUT.default_render_state[GFXRS_ALPHATESTENABLE].iValue );
1859 HW__SetAlphaTestFunc( s_StateLUT.default_render_state[GFXRS_ALPHATESTFUNC].iValue, s_StateLUT.default_render_state[GFXRS_ALPHATESTREF].iValue );
1860-
1861+#endif
1862
1863 HW__EnableStencil( s_StateLUT.default_render_state[GFXRS_STENCILENABLE].iValue );
1864 HW__SetStencilFunc(
1865@@ -155,12 +151,11 @@
1866 s_StateLUT.default_render_state[GFXRS_FRONT_STENCILZFAIL].iValue,
1867 s_StateLUT.default_render_state[GFXRS_FRONT_STENCILZPASS].iValue);
1868
1869+#ifndef NUX_OPENGLES_20
1870 HW__EnableLineSmooth(s_StateLUT.default_render_state[GFXRS_LINESMOOTHENABLE].iValue);
1871+#endif
1872 HW__SetLineWidth(s_StateLUT.default_render_state[GFXRS_LINEWIDTH].iValue, s_StateLUT.default_render_state[GFXRS_LINEHINT].iValue);
1873
1874- HW__EnablePointSmooth(s_StateLUT.default_render_state[GFXRS_POINTSMOOTHENABLE].iValue);
1875- HW__SetPointSize(s_StateLUT.default_render_state[GFXRS_POINTSIZE].iValue, s_StateLUT.default_render_state[GFXRS_POINTHINT].iValue);
1876-
1877 #if 0
1878 HW__EnableTwoSidedStencil( s_StateLUT.default_render_state[GFXRS_TWOSIDEDSTENCILENABLE].iValue );
1879
1880@@ -185,7 +180,6 @@
1881
1882 HW__EnableScissor( s_StateLUT.default_render_state[GFXRS_SCISSORTESTENABLE].iValue );
1883
1884- HW__EnableFog( s_StateLUT.default_render_state[GFXRS_FOGENABLE].iValue );
1885 }
1886
1887 void GpuRenderStates::SubmitChangeStates()
1888@@ -205,10 +199,10 @@
1889 render_state_changes_[GFXRS_SRCBLEND].iValue, render_state_changes_[GFXRS_DESTBLEND].iValue,
1890 render_state_changes_[GFXRS_SRCBLENDALPHA].iValue, render_state_changes_[GFXRS_DESTBLENDALPHA ].iValue );
1891
1892-
1893+#ifndef NUX_OPENGLES_20
1894 HW__EnableAlphaTest( render_state_changes_[GFXRS_ALPHATESTENABLE].iValue );
1895 HW__SetAlphaTestFunc( render_state_changes_[GFXRS_ALPHATESTFUNC].iValue, render_state_changes_[GFXRS_ALPHATESTREF].iValue );
1896-
1897+#endif
1898
1899 HW__EnableStencil( render_state_changes_[GFXRS_STENCILENABLE].iValue );
1900
1901@@ -221,12 +215,11 @@
1902 render_state_changes_[GFXRS_FRONT_STENCILZFAIL].iValue,
1903 render_state_changes_[GFXRS_FRONT_STENCILZPASS].iValue);
1904
1905+#ifndef NUX_OPENGLES_20
1906 HW__EnableLineSmooth(render_state_changes_[GFXRS_LINESMOOTHENABLE].iValue);
1907+#endif
1908 HW__SetLineWidth(render_state_changes_[GFXRS_LINEWIDTH].iValue, render_state_changes_[GFXRS_LINEHINT].iValue);
1909
1910- HW__EnablePointSmooth(render_state_changes_[GFXRS_POINTSMOOTHENABLE].iValue);
1911- HW__SetPointSize(render_state_changes_[GFXRS_POINTSIZE].iValue, render_state_changes_[GFXRS_POINTHINT].iValue);
1912-
1913 #if 0
1914 HW__EnableTwoSidedStencil( s_StateLUT.default_render_state[GFXRS_TWOSIDEDSTENCILENABLE].iValue );
1915
1916@@ -251,8 +244,6 @@
1917
1918 HW__EnableScissor( render_state_changes_[GFXRS_SCISSORTESTENABLE].iValue );
1919
1920- HW__EnableFog( render_state_changes_[GFXRS_FOGENABLE].iValue );
1921-
1922 }
1923
1924 void GpuRenderStates::ResetStateChangeToDefault()
1925
1926=== modified file 'NuxGraphics/GLRenderStates.h'
1927--- NuxGraphics/GLRenderStates.h 2012-09-30 14:55:52 +0000
1928+++ NuxGraphics/GLRenderStates.h 2012-11-05 17:50:27 +0000
1929@@ -38,7 +38,6 @@
1930 GFXRS_FRONTFACE, // GL_CCW
1931
1932 GFXRS_SCISSORTESTENABLE, // GL_FALSE
1933- GFXRS_FOGENABLE, // GL_FALSE
1934
1935 GFXRS_ZTESTENABLE, // GL_TRUE
1936 GFXRS_ZWRITEENABLE, // GL_TRUE
1937@@ -78,11 +77,8 @@
1938 GFXRS_BACK_STENCILZPASS, // GL_KEEP
1939
1940
1941- GFXRS_POINTSMOOTHENABLE, // GL_FLASE
1942 GFXRS_LINESMOOTHENABLE, // GL_FALSE
1943- GFXRS_POINTSIZE, // 1.0f
1944 GFXRS_LINEWIDTH, // 1.0f
1945- GFXRS_POINTHINT, // GL_FASTEST
1946 GFXRS_LINEHINT, // GL_FASTEST
1947
1948 GFXRS_COLORWRITEENABLE_R, // TRUE or FALSE
1949@@ -90,10 +86,6 @@
1950 GFXRS_COLORWRITEENABLE_B, // TRUE or FALSE
1951 GFXRS_COLORWRITEENABLE_A, // TRUE or FALSE
1952
1953- GFXRS_POLYGONOFFSETENABLE, // GL_FALSE
1954- GFXRS_POLYGONOFFSETFACTOR, // 0.0f
1955- GFXRS_POLYGONOFFSETUNITS, // 0.0f
1956-
1957 GFXRS_MAX_RENDERSTATES,
1958 };
1959
1960@@ -153,10 +145,12 @@
1961 void CheckRenderStatesConformity();
1962
1963 // Render states
1964+#ifndef NUX_OPENGLES_20
1965 inline void SetAlphaTest(
1966 bool EnableAlphaTest_,
1967 unsigned int AlphaTestFunc_ = GL_ALWAYS,
1968 BYTE AlphaTestRef_ = 0);
1969+#endif
1970
1971 inline void SetBlend(bool AlphaBlendEnable_);
1972 inline void SetBlend(bool AlphaBlendEnable_,
1973@@ -232,11 +226,6 @@
1974 unsigned int LineWidth = 1,
1975 unsigned int HINT = GL_FASTEST);
1976
1977- inline void EnablePointSmooth(
1978- bool EnablePointSmooth = TRUE,
1979- unsigned int PointSize = 1,
1980- unsigned int HINT = GL_FASTEST);
1981-
1982 inline void SetColorMask(
1983 unsigned int bRed = TRUE,
1984 unsigned int bGreen = TRUE,
1985@@ -252,7 +241,6 @@
1986 inline void SetDepthMask(unsigned int bDepth = TRUE);
1987
1988 inline void EnableScissor(unsigned int bScissor = FALSE);
1989- inline void EnableFog(unsigned int bFog = FALSE);
1990 #ifndef NUX_OPENGLES_20
1991 inline void SetPolygonMode(unsigned int FrontMode = GL_FILL, unsigned int BackMode = GL_FILL);
1992 #else
1993@@ -267,11 +255,12 @@
1994 GpuBrand gpu_brand_;
1995 GpuInfo* gpu_info_;
1996
1997+#ifndef NUX_OPENGLES_20
1998 inline void HW__EnableAlphaTest(unsigned int b);
1999-
2000 inline void HW__SetAlphaTestFunc(
2001 unsigned int AlphaTestFunc_,
2002 BYTE AlphaTestRef_);
2003+#endif
2004
2005 inline void HW__EnableAlphaBlend(unsigned int b);
2006
2007@@ -326,22 +315,20 @@
2008 unsigned int ZPassOp_);
2009 #endif
2010
2011+#ifndef NUX_OPENGLES_20
2012 inline void HW__EnableLineSmooth(unsigned int EnableLineSmooth);
2013+#endif
2014 inline void HW__SetLineWidth(unsigned int width, unsigned int HINT);
2015
2016- inline void HW__EnablePointSmooth(unsigned int EnablePointSmooth);
2017- inline void HW__SetPointSize(unsigned int size, unsigned int HINT);
2018-
2019 inline void HW__SetColorMask(unsigned int bRed, unsigned int bGreen, unsigned int bBlue, unsigned int bAlpha);
2020 inline void HW__SetDepthMask(unsigned int bDepth);
2021
2022 inline void HW__EnableScissor(unsigned int bScissor);
2023- inline void HW__EnableFog(unsigned int bFog);
2024-
2025+
2026+
2027+#ifndef NUX_OPENGLES_20
2028 inline void HW__SetPolygonMode(unsigned int FrontMode, unsigned int BackMode);
2029- inline void HW__EnablePolygonOffset(unsigned int EnablePolygonOffset);
2030- inline void HW__SetPolygonOffset(float Factor, float Units);
2031-
2032+#endif
2033 private:
2034 RenderStateMap render_state_changes_[GFXRS_MAX_RENDERSTATES];
2035 RenderStateMap sampler_state_changes_[4][GFXSS_MAX_SAMPLERSTATES];
2036@@ -355,7 +342,7 @@
2037 //#define SET_RS_VALUE_FLOAT(a, b) (a).fValue = (b)
2038 //#define RS_VALUE_FLOAT(a, b) (a).fValue
2039
2040-
2041+#ifndef NUX_OPENGLES_20
2042 inline void GpuRenderStates::SetAlphaTest(
2043 bool EnableAlphaTest_,
2044 unsigned int AlphaTestFunc_,
2045@@ -380,6 +367,7 @@
2046 HW__SetAlphaTestFunc(AlphaTestFunc_, AlphaTestRef_);
2047 }
2048 }
2049+#endif
2050
2051 inline void GpuRenderStates::SetBlend(bool AlphaBlendEnable_)
2052 {
2053@@ -725,7 +713,9 @@
2054 {
2055 if (!RS_VALUE(render_state_changes_[GFXRS_LINESMOOTHENABLE]))
2056 {
2057+#ifndef NUX_OPENGLES_20
2058 HW__EnableLineSmooth(GL_TRUE);
2059+#endif
2060 }
2061
2062 if ((RS_VALUE(render_state_changes_[GFXRS_LINEWIDTH]) != LineWidth) ||
2063@@ -736,36 +726,13 @@
2064 }
2065 else
2066 {
2067+#ifndef NUX_OPENGLES_20
2068 HW__EnableLineSmooth(GL_FALSE);
2069+#endif
2070 HW__SetLineWidth(LineWidth, Hint);
2071 }
2072 }
2073
2074- inline void GpuRenderStates::EnablePointSmooth(
2075- bool EnablePointSmooth,
2076- unsigned int PointSize,
2077- unsigned int Hint)
2078- {
2079- if (EnablePointSmooth)
2080- {
2081- if (!RS_VALUE(render_state_changes_[GFXRS_POINTSMOOTHENABLE]))
2082- {
2083- HW__EnablePointSmooth(GL_TRUE);
2084- }
2085-
2086- if ((RS_VALUE(render_state_changes_[GFXRS_POINTSIZE]) != PointSize) ||
2087- (RS_VALUE(render_state_changes_[GFXRS_POINTHINT]) != Hint))
2088- {
2089- HW__SetLineWidth(PointSize, Hint);
2090- }
2091- }
2092- else
2093- {
2094- HW__EnablePointSmooth(GL_FALSE);
2095- HW__SetLineWidth(PointSize, Hint);
2096- }
2097- }
2098-
2099 inline void GpuRenderStates::SetColorMask(
2100 unsigned int bRed,
2101 unsigned int bGreen,
2102@@ -810,14 +777,7 @@
2103 }
2104 }
2105
2106- inline void GpuRenderStates::EnableFog(unsigned int bFog)
2107- {
2108- if ((RS_VALUE(render_state_changes_[GFXRS_FOGENABLE]) != bFog))
2109- {
2110- HW__EnableFog(bFog);
2111- }
2112- }
2113-
2114+#ifndef NUX_OPENGLES_20
2115 inline void GpuRenderStates::SetPolygonMode(unsigned int FrontMode, unsigned int BackMode)
2116 {
2117 if ((RS_VALUE(render_state_changes_[GFXRS_FRONT_POLYGONMODE]) != FrontMode) ||
2118@@ -826,34 +786,15 @@
2119 HW__SetPolygonMode(FrontMode, BackMode);
2120 }
2121 }
2122-
2123- inline void GpuRenderStates::SetPolygonOffset(unsigned int bEnable,
2124- float Factor, float Units)
2125+#else
2126+ inline void GpuRenderStates::SetPolygonMode(unsigned int /*FrontMode*/, unsigned int /*BackMode*/)
2127 {
2128- if (bEnable)
2129- {
2130- if (!RS_VALUE(render_state_changes_[GFXRS_POLYGONOFFSETENABLE]))
2131- {
2132- HW__EnablePolygonOffset(GL_TRUE);
2133- }
2134-
2135- if ((RS_VALUE(render_state_changes_[GFXRS_POLYGONOFFSETFACTOR]) != static_cast<unsigned int> (Factor)) ||
2136- (RS_VALUE(render_state_changes_[GFXRS_POLYGONOFFSETUNITS]) != static_cast<unsigned int> (Units)))
2137- {
2138- HW__SetPolygonOffset(Factor, Units);
2139- }
2140- }
2141- else
2142- {
2143- HW__EnablePolygonOffset(GL_FALSE);
2144- }
2145 }
2146-
2147-
2148-//////////////////////////////////////
2149+#endif
2150+
2151+#ifndef NUX_OPENGLES_20
2152 inline void GpuRenderStates::HW__EnableAlphaTest(unsigned int b)
2153 {
2154-#ifndef NUX_OPENGLES_20
2155 if (b)
2156 {
2157 CHECKGL(glEnable(GL_ALPHA_TEST));
2158@@ -864,13 +805,11 @@
2159 }
2160
2161 SET_RS_VALUE(render_state_changes_[GFXRS_ALPHATESTENABLE], b ? GL_TRUE : GL_FALSE);
2162-#endif
2163 }
2164
2165 inline void GpuRenderStates::HW__SetAlphaTestFunc(unsigned int AlphaTestFunc_,
2166 BYTE AlphaTestRef_)
2167 {
2168-#ifndef NUX_OPENGLES_20
2169 nuxAssertMsg(
2170 (AlphaTestFunc_ == GL_NEVER) ||
2171 (AlphaTestFunc_ == GL_LESS) ||
2172@@ -885,8 +824,8 @@
2173 CHECKGL(glAlphaFunc(AlphaTestFunc_, (float) AlphaTestRef_ * (1.0f / 255.0f)));
2174 SET_RS_VALUE(render_state_changes_[GFXRS_ALPHATESTFUNC], AlphaTestFunc_);
2175 SET_RS_VALUE(render_state_changes_[GFXRS_ALPHATESTREF], AlphaTestRef_);
2176+ }
2177 #endif
2178- }
2179
2180 inline void GpuRenderStates::HW__EnableAlphaBlend(unsigned int b)
2181 {
2182@@ -1337,9 +1276,10 @@
2183 }
2184 #endif
2185
2186+#ifndef NUX_OPENGLES_20
2187 inline void GpuRenderStates::HW__EnableLineSmooth(unsigned int EnableLineSmooth)
2188 {
2189-#ifndef NUX_OPENGLES_20
2190+
2191 if (EnableLineSmooth)
2192 {
2193 CHECKGL(glEnable(GL_LINE_SMOOTH));
2194@@ -1350,8 +1290,8 @@
2195 }
2196
2197 SET_RS_VALUE(render_state_changes_[GFXRS_LINESMOOTHENABLE], EnableLineSmooth ? GL_TRUE : GL_FALSE);
2198+ }
2199 #endif
2200- }
2201
2202 inline void GpuRenderStates::HW__SetLineWidth(unsigned int width, unsigned int Hint)
2203 {
2204@@ -1370,38 +1310,6 @@
2205 #endif
2206 }
2207
2208- inline void GpuRenderStates::HW__EnablePointSmooth(unsigned int EnablePointSmooth)
2209- {
2210-#ifndef NUX_OPENGLES_20
2211- if (EnablePointSmooth)
2212- {
2213- CHECKGL(glEnable(GL_POINT_SMOOTH));
2214- }
2215- else
2216- {
2217- CHECKGL(glDisable(GL_POINT_SMOOTH));
2218- }
2219-
2220- SET_RS_VALUE(render_state_changes_[GFXRS_POINTSMOOTHENABLE], EnablePointSmooth ? GL_TRUE : GL_FALSE);
2221-#endif
2222- }
2223-
2224- inline void GpuRenderStates::HW__SetPointSize(unsigned int size, unsigned int Hint)
2225- {
2226-#ifndef NUX_OPENGLES_20
2227- nuxAssertMsg(
2228- (Hint == GL_NICEST) ||
2229- (Hint == GL_FASTEST) ||
2230- (Hint == GL_DONT_CARE),
2231- "Error(HW__SetPointSize): Invalid Point Hint RenderState");
2232-
2233- CHECKGL(glPointSize(size));
2234- CHECKGL(glHint(GL_POINT_SMOOTH_HINT, Hint);)
2235- SET_RS_VALUE(render_state_changes_[GFXRS_POINTSIZE], size);
2236- SET_RS_VALUE(render_state_changes_[GFXRS_POINTHINT], Hint);
2237-#endif
2238- }
2239-
2240 inline void GpuRenderStates::HW__SetColorMask(
2241 unsigned int bRed,
2242 unsigned int bGreen,
2243@@ -1435,25 +1343,9 @@
2244 SET_RS_VALUE(render_state_changes_[GFXRS_SCISSORTESTENABLE], bScissor ? GL_TRUE : GL_FALSE);
2245 }
2246
2247- inline void GpuRenderStates::HW__EnableFog(unsigned int bFog)
2248- {
2249 #ifndef NUX_OPENGLES_20
2250- if (bFog)
2251- {
2252- CHECKGL(glEnable(GL_FOG));
2253- }
2254- else
2255- {
2256- CHECKGL(glDisable(GL_FOG));
2257- }
2258-
2259- SET_RS_VALUE(render_state_changes_[GFXRS_FOGENABLE], bFog ? GL_TRUE : GL_FALSE);
2260-#endif
2261- }
2262-
2263 inline void GpuRenderStates::HW__SetPolygonMode(unsigned int FrontMode, unsigned int BackMode)
2264 {
2265-#ifndef NUX_OPENGLES_20
2266 nuxAssertMsg(
2267 (FrontMode == GL_FILL) ||
2268 (FrontMode == GL_LINE) ||
2269@@ -1471,30 +1363,8 @@
2270
2271 SET_RS_VALUE(render_state_changes_[GFXRS_FRONT_POLYGONMODE], FrontMode);
2272 SET_RS_VALUE(render_state_changes_[GFXRS_BACK_POLYGONMODE], BackMode);
2273+ }
2274 #endif
2275- }
2276-
2277- inline void GpuRenderStates::HW__EnablePolygonOffset(unsigned int EnablePolygonOffset)
2278- {
2279- if (EnablePolygonOffset)
2280- {
2281- CHECKGL(glEnable(GL_POLYGON_OFFSET_FILL));
2282- }
2283- else
2284- {
2285- CHECKGL(glDisable(GL_POLYGON_OFFSET_FILL));
2286- }
2287-
2288- SET_RS_VALUE(render_state_changes_[GL_POLYGON_OFFSET_FILL], EnablePolygonOffset ? GL_TRUE : GL_FALSE);
2289- }
2290-
2291- inline void GpuRenderStates::HW__SetPolygonOffset(float Factor, float Units)
2292- {
2293- CHECKGL(glPolygonOffset(Factor, Units));
2294-
2295- SET_RS_VALUE(render_state_changes_[GFXRS_POLYGONOFFSETFACTOR], static_cast<unsigned int> (Factor));
2296- SET_RS_VALUE(render_state_changes_[GFXRS_POLYGONOFFSETUNITS], static_cast<unsigned int> (Units));
2297- }
2298
2299 #undef SET_RS_VALUE
2300 #undef RS_VALUE
2301
2302=== modified file 'NuxGraphics/GLResource.h'
2303--- NuxGraphics/GLResource.h 2012-11-04 11:02:49 +0000
2304+++ NuxGraphics/GLResource.h 2012-11-05 17:50:27 +0000
2305@@ -92,17 +92,13 @@
2306 #include "EGL/egl.h"
2307 #include "GLES2/gl2.h"
2308 #include "GLES2/gl2ext.h"
2309- // Explicitly include X11 headers as many EGL implementations don't
2310- // do it for us.
2311- #include <X11/Xlib.h>
2312- #include <X11/Xutil.h>
2313 #else
2314 #ifndef GLEW_MX
2315 #define GLEW_MX
2316 #endif
2317 #include "GL/glew.h"
2318 #include "GL/glxew.h"
2319-
2320+
2321 GLEWContext *glewGetContext();
2322 GLXEWContext *glxewGetContext();
2323
2324@@ -112,6 +108,12 @@
2325 #endif
2326 #endif
2327
2328+ #ifdef USE_X11
2329+ // Explicitly include X11 headers as many EGL implementations don't
2330+ // do it for us.
2331+ #include <X11/Xlib.h>
2332+ #include <X11/Xutil.h>
2333+ #endif
2334 #endif
2335
2336 #include "RunTimeStats.h"
2337
2338=== modified file 'NuxGraphics/GLSh_ColorPicker.cpp'
2339--- NuxGraphics/GLSh_ColorPicker.cpp 2012-10-10 22:46:50 +0000
2340+++ NuxGraphics/GLSh_ColorPicker.cpp 2012-11-05 17:50:27 +0000
2341@@ -252,7 +252,11 @@
2342 {
2343 const char* FrgShaderCode;
2344
2345+#ifdef NUX_ARCH_ARM
2346+ if (GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath())
2347+#else
2348 if (GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath() && (GetGraphicsDisplay()->GetGpuDevice()->GetGPUBrand() != GPU_BRAND_INTEL))
2349+#endif
2350 {
2351 switch(color_channel)
2352 {
2353@@ -345,11 +349,12 @@
2354 break;
2355 }
2356 }
2357-
2358+#ifndef NUX_OPENGLES_20
2359 m_AsmProg = GetGraphicsDisplay()->GetGpuDevice()->CreateAsmShaderProgram();
2360 m_AsmProg->LoadVertexShader(AsmVtxShader);
2361 m_AsmProg->LoadPixelShader(FrgShaderCode);
2362 m_AsmProg->Link();
2363+#endif
2364 }
2365 }
2366
2367@@ -357,7 +362,9 @@
2368 {
2369 GlobalPixelShader = ObjectPtr<IOpenGLPixelShader> (0);
2370 sprog.Release();
2371+#ifndef NUX_OPENGLES_20
2372 m_AsmProg.Release();
2373+#endif
2374 }
2375
2376 void GLSh_ColorPicker::SetColor(float R, float G, float B, float A)
2377@@ -385,7 +392,11 @@
2378 fx + width, fy, 0.0f, 1.0f,
2379 };
2380
2381+#ifdef NUX_ARCH_ARM
2382+ if (GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath())
2383+#else
2384 if (GetGraphicsDisplay()->GetGraphicsEngine()->UsingGLSLCodePath() && (GetGraphicsDisplay()->GetGpuDevice()->GetGPUBrand() != GPU_BRAND_INTEL))
2385+#endif
2386 {
2387 CHECKGL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0));
2388 CHECKGL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
2389
2390=== modified file 'NuxGraphics/GLSh_ColorPicker.h'
2391--- NuxGraphics/GLSh_ColorPicker.h 2011-10-19 20:32:38 +0000
2392+++ NuxGraphics/GLSh_ColorPicker.h 2012-11-05 17:50:27 +0000
2393@@ -46,7 +46,9 @@
2394
2395 ObjectPtr<IOpenGLPixelShader> GlobalPixelShader;
2396 ObjectPtr<IOpenGLShaderProgram> sprog;
2397+#ifndef NUX_OPENGLES_20
2398 ObjectPtr<IOpenGLAsmShaderProgram> m_AsmProg;
2399+#endif
2400
2401 UINT ViewPortX;
2402 UINT ViewPortY;
2403
2404=== modified file 'NuxGraphics/GLSh_DrawFunction.cpp'
2405--- NuxGraphics/GLSh_DrawFunction.cpp 2012-10-10 22:46:50 +0000
2406+++ NuxGraphics/GLSh_DrawFunction.cpp 2012-11-05 17:50:27 +0000
2407@@ -111,10 +111,12 @@
2408 }
2409 else
2410 {
2411+#ifndef NUX_OPENGLES_20
2412 m_AsmProg = GetGraphicsDisplay()->GetGpuDevice()->CreateAsmShaderProgram();
2413 m_AsmProg->LoadVertexShader(AsmVtxShader.c_str());
2414 m_AsmProg->LoadPixelShader(AsmFrgShader.c_str());
2415 m_AsmProg->Link();
2416+#endif
2417 }
2418 }
2419
2420
2421=== modified file 'NuxGraphics/GLSh_DrawFunction.h'
2422--- NuxGraphics/GLSh_DrawFunction.h 2011-10-19 20:32:38 +0000
2423+++ NuxGraphics/GLSh_DrawFunction.h 2012-11-05 17:50:27 +0000
2424@@ -48,7 +48,9 @@
2425 private:
2426 Color background_color_;
2427 ObjectPtr<IOpenGLShaderProgram> sprog;
2428+#ifndef NUX_OPENGLES_20
2429 ObjectPtr<IOpenGLAsmShaderProgram> m_AsmProg;
2430+#endif
2431
2432 float _ScreenOffsetX, _ScreenOffsetY;
2433 UINT ViewPortX;
2434
2435=== modified file 'NuxGraphics/GLWindowManager.cpp'
2436--- NuxGraphics/GLWindowManager.cpp 2012-08-14 00:19:27 +0000
2437+++ NuxGraphics/GLWindowManager.cpp 2012-11-05 17:50:27 +0000
2438@@ -130,12 +130,12 @@
2439
2440 return glwindow;
2441 }
2442-#elif defined(NUX_OS_LINUX)
2443-#ifdef NUX_OPENGLES_20
2444+#elif defined(USE_X11)
2445+# ifdef NUX_OPENGLES_20
2446 GraphicsDisplay *DisplayAccessController::CreateFromForeignWindow(Display *X11Display, Window X11Window, EGLContext OpenGLContext)
2447-#else
2448+# else
2449 GraphicsDisplay *DisplayAccessController::CreateFromForeignWindow(Display *X11Display, Window X11Window, GLXContext OpenGLContext)
2450-#endif
2451+# endif
2452 {
2453 if (GetGraphicsDisplay())
2454 {
2455@@ -150,7 +150,7 @@
2456 return glwindow;
2457 }
2458 #endif
2459-}
2460+} // namespace nux
2461
2462 #ifndef NUX_OPENGLES_20
2463 GLEWContext *glewGetContext()
2464
2465=== modified file 'NuxGraphics/GLWindowManager.h'
2466--- NuxGraphics/GLWindowManager.h 2012-08-14 00:19:27 +0000
2467+++ NuxGraphics/GLWindowManager.h 2012-11-05 17:50:27 +0000
2468@@ -67,13 +67,15 @@
2469 #if defined(NUX_OS_WINDOWS)
2470 //! Create a GraphicsDisplay from a foreign window and display.
2471 GraphicsDisplay *CreateFromForeignWindow(HWND WindowHandle, HDC WindowDCHandle, HGLRC OpenGLRenderingContext);
2472-#elif defined(NUX_OS_LINUX)
2473+#elif defined(USE_X11)
2474 //! Create a GraphicsDisplay from a foreign window and display.
2475-#ifdef NUX_OPENGLES_20
2476+# ifdef NUX_OPENGLES_20
2477 GraphicsDisplay *CreateFromForeignWindow(Display *X11Display, Window X11Window, EGLContext OpenGLContext);
2478-#else
2479+# else
2480 GraphicsDisplay *CreateFromForeignWindow(Display *X11Display, Window X11Window, GLXContext OpenGLContext);
2481-#endif
2482+# endif
2483+#elif defined(NO_X11)
2484+ GraphicsDisplay *CreateFromForeignWindow(EGLDisplay *disp, EGLContext OpenGLContext);
2485 #endif
2486
2487 static DisplayAccessController &Instance();
2488
2489=== modified file 'NuxGraphics/GpuDevice.cpp'
2490--- NuxGraphics/GpuDevice.cpp 2012-10-10 22:46:50 +0000
2491+++ NuxGraphics/GpuDevice.cpp 2012-11-05 17:50:27 +0000
2492@@ -187,6 +187,12 @@
2493 STREAMSOURCE GpuDevice::_StreamSource[MAX_NUM_STREAM];
2494
2495 GpuInfo::GpuInfo()
2496+ : _opengl_max_texture_size(0)
2497+ , _opengl_max_texture_units(0)
2498+ , _opengl_max_texture_coords(0)
2499+ , _opengl_max_texture_image_units(0)
2500+ , _opengl_max_fb_attachment(0)
2501+ , _opengl_max_vertex_attributes(0)
2502 {
2503 _support_opengl_version_11 = false;
2504 _support_opengl_version_12 = false;
2505@@ -229,6 +235,12 @@
2506 CHECKGL(glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &_opengl_max_vertex_attributes));
2507 CHECKGL(glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &_opengl_max_fb_attachment));
2508 #else
2509+ // By opengl es 2.0 standard, GL_MAX_TEXTURE_SIZE should return a minimum of 64.
2510+ CHECKGL(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_opengl_max_texture_size));
2511+ // GL_MAX_TEXTURE_UNITS is not supported under opengl es 2.0.
2512+ // GL_MAX_TEXTURE_IMAGE_UNITS is supported under opengl es 2.0.
2513+ CHECKGL(glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &_opengl_max_texture_image_units));
2514+ // GL_MAX_COLOR_ATTACHMENTS_EXT is not supported under opengl es 2.0.
2515 _opengl_max_fb_attachment = 1;
2516 #endif
2517
2518@@ -284,8 +296,8 @@
2519 int req_opengl_major,
2520 int req_opengl_minor,
2521 bool opengl_es_20)
2522-#elif defined(NUX_OS_LINUX)
2523-#ifdef NUX_OPENGLES_20
2524+#elif defined(USE_X11)
2525+# ifdef NUX_OPENGLES_20
2526 GpuDevice::GpuDevice(unsigned int DeviceWidth, unsigned int DeviceHeight, BitmapFormat DeviceFormat,
2527 Display *display,
2528 Window window,
2529@@ -295,7 +307,7 @@
2530 int req_opengl_major,
2531 int req_opengl_minor,
2532 bool opengl_es_20)
2533-#else
2534+# else
2535 GpuDevice::GpuDevice(unsigned int /* DeviceWidth */, unsigned int /* DeviceHeight */, BitmapFormat /* DeviceFormat */,
2536 Display *display,
2537 Window window,
2538@@ -305,7 +317,14 @@
2539 int req_opengl_major,
2540 int req_opengl_minor,
2541 bool opengl_es_20)
2542-#endif
2543+# endif
2544+#elif defined(NO_X11)
2545+ GpuDevice::GpuDevice(unsigned int DeviceWidth, unsigned int DeviceHeight, BitmapFormat DeviceFormat,
2546+ EGLDisplay display,
2547+ EGLConfig fb_config,
2548+ EGLContext &opengl_rendering_context,
2549+ int req_opengl_major,
2550+ int req_opengl_minor)
2551 #endif
2552 : opengl_major_(0)
2553 , opengl_minor_(0)
2554@@ -416,11 +435,13 @@
2555 #if defined(NUX_OS_WINDOWS)
2556 bool opengl_es_context_created = false;
2557 if (((opengl_major_ >= 3) && (req_opengl_major >= 3)) || (opengl_major_ >= 3) || opengl_es_20)
2558-#elif defined(NUX_OS_LINUX)
2559+#elif defined(USE_X11) // Should this be GLES check?
2560 //bool opengl_es_context_created = false;
2561 if (has_glx_13_support &&
2562 (((opengl_major_ >= 3) && (req_opengl_major >= 3)) ||
2563 ((opengl_major_ >= 3) && opengl_es_20)))
2564+#elif defined(NO_X11)
2565+ if (((opengl_major_ >= 3) && (req_opengl_major >= 3)) || (opengl_major_ >= 3))
2566 #endif
2567 {
2568 // Create a new Opengl Rendering Context
2569@@ -455,6 +476,7 @@
2570 }
2571 }
2572
2573+#if !defined(NO_X11)
2574 if (opengl_es_20)
2575 {
2576 #if defined(NUX_OS_WINDOWS)
2577@@ -503,14 +525,16 @@
2578 }*/
2579 #endif
2580 }
2581- else if (requested_profile_is_supported)
2582+ else
2583+#endif
2584+ if (requested_profile_is_supported)
2585 {
2586+#if defined(NUX_OS_WINDOWS)
2587 int profile_mask = 0;
2588 int profile_value = 0;
2589 int flag_mask = 0;
2590 int flag_value = 0;
2591
2592-#if defined(NUX_OS_WINDOWS)
2593 if (((req_opengl_major == 3) && (req_opengl_minor >= 3)) || (req_opengl_major >= 4))
2594 {
2595 profile_mask = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
2596@@ -542,6 +566,11 @@
2597 wglMakeCurrent(device_context, opengl_rendering_context);
2598 }
2599 #elif defined(NUX_OS_LINUX) && !defined(NUX_OPENGLES_20)
2600+ int profile_mask = 0;
2601+ int profile_value = 0;
2602+ int flag_mask = 0;
2603+ int flag_value = 0;
2604+
2605 if (((req_opengl_major == 3) && (req_opengl_minor >= 3)) || (req_opengl_major >= 4))
2606 {
2607 profile_mask = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
2608
2609=== modified file 'NuxGraphics/GpuDevice.h'
2610--- NuxGraphics/GpuDevice.h 2012-10-25 07:13:47 +0000
2611+++ NuxGraphics/GpuDevice.h 2012-11-05 17:50:27 +0000
2612@@ -243,9 +243,12 @@
2613 ObjectPtr<IOpenGLShaderProgram> CreateShaderProgram();
2614 ObjectPtr<IOpenGLVertexShader> CreateVertexShader();
2615 ObjectPtr<IOpenGLPixelShader> CreatePixelShader();
2616+
2617+#ifndef NUX_OPENGLES_20
2618 ObjectPtr<IOpenGLAsmShaderProgram> CreateAsmShaderProgram();
2619 ObjectPtr<IOpenGLAsmVertexShader> CreateAsmVertexShader();
2620 ObjectPtr<IOpenGLAsmPixelShader> CreateAsmPixelShader();
2621+#endif
2622
2623 #if (NUX_ENABLE_CG_SHADERS)
2624 ObjectPtr<ICgVertexShader> CreateCGVertexShader();
2625@@ -439,7 +442,7 @@
2626 int req_opengl_minor = 0, // requested opengl minor version.
2627 bool opengl_es_20 = false);
2628
2629-#elif defined(NUX_OS_LINUX)
2630+#elif defined(USE_X11)
2631 #ifdef NUX_OPENGLES_20
2632 GpuDevice(unsigned int DeviceWidth, unsigned int DeviceHeight,
2633 BitmapFormat DeviceFormat,
2634@@ -463,6 +466,14 @@
2635 int req_opengl_minor = 0, // requested opengl minor version.
2636 bool opengl_es_20 = false);
2637 #endif
2638+#elif defined(NO_X11)
2639+ GpuDevice(unsigned int DeviceWidth, unsigned int DeviceHeight, BitmapFormat DeviceFormat,
2640+ EGLDisplay display,
2641+ EGLConfig fb_config,
2642+ EGLContext &opengl_rendering_context,
2643+ int req_opengl_major,
2644+ int req_opengl_minor);
2645+
2646 #endif
2647 ~GpuDevice();
2648 friend class IOpenGLSurface;
2649
2650=== modified file 'NuxGraphics/GpuDeviceShader.cpp'
2651--- NuxGraphics/GpuDeviceShader.cpp 2012-09-24 09:04:26 +0000
2652+++ NuxGraphics/GpuDeviceShader.cpp 2012-11-05 17:50:27 +0000
2653@@ -54,6 +54,7 @@
2654 return result;
2655 }
2656
2657+#ifndef NUX_OPENGLES_20
2658 ObjectPtr<IOpenGLAsmShaderProgram> GpuDevice::CreateAsmShaderProgram()
2659 {
2660 ObjectPtr<IOpenGLAsmShaderProgram> result;
2661@@ -74,6 +75,7 @@
2662 result.Adopt(new IOpenGLAsmPixelShader());
2663 return result;
2664 }
2665+#endif
2666
2667 #if (NUX_ENABLE_CG_SHADERS)
2668
2669
2670=== modified file 'NuxGraphics/GraphicsDisplay.h'
2671--- NuxGraphics/GraphicsDisplay.h 2011-10-19 20:32:38 +0000
2672+++ NuxGraphics/GraphicsDisplay.h 2012-11-05 17:50:27 +0000
2673@@ -25,7 +25,7 @@
2674
2675 #if defined(NUX_OS_WINDOWS)
2676 #include "GraphicsDisplayWin.h"
2677-#elif defined(NUX_OS_LINUX)
2678+#elif defined(USE_X11)
2679 #include "GraphicsDisplayX11.h"
2680 #else
2681 #error "GraphicsDisplay.h" is not implemented for this platform.
2682
2683=== modified file 'NuxGraphics/GraphicsDisplayX11.cpp'
2684--- NuxGraphics/GraphicsDisplayX11.cpp 2012-10-10 22:46:50 +0000
2685+++ NuxGraphics/GraphicsDisplayX11.cpp 2012-11-05 17:50:27 +0000
2686@@ -36,6 +36,7 @@
2687 #include <X11/extensions/shape.h>
2688 #include <X11/XKBlib.h>
2689
2690+
2691 namespace nux
2692 {
2693 int GraphicsDisplay::double_click_time_delay = 400; // milliseconds
2694@@ -183,7 +184,17 @@
2695 return(event->type == MapNotify) && (event->xmap.window == (Window) arg);
2696 }
2697
2698-// TODO: change windowWidth, windowHeight, to window_size;
2699+ void GraphicsDisplay::XICFocus()
2700+ {
2701+ m_xim_controller->FocusInXIC();
2702+ }
2703+
2704+ void GraphicsDisplay::XICUnFocus()
2705+ {
2706+ m_xim_controller->FocusOutXIC();
2707+ }
2708+
2709+ // TODO: change windowWidth, windowHeight, to window_size;
2710 static NCriticalSection CreateOpenGLWindow_CriticalSection;
2711 bool GraphicsDisplay::CreateOpenGLWindow(const char* window_title,
2712 unsigned int WindowWidth,
2713@@ -568,6 +579,16 @@
2714 //XMapRaised(m_X11Display, m_X11Window);
2715 }
2716
2717+ m_xim_controller.reset(new XIMController(m_X11Display));
2718+ m_xim_controller->SetFocusedWindow(m_X11Window);
2719+
2720+ if (m_xim_controller->IsXICValid())
2721+ {
2722+ long im_event_mask=0;
2723+ XGetICValues(m_xim_controller->GetXIC(), XNFilterEvents, &im_event_mask, NULL);
2724+ m_X11Attr.event_mask |= im_event_mask;
2725+ }
2726+
2727 #ifndef NUX_OPENGLES_20
2728 if (_has_glx_13)
2729 {
2730@@ -672,6 +693,8 @@
2731
2732 gfx_interface_created_ = true;
2733
2734+ m_xim_controller.reset(new XIMController(m_X11Display));
2735+
2736 // m_DeviceFactory = new GpuDevice(viewport_size_.GetWidth(), viewport_size_.GetHeight(), BITFMT_R8G8B8A8);
2737 m_DeviceFactory = new GpuDevice(viewport_size_.width, viewport_size_.height, BITFMT_R8G8B8A8,
2738 m_X11Display,
2739@@ -699,6 +722,11 @@
2740 return m_DeviceFactory;
2741 }
2742
2743+ void GraphicsDisplay::SetFocusedWindowForXIMController(Window window)
2744+ {
2745+ m_xim_controller->SetFocusedWindow(window);
2746+ }
2747+
2748 int GraphicsDisplay::GetGlXMajor() const
2749 {
2750 return _glx_major;
2751@@ -1231,6 +1259,9 @@
2752 bool bProcessEvent = true;
2753 XNextEvent(m_X11Display, &xevent);
2754
2755+ if (XFilterEvent(&xevent, None) == True)
2756+ return true;
2757+
2758 if (!_event_filters.empty())
2759 {
2760 for (auto filter : _event_filters)
2761@@ -1540,6 +1571,8 @@
2762 m_pEvent->dy = 0;
2763 m_pEvent->virtual_code = 0;
2764 //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: FocusIn event.");
2765+
2766+ m_xim_controller->FocusInXIC();
2767 break;
2768 }
2769
2770@@ -1555,6 +1588,8 @@
2771 m_pEvent->dy = 0;
2772 m_pEvent->virtual_code = 0;
2773 //nuxDebugMsg("[GraphicsDisplay::ProcessXEvents]: FocusOut event.");
2774+
2775+ m_xim_controller->FocusOutXIC();
2776 break;
2777 }
2778
2779@@ -1585,7 +1620,15 @@
2780 skip = true;
2781 }
2782
2783- int num_char_stored = XLookupString(&xevent.xkey, buffer, NUX_EVENT_TEXT_BUFFER_SIZE, (KeySym*) &m_pEvent->x11_keysym, NULL);
2784+ int num_char_stored = 0;
2785+ if (m_xim_controller->IsXICValid())
2786+ {
2787+ num_char_stored = XmbLookupString(m_xim_controller->GetXIC(), &xevent.xkey, buffer, NUX_EVENT_TEXT_BUFFER_SIZE, (KeySym*) &m_pEvent->x11_keysym, NULL);
2788+ }
2789+ else
2790+ {
2791+ num_char_stored = XLookupString(&xevent.xkey, buffer, NUX_EVENT_TEXT_BUFFER_SIZE, (KeySym*) &m_pEvent->x11_keysym, NULL);
2792+ }
2793 if (num_char_stored && (!skip))
2794 {
2795 Memcpy(m_pEvent->text, buffer, num_char_stored);
2796
2797=== modified file 'NuxGraphics/GraphicsDisplayX11.h'
2798--- NuxGraphics/GraphicsDisplayX11.h 2012-10-10 22:46:50 +0000
2799+++ NuxGraphics/GraphicsDisplayX11.h 2012-11-05 17:50:27 +0000
2800@@ -27,6 +27,7 @@
2801 #include "GLTimer.h"
2802 #include "GLDeviceObjects.h"
2803 #include "GLRenderStates.h"
2804+#include "XIMController.h"
2805
2806 /* Xlib.h is the default header that is included and has the core functionallity */
2807 #include <X11/Xlib.h>
2808@@ -35,10 +36,11 @@
2809 /* keysym.h contains keysymbols which we use to resolv what keys that are being pressed */
2810 #include <X11/keysym.h>
2811
2812-
2813 #include <X11/extensions/xf86vmode.h>
2814 #include <X11/extensions/Xinerama.h>
2815
2816+#include <boost/shared_ptr.hpp>
2817+
2818 namespace nux
2819 {
2820
2821@@ -85,6 +87,8 @@
2822 Window m_X11Window;
2823 XVisualInfo *m_X11VisualInfo;
2824
2825+ boost::shared_ptr<XIMController> m_xim_controller;
2826+
2827 int parent_window_;
2828 #ifndef NUX_OPENGLES_20
2829 GLXContext m_GLCtx;
2830@@ -284,6 +288,8 @@
2831
2832 GpuDevice* GetGpuDevice() const;
2833
2834+ void SetFocusedWindowForXIMController(Window window);
2835+
2836 // Dialog
2837 /*bool StartOpenFileDialog(FileDialogOption& fdo);
2838 bool StartSaveFileDialog(FileDialogOption& fdo);
2839@@ -343,6 +349,8 @@
2840
2841 void * KeyboardGrabData() { return _global_keyboard_grab_data; }
2842 void * PointerGrabData() { return _global_pointer_grab_data; }
2843+ void XICFocus();
2844+ void XICUnFocus();
2845
2846 private:
2847 void InitGlobalGrabWindow();
2848
2849=== modified file 'NuxGraphics/GraphicsEngine.cpp'
2850--- NuxGraphics/GraphicsEngine.cpp 2012-10-10 22:46:50 +0000
2851+++ NuxGraphics/GraphicsEngine.cpp 2012-11-05 17:50:27 +0000
2852@@ -195,19 +195,18 @@
2853 SetScissor(0, 0, _graphics_display.GetWindowWidth(), _graphics_display.GetWindowHeight());
2854 EnableScissoring(true);
2855
2856-
2857- bool opengl_14_support = true;
2858-
2859- if ((_graphics_display.GetGpuDevice()->GetOpenGLMajorVersion() == 1) &&
2860- (_graphics_display.GetGpuDevice()->GetOpenGLMinorVersion() < 4))
2861- {
2862- // OpenGL version is less than OpenGL 1.4
2863- opengl_14_support = false;
2864- }
2865-
2866 if (create_rendering_data)
2867 {
2868 #ifndef NUX_OPENGLES_20
2869+ bool opengl_14_support = true;
2870+
2871+ if ((_graphics_display.GetGpuDevice()->GetOpenGLMajorVersion() == 1) &&
2872+ (_graphics_display.GetGpuDevice()->GetOpenGLMinorVersion() < 4))
2873+ {
2874+ // OpenGL version is less than OpenGL 1.4
2875+ opengl_14_support = false;
2876+ }
2877+
2878 if (_graphics_display.GetGpuDevice()->GetGpuInfo().Support_ARB_Fragment_Shader() &&
2879 _graphics_display.GetGpuDevice()->GetGpuInfo().Support_ARB_Vertex_Program() &&
2880 opengl_14_support)
2881@@ -245,6 +244,9 @@
2882 _offscreen_color_rt1 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
2883 _offscreen_color_rt2 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
2884 _offscreen_color_rt3 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
2885+
2886+ _offscreen_depth_rt0 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
2887+ _offscreen_depth_rt1 = _graphics_display.GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
2888 }
2889 }
2890
2891@@ -1313,7 +1315,7 @@
2892 if ((depthbuffer.IsValid()) && ((depthbuffer->GetWidth() != width) || (depthbuffer->GetHeight() != height)))
2893 {
2894 // Generate a new depth texture only if a valid one was passed to this function.
2895- depthbuffer = _graphics_display.GetGpuDevice()->CreateTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
2896+ depthbuffer = _graphics_display.GetGpuDevice()->CreateTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
2897 }
2898
2899 fbo->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8);
2900
2901=== modified file 'NuxGraphics/GraphicsEngine.h'
2902--- NuxGraphics/GraphicsEngine.h 2012-10-12 03:42:26 +0000
2903+++ NuxGraphics/GraphicsEngine.h 2012-11-05 17:50:27 +0000
2904@@ -275,6 +275,7 @@
2905 ObjectPtr<IOpenGLBaseTexture>& src_device_texture,
2906 TexCoordXForm& texxform0, const Color& c0);
2907
2908+#ifndef NUX_OPENGLES_20
2909 // ASM
2910 void QRP_ASM_1Tex(int x, int y, int width, int height, ObjectPtr<IOpenGLBaseTexture> Tex0, TexCoordXForm& texxform, const Color& color0);
2911 void QRP_ASM_1TexPremultiply(int x, int y, int width, int height, ObjectPtr<IOpenGLBaseTexture> Tex0, TexCoordXForm& texxform, const Color& color0);
2912@@ -393,7 +394,7 @@
2913 ObjectPtr<IOpenGLBaseTexture>& dst_device_texture,
2914 ObjectPtr<IOpenGLBaseTexture>& src_device_texture,
2915 TexCoordXForm& texxform0, const Color& c0);
2916-
2917+#endif
2918 // GLSL
2919
2920 void QRP_GLSL_1Tex(int x, int y, int width, int height, ObjectPtr<IOpenGLBaseTexture> DeviceTexture, TexCoordXForm& texxform, const Color& c0);
2921
2922=== modified file 'NuxGraphics/IOpenGLSurface.cpp'
2923--- NuxGraphics/IOpenGLSurface.cpp 2012-10-10 06:25:39 +0000
2924+++ NuxGraphics/IOpenGLSurface.cpp 2012-11-05 17:50:27 +0000
2925@@ -518,16 +518,17 @@
2926 // Because we use SubImage when unlocking surfaces, we must first get some dummy data in the surface before we can make a lock.
2927 int texwidth = ImageSurface::GetLevelWidth(_BaseTexture->_PixelFormat, _BaseTexture->_Width, _SMipLevel);
2928 int texheight = ImageSurface::GetLevelHeight(_BaseTexture->_PixelFormat, _BaseTexture->_Height, _SMipLevel);
2929- int size = ImageSurface::GetLevelSize(_BaseTexture->_PixelFormat, _BaseTexture->_Width, _BaseTexture->_Height, _SMipLevel);
2930 int MemAlignment = ImageSurface::GetMemAlignment(_BaseTexture->_PixelFormat);
2931
2932 nuxAssert( texwidth > 0 ); // Should never happen
2933 nuxAssert( texheight > 0 ); // Should never happen
2934+
2935+ CHECKGL(glPixelStorei(GL_UNPACK_ALIGNMENT, MemAlignment));
2936+
2937+#ifndef NUX_OPENGLES_20
2938+ int size = ImageSurface::GetLevelSize(_BaseTexture->_PixelFormat, _BaseTexture->_Width, _BaseTexture->_Height, _SMipLevel);
2939 nuxAssert( size > 0 ); // Should never happen
2940
2941- CHECKGL(glPixelStorei(GL_UNPACK_ALIGNMENT, MemAlignment));
2942-
2943-#ifndef NUX_OPENGLES_20
2944 if ( _BaseTexture->_PixelFormat == BITFMT_DXT1 ||
2945 _BaseTexture->_PixelFormat == BITFMT_DXT2 ||
2946 _BaseTexture->_PixelFormat == BITFMT_DXT3 ||
2947
2948=== modified file 'NuxGraphics/Makefile.am'
2949--- NuxGraphics/Makefile.am 2012-07-27 19:40:40 +0000
2950+++ NuxGraphics/Makefile.am 2012-11-05 17:50:27 +0000
2951@@ -1,4 +1,4 @@
2952-CLEANFILES =
2953+CLEANFILES =
2954 DISTCLEANFILES =
2955 EXTRA_DIST = $(srcdir)/GraphicsDisplayWin.cpp \
2956 $(srcdir)/GraphicsDisplayWin.h
2957@@ -34,7 +34,6 @@
2958 $(srcdir)/FontTexture.h \
2959 $(srcdir)/FontRenderer.h \
2960 $(srcdir)/GdkGraphics.h \
2961- $(srcdir)/GraphicsDisplayX11.h \
2962 $(srcdir)/Gfx_Interface.h \
2963 $(srcdir)/GLDeviceFrameBufferObject.h \
2964 $(srcdir)/GLDeviceObjects.h \
2965@@ -63,7 +62,6 @@
2966 $(srcdir)/MeshFileLoader-OBJ.h \
2967 $(srcdir)/ImageSurface.h \
2968 $(srcdir)/IOpenGLAnimatedTexture.h \
2969- $(srcdir)/IOpenGLAsmShader.h \
2970 $(srcdir)/IOpenGLBaseTexture.h \
2971 $(srcdir)/IOpenGLCubeTexture.h \
2972 $(srcdir)/IOpenGLFrameBufferObject.h \
2973@@ -85,12 +83,24 @@
2974 $(srcdir)/OpenGLDefinitions.h \
2975 $(srcdir)/OpenGLMapping.h \
2976 $(srcdir)/RenderingPipe.h \
2977- $(srcdir)/RenderingPipeAsm.h \
2978 $(srcdir)/RenderingPipeGLSL.h \
2979 $(srcdir)/RenderingPipeTextureBlendShaderSource.h \
2980- $(srcdir)/RunTimeStats.h \
2981+ $(srcdir)/RunTimeStats.h
2982+
2983+if USE_X11
2984+source_h += \
2985+ $(srcdir)/GraphicsDisplayX11.h \
2986 $(srcdir)/VirtualKeyCodesX11.h \
2987- $(srcdir)/XInputWindow.h
2988+ $(srcdir)/XInputWindow.h \
2989+ $(srcdir)/XICClient.h \
2990+ $(srcdir)/XIMController.h
2991+endif
2992+
2993+if !NUX_OPENGLES_20
2994+source_h += \
2995+ $(srcdir)/IOpenGLAsmShader.h \
2996+ $(srcdir)/RenderingPipeAsm.h
2997+endif
2998
2999 if HAVE_GEIS
3000 source_h += \
3001@@ -127,13 +137,11 @@
3002 $(srcdir)/GpuDeviceShader.cpp \
3003 $(srcdir)/GpuDeviceTexture.cpp \
3004 $(srcdir)/GpuDeviceVertex.cpp \
3005- $(srcdir)/GraphicsDisplayX11.cpp \
3006 $(srcdir)/GraphicsEngine.cpp \
3007 $(srcdir)/MeshData.cpp \
3008 $(srcdir)/MeshFileLoader-OBJ.cpp \
3009 $(srcdir)/ImageSurface.cpp \
3010 $(srcdir)/IOpenGLAnimatedTexture.cpp \
3011- $(srcdir)/IOpenGLAsmShader.cpp \
3012 $(srcdir)/IOpenGLBaseTexture.cpp \
3013 $(srcdir)/IOpenGLCubeTexture.cpp \
3014 $(srcdir)/IOpenGLFrameBufferObject.cpp \
3015@@ -152,18 +160,31 @@
3016 $(srcdir)/NuxGraphicsObject.cpp \
3017 $(srcdir)/NuxGraphicsResources.cpp \
3018 $(srcdir)/RenderingPipe.cpp \
3019- $(srcdir)/RenderingPipeAsm.cpp \
3020 $(srcdir)/RenderingPipeGLSL.cpp \
3021 $(srcdir)/RenderingPipeTextureBlend.cpp \
3022 $(srcdir)/GLRenderingAPI.cpp \
3023- $(srcdir)/RunTimeStats.cpp \
3024- $(srcdir)/XInputWindow.cpp
3025+ $(srcdir)/RunTimeStats.cpp
3026+
3027+if USE_X11
3028+source_cpp += \
3029+ $(srcdir)/GraphicsDisplayX11.cpp \
3030+ $(srcdir)/XInputWindow.cpp \
3031+ $(srcdir)/XICClient.cpp \
3032+ $(srcdir)/XIMController.cpp
3033+endif
3034+
3035+if !NUX_OPENGLES_20
3036+source_cpp += \
3037+ $(srcdir)/IOpenGLAsmShader.cpp \
3038+ $(srcdir)/RenderingPipeAsm.cpp
3039+endif
3040
3041 if HAVE_GEIS
3042 source_cpp += \
3043 $(srcdir)/GestureEvent.cpp
3044 endif
3045
3046+
3047 libnux_graphics_@NUX_API_VERSION@_la_SOURCES = \
3048 $(source_cpp) \
3049 $(source_h)
3050
3051=== modified file 'NuxGraphics/RenderingPipeGLSL.cpp'
3052--- NuxGraphics/RenderingPipeGLSL.cpp 2012-10-10 22:46:50 +0000
3053+++ NuxGraphics/RenderingPipeGLSL.cpp 2012-11-05 17:50:27 +0000
3054@@ -489,139 +489,6 @@
3055 _alpha_replicate_prog->Link();
3056 }
3057
3058- void GraphicsEngine::InitSLHorizontalGaussFilter()
3059- {
3060- ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
3061- ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
3062-
3063- const char* VSString = NUX_VERTEX_SHADER_HEADER
3064- "uniform mat4 ViewProjectionMatrix; \n\
3065- attribute vec4 AVertex; \n\
3066- attribute vec4 MyTextureCoord0; \n\
3067- attribute vec4 VertexColor; \n\
3068- varying vec4 varyTexCoord0; \n\
3069- varying vec4 varyVertexColor; \n\
3070- void main() \n\
3071- { \n\
3072- varyTexCoord0 = MyTextureCoord0; \n\
3073- varyVertexColor = VertexColor; \n\
3074- gl_Position = ViewProjectionMatrix * (AVertex); \n\
3075- }";
3076-
3077-
3078- const char* PSString = NUX_FRAGMENT_SHADER_HEADER
3079- "varying vec4 varyTexCoord0; \n\
3080- varying vec4 varyVertexColor; \n\
3081- uniform sampler2D TextureObject0; \n\
3082- uniform vec2 TextureSize0; \n\
3083- vec4 SampleTexture(sampler2D TexObject, vec2 TexCoord) \n\
3084- { \n\
3085- return texture2D(TexObject, TexCoord.st); \n\
3086- } \n\
3087- #define NUM_SAMPLES 7 \n\
3088- uniform float W[NUM_SAMPLES]; \n\
3089- void main() \n\
3090- { \n\
3091- vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); \n\
3092- vec2 delta = vec2(1.0 / TextureSize0.x, 0.0); \n\
3093- vec2 texCoord = vec2(varyTexCoord0.s, varyTexCoord0.t); \n\
3094- texCoord.x -= float((NUM_SAMPLES - 1) / 2) / TextureSize0.x; \n\
3095- texCoord.y += 0.0 / TextureSize0.y; \n\
3096- sum += SampleTexture(TextureObject0, texCoord) * W[0]; \n\
3097- texCoord += delta; \n\
3098- sum += SampleTexture(TextureObject0, texCoord) * W[1]; \n\
3099- texCoord += delta; \n\
3100- sum += SampleTexture(TextureObject0, texCoord) * W[2]; \n\
3101- texCoord += delta; \n\
3102- sum += SampleTexture(TextureObject0, texCoord) * W[3]; \n\
3103- texCoord += delta; \n\
3104- sum += SampleTexture(TextureObject0, texCoord) * W[4]; \n\
3105- texCoord += delta; \n\
3106- sum += SampleTexture(TextureObject0, texCoord) * W[5]; \n\
3107- texCoord += delta; \n\
3108- sum += SampleTexture(TextureObject0, texCoord) * W[6]; \n\
3109- texCoord += delta; \n\
3110- gl_FragColor = vec4(sum.x, sum.y, sum.z, sum.w); \n\
3111- }";
3112-
3113- _horizontal_gauss_filter_prog = _graphics_display.m_DeviceFactory->CreateShaderProgram();
3114- VS->SetShaderCode(TCHAR_TO_ANSI(VSString));
3115- PS->SetShaderCode(TCHAR_TO_ANSI(PSString), "#define SAMPLERTEX2D");
3116-
3117- _horizontal_gauss_filter_prog->ClearShaderObjects();
3118- _horizontal_gauss_filter_prog->AddShaderObject(VS);
3119- _horizontal_gauss_filter_prog->AddShaderObject(PS);
3120- CHECKGL(glBindAttribLocation(_horizontal_gauss_filter_prog->GetOpenGLID(), 0, "AVertex"));
3121- _horizontal_gauss_filter_prog->Link();
3122-
3123- }
3124-
3125- void GraphicsEngine::InitSLVerticalGaussFilter()
3126- {
3127- ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
3128- ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
3129-
3130- const char* VSString = NUX_VERTEX_SHADER_HEADER
3131- "uniform mat4 ViewProjectionMatrix; \n\
3132- attribute vec4 AVertex; \n\
3133- attribute vec4 MyTextureCoord0; \n\
3134- attribute vec4 VertexColor; \n\
3135- varying vec4 varyTexCoord0; \n\
3136- varying vec4 varyVertexColor; \n\
3137- void main() \n\
3138- { \n\
3139- varyTexCoord0 = MyTextureCoord0; \n\
3140- varyVertexColor = VertexColor; \n\
3141- gl_Position = ViewProjectionMatrix * (AVertex); \n\
3142- }";
3143-
3144-
3145- const char* PSString = NUX_FRAGMENT_SHADER_HEADER
3146- "varying vec4 varyTexCoord0; \n\
3147- varying vec4 varyVertexColor; \n\
3148- uniform sampler2D TextureObject0; \n\
3149- uniform vec2 TextureSize0; \n\
3150- vec4 SampleTexture(sampler2D TexObject, vec2 TexCoord) \n\
3151- { \n\
3152- return texture2D(TexObject, TexCoord.st); \n\
3153- } \n\
3154- #define NUM_SAMPLES 7 \n\
3155- uniform float W [NUM_SAMPLES]; \n\
3156- void main() \n\
3157- { \n\
3158- vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); \n\
3159- vec2 delta = vec2(0.0, 1.0 / TextureSize0.y); \n\
3160- vec2 texCoord = vec2(varyTexCoord0.s, varyTexCoord0.t); \n\
3161- texCoord.x += 0.0 / TextureSize0.x; \n\
3162- texCoord.y -= float((NUM_SAMPLES - 1) / 2) / TextureSize0.y; \n\
3163- sum += SampleTexture(TextureObject0, texCoord) * W[0]; \n\
3164- texCoord += delta; \n\
3165- sum += SampleTexture(TextureObject0, texCoord) * W[1]; \n\
3166- texCoord += delta; \n\
3167- sum += SampleTexture(TextureObject0, texCoord) * W[2]; \n\
3168- texCoord += delta; \n\
3169- sum += SampleTexture(TextureObject0, texCoord) * W[3]; \n\
3170- texCoord += delta; \n\
3171- sum += SampleTexture(TextureObject0, texCoord) * W[4]; \n\
3172- texCoord += delta; \n\
3173- sum += SampleTexture(TextureObject0, texCoord) * W[5]; \n\
3174- texCoord += delta; \n\
3175- sum += SampleTexture(TextureObject0, texCoord) * W[6]; \n\
3176- texCoord += delta; \n\
3177- gl_FragColor = vec4(sum.x, sum.y, sum.z, sum.w); \n\
3178- }";
3179-
3180- _vertical_gauss_filter_prog = _graphics_display.m_DeviceFactory->CreateShaderProgram();
3181- VS->SetShaderCode(TCHAR_TO_ANSI(VSString));
3182- PS->SetShaderCode(TCHAR_TO_ANSI(PSString), "#define SAMPLERTEX2D");
3183-
3184- _vertical_gauss_filter_prog->ClearShaderObjects();
3185- _vertical_gauss_filter_prog->AddShaderObject(VS);
3186- _vertical_gauss_filter_prog->AddShaderObject(PS);
3187- CHECKGL(glBindAttribLocation(_vertical_gauss_filter_prog->GetOpenGLID(), 0, "AVertex"));
3188- _vertical_gauss_filter_prog->Link();
3189- }
3190-
3191 void GraphicsEngine::InitSLHorizontalHQGaussFilter(int sigma)
3192 {
3193 int k = Clamp<int>(sigma, NUX_MIN_GAUSSIAN_SIGMA, NUX_MAX_GAUSSIAN_SIGMA);
3194@@ -1691,6 +1558,69 @@
3195 ShaderProg->End();
3196 }
3197
3198+ void GraphicsEngine::InitSLHorizontalGaussFilter()
3199+ {
3200+ ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
3201+ ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
3202+
3203+ const char* VSString = NUX_VERTEX_SHADER_HEADER
3204+ "uniform mat4 ViewProjectionMatrix; \n\
3205+ attribute vec4 AVertex; \n\
3206+ attribute vec4 MyTextureCoord0; \n\
3207+ varying vec4 varyTexCoord0; \n\
3208+ void main() \n\
3209+ { \n\
3210+ varyTexCoord0 = MyTextureCoord0; \n\
3211+ gl_Position = ViewProjectionMatrix * (AVertex); \n\
3212+ }";
3213+
3214+
3215+ const char* PSString = NUX_FRAGMENT_SHADER_HEADER
3216+ "varying vec4 varyTexCoord0; \n\
3217+ uniform sampler2D TextureObject0; \n\
3218+ uniform vec2 TextureSize0; \n\
3219+ vec4 SampleTexture(sampler2D TexObject, vec2 TexCoord) \n\
3220+ { \n\
3221+ return texture2D(TexObject, TexCoord.st); \n\
3222+ } \n\
3223+ #define NUM_SAMPLES 7 \n\
3224+ uniform float W[NUM_SAMPLES]; \n\
3225+ void main() \n\
3226+ { \n\
3227+ vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); \n\
3228+ vec2 delta = vec2(1.0 / TextureSize0.x, 0.0); \n\
3229+ vec2 texCoord = vec2(varyTexCoord0.s, varyTexCoord0.t); \n\
3230+ texCoord.x -= float((NUM_SAMPLES - 1) / 2) / TextureSize0.x; \n\
3231+ texCoord.y += 0.0 / TextureSize0.y; \n\
3232+ sum += SampleTexture(TextureObject0, texCoord) * W[0]; \n\
3233+ texCoord += delta; \n\
3234+ sum += SampleTexture(TextureObject0, texCoord) * W[1]; \n\
3235+ texCoord += delta; \n\
3236+ sum += SampleTexture(TextureObject0, texCoord) * W[2]; \n\
3237+ texCoord += delta; \n\
3238+ sum += SampleTexture(TextureObject0, texCoord) * W[3]; \n\
3239+ texCoord += delta; \n\
3240+ sum += SampleTexture(TextureObject0, texCoord) * W[4]; \n\
3241+ texCoord += delta; \n\
3242+ sum += SampleTexture(TextureObject0, texCoord) * W[5]; \n\
3243+ texCoord += delta; \n\
3244+ sum += SampleTexture(TextureObject0, texCoord) * W[6]; \n\
3245+ texCoord += delta; \n\
3246+ gl_FragColor = vec4(sum.x, sum.y, sum.z, sum.w); \n\
3247+ }";
3248+
3249+ _horizontal_gauss_filter_prog = _graphics_display.m_DeviceFactory->CreateShaderProgram();
3250+ VS->SetShaderCode(TCHAR_TO_ANSI(VSString));
3251+ PS->SetShaderCode(TCHAR_TO_ANSI(PSString));
3252+
3253+ _horizontal_gauss_filter_prog->ClearShaderObjects();
3254+ _horizontal_gauss_filter_prog->AddShaderObject(VS);
3255+ _horizontal_gauss_filter_prog->AddShaderObject(PS);
3256+ CHECKGL(glBindAttribLocation(_horizontal_gauss_filter_prog->GetOpenGLID(), 0, "AVertex"));
3257+ _horizontal_gauss_filter_prog->Link();
3258+
3259+ }
3260+
3261 void GraphicsEngine::QRP_GLSL_HorizontalGauss(int x, int y, int width, int height, ObjectPtr<IOpenGLBaseTexture> device_texture, TexCoordXForm &texxform0, const Color & /* c0 */, float sigma)
3262 {
3263 if (!_horizontal_gauss_filter_prog.IsValid())
3264@@ -1718,6 +1648,7 @@
3265
3266 CHECKGL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0));
3267 CHECKGL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
3268+
3269 ShaderProg->Begin();
3270
3271 int TextureObjectLocation = ShaderProg->GetUniformLocationARB("TextureObject0");
3272@@ -1725,10 +1656,9 @@
3273 int TextureSizeLocation = ShaderProg->GetUniformLocationARB("TextureSize0");
3274 int VertexLocation = ShaderProg->GetAttributeLocation("AVertex");
3275 int TextureCoord0Location = ShaderProg->GetAttributeLocation("MyTextureCoord0");
3276-
3277+
3278 SetTexture(GL_TEXTURE0, device_texture);
3279 CHECKGL(glUniform1iARB(TextureObjectLocation, 0));
3280-
3281 sigma = Clamp <float> (sigma, 0.1f, 9.0f);
3282 // Set the Gaussian weights
3283 {
3284@@ -1763,6 +1693,68 @@
3285 ShaderProg->End();
3286 }
3287
3288+ void GraphicsEngine::InitSLVerticalGaussFilter()
3289+ {
3290+ ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
3291+ ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
3292+
3293+ const char* VSString = NUX_VERTEX_SHADER_HEADER
3294+ "uniform mat4 ViewProjectionMatrix; \n\
3295+ attribute vec4 AVertex; \n\
3296+ attribute vec4 MyTextureCoord0; \n\
3297+ varying vec4 varyTexCoord0; \n\
3298+ void main() \n\
3299+ { \n\
3300+ varyTexCoord0 = MyTextureCoord0; \n\
3301+ gl_Position = ViewProjectionMatrix * (AVertex); \n\
3302+ }";
3303+
3304+
3305+ const char* PSString = NUX_FRAGMENT_SHADER_HEADER
3306+ "varying vec4 varyTexCoord0; \n\
3307+ uniform sampler2D TextureObject0; \n\
3308+ uniform vec2 TextureSize0; \n\
3309+ vec4 SampleTexture(sampler2D TexObject, vec2 TexCoord) \n\
3310+ { \n\
3311+ return texture2D(TexObject, TexCoord.st); \n\
3312+ } \n\
3313+ #define NUM_SAMPLES 7 \n\
3314+ uniform float W [NUM_SAMPLES]; \n\
3315+ void main() \n\
3316+ { \n\
3317+ vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); \n\
3318+ vec2 delta = vec2(0.0, 1.0 / TextureSize0.y); \n\
3319+ vec2 texCoord = vec2(varyTexCoord0.s, varyTexCoord0.t); \n\
3320+ texCoord.x += 0.0 / TextureSize0.x; \n\
3321+ texCoord.y -= float((NUM_SAMPLES - 1) / 2) / TextureSize0.y; \n\
3322+ sum += SampleTexture(TextureObject0, texCoord) * W[0]; \n\
3323+ texCoord += delta; \n\
3324+ sum += SampleTexture(TextureObject0, texCoord) * W[1]; \n\
3325+ texCoord += delta; \n\
3326+ sum += SampleTexture(TextureObject0, texCoord) * W[2]; \n\
3327+ texCoord += delta; \n\
3328+ sum += SampleTexture(TextureObject0, texCoord) * W[3]; \n\
3329+ texCoord += delta; \n\
3330+ sum += SampleTexture(TextureObject0, texCoord) * W[4]; \n\
3331+ texCoord += delta; \n\
3332+ sum += SampleTexture(TextureObject0, texCoord) * W[5]; \n\
3333+ texCoord += delta; \n\
3334+ sum += SampleTexture(TextureObject0, texCoord) * W[6]; \n\
3335+ texCoord += delta; \n\
3336+ gl_FragColor = vec4(sum.x, sum.y, sum.z, sum.w); \n\
3337+ }";
3338+
3339+ _vertical_gauss_filter_prog = _graphics_display.m_DeviceFactory->CreateShaderProgram();
3340+ VS->SetShaderCode(TCHAR_TO_ANSI(VSString));
3341+ PS->SetShaderCode(TCHAR_TO_ANSI(PSString));
3342+
3343+ _vertical_gauss_filter_prog->ClearShaderObjects();
3344+ _vertical_gauss_filter_prog->AddShaderObject(VS);
3345+ _vertical_gauss_filter_prog->AddShaderObject(PS);
3346+ CHECKGL(glBindAttribLocation(_vertical_gauss_filter_prog->GetOpenGLID(), 0, "AVertex"));
3347+ _vertical_gauss_filter_prog->Link();
3348+ }
3349+
3350 void GraphicsEngine::QRP_GLSL_VerticalGauss(int x, int y, int width, int height, ObjectPtr<IOpenGLBaseTexture> device_texture, TexCoordXForm &texxform0, const Color & /* c0 */, float sigma)
3351 {
3352 if (!_vertical_gauss_filter_prog.IsValid())
3353@@ -2085,6 +2077,7 @@
3354 num_pass = Clamp<int> (num_pass, 1, 50);
3355
3356 ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
3357+
3358 int previous_width = 0;
3359 int previous_height = 0;
3360 if (prevFBO.IsValid())
3361@@ -2105,6 +2098,7 @@
3362 _offscreen_color_rt1->SetFiltering(GL_NEAREST, GL_NEAREST);
3363
3364 SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, buffer_width, buffer_height);
3365+
3366 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
3367
3368 QRP_GLSL_1Tex(x, y, quad_width, quad_height, device_texture, texxform, color::White);
3369@@ -2114,11 +2108,13 @@
3370 {
3371 SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt1, _offscreen_depth_rt1, buffer_width, buffer_height);
3372 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
3373- QRP_GLSL_HorizontalGauss(0, 0, buffer_width, buffer_height, _offscreen_color_rt0, texxform1, c0, sigma);
3374+ if (_offscreen_color_rt0.IsValid())
3375+ QRP_GLSL_HorizontalGauss(0, 0, buffer_width, buffer_height, _offscreen_color_rt0, texxform1, c0, sigma);
3376
3377 SetFrameBufferHelper(_offscreen_fbo, _offscreen_color_rt0, _offscreen_depth_rt0, buffer_width, buffer_height);
3378 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
3379- QRP_GLSL_VerticalGauss(0, 0, buffer_width, buffer_height, _offscreen_color_rt1, texxform1, c0, sigma);
3380+ if (_offscreen_color_rt1.IsValid())
3381+ QRP_GLSL_VerticalGauss(0, 0, buffer_width, buffer_height, _offscreen_color_rt1, texxform1, c0, sigma);
3382 }
3383
3384 _offscreen_fbo->Deactivate();
3385
3386=== modified file 'NuxGraphics/VirtualKeyCodes.h'
3387--- NuxGraphics/VirtualKeyCodes.h 2011-10-19 20:32:38 +0000
3388+++ NuxGraphics/VirtualKeyCodes.h 2012-11-05 17:50:27 +0000
3389@@ -134,9 +134,14 @@
3390 #define NUX_VK_RSHIFT 0xA1 // Right SHIFT key
3391 #define NUX_VK_LCONTROL 0xA2 // Left CONTROL key
3392 #define NUX_VK_RCONTROL 0xA3 // Right CONTROL key
3393+// To match VK in X11 file.
3394+#define NUX_VK_CONTROL NUX_VK_LCONTROL
3395 #define NUX_VK_CAPITAL 0x14 // CAPS LOCK key
3396 #define NUX_VK_LSUPER 0x5B // Left Windows key(Microsoft Natural Keyboard)
3397 #define NUX_VK_RSUPER 0x5C // Right Windows key(Microsoft Natural Keyboard)
3398+// To match VK in X11 file.
3399+#define NUX_VK_LWIN NUX_VK_LSUPER
3400+#define NUX_VK_RWIN NUX_VK_RSUPER
3401 #define NUX_VK_LALT 0xA4 // Left MENU key
3402 #define NUX_VK_RALT 0xA5 // Right MENU key
3403
3404
3405=== added file 'NuxGraphics/XICClient.cpp'
3406--- NuxGraphics/XICClient.cpp 1970-01-01 00:00:00 +0000
3407+++ NuxGraphics/XICClient.cpp 2012-11-05 17:50:27 +0000
3408@@ -0,0 +1,115 @@
3409+/*
3410+* Copyright 2012 Inalogic® Inc.
3411+*
3412+* This program is free software: you can redistribute it and/or modify it
3413+* under the terms of the GNU Lesser General Public License, as
3414+* published by the Free Software Foundation; either version 2.1 or 3.0
3415+* of the License.
3416+*
3417+* This program is distributed in the hope that it will be useful, but
3418+* WITHOUT ANY WARRANTY; without even the implied warranties of
3419+* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
3420+* PURPOSE. See the applicable version of the GNU Lesser General Public
3421+* License for more details.
3422+*
3423+* You should have received a copy of both the GNU Lesser General Public
3424+* License along with this program. If not, see <http://www.gnu.org/licenses/>
3425+*
3426+* Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
3427+*
3428+*/
3429+
3430+
3431+#include "XICClient.h"
3432+#include "NuxCore/NuxCore.h"
3433+
3434+XICClient::XICClient()
3435+ : xic_(NULL),
3436+ xim_style_(0),
3437+ focused_(false)
3438+{
3439+}
3440+
3441+XICClient::~XICClient()
3442+{
3443+}
3444+
3445+void XICClient::ResetXIC(XIM xim, Window window)
3446+{
3447+ if (!xim_style_)
3448+ SetupXIMStyle(xim);
3449+ SetupXIC(xim, window);
3450+}
3451+
3452+void XICClient::SetupXIC(XIM xim, Window window)
3453+{
3454+ xic_ = XCreateIC(xim, XNInputStyle, xim_style_, XNClientWindow, window, XNFocusWindow, window, NULL);
3455+}
3456+
3457+void XICClient::SetupXIMStyle(XIM xim)
3458+{
3459+ int i;
3460+ XIMStyles *xim_styles = NULL;
3461+ XIMStyle root_style = (XIMPreeditNothing|XIMStatusNothing);
3462+
3463+ XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
3464+
3465+ for (i = 0; i < xim_styles->count_styles; ++i)
3466+ if (xim_styles->supported_styles[i] == root_style)
3467+ break;
3468+
3469+ if (i >= xim_styles->count_styles)
3470+ xim_style_ = 0;
3471+ xim_style_ = root_style;
3472+}
3473+
3474+bool XICClient::HasXIC() const
3475+{
3476+ if (xic_ == NULL)
3477+ return false;
3478+ return true;
3479+}
3480+
3481+XIC XICClient::GetXIC() const
3482+{
3483+ return xic_;
3484+}
3485+
3486+void XICClient::Reinitialize()
3487+{
3488+ xic_ = NULL;
3489+ xim_style_ = 0;
3490+ focused_ = false;
3491+}
3492+
3493+void XICClient::FocusInXIC()
3494+{
3495+ if (xic_ && !focused_)
3496+ {
3497+ XSetICFocus(xic_);
3498+ focused_ = true;
3499+ }
3500+}
3501+
3502+void XICClient::FocusOutXIC()
3503+{
3504+ if (xic_ && focused_)
3505+ {
3506+ XUnsetICFocus(xic_);
3507+ focused_ = false;
3508+ }
3509+}
3510+
3511+bool XICClient::IsFocused() const
3512+{
3513+ return focused_;
3514+}
3515+
3516+void XICClient::DestroyXIC()
3517+{
3518+ if (xic_)
3519+ {
3520+ XDestroyIC(xic_);
3521+ xic_ = NULL;
3522+ }
3523+}
3524
3525=== added file 'NuxGraphics/XICClient.h'
3526--- NuxGraphics/XICClient.h 1970-01-01 00:00:00 +0000
3527+++ NuxGraphics/XICClient.h 2012-11-05 17:50:27 +0000
3528@@ -0,0 +1,56 @@
3529+/*
3530+* Copyright 2012 Inalogic® Inc.
3531+*
3532+* This program is free software: you can redistribute it and/or modify it
3533+* under the terms of the GNU Lesser General Public License, as
3534+* published by the Free Software Foundation; either version 2.1 or 3.0
3535+* of the License.
3536+*
3537+* This program is distributed in the hope that it will be useful, but
3538+* WITHOUT ANY WARRANTY; without even the implied warranties of
3539+* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
3540+* PURPOSE. See the applicable version of the GNU Lesser General Public
3541+* License for more details.
3542+*
3543+* You should have received a copy of both the GNU Lesser General Public
3544+* License along with this program. If not, see <http://www.gnu.org/licenses/>
3545+*
3546+* Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
3547+*
3548+*/
3549+
3550+#ifndef XICCLIENT_H
3551+#define XICCLIENT_H
3552+
3553+/* Xlib.h is the default header that is included and has the core functionallity */
3554+#include <X11/Xlib.h>
3555+
3556+class XICClient
3557+{
3558+public:
3559+ XICClient();
3560+ ~XICClient();
3561+
3562+ void ResetXIC(XIM xim, Window window);
3563+
3564+ bool HasXIC() const;
3565+ XIC GetXIC() const;
3566+
3567+ void Reinitialize();
3568+
3569+ void FocusInXIC();
3570+ void FocusOutXIC();
3571+ bool IsFocused() const;
3572+
3573+ void DestroyXIC();
3574+private:
3575+ void SetupXIC(XIM xim, Window window);
3576+ void SetupXIMStyle(XIM xim);
3577+
3578+ XIC xic_;
3579+ XIMStyle xim_style_;
3580+
3581+ bool focused_;
3582+};
3583+
3584+#endif // XICClient.h
3585
3586=== added file 'NuxGraphics/XIMController.cpp'
3587--- NuxGraphics/XIMController.cpp 1970-01-01 00:00:00 +0000
3588+++ NuxGraphics/XIMController.cpp 2012-11-05 17:50:27 +0000
3589@@ -0,0 +1,140 @@
3590+/*
3591+* Copyright 2012 Inalogic® Inc.
3592+*
3593+* This program is free software: you can redistribute it and/or modify it
3594+* under the terms of the GNU Lesser General Public License, as
3595+* published by the Free Software Foundation; either version 2.1 or 3.0
3596+* of the License.
3597+*
3598+* This program is distributed in the hope that it will be useful, but
3599+* WITHOUT ANY WARRANTY; without even the implied warranties of
3600+* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
3601+* PURPOSE. See the applicable version of the GNU Lesser General Public
3602+* License for more details.
3603+*
3604+* You should have received a copy of both the GNU Lesser General Public
3605+* License along with this program. If not, see <http://www.gnu.org/licenses/>
3606+*
3607+* Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
3608+*
3609+*/
3610+
3611+#include "XIMController.h"
3612+#include "NuxCore/NuxCore.h"
3613+#include "GraphicsDisplayX11.h"
3614+
3615+
3616+XIMController::XIMController(Display* display)
3617+ : display_(display),
3618+ window_(0),
3619+ xim_(NULL)
3620+{
3621+ InitXIMCallback();
3622+}
3623+
3624+XIMController::~XIMController()
3625+{
3626+ /* The XIC must be destroyed before the XIM */
3627+ if (xic_client_.HasXIC())
3628+ xic_client_.DestroyXIC();
3629+
3630+ if (xim_)
3631+ XCloseIM(xim_);
3632+}
3633+
3634+void XIMController::SetFocusedWindow(Window window)
3635+{
3636+ window_ = window;
3637+ if (xim_)
3638+ xic_client_.ResetXIC(xim_, window);
3639+}
3640+
3641+bool XIMController::IsXICValid() const
3642+{
3643+ return xic_client_.HasXIC();
3644+}
3645+
3646+XIC XIMController::GetXIC() const
3647+{
3648+ return xic_client_.GetXIC();
3649+}
3650+
3651+void XIMController::FocusInXIC()
3652+{
3653+ xic_client_.FocusInXIC();
3654+}
3655+
3656+void XIMController::FocusOutXIC()
3657+{
3658+ xic_client_.FocusOutXIC();
3659+}
3660+
3661+void XIMController::InitXIMCallback()
3662+{
3663+ const char *xmodifier;
3664+ /* don't do anything if we are using ibus */
3665+ xmodifier = getenv("XMODIFIERS");
3666+ if (xmodifier && strstr(xmodifier,"ibus") != NULL)
3667+ {
3668+ nuxDebugMsg("[GraphicsDisplay::InitXIM] ibus natively supported");
3669+ return;
3670+ }
3671+
3672+ if (setlocale(LC_ALL, "") == NULL)
3673+ {
3674+ nuxDebugMsg("[GraphicsDisplay::InitXIM] cannot setlocale");
3675+ }
3676+
3677+ if (XSupportsLocale())
3678+ {
3679+ if (XSetLocaleModifiers("") == NULL)
3680+ {
3681+ nuxDebugMsg("[GraphicsDisplay::InitXIM] XSetLocaleModifiers failed.");
3682+ }
3683+ XRegisterIMInstantiateCallback(display_, NULL, NULL, NULL,
3684+ XIMController::SetupXIMClientCallback,
3685+ (XPointer)this);
3686+ }
3687+}
3688+
3689+void XIMController::SetupXIMClientCallback(Display *dpy, XPointer client_data, XPointer call_data)
3690+{
3691+ XIMController* self = (XIMController*)client_data;
3692+ self->SetupXIM();
3693+}
3694+
3695+void XIMController::EndXIMClientCallback(Display *dpy, XPointer client_data, XPointer call_data)
3696+{
3697+ XIMController* self = (XIMController*)client_data;
3698+ self->xim_ = NULL;
3699+ self->xic_client_.Reinitialize();
3700+ self->InitXIMCallback();
3701+}
3702+
3703+void XIMController::SetupXIM()
3704+{
3705+ xim_ = XOpenIM(display_, NULL, NULL, NULL);
3706+ if (xim_)
3707+ {
3708+ SetupXIMDestroyedCallback();
3709+
3710+ if (window_)
3711+ xic_client_.ResetXIC(xim_, window_);
3712+
3713+ XUnregisterIMInstantiateCallback (display_, NULL, NULL, NULL,
3714+ XIMController::SetupXIMClientCallback,
3715+ (XPointer)this);
3716+ }
3717+ else
3718+ {
3719+ nuxDebugMsg("[GraphicsDisplay::XIMStartCallback] Failed to open IM.");
3720+ }
3721+}
3722+
3723+void XIMController::SetupXIMDestroyedCallback()
3724+{
3725+ XIMCallback destroy_callback;
3726+ destroy_callback.callback = (XIMProc)XIMController::EndXIMClientCallback;
3727+ destroy_callback.client_data = (XPointer)this;
3728+ XSetIMValues (xim_, XNDestroyCallback, &destroy_callback, NULL);
3729+}
3730
3731=== added file 'NuxGraphics/XIMController.h'
3732--- NuxGraphics/XIMController.h 1970-01-01 00:00:00 +0000
3733+++ NuxGraphics/XIMController.h 2012-11-05 17:50:27 +0000
3734@@ -0,0 +1,57 @@
3735+/*
3736+* Copyright 2012 Inalogic® Inc.
3737+*
3738+* This program is free software: you can redistribute it and/or modify it
3739+* under the terms of the GNU Lesser General Public License, as
3740+* published by the Free Software Foundation; either version 2.1 or 3.0
3741+* of the License.
3742+*
3743+* This program is distributed in the hope that it will be useful, but
3744+* WITHOUT ANY WARRANTY; without even the implied warranties of
3745+* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
3746+* PURPOSE. See the applicable version of the GNU Lesser General Public
3747+* License for more details.
3748+*
3749+* You should have received a copy of both the GNU Lesser General Public
3750+* License along with this program. If not, see <http://www.gnu.org/licenses/>
3751+*
3752+* Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
3753+*
3754+*/
3755+
3756+#ifndef XIMCONTROLLER_H
3757+#define XIMCONTROLLER_H
3758+
3759+#include "XICClient.h"
3760+
3761+/* Xlib.h is the default header that is included and has the core functionallity */
3762+#include <X11/Xlib.h>
3763+
3764+class XIMController
3765+{
3766+public:
3767+ XIMController(Display* display);
3768+ ~XIMController();
3769+
3770+ void SetFocusedWindow(Window window);
3771+
3772+ bool IsXICValid() const;
3773+ XIC GetXIC() const;
3774+
3775+ void FocusInXIC();
3776+ void FocusOutXIC();
3777+private:
3778+ void InitXIMCallback();
3779+ static void SetupXIMClientCallback(Display *dpy, XPointer client_data, XPointer call_data);
3780+ static void EndXIMClientCallback(Display *dpy, XPointer client_data, XPointer call_data);
3781+
3782+ void SetupXIM();
3783+ void SetupXIMDestroyedCallback();
3784+
3785+ Display* display_;
3786+ Window window_;
3787+ XIM xim_;
3788+ XICClient xic_client_;
3789+};
3790+
3791+#endif // XIMController.h
3792
3793=== modified file 'NuxGraphics/XInputWindow.cpp'
3794--- NuxGraphics/XInputWindow.cpp 2012-09-19 04:53:45 +0000
3795+++ NuxGraphics/XInputWindow.cpp 2012-11-05 17:50:27 +0000
3796@@ -22,6 +22,8 @@
3797 #include "XInputWindow.h"
3798 #include "GraphicsDisplayX11.h"
3799 #include "GLThread.h"
3800+#include "XIMController.h"
3801+
3802
3803 // Jay, what is this for? It isn't referenced anywhere.
3804 #define xdnd_version 5
3805@@ -376,8 +378,9 @@
3806
3807 void XInputWindow::Show()
3808 {
3809+ GetGraphicsDisplay()->SetFocusedWindowForXIMController(window_);
3810+
3811 shown_ = true;
3812-
3813 if (!mapped_)
3814 {
3815 XMapRaised(display_, window_);
3816
3817=== modified file 'NuxGraphics/XInputWindow.h'
3818--- NuxGraphics/XInputWindow.h 2012-01-18 19:51:33 +0000
3819+++ NuxGraphics/XInputWindow.h 2012-11-05 17:50:27 +0000
3820@@ -35,6 +35,7 @@
3821 #include "NuxCore/NuxCore.h"
3822 #include "NuxCore/Rect.h"
3823
3824+
3825 namespace nux
3826 {
3827
3828
3829=== modified file 'configure.ac'
3830--- configure.ac 2012-10-18 03:30:41 +0000
3831+++ configure.ac 2012-11-05 17:50:27 +0000
3832@@ -23,7 +23,7 @@
3833 # e.g.: december 5th, 2011 is: 20111205
3834 # To make more than one API change in a day, add a number to the date. Like 20111205.xx
3835
3836-m4_define([nux_abi_version], [20121012.01])
3837+m4_define([nux_abi_version], [20121017.01])
3838
3839 m4_define([nux_version],
3840 [nux_major_version.nux_minor_version.nux_micro_version])
3841@@ -119,6 +119,21 @@
3842 GL_PKGS="gl glu glew glewmx xext x11"
3843 MAINTAINER_CFLAGS=""
3844
3845+# X11 build
3846+AC_ARG_ENABLE([x_support],
3847+ [AC_HELP_STRING([--enable-x-support=@<:@no/yes@:>@],
3848+ [Enable X11 code path @<:@default=yes@:>@])],
3849+ [],
3850+ [enable_x_support=yes])
3851+AS_IF([test "x$enable_x_support" = "xyes"], [
3852+ MAINTAINER_CFLAGS+=" -DUSE_X11"
3853+ ])
3854+AS_IF([test "x$enable_x_support" = "xno"], [
3855+ MAINTAINER_CFLAGS+=" -DNO_X11"
3856+ ])
3857+
3858+AM_CONDITIONAL(USE_X11, [test "x$enable_x_support" = "xyes"])
3859+
3860 # Enable opengl es 20 code path
3861 AC_ARG_ENABLE([opengles_20],
3862 [AC_HELP_STRING([--enable-opengles-20=@<:@no/yes@:>@],
3863@@ -127,12 +142,25 @@
3864 [enable_opengles_20=no])
3865 AS_IF([test "x$enable_opengles_20" = "xyes"],
3866 [
3867- MAINTAINER_CFLAGS+=" -DNUX_OPENGLES_20"
3868- GL_PKGS="egl glesv2"
3869+ MAINTAINER_CFLAGS+=" -DNUX_OPENGLES_20"
3870+ GL_PKGS="egl glesv2"
3871 ]
3872 )
3873 AM_CONDITIONAL(NUX_OPENGLES_20, [test "x$enable_opengles_20" = "xyes"])
3874
3875+# Minimal builds
3876+AC_ARG_ENABLE([minimal_build],
3877+ [AC_HELP_STRING([--enable-minimal-build=@<:@no/yes@:>@],
3878+ [Enable minimal builds @<:@default=no@:>@])],
3879+ [],
3880+ [enable_minimal_build=no])
3881+
3882+AS_IF([test "x$enable_minimal_build" = "xyes"], [
3883+ MAINTAINER_CFLAGS+=" -DNUX_MINIMAL"
3884+ ])
3885+AM_CONDITIONAL(NUX_MINIMAL, [test "x$enable_minimal_build" = "xyes"])
3886+
3887+
3888 AC_SUBST(GL_PKGS)
3889 AC_SUBST(MAINTAINER_CFLAGS)
3890
3891@@ -339,7 +367,7 @@
3892 dnl ==========================================================================
3893
3894 if test "x$GCC" = "xyes"; then
3895- GCC_FLAGS="-g -Wall -Wextra -std=c++0x"
3896+ GCC_FLAGS="-g -Werror -Wall -Wextra -Wno-unused-parameter -std=c++0x"
3897 fi
3898
3899 # gcc flags for building the tests.
3900@@ -355,7 +383,7 @@
3901
3902 AS_IF([test "x$enable_maintainer_mode" = "xyes" && test "x$GCC" = "xyes"],
3903 [
3904- MAINTAINER_CFLAGS+="-Wall -Wextra -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self"
3905+ MAINTAINER_CFLAGS+="-Werror -Wall -Wextra -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self -Wno-unused-parameter"
3906 ]
3907 )
3908
3909@@ -368,8 +396,8 @@
3910 [enable_debug=no])
3911 AS_IF([test "x$enable_debug" = "xyes"],
3912 [
3913- MAINTAINER_CFLAGS+=" -DNUX_DEBUG"
3914- GCC_FLAGS="-g -O0 -Wall -Wextra -std=c++0x"
3915+ MAINTAINER_CFLAGS+=" -DNUX_DEBUG"
3916+ GCC_FLAGS="-g -O0 -Wall -Wextra -Wno-unused-parameter -std=c++0x"
3917 ]
3918 )
3919
3920@@ -458,6 +486,8 @@
3921 echo -e " Build Gpu Tests : ${BOLD_WHITE}${enable_gputests}${RESET}"
3922 echo -e " Build Nux Tests : ${BOLD_WHITE}${enable_tests}${RESET}"
3923 echo -e " Gestures support : ${BOLD_WHITE}${have_geis}${RESET}"
3924+echo -e " X11 build support : ${BOLD_WHITE}${enable_x_support}${RESET}"
3925+echo -e " Minimal build : ${BOLD_WHITE}${enable_minimal_build}${RESET}"
3926 echo ""
3927
3928 echo -e "${RESET}"
3929
3930=== modified file 'examples/Makefile.am'
3931--- examples/Makefile.am 2012-10-02 14:57:05 +0000
3932+++ examples/Makefile.am 2012-11-05 17:50:27 +0000
3933@@ -60,7 +60,7 @@
3934 $(top_builddir)/Nux/libnux-@NUX_API_VERSION@.la \
3935 $(NUX_EXAMPLES_LIBS) \
3936 $(NUX_LIBS) \
3937- $(IBUS_LIBS)
3938+ $(IBUS_LIBS)
3939
3940 # This is the individual executable build. For every $exe in noinst_PROGRAMS
3941 # you need a $exe_SOURCES and $exe_LDADD so it builds
3942@@ -123,7 +123,7 @@
3943 # To distribute source add the source code here
3944 #sourceexampledir = "$(pkgdatadir)/examples"
3945 #sourceexample_DATA = $(combobox_SOURCES) \
3946-#
3947+#
3948
3949 endif
3950
3951
3952=== modified file 'gputests/framebufferobject.cpp'
3953--- gputests/framebufferobject.cpp 2012-09-26 06:44:12 +0000
3954+++ gputests/framebufferobject.cpp 2012-11-05 17:50:27 +0000
3955@@ -36,7 +36,7 @@
3956
3957 void RenderToFrameBufferObject ()
3958 {
3959- nux::GraphicsDisplay* graphics_display = gGLWindowManager.CreateGLWindow("Window", 570, 270, nux::WINDOWSTYLE_NORMAL, 0, false);
3960+ nux::GraphicsDisplay* graphics_display = gGLWindowManager.CreateGLWindow("Window", 200, 200, nux::WINDOWSTYLE_NORMAL, 0, false);
3961 nux::GraphicsEngine* graphics_engine = graphics_display->GetGraphicsEngine();
3962
3963 graphics_display->ShowWindow();
3964@@ -54,19 +54,22 @@
3965 graphics_engine->GetWindowSize(w, h);
3966 graphics_engine->SetViewport(0, 0, w, h);
3967 graphics_engine->SetContext(0, 0, w, h);
3968+ graphics_engine->SetScissor(0, 0, w, h);
3969 graphics_engine->Push2DWindow(w, h);
3970
3971 nux::Event event;
3972 memset(&event, 0, sizeof(nux::Event));
3973
3974+ bool first_time = true;
3975 do
3976 {
3977 CHECKGL( glClearColor(0, 0, 0, 1) );
3978 CHECKGL( glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT) );
3979
3980 graphics_display->GetSystemEvent(&event);
3981- if(event.type == nux::NUX_SIZE_CONFIGURATION)
3982+ if(first_time || (event.type == nux::NUX_SIZE_CONFIGURATION))
3983 {
3984+ first_time = false;
3985 graphics_engine->DisableAllTextureMode(0);
3986 graphics_engine->DisableAllTextureMode(1);
3987 graphics_engine->DisableAllTextureMode(2);
3988@@ -76,15 +79,21 @@
3989 graphics_engine->SetScissor(0, 0, w, h);
3990 graphics_engine->SetContext(0, 0, w, h);
3991 graphics_engine->Push2DWindow(w, h);
3992-
3993- fbo = graphics_display->GetGpuDevice ()->CreateFrameBufferObject ();
3994- texture_rt = graphics_display->GetGpuDevice ()->CreateSystemCapableDeviceTexture (graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), 1, nux::BITFMT_R8G8B8A8);
3995- depth_rt = graphics_display->GetGpuDevice ()->CreateSystemCapableDeviceTexture (graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), 1, nux::BITFMT_D24S8);
3996+ fbo = graphics_display->GetGpuDevice()->CreateFrameBufferObject ();
3997+ texture_rt = graphics_display->GetGpuDevice()->CreateSystemCapableDeviceTexture(graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), 1, nux::BITFMT_R8G8B8A8);
3998+ depth_rt = graphics_display->GetGpuDevice()->CreateSystemCapableDeviceTexture (graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), 1, nux::BITFMT_D24S8);
3999 }
4000
4001 fbo->FormatFrameBufferObject (graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), nux::BITFMT_R8G8B8A8);
4002- fbo->SetRenderTarget (0, texture_rt->GetSurfaceLevel (0));
4003- fbo->SetDepthSurface (depth_rt->GetSurfaceLevel (0));
4004+ if (texture_rt.IsValid())
4005+ {
4006+ fbo->SetRenderTarget(0, texture_rt->GetSurfaceLevel(0));
4007+ }
4008+ if (depth_rt.IsValid())
4009+ {
4010+ fbo->SetDepthSurface(depth_rt->GetSurfaceLevel(0));
4011+ }
4012+
4013 fbo->Activate();
4014
4015 graphics_engine->GetWindowSize(w, h);
4016@@ -99,7 +108,8 @@
4017
4018 graphics_engine->QRP_Color(geo.x, geo.y, geo.width, geo.height, nux::color::RandomColor());
4019
4020- graphics_display->GetGpuDevice ()->DeactivateFrameBuffer ();
4021+ // Restore the back buffer
4022+ graphics_display->GetGpuDevice()->DeactivateFrameBuffer();
4023
4024 nux::TexCoordXForm texxform;
4025 graphics_engine->QRP_1Tex(0, 0, graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), texture_rt, texxform, nux::color::White);
4026
4027=== modified file 'gputests/quad_2texmod.cpp'
4028--- gputests/quad_2texmod.cpp 2012-09-26 06:44:12 +0000
4029+++ gputests/quad_2texmod.cpp 2012-11-05 17:50:27 +0000
4030@@ -90,6 +90,7 @@
4031 memset(&event, 0, sizeof(nux::Event));
4032 graphics_engine->GetWindowSize(w, h);
4033 graphics_engine->SetViewport(0, 0, w, h);
4034+ graphics_engine->SetScissor(0, 0, w, h);
4035 graphics_engine->SetContext(0, 0, w, h);
4036 graphics_engine->Push2DWindow(w, h);
4037
4038
4039=== modified file 'gputests/texture_blur.cpp'
4040--- gputests/texture_blur.cpp 2012-09-26 06:44:12 +0000
4041+++ gputests/texture_blur.cpp 2012-11-05 17:50:27 +0000
4042@@ -56,16 +56,18 @@
4043 graphics_engine->GetWindowSize(w, h);
4044 graphics_engine->SetViewport(0, 0, w, h);
4045 graphics_engine->SetContext(0, 0, w, h);
4046+ graphics_engine->SetScissor(0, 0, w, h);
4047 graphics_engine->Push2DWindow(w, h);
4048
4049 nux::Event event;
4050 memset(&event, 0, sizeof(nux::Event));
4051
4052- char fps [25];
4053+ /*char fps [25];
4054 int frame_counter = 0;
4055 int frame_periode = 0;
4056 float frame_rate = 0;
4057 float periode_time = 0;
4058+ */
4059 bool first_time = true;
4060 do
4061 {
4062@@ -86,15 +88,28 @@
4063 graphics_engine->SetContext(0, 0, w, h);
4064 graphics_engine->Push2DWindow(w, h);
4065
4066- fbo = graphics_display->GetGpuDevice ()->CreateFrameBufferObject ();
4067- texture_rt = graphics_display->GetGpuDevice ()->CreateSystemCapableDeviceTexture (graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), 1, nux::BITFMT_R8G8B8A8);
4068- depth_rt = graphics_display->GetGpuDevice ()->CreateSystemCapableDeviceTexture (graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), 1, nux::BITFMT_D24S8);
4069- fbo->FormatFrameBufferObject (graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), nux::BITFMT_R8G8B8A8);
4070- }
4071-
4072- fbo->SetRenderTarget (0, texture_rt->GetSurfaceLevel (0));
4073- fbo->SetDepthSurface (depth_rt->GetSurfaceLevel (0));
4074+ fbo = graphics_display->GetGpuDevice()->CreateFrameBufferObject();
4075+ texture_rt = graphics_display->GetGpuDevice()->CreateSystemCapableDeviceTexture(graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), 1, nux::BITFMT_R8G8B8A8);
4076+ depth_rt = graphics_display->GetGpuDevice()->CreateSystemCapableDeviceTexture(graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), 1, nux::BITFMT_D24S8);
4077+ }
4078+
4079+ fbo->FormatFrameBufferObject(graphics_display->GetWindowWidth(), graphics_display->GetWindowHeight(), nux::BITFMT_R8G8B8A8);
4080+ if (texture_rt.IsValid())
4081+ {
4082+ fbo->SetRenderTarget(0, texture_rt->GetSurfaceLevel (0));
4083+ }
4084+
4085+ if (depth_rt.IsValid())
4086+ {
4087+ fbo->SetDepthSurface(depth_rt->GetSurfaceLevel (0));
4088+ }
4089 fbo->Activate();
4090+
4091+ graphics_engine->GetWindowSize(w, h);
4092+ graphics_engine->SetViewport(0, 0, w, h);
4093+ graphics_engine->SetContext(0, 0, w, h);
4094+ graphics_engine->Push2DWindow(w, h);
4095+
4096 for (int i = 0; i < 1; i++)
4097 {
4098 nux::Rect geo (nux::RandomUInt(graphics_display->GetWindowWidth()),
4099@@ -106,16 +121,24 @@
4100 }
4101
4102 // Restore the back buffer
4103- graphics_display->GetGpuDevice ()->DeactivateFrameBuffer ();
4104+ graphics_display->GetGpuDevice()->DeactivateFrameBuffer();
4105+
4106+ nux::ObjectPtr <nux::IOpenGLBaseTexture> tex_blur;
4107
4108 nux::TexCoordXForm texxform;
4109- // Make a blurred copy of the previous render target
4110- nux::ObjectPtr <nux::IOpenGLBaseTexture> tex_blur = graphics_engine->QRP_GetBlurTexture (
4111- 0, 0, texture_rt->GetWidth (), texture_rt->GetHeight (),
4112- texture_rt, texxform, nux::color::White, 1.0f);
4113+ //Make a blurred copy of the previous render target
4114+ printf("exec 0\n");
4115+ if (texture_rt.IsValid() && graphics_engine)
4116+ {
4117+ tex_blur = graphics_engine->QRP_GLSL_GetBlurTexture(
4118+ 0, 0, texture_rt->GetWidth(), texture_rt->GetHeight(),
4119+ texture_rt, texxform, nux::color::White, 7.0f);
4120+ }
4121+ printf("exec 1\n");
4122
4123 graphics_engine->QRP_1Tex(0, 0, tex_blur->GetWidth(), tex_blur->GetHeight(), tex_blur, texxform, nux::color::White);
4124
4125+ /*
4126 sprintf(fps, "FPS: %3.2f", frame_rate);
4127 nux::PageBBox page;
4128 page.xmin = 0;
4129@@ -125,9 +148,7 @@
4130 page.x_margin = 0;
4131 page.y_margin = 0;
4132 graphics_engine->RenderColorTextLineStatic(graphics_engine->GetBoldFont (), page, fps, nux::color::White, false, nux::eAlignTextLeft);
4133-
4134- graphics_display->SwapBuffer();
4135-
4136+
4137 float frame_time = graphics_display->GetFrameTime();
4138 graphics_display->ResetFrameTime();
4139 periode_time += frame_time;
4140@@ -141,8 +162,10 @@
4141 periode_time = 0.0f;
4142 frame_periode = 0;
4143 }
4144-
4145- } while((event.type != nux::NUX_TERMINATE_APP) && (event.GetVirtualKeyState(NUX_VK_ESCAPE) == 0));
4146+ */
4147+
4148+ graphics_display->SwapBuffer();
4149+ } while((event.type != nux::NUX_TERMINATE_APP));
4150
4151 fbo.Release ();
4152 texture_rt.Release ();
4153
4154=== modified file 'gputests/texture_copy_blur.cpp'
4155--- gputests/texture_copy_blur.cpp 2012-09-26 06:44:12 +0000
4156+++ gputests/texture_copy_blur.cpp 2012-11-05 17:50:27 +0000
4157@@ -62,11 +62,12 @@
4158 nux::Event event;
4159 memset(&event, 0, sizeof(nux::Event));
4160
4161- char fps [25];
4162+ /*char fps [25];
4163 int frame_counter = 0;
4164 int frame_periode = 0;
4165 float frame_rate = 0;
4166 float periode_time = 0;
4167+ */
4168 bool first_time = true;
4169 do
4170 {
4171@@ -122,7 +123,7 @@
4172 // Render the blurred texture
4173 graphics_engine->QRP_1Tex(0, 0, tex_blur->GetWidth(), tex_blur->GetHeight(), tex_blur, texxform, nux::color::White);
4174
4175- sprintf(fps, "FPS: %3.2f", frame_rate);
4176+ /*sprintf(fps, "FPS: %3.2f", frame_rate);
4177 nux::PageBBox page;
4178 page.xmin = 0;
4179 page.xmax = 100;
4180@@ -147,6 +148,7 @@
4181 periode_time = 0.0f;
4182 frame_periode = 0;
4183 }
4184+ */
4185
4186 } while((event.type != nux::NUX_TERMINATE_APP) && (event.GetVirtualKeyState(NUX_VK_ESCAPE) == 0));
4187
4188
4189=== modified file 'tests/Makefile.am'
4190--- tests/Makefile.am 2012-10-11 17:31:41 +0000
4191+++ tests/Makefile.am 2012-11-05 17:50:27 +0000
4192@@ -25,6 +25,7 @@
4193 xtest-text-entry-deadkeys \
4194 xtest-text-entry-compositionkeys \
4195 xtest-text-entry-logic \
4196+ xtest-text-entry-xim \
4197 xtest-focus-on-mouse-enter
4198
4199 gtest_nuxcore_SOURCES = \
4200@@ -301,6 +302,14 @@
4201 xtest_text_entry_compositionkeys_LDADD = $(TestLibs)
4202 xtest_text_entry_compositionkeys_LDFLAGS = -lpthread -lXtst
4203
4204+xtest_text_entry_xim_SOURCES = xtest-text-entry-xim.cpp \
4205+ nux_automated_test_framework.cpp \
4206+ nux_automated_test_framework.h
4207+
4208+xtest_text_entry_xim_CPPFLAGS = $(TestFlags)
4209+xtest_text_entry_xim_LDADD = $(TestLibs)
4210+xtest_text_entry_xim_LDFLAGS = -lpthread -lXtst
4211+
4212 #run make test as part of make check
4213 check-local: test gtest test-apps
4214
4215@@ -314,7 +323,7 @@
4216 check-headless: gtest-nuxcore
4217 @gtester --verbose -k -o=test-nux-results.xml ./gtest-nuxcore
4218
4219-test-apps: test-graphics-display test-empty-window xtest-text-entry xtest-button xtest-mouse-events xtest-mouse-buttons xtest-hgrid-key-navigation xtest-hlayout-key-navigation xtest-vlayout-key-navigation xtest-scrollbar xtest-focus-on-mouse-down xtest-focus-on-mouse-enter xtest-keynav-directions xtest-text-entry-logic xtest-text-entry-deadkeys xtest-text-entry-compositionkeys
4220+test-apps: test-graphics-display test-empty-window xtest-text-entry-xim xtest-text-entry xtest-button xtest-mouse-events xtest-mouse-buttons xtest-hgrid-key-navigation xtest-hlayout-key-navigation xtest-vlayout-key-navigation xtest-scrollbar xtest-focus-on-mouse-down xtest-focus-on-mouse-enter xtest-keynav-directions xtest-text-entry-logic xtest-text-entry-deadkeys xtest-text-entry-compositionkeys
4221 ./test-graphics-display
4222 ./test-empty-window
4223 ./xtest-text-entry
4224@@ -331,7 +340,7 @@
4225 ./xtest-text-entry-logic
4226 ./xtest-text-entry-deadkeys
4227 ./xtest-text-entry-compositionkeys
4228-
4229+
4230
4231 check-report:
4232 @gtester -k -o=test-nux-results.xml -k ./test-nux \
4233
4234=== modified file 'tests/nux_automated_test_framework.cpp'
4235--- tests/nux_automated_test_framework.cpp 2012-09-26 06:44:12 +0000
4236+++ tests/nux_automated_test_framework.cpp 2012-11-05 17:50:27 +0000
4237@@ -23,6 +23,7 @@
4238 #include <X11/keysym.h>
4239 #include "nux_automated_test_framework.h"
4240
4241+#define MAX_KEYS 4 // Max keys
4242
4243 int NuxAutomatedTestFramework::mouse_motion_time_span = 1000; // milliseconds
4244 int NuxAutomatedTestFramework::mouse_click_time_span = 300; // milliseconds
4245@@ -394,6 +395,7 @@
4246 }
4247 nux::SleepForMilliseconds(300);
4248 }
4249+ XFlush(display_);
4250 }
4251
4252 void NuxAutomatedTestFramework::ViewSendCompositionKeys(const std::string& str)
4253@@ -406,6 +408,92 @@
4254 ViewSendString(str);
4255 }
4256
4257+
4258+// Send strings in the format of "key+key+key" up to 4 where the last key is not a modifier
4259+// example "ctrl+alt+=
4260+void NuxAutomatedTestFramework::ViewSendKeys(const std::string& str)
4261+{
4262+ std::string keys[MAX_KEYS];
4263+ KeySym keys_sym[MAX_KEYS] = {0};
4264+ size_t f_ptr = 0, s_ptr = 0;
4265+ int i = 0;
4266+
4267+ //Split up keys on the +
4268+ while (s_ptr != std::string::npos && i < MAX_KEYS)
4269+ {
4270+ s_ptr = str.find("+", f_ptr);
4271+ keys[i] = str.substr(f_ptr, (s_ptr-f_ptr));
4272+ f_ptr = s_ptr+1;
4273+ i++;
4274+ }
4275+
4276+ // Find what the key_sym should be for each key
4277+ for (int i = 0; i < MAX_KEYS; i++)
4278+ {
4279+ if (keys[i].empty())
4280+ {
4281+ break;
4282+ }
4283+ else if (keys[i] == "ctrl")
4284+ {
4285+ keys_sym[i] = XK_Control_L;
4286+ }
4287+ else if (keys[i] == "alt")
4288+ {
4289+ keys_sym[i] = XK_Alt_L;
4290+ }
4291+ else if (keys[i] == "space")
4292+ {
4293+ keys_sym[i] = XK_space;
4294+ }
4295+ else if (keys[i] == "enter" || keys[i] == "return")
4296+ {
4297+ keys_sym[i] = XK_Return;
4298+ }
4299+ else if (keys[i] == "=")
4300+ {
4301+ keys_sym[i] = XK_equal;
4302+ }
4303+ else if (keys[i] == "[")
4304+ {
4305+ keys_sym[i] = XK_bracketleft;
4306+ }
4307+ else if (keys[i] =="shift")
4308+ {
4309+ keys_sym[i] = XK_Shift_L;
4310+ }
4311+ else
4312+ {
4313+ // If nothing is found try and find it...
4314+ if (!(keys_sym[i] = XStringToKeysym(keys[i].c_str())))
4315+ printf("Undefinded Key: %s (Add it to this list)\n", keys[i].c_str());
4316+ }
4317+ }
4318+ XTestGrabControl(display_, True);
4319+ KeyCode modcode[MAX_KEYS] = {0};
4320+
4321+ // Press the keys from 0,1,2,3
4322+ for (int i = 0; i < MAX_KEYS; i++)
4323+ {
4324+ if (keys_sym[i] != 0)
4325+ {
4326+ modcode[i] = XKeysymToKeycode(display_, keys_sym[i]);
4327+ XTestFakeKeyEvent(display_, modcode[i], True, 0);
4328+ }
4329+ }
4330+
4331+ // Release the keys from 3,2,1,0
4332+ for (int i = MAX_KEYS-1; i >= 0; i--)
4333+ {
4334+ if (keys_sym[i] != 0)
4335+ {
4336+ XTestFakeKeyEvent(display_, modcode[i], False, 0);
4337+ }
4338+ }
4339+ XTestGrabControl(display_, False);
4340+ XFlush(display_);
4341+}
4342+
4343 void NuxAutomatedTestFramework::ViewSendKeyCombo(KeySym modsym0, KeySym modsym1, KeySym modsym2, const char c)
4344 {
4345 KeyCode keycode = 0;
4346@@ -528,7 +616,7 @@
4347 /* Generate modkey release */
4348 XTestFakeKeyEvent(display_, modcode1, False, 0);
4349 XTestFakeKeyEvent(display_, modcode0, False, 0);
4350-
4351+ XFlush(display_);
4352 }
4353
4354 void NuxAutomatedTestFramework::PutMouseAt(int x, int y)
4355
4356=== modified file 'tests/nux_automated_test_framework.h'
4357--- tests/nux_automated_test_framework.h 2012-08-28 21:38:54 +0000
4358+++ tests/nux_automated_test_framework.h 2012-11-05 17:50:27 +0000
4359@@ -90,6 +90,8 @@
4360 void ViewSendDown();
4361 //! Simulate composition keys.
4362 void ViewSendCompositionKeys(const std::string &str);
4363+ //! Simulate 1-4 key presses.
4364+ void ViewSendKeys(const std::string &str);
4365
4366 void ViewSendIBusToggle();
4367
4368
4369=== added file 'tests/xim-test-commands.txt'
4370--- tests/xim-test-commands.txt 1970-01-01 00:00:00 +0000
4371+++ tests/xim-test-commands.txt 2012-11-05 17:50:27 +0000
4372@@ -0,0 +1,52 @@
4373+//
4374+// Copyright 2010 Inalogic Inc.
4375+//
4376+// This program is free software: you can redistribute it and/or modify it
4377+// under the terms of the GNU General Public License version 3, as published
4378+// by the Free Software Foundation.
4379+//
4380+// This program is distributed in the hope that it will be useful, but
4381+// WITHOUT ANY WARRANTY; without even the implied warranties of
4382+// MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
4383+// PURPOSE. See the GNU General Public License for more details.
4384+//
4385+// You should have received a copy of the GNU General Public License
4386+// version 3 along with this program. If not, see
4387+// <http://www.gnu.org/licenses/>
4388+//
4389+// Author by: Brandon Schaefer <brandon.schaefer@canonical.com>
4390+
4391+// 0 is the name of the IM
4392+// 1 is any key sequences you need to enter to get the IM
4393+// in the correct state while testing
4394+// 2 is text that will get inputed to the IM. The input is what you
4395+// would normally type to get your desired CJK string
4396+// 3 is the expect result that the IM should turn your input into
4397+// 4 is when we know the test is over and to close the current IM
4398+
4399+// This test GCIN with chewing
4400+0 gcin
4401+1 ctrl+space
4402+1 ctrl+alt+[
4403+2 w91o3g4
4404+1 enter
4405+1 ctrl+space
4406+3 北市
4407+4 halt
4408+
4409+// This test Fcitx with google pinyin
4410+0 fcitx
4411+1 ctrl+space
4412+2 dianshi ji1
4413+3 耟椒晃
4414+4 halt
4415+
4416+// This test Hime with anthy
4417+0 hime
4418+1 ctrl+space
4419+1 ctrl+alt+=
4420+2 shisutemu
4421+1 enter
4422+1 ctrl+space
4423+3 しすてむ
4424+4 halt
4425
4426=== added file 'tests/xtest-text-entry-xim.cpp'
4427--- tests/xtest-text-entry-xim.cpp 1970-01-01 00:00:00 +0000
4428+++ tests/xtest-text-entry-xim.cpp 2012-11-05 17:50:27 +0000
4429@@ -0,0 +1,450 @@
4430+/*
4431+ * Copyright 2010 Inalogic Inc.
4432+ *
4433+ * This program is free software: you can redistribute it and/or modify it
4434+ * under the terms of the GNU General Public License version 3, as published
4435+ * by the Free Software Foundation.
4436+ *
4437+ * This program is distributed in the hope that it will be useful, but
4438+ * WITHOUT ANY WARRANTY; without even the implied warranties of
4439+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
4440+ * PURPOSE. See the GNU General Public License for more details.
4441+ *
4442+ * You should have received a copy of the GNU General Public License
4443+ * version 3 along with this program. If not, see
4444+ * <http://www.gnu.org/licenses/>
4445+ *
4446+ * Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
4447+ *
4448+ */
4449+
4450+#include "Nux/Nux.h"
4451+#include "Nux/WindowThread.h"
4452+#include "Nux/VLayout.h"
4453+#include "Nux/TextEntry.h"
4454+#include "Nux/InputMethodIBus.h"
4455+#include "Nux/ProgramFramework/ProgramTemplate.h"
4456+#include "Nux/ProgramFramework/TestView.h"
4457+#include <X11/extensions/XTest.h>
4458+#include <X11/keysym.h>
4459+#include "nux_automated_test_framework.h"
4460+
4461+#include <sys/types.h>
4462+#include <signal.h>
4463+#include <stdio.h>
4464+
4465+#include <fstream>
4466+#include <queue>
4467+
4468+class TextTextEntry: public ProgramTemplate
4469+{
4470+public:
4471+ TextTextEntry(const char* program_name, int window_width, int window_height, int program_life_span);
4472+ ~TextTextEntry();
4473+
4474+ virtual void UserInterfaceSetup();
4475+
4476+ void TextEntryClick(nux::TextEntry* text_entry);
4477+ void OnActivated();
4478+ void OnCursorMoved(int);
4479+ void ResetEvents();
4480+
4481+ nux::TextEntry* text_entry_;
4482+
4483+ bool clicked_;
4484+ bool activated_;
4485+ bool cursor_moved_;
4486+};
4487+
4488+TextTextEntry::TextTextEntry(const char* program_name,
4489+ int window_width,
4490+ int window_height,
4491+ int program_life_span)
4492+ : ProgramTemplate(program_name, window_width, window_height, program_life_span)
4493+ , clicked_(false)
4494+ , activated_(false)
4495+ , cursor_moved_(false)
4496+{
4497+ ResetEvents();
4498+ text_entry_ = NULL;
4499+}
4500+
4501+TextTextEntry::~TextTextEntry()
4502+{
4503+}
4504+
4505+void TextTextEntry::ResetEvents()
4506+{
4507+ clicked_ = false;
4508+ activated_ = false;
4509+ cursor_moved_ = false;
4510+}
4511+
4512+void TextTextEntry::TextEntryClick(nux::TextEntry* text_entry)
4513+{
4514+ if (text_entry_ == text_entry)
4515+ {
4516+ clicked_ = true;
4517+ }
4518+}
4519+
4520+void TextTextEntry::OnActivated()
4521+{
4522+ activated_ = true;
4523+}
4524+
4525+void TextTextEntry::OnCursorMoved(int position)
4526+{
4527+ cursor_moved_ = true;
4528+}
4529+
4530+void TextTextEntry::UserInterfaceSetup()
4531+{
4532+ nux::VLayout* main_layout = new nux::VLayout(NUX_TRACKER_LOCATION);
4533+ text_entry_ = new nux::TextEntry("", NUX_TRACKER_LOCATION);
4534+ text_entry_->activated.connect(sigc::mem_fun(this, &TextTextEntry::OnActivated));
4535+ text_entry_->cursor_moved.connect(sigc::mem_fun(this, &TextTextEntry::OnCursorMoved));
4536+ text_entry_->SetFontSize(76);
4537+
4538+ main_layout->AddView(text_entry_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
4539+ main_layout->SetSpaceBetweenChildren(10);
4540+ main_layout->SetContentDistribution(nux::MAJOR_POSITION_CENTER);
4541+
4542+ static_cast<nux::WindowThread*>(window_thread_)->SetLayout(main_layout);
4543+
4544+ nux::ColorLayer background(nux::Color(0xFF4D4D4D));
4545+ static_cast<nux::WindowThread*>(window_thread_)->SetWindowBackgroundPaintLayer(&background);
4546+}
4547+
4548+TextTextEntry* test_textentry = NULL;
4549+
4550+// Returns dynamic memory, delete me!
4551+char* ReadInCommands(const char* path)
4552+{
4553+ char* raw_file = NULL;
4554+ long size;
4555+ std::ifstream file(path, std::ios::in|std::ios::ate);
4556+
4557+ if (file.is_open())
4558+ {
4559+ size = file.tellg();
4560+ raw_file = new char[size+1];
4561+ file.seekg (0, std::ios::beg);
4562+ file.read(raw_file, size);
4563+ file.close();
4564+ }
4565+ return raw_file;
4566+}
4567+
4568+void TokenizeCommands(char* raw_cmds, std::queue<std::string>& token_queue)
4569+{
4570+ int i = 0;
4571+ int size = strlen(raw_cmds);
4572+
4573+ while (i < size)
4574+ {
4575+ if (raw_cmds[i] == '/' && raw_cmds[i+1] == '/')
4576+ {
4577+ while (raw_cmds[i] != '\n' && i < size)
4578+ {
4579+ i++;
4580+ }
4581+ i++;
4582+ }
4583+ else if (raw_cmds[i] >= '0' && raw_cmds[i] <= '9')
4584+ {
4585+ std::string num = "";
4586+ while (raw_cmds[i] != ' ' && i < size)
4587+ {
4588+ num += raw_cmds[i];
4589+ i++;
4590+ }
4591+ token_queue.push(num);
4592+
4593+ while (raw_cmds[i] == ' ') {i++;}
4594+
4595+ std::string cmd = "";
4596+ while (raw_cmds[i] != '\n' && raw_cmds[i] != '\0' && i < size)
4597+ {
4598+ cmd += raw_cmds[i];
4599+ i++;
4600+ }
4601+ token_queue.push(cmd);
4602+ }
4603+ else
4604+ {
4605+ i++;
4606+ }
4607+ }
4608+}
4609+
4610+void KillInputMethod(const char* im_name)
4611+{
4612+ FILE* f_ptr;
4613+ char pgrep[128] = "pgrep ";
4614+ char pid[128];
4615+ char* last = NULL;
4616+ int cur_pid = 0;
4617+
4618+ strcat(pgrep, im_name);
4619+ if ((f_ptr = popen(pgrep, "r")) == NULL)
4620+ return;
4621+
4622+ while(fgets(pid, 128, f_ptr) != NULL)
4623+ {
4624+ cur_pid = strtol(pid, &last, 10);
4625+ if (*last == '\0' || *last == '\n')
4626+ {
4627+ // Make sure it's dead
4628+ kill(cur_pid, SIGKILL);
4629+ kill(cur_pid, SIGSTOP);
4630+ }
4631+ }
4632+ pclose(f_ptr);
4633+}
4634+
4635+void KillCurrentInputMethod()
4636+{
4637+ const char* xmodifier;
4638+ xmodifier = getenv("XMODIFIERS");
4639+ if (!xmodifier)
4640+ return;
4641+
4642+ KillInputMethod(strchr(xmodifier, '=')+1);
4643+}
4644+
4645+/*
4646+ 0 - Name of Input method
4647+ 1 - what keys we should press
4648+ 2 - what to type
4649+ 3 - what to expect
4650+ 4 - we are done with this IM
4651+
4652+ CFG (If someone complains that we need to check the input)
4653+ **Note I cheated with Key, Letter and CJK...can be filled in
4654+ S -> 0 L | 1 K | 2 L | 3 C | 4 <halt>
4655+ K -> K+K | <Key>
4656+ L -> LL | <Letter>
4657+ C -> CC | <CJK>
4658+
4659+ example:
4660+ 0 fcitx
4661+ 1 ctrl+space
4662+ 2 ninhao <CJK>
4663+
4664+ Abstract Syntax
4665+ IM = 0 <name>
4666+ KeyStrokes= 1 <key> | 1 <key+key> | 1 <key+key+key> | 1 <key+key+key+key>
4667+ Input = 2 <input>
4668+ Expect = 3 <cjk>
4669+ Halt = 4 halt
4670+
4671+ 0 -> popen(im_name)
4672+ 1 -> RunKeyStrokes(keys)
4673+ 2 -> TypeInput(input)
4674+ 3 -> CheckInput(cjk)
4675+ 4 -> pclose(im_name)
4676+*/
4677+
4678+std::vector<std::string>& GetSplitEnvPath()
4679+{
4680+ static std::vector<std::string> split_path;
4681+
4682+ if (split_path.empty())
4683+ {
4684+ std::string tmp;
4685+ size_t colon_ptr = 0, start_ptr = 0;
4686+
4687+ const std::string env_path(getenv("PATH"));
4688+
4689+ if (!env_path.empty())
4690+ {
4691+ // Splits the env path var up on (":")
4692+ while (colon_ptr != std::string::npos)
4693+ {
4694+ colon_ptr = env_path.find(":", start_ptr);
4695+ tmp = env_path.substr(start_ptr, (colon_ptr-start_ptr));
4696+ start_ptr = colon_ptr+1;
4697+ split_path.push_back(tmp);
4698+ }
4699+ }
4700+ }
4701+ return split_path;
4702+}
4703+
4704+bool CheckIMExist(const char* im_name)
4705+{
4706+ std::vector<std::string> split_path = GetSplitEnvPath();
4707+ std::string command("ls ");
4708+ char buf [128];
4709+ FILE* path = NULL;
4710+
4711+ for (unsigned int i = 0; i < split_path.size(); i++)
4712+ {
4713+ if ((path = popen((command + split_path[i]).c_str(),"r")) == NULL)
4714+ return false;
4715+
4716+ while (fgets(buf, 128, path) != NULL)
4717+ {
4718+ if (strstr(buf, im_name))
4719+ return true;
4720+ }
4721+ }
4722+ return false;
4723+}
4724+
4725+FILE* OpenIM(const char* im_name)
4726+{
4727+ FILE* open_file = NULL;
4728+
4729+ if (CheckIMExist(im_name))
4730+ {
4731+ open_file = popen(im_name,"r");
4732+ nux::SleepForMilliseconds(500);
4733+ }
4734+ return open_file;
4735+}
4736+
4737+bool CheckInput(const std::string cjk, NuxAutomatedTestFramework* test)
4738+{
4739+ std::string message("Test is: " + cjk);
4740+ test->TestReportMsg(test_textentry->text_entry_->GetText() == cjk, message.c_str());
4741+
4742+ test->ViewSendCtrlA();
4743+ nux::SleepForMilliseconds(500);
4744+
4745+ test->ViewSendDelete();
4746+ nux::SleepForMilliseconds(500);
4747+ return true;
4748+}
4749+
4750+std::string next_token (std::queue<std::string>& tokens)
4751+{
4752+ std::string next_token;
4753+ if (!tokens.empty())
4754+ {
4755+ next_token = tokens.front();
4756+ tokens.pop();
4757+ }
4758+ return next_token;
4759+}
4760+
4761+bool RunCommands(std::queue<std::string>& tokens, NuxAutomatedTestFramework* test)
4762+{
4763+ std::string next_cmd;
4764+ std::string im_name;
4765+ std::string cur_cmd = next_token(tokens);
4766+ FILE* start_im = NULL;
4767+
4768+ while (!tokens.empty())
4769+ {
4770+ next_cmd = next_token(tokens);
4771+ if (cur_cmd == "0")
4772+ {
4773+ if ((start_im = OpenIM(next_cmd.c_str())) != NULL)
4774+ {
4775+ im_name = next_cmd.c_str();
4776+ nux::SleepForMilliseconds(500);
4777+ }
4778+ else
4779+ {
4780+ fprintf(stderr, "Command not found: %s\n", next_cmd.c_str());
4781+
4782+ // Skip the test
4783+ while (cur_cmd != "4")
4784+ {
4785+ cur_cmd = next_token(tokens);
4786+ }
4787+ next_cmd = next_token(tokens);
4788+ }
4789+ }
4790+ else if (cur_cmd == "1")
4791+ {
4792+ test->ViewSendKeys(next_cmd);
4793+ }
4794+ else if (cur_cmd == "2")
4795+ {
4796+ test->ViewSendString(next_cmd);
4797+ }
4798+ else if (cur_cmd == "3")
4799+ {
4800+ CheckInput(next_cmd, test);
4801+ }
4802+ else if (cur_cmd == "4")
4803+ {
4804+ KillInputMethod(im_name.c_str());
4805+ pclose(start_im);
4806+ }
4807+ else
4808+ {
4809+ fprintf(stderr, "Error - Incorrect command: %s\n", cur_cmd.c_str());
4810+ return false;
4811+ }
4812+ nux::SleepForMilliseconds(500);
4813+ cur_cmd = next_token(tokens);
4814+ }
4815+
4816+ return true;
4817+}
4818+
4819+void TestingThread(nux::NThread* thread, void* user_data)
4820+{
4821+ while (test_textentry->ReadyToGo() == false)
4822+ {
4823+ nuxDebugMsg("Waiting to start");
4824+ nux::SleepForMilliseconds(300);
4825+ }
4826+
4827+ nux::SleepForMilliseconds(1300);
4828+ nux::WindowThread* wnd_thread = static_cast<nux::WindowThread*>(user_data);
4829+ NuxAutomatedTestFramework test(wnd_thread);
4830+ test.Startup();
4831+ test.TestReportMsg(test_textentry->text_entry_, "TextEntry created");
4832+
4833+ test_textentry->ResetEvents();
4834+ test.ViewSendMouseMotionToCenter(test_textentry->text_entry_);
4835+
4836+ test.ViewSendMouseClick(0,1);
4837+
4838+ std::queue<std::string> tokens;
4839+ char* raw_commands;
4840+
4841+ // Just kills what should be the current IM (if there is one)
4842+ KillCurrentInputMethod();
4843+
4844+ raw_commands = ReadInCommands("xim-test-commands.txt");
4845+ if (raw_commands)
4846+ {
4847+ TokenizeCommands(raw_commands, tokens);
4848+ delete raw_commands;
4849+ RunCommands(tokens, &test);
4850+ }
4851+
4852+ if (test.WhenDoneTerminateProgram())
4853+ {
4854+ wnd_thread->ExitMainLoop();
4855+ }
4856+ nuxDebugMsg("Exit testing thread");
4857+}
4858+
4859+int main(int argc, char** argv)
4860+{
4861+ int xstatus = XInitThreads();
4862+ nuxAssertMsg(xstatus > 0, "XInitThreads has failed");
4863+
4864+ test_textentry = new TextTextEntry("Text Entry", 600, 200, 40000);
4865+ test_textentry->Startup();
4866+ test_textentry->UserInterfaceSetup();
4867+
4868+ nux::SystemThread* test_thread = nux::CreateSystemThread(NULL, &TestingThread, test_textentry->GetWindowThread());
4869+
4870+ test_thread->Start(test_textentry);
4871+
4872+ test_textentry->Run();
4873+
4874+ delete test_thread;
4875+ delete test_textentry;
4876+
4877+ return 0;
4878+}
4879+

Subscribers

People subscribed via source and target branches