Merge lp:~brandontschaefer/unity/fix-867885 into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Merged at revision: 1702
Proposed branch: lp:~brandontschaefer/unity/fix-867885
Merge into: lp:unity
Diff against target: 91 lines (+10/-32)
2 files modified
plugins/unityshell/src/DashSearchBar.cpp (+2/-1)
plugins/unityshell/src/IMTextEntry.cpp (+8/-31)
To merge this branch: bzr merge lp:~brandontschaefer/unity/fix-867885
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Unity Team Pending
Review via email: mp+78689@code.launchpad.net

Description of the change

Fixed the problem with the ibus window and text disappearing. Also now the ibus preedit text gets highlighted like it usually does when used else where.

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/DashSearchBar.cpp'
2--- plugins/unityshell/src/DashSearchBar.cpp 2011-09-29 08:16:37 +0000
3+++ plugins/unityshell/src/DashSearchBar.cpp 2011-10-10 05:53:24 +0000
4@@ -184,7 +184,8 @@
5 (GSourceFunc)&OnLiveSearchTimeout,
6 this);
7
8- bool is_empty = pango_entry_->GetText() == "";
9+
10+ bool is_empty = pango_entry_->im_active() ? false : pango_entry_->GetText() == "";
11 hint_->SetVisible(is_empty);
12 spinner_->SetState(is_empty ? STATE_READY : STATE_SEARCHING);
13
14
15=== modified file 'plugins/unityshell/src/IMTextEntry.cpp'
16--- plugins/unityshell/src/IMTextEntry.cpp 2011-09-29 08:16:37 +0000
17+++ plugins/unityshell/src/IMTextEntry.cpp 2011-10-10 05:53:24 +0000
18@@ -243,16 +243,6 @@
19 LOG_DEBUG(logger) << "Commit: " << str;
20 DeleteSelection();
21
22- /* remove preedit text and set cursor to previous position */
23- if (preedit_cursor_) {
24- std::string new_text = GetText();
25- new_text.replace(cursor_, preedit_cursor_, "");
26- int cursor = cursor_;
27- SetText(new_text.c_str());
28- SetCursor(cursor);
29- preedit_cursor_ = 0;
30- }
31-
32 if (str)
33 {
34 std::string new_text = GetText();
35@@ -270,49 +260,36 @@
36 glib::String preedit;
37 int cursor_pos = -1;
38
39- gtk_im_context_get_preedit_string(context, &preedit, NULL, &cursor_pos);
40+ gtk_im_context_get_preedit_string(context, &preedit, &preedit_attrs_, &cursor_pos);
41
42 LOG_DEBUG(logger) << "Preedit changed: " << preedit;
43
44- preedit_string = preedit.Str();
45+ _preedit = preedit.Str();
46
47 if (strlen(preedit.Str().c_str())) {
48- DeleteSelection();
49- std::string new_text = GetText();
50- new_text.replace(cursor_, preedit_cursor_, preedit.Str());
51- int cursor = cursor_;
52- SetText(new_text.c_str());
53- SetCursor(cursor);
54 preedit_cursor_ = preedit.Str().length();
55+ QueueRefresh(true, true);
56+ sigTextChanged.emit(this);
57 UpdateCursorLocation();
58 }
59 }
60
61 void IMTextEntry::OnPreeditStart(GtkIMContext* context)
62 {
63- preedit_string = "";
64 im_active = true;
65- preedit_cursor_ = 0;
66
67 LOG_DEBUG(logger) << "Preedit start";
68 }
69
70 void IMTextEntry::OnPreeditEnd(GtkIMContext* context)
71 {
72- preedit_string = "";
73 im_active = false;
74+ ResetPreedit();
75 gtk_im_context_reset(im_context_);
76
77- /* remove preedit text and set cursor to previous position */
78- if (preedit_cursor_) {
79- std::string new_text = GetText();
80- new_text.replace(cursor_, preedit_cursor_, "");
81- int cursor = cursor_;
82- SetText(new_text.c_str());
83- SetCursor(cursor);
84- preedit_cursor_ = 0;
85- }
86-
87+ QueueRefresh(true, true);
88+ sigTextChanged.emit(this);
89+
90 LOG_DEBUG(logger) << "Preedit ended";
91 }
92