Nux

Merge lp:~brandontschaefer/nux/lp.1219432-fix into lp:nux

Proposed by Brandon Schaefer
Status: Merged
Approved by: Christopher Townsend
Approved revision: 816
Merged at revision: 815
Proposed branch: lp:~brandontschaefer/nux/lp.1219432-fix
Merge into: lp:nux
Diff against target: 75 lines (+21/-12)
2 files modified
NuxGraphics/GraphicsDisplayX11.cpp (+20/-12)
NuxGraphics/XIMController.cpp (+1/-0)
To merge this branch: bzr merge lp:~brandontschaefer/nux/lp.1219432-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Christopher Townsend Approve
Review via email: mp+184180@code.launchpad.net

Commit message

Greek does not play nice with XmbLookupString and gives us a size 0 for the event string size. So if we run into the status XLookupKeySym, look it up using XLookupString. This way pinyin will still work as it did before the greek fix went in last week.

Description of the change

Greek does not play nice with XmbLookupString and gives us a size 0 for the event string size. So if we run into the status XLookupKeySym, look it up using XLookupString. This way pinyin will still work as it did before the greek fix went in last week.

To post a comment you must log in.
816. By Brandon Schaefer

* Destory the XIC when we focus out, otherwise we seem to be getting stuck if
  we leave fcitx enabled...need to check 12.04 to see if this is the case as well.
  Could be a bug in fcitx...as we have focused out, and it doesn't leave enabled mode.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Works for me now. I'm approving but bregma is also looking it over, so let's wait on his feedback before globally approving.

review: Approve
Revision history for this message
Christopher Townsend (townsend) wrote :

Ok, let's globally approve this.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NuxGraphics/GraphicsDisplayX11.cpp'
2--- NuxGraphics/GraphicsDisplayX11.cpp 2013-09-05 19:27:56 +0000
3+++ NuxGraphics/GraphicsDisplayX11.cpp 2013-09-05 22:25:40 +0000
4@@ -1603,6 +1603,15 @@
5 }
6 }
7
8+ void GetDefaultSizeLookupString(XEvent event, Event* nux_event)
9+ {
10+ nux_event->dtext = new char[NUX_EVENT_TEXT_BUFFER_SIZE];
11+ int num_char_stored = XLookupString(&event.xkey, nux_event->dtext, NUX_EVENT_TEXT_BUFFER_SIZE,
12+ (KeySym*)&nux_event->x11_keysym, nullptr);
13+
14+ nux_event->dtext[num_char_stored] = 0;
15+ }
16+
17 void GraphicsDisplay::ProcessXEvent(XEvent xevent, bool foreign)
18 {
19 int x_recalc = 0;
20@@ -1708,8 +1717,6 @@
21 m_pEvent->x11_timestamp = xevent.xkey.time;
22 m_pEvent->x11_key_state = xevent.xkey.state;
23
24- char buffer[NUX_EVENT_TEXT_BUFFER_SIZE];
25-
26 Memset(m_pEvent->text, 0, NUX_EVENT_TEXT_BUFFER_SIZE);
27
28 bool skip = false;
29@@ -1729,11 +1736,16 @@
30 {
31 delete[] m_pEvent->dtext;
32 m_pEvent->dtext = nullptr;
33-
34- num_char_stored = XmbLookupString(m_xim_controller->GetXIC(), &xevent.xkey, buffer,
35- NUX_EVENT_TEXT_BUFFER_SIZE, (KeySym*) &m_pEvent->x11_keysym, nullptr);
36-
37- if (num_char_stored > 0)
38+ Status status;
39+
40+ num_char_stored = XmbLookupString(m_xim_controller->GetXIC(), &xevent.xkey, nullptr,
41+ 0, (KeySym*) &m_pEvent->x11_keysym, &status);
42+
43+ if (status == XLookupKeySym)
44+ {
45+ GetDefaultSizeLookupString(xevent, m_pEvent);
46+ }
47+ else if (num_char_stored > 0)
48 {
49 int buf_len = num_char_stored + 1;
50 m_pEvent->dtext = new char[buf_len];
51@@ -1745,11 +1757,7 @@
52 }
53 else
54 {
55- m_pEvent->dtext = new char[NUX_EVENT_TEXT_BUFFER_SIZE];
56- num_char_stored = XLookupString(&xevent.xkey, m_pEvent->dtext, NUX_EVENT_TEXT_BUFFER_SIZE,
57- (KeySym*) &m_pEvent->x11_keysym, nullptr);
58-
59- m_pEvent->dtext[num_char_stored] = 0;
60+ GetDefaultSizeLookupString(xevent, m_pEvent);
61 }
62 }
63
64
65=== modified file 'NuxGraphics/XIMController.cpp'
66--- NuxGraphics/XIMController.cpp 2012-12-17 19:04:50 +0000
67+++ NuxGraphics/XIMController.cpp 2013-09-05 22:25:40 +0000
68@@ -78,6 +78,7 @@
69 void XIMController::FocusOutXIC()
70 {
71 xic_client_.FocusOutXIC();
72+ xic_client_.DestroyXIC();
73 }
74
75 void XIMController::InitXIMCallback()

Subscribers

People subscribed via source and target branches