timthedevguy / BGHUDAppKit

* BGHUDAPPKIT is no longer under development by me, I hope that the community will keep it alive and going as I no longer have time to dedicate to the project** The missing HUD controls. Please scroll down to read the readme file for an important notice concerning the future of BGHUDAppKit. Note that there are multiple versions available, 10.5+, 10.6.7, and now 10.7. As soon as I learn how I'll make these all one code base if possible.
http://www.binarymethod.com/
312 stars 57 forks source link

BGHUDTextFieldCell causing continuous draw activity and slowing app to a crawl #9

Closed rjo closed 14 years ago

rjo commented 14 years ago

I was sitting here working on a beautiful hud window with an opengl view in it. I noticed that my drawing was strangely slow, and the response of my 3dConnexion Space Navigator very sluggish. Unable to figure out why, i threw together a new test project with a regular old window and suddenly my code ran at normal speed. I got to thinking that the only difference was BGHUDAppKit and decided to pull all the controls off my window. The app ran at the right speed. I tested with a couple of controls and only the text field seems to cause the slowdown. I added some debug output to the drawwithFrame: method and found that when it has the focus it is continuously drawing.

I've started looking at the code but don't have enough cocoa experience to diagnose this. I love the look of this framework but cant use it while this is slowing my code down so I hope someone can take a look at it!

timthedevguy commented 14 years ago

This is a known issue, the textbox draws continuously because of the cursor. I've got some test code to help fix it but am still researching a less hackish approach. Should have something in the next few days...

timthedevguy commented 14 years ago

Ok...I can't find any way to fix this. That test code was a flop, if anyone has any ideas I'm all ears!! :)

rjo commented 14 years ago

binarygod, i just took a look at this and it seems this is triggering the problem: (line 199 in my revision)

[view setTextColor: [[[BGThemeManager keyedManager] themeForKey: self.themeKey] textColor]];

commenting that line out fixes the problem for me so apparently that is causing the view to think its dirty, causing a redraw and a retrigger. why is it necessary to change the view's text color?

timthedevguy commented 14 years ago

The code you are looking at is the selection code for inactive, active selections in the textfield. I'm looking into why I did it that way in the first place, I have a terrible memory, I run out of space and throw stuff away that I shouldn't :(

timthedevguy commented 14 years ago

Ok, that code was there to reset the text colors after a deselection of the text, otherwise the text that was selected stays the colors that it was while selected. Working on a solution right now!!

timthedevguy commented 14 years ago

Fixes BGHUDTextFieldCell Continuous drawing.

Thanks to rjo for pointing out the culprite code, this issue is finally fixed. Closed by 72976e3d1b92537df004244b9a3d95669338d392