Re: Why does my cursor doesn't change

hi Aristotle;

On Wed, 2007-04-04 at 17:51 +0200, A. Pagaltzis wrote:
* Emmanuele Bassi <ebassi gmail com> [2007-04-03 18:50]:
On Tue, 2007-04-03 at 11:36 -0500, Kenneth Swanson wrote:
Are we not telling people the other, quick 'n' dirty way to
get around this?  That is, that if you have a long block of
code in a callback or some other code, you can add the line

Gtk2->main_iteration while(Gtk2->events_pending);

to get the GUI to update?  Or does that not work correctly

it's not the "kosher" solution: forcing the main loop to spin
it's an hack, and masks the real problem

Thatâs true, but does it have any *tangible* drawbacks to kick
the mainloop manually?

not that I know of, but it's really not nice apart from a stop-gap
solution while you fix your code.

once you add it and you keep relying on it, you usually end up
replicating that line time and again around critical sections and the
readability and maintainability of your code begins to suffer.

 Is there any reason why this shouldnât be
used even in cases where it would be *much* harder to punt the
processing to a timeout callback (or a forked child)?

using an idle or a timeout source never is *much* harder: it's not
different than using a while(1){} loop, not even conceptually.

spinning the main loop manually is the solution you apply when
porting/fixing code that has been written by someone else more versed in
console applications, when you need to phase out that code while people
are still working with it.


Emmanuele Bassi,  E: ebassi gmail com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]