[Pidgin] #5681: infinite input area auto resizing, pidgin hangs.

Pidgin trac at pidgin.im
Thu Jun 12 13:38:21 EDT 2008


#5681: infinite input area auto resizing, pidgin hangs.
---------------------------+------------------------------------------------
  Reporter:  irtiger       |       Owner:  seanegan
      Type:  defect        |      Status:  new     
  Priority:  minor         |   Milestone:          
 Component:  pidgin (gtk)  |     Version:  2.4.1   
Resolution:                |    Keywords:          
   Pending:  0             |  
---------------------------+------------------------------------------------
Comment (by tejun):

 Attached is the patch to fix the problem.  It's against pidgin-2.4.1.  The
 following is why it happens.

 1. Conversation entry area is about to overflow and a complex character is
 entered via IM and put into preedit area of TextEntry.

 2. resize_imhtml_cb() is invoked.  It iterates through the text buffer
 display-line-by-display-line counting display lines.  Although the display
 line iteration itself does consider characters in preedit area, the
 preedit area is not part of the text buffer, so the iterator reaches end
 where the text buffer ends and the preedit area starts.  So, the display
 line count is off by -1.

 3. resize_imhtml_cb() requests resize and finishes.

 4. gtk goes out and resizes the area.  It of course considers the pre-edit
 area.  As the text view is too small to accommodate text buffer + preedit
 area, vscroll is created, which reduces its width and thus overflowing
 characters at the end of the text buffer into the next line.

 5. resize_imhtml_cb() is invoked again.  As the width has been shrank, the
 end of the text buffer overflowed into the next line along with the
 preedit area.  So, this time, the line count is correct.

 6. resize_imhtml_cb() requests resize and finishes.

 7. gtk resizes again.  As the height is now enough to contain everything,
 it removes the vscroll and the width is restored.

 8. goto 2, ad nauseam.

 The problem is that there's no way to access or determine the size of the
 preedit area via TextView interface.  The patch uses unsupported
 gtk_text_layout_get_size(), which returns the final size of the rendered
 area to work around the problem.  It's cleaner and more efficient.  IMHO,
 proper solution would be adding similar interface to TextView.

 Thanks && kudos for the great work, can't live without pidgin :-)

-- 
Ticket URL: <http://developer.pidgin.im/ticket/5681#comment:4>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list