[haiku-bugs] Re: [Haiku] #8556: [StyledEdit] increases window number even if previous one was closed

  • From: "leavengood" <trac@xxxxxxxxxxxx>
  • Date: Wed, 08 Aug 2012 05:15:11 -0000

#8556: [StyledEdit] increases window number even if previous one was closed
---------------------------------------+----------------------------
   Reporter:  diver                    |      Owner:  leavengood
       Type:  bug                      |     Status:  assigned
   Priority:  normal                   |  Milestone:  R1
  Component:  Applications/StyledEdit  |    Version:  R1/Development
 Resolution:                           |   Keywords:
 Blocked By:                           |   Blocking:
Has a Patch:  0                        |   Platform:  All
---------------------------------------+----------------------------

Comment (by leavengood):

 Wow, was it 2 months ago when I last worked on this? I did try to "bang
 something out" back then, but it was not so easy.

 Tonight I decided to take a step back and implemented a prototype for a
 NewWindowPolicy class in Ruby, and I have something working fairly well.
 The basic idea is to have a simple WindowState class which has a title
 (BString) and location (BPoint), and the NewWindowPolicy class has methods
 to get the next WindowState and a method which is called when a window is
 closed. The next method stores the returned window state in a list. The
 closed method will check if the closing window's attributes (title and
 position) is in the list, and if it is, it will be moved from the main
 list into a recycled list. Then if there is anything in the recycled list
 it will be used before generating something new in next. I wrote an RSpec
 for my Ruby class and it works pretty well.

 So now I'll try to convert it to C++ and see how that works. Since I
 recall seeing other bugs about the window handling of other applications
 in Haiku, I imagine this class (which I'll put in the shared kit) can be
 used in other places.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/8556#comment:9>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: